Added verification of receipt_pref to login test.

This commit is contained in:
s3lph 2018-09-09 03:40:06 +02:00
parent 53233d74c3
commit 71d7bb85ce

View file

@ -100,7 +100,7 @@ class DatabaseTest(unittest.TestCase):
except AuthenticationError as e:
self.assertEqual('Touchkey not set', e.msg)
# Add a touchkey without using the provided function
c.execute('''UPDATE users SET touchkey = :tkhash WHERE user_id = :user_id''', {
c.execute('''UPDATE users SET touchkey = :tkhash, receipt_pref = 2 WHERE user_id = :user_id''', {
'tkhash': crypt.crypt('0123', crypt.mksalt()),
'user_id': u.id
})
@ -108,6 +108,7 @@ class DatabaseTest(unittest.TestCase):
self.assertEqual(u.id, user.id)
user = db.login('testuser', touchkey='0123')
self.assertEqual(u.id, user.id)
self.assertEqual(2, user.receipt_pref)
with self.assertRaises(AuthenticationError):
# Inexistent user should fail
db.login('nooone', 'supersecurepassword')