Added verification of receipt_pref to login test.
This commit is contained in:
parent
53233d74c3
commit
71d7bb85ce
1 changed files with 2 additions and 1 deletions
|
@ -100,7 +100,7 @@ class DatabaseTest(unittest.TestCase):
|
||||||
except AuthenticationError as e:
|
except AuthenticationError as e:
|
||||||
self.assertEqual('Touchkey not set', e.msg)
|
self.assertEqual('Touchkey not set', e.msg)
|
||||||
# Add a touchkey without using the provided function
|
# 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()),
|
'tkhash': crypt.crypt('0123', crypt.mksalt()),
|
||||||
'user_id': u.id
|
'user_id': u.id
|
||||||
})
|
})
|
||||||
|
@ -108,6 +108,7 @@ class DatabaseTest(unittest.TestCase):
|
||||||
self.assertEqual(u.id, user.id)
|
self.assertEqual(u.id, user.id)
|
||||||
user = db.login('testuser', touchkey='0123')
|
user = db.login('testuser', touchkey='0123')
|
||||||
self.assertEqual(u.id, user.id)
|
self.assertEqual(u.id, user.id)
|
||||||
|
self.assertEqual(2, user.receipt_pref)
|
||||||
with self.assertRaises(AuthenticationError):
|
with self.assertRaises(AuthenticationError):
|
||||||
# Inexistent user should fail
|
# Inexistent user should fail
|
||||||
db.login('nooone', 'supersecurepassword')
|
db.login('nooone', 'supersecurepassword')
|
||||||
|
|
Loading…
Reference in a new issue