def test_validate_username_with_invalid_details(create_users): # Arrange invalid_username = 98765 password = "******" storage = UserStorageImplementation() # Act with pytest.raises(InvalidUsername): storage.validate_username(username=invalid_username, password=password)
def test_validate_username_with_valid_details_return_user_id(create_users): # Arrange username = "******" password = "******" storage = UserStorageImplementation() # Act actual_user_id = storage.validate_username(username=username, password=password) # Assert user_obj = User.objects.get(id=actual_user_id) user_id = user_obj.id assert actual_user_id == user_id assert user_obj.username == username assert user_obj.password == password