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' )
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' )