Beispiel #1
0
 def test_fail_authentication(self):
     user = User({'username':'******',              
                   'hash':calculate_hash('testtest'),
                   'salt':'test',})
     self.assertEqual( user.authenticate('lolo'), False, 'Authentication should fail' )
     user = User({'username':'******',              
                   'hash':calculate_hash('testtest'),
                   'salt':'lol',})
     self.assertEqual( user.authenticate('test'), False, 'Authentication should fail' )
Beispiel #2
0
 def test_authentication(self):
     user = User({'username':'******',              
                   'hash':calculate_hash('testtest'),
                   'salt':'test',})
     self.assertEqual( user.authenticate('test'), True, 'User should be now authenticated succesfully' )
Beispiel #3
0
 def test_fetching_user_from_storage(self):
     storage = UserStorage()
     storage.add_user(User({'username' : 'teemu',
                 'hash': calculate_hash('test'+'test'),
                 'hash': 'test'}))
     self.assertIsNotNone(storage.get_user('teemu'),'There sould be at least one user at the storage')