def test_authenticate_user(self): ''' the test case checks if the password a user has entered corresponds with the one that has been saved. Args: first_name: user's first_name password: user's password Returns: User: current user, outcome determined by results of the logical operator ''' self.new_user = User("Mary", "Njihia", "hgnkf254") self.new_user.save_user() user_zwei = User("Jane", "Doe", "pass100") user_zwei.save_user() for user in User.passwort_users: if user.first_name == user_zwei.first_name and user.password == user_zwei.password: current_user = user.first_name self.assertEqual(current_user, Credentials.authenticate_user(user_zwei.first_name, user_zwei.password)) return current_user
def authenticate(first_name,password): ''' method to check match between user and provided password ''' return Credentials.authenticate_user(first_name,password)