def test_update_drink_fail( drink_repository_mock, drink_id, drink_name, drink_image_url, drink_type, ): drink_repository_mock.update.side_effect = ResourceNotFoundError() drink_application_service = DrinkApplicationService( drink_repository=drink_repository_mock) input_dto = UpdateDrinkInputDto( drink_id=str(drink_id), drink_name="Tequila", drink_image_url="tequila image url", drink_type=DrinkType.LIQUOR.value, avg_rating=float(DrinkRating(value=3.65)), num_of_reviews=10, num_of_wish=20, ) actual = drink_application_service.update_drink(input_dto) expected = FailedOutputDto(type="Resource Not Found Error", message="") assert actual == expected
def test_update_drink_success( drink_repository_mock, drink_id, drink_name, drink_image_url, drink_type, ): drink_repository_mock.update.return_value = None drink_application_service = DrinkApplicationService( drink_repository=drink_repository_mock) input_dto = UpdateDrinkInputDto( drink_id=str(drink_id), drink_name="Tequila", drink_image_url="tequila image url", drink_type=DrinkType.LIQUOR.value, avg_rating=float(DrinkRating(value=3.65)), num_of_reviews=10, num_of_wish=20, ) actual = drink_application_service.update_drink(input_dto) expected = UpdateDrinkOutputDto() assert actual == expected