def test_add_drink_wish_fail(
    drink_repository_mock,
    drink_id,
    drink_name,
    drink_image_url,
    drink_type,
):
    drink_repository_mock.find_by_drink_id.side_effect = ResourceNotFoundError(
    )
    drink_repository_mock.update.return_value = None
    drink_application_service = DrinkApplicationService(
        drink_repository=drink_repository_mock)

    input_dto = AddDrinkWishInputDto(drink_id=str(drink_id))
    actual = drink_application_service.add_drink_wish(input_dto)
    expected = FailedOutputDto(type="Resource Not Found Error", message="")
    assert actual == expected

    drink_repository_mock.find_by_drink_id.return_value = None
    drink_repository_mock.update.side_effect = ResourceNotFoundError()
    drink_application_service = DrinkApplicationService(
        drink_repository=drink_repository_mock)

    input_dto = AddDrinkWishInputDto(drink_id=str(drink_id))
    actual = drink_application_service.add_drink_wish(input_dto)
    expected = FailedOutputDto(type="Resource Not Found Error", message="")
    assert actual == expected
    def create_wish(
        self,
        input_dto: CreateWishInputDto,
        drink_application_service: DrinkApplicationService,
    ) -> Union[CreateWishOutputDto, FailedOutputDto]:
        try:
            wish = Wish(
                id=WishId.build(user_id=str(input_dto.user_id),
                                drink_id=str(input_dto.drink_id)),
                user_id=UserId(value=input_dto.user_id),
                drink_id=DrinkId.from_str(input_dto.drink_id),
                created_at=time.time(),
            )
            self._wish_repository.add(wish)

            add_drink_wish_input_dto = AddDrinkWishInputDto(
                drink_id=input_dto.drink_id)
            add_drink_wish_output_dto = drink_application_service.add_drink_wish(
                input_dto=add_drink_wish_input_dto)

            if not add_drink_wish_output_dto.status:
                return add_drink_wish_output_dto
            return CreateWishOutputDto(id=str(wish.id),
                                       user_id=str(wish.user_id),
                                       drink_id=str(wish.drink_id),
                                       created_at=wish.created_at)
        except ResourceAlreadyExistError as e:
            return FailedOutputDto.build_resource_conflict_error(
                message=str(e))
        except Exception as e:
            return FailedOutputDto.build_system_error(message=str(e))
def test_add_drink_wish_success(
    drink_repository_mock,
    drink_id,
    drink_name,
    drink_image_url,
    drink_type,
):
    drink_repository_mock.find_by_drink_id.return_value = Drink(
        id=drink_id,
        name=drink_name,
        image_url=drink_image_url,
        type=drink_type)
    drink_repository_mock.update.return_value = None
    drink_application_service = DrinkApplicationService(
        drink_repository=drink_repository_mock)

    input_dto = AddDrinkWishInputDto(drink_id=str(drink_id))
    actual = drink_application_service.add_drink_wish(input_dto)
    expected = AddDrinkWishOutputDto()
    assert actual == expected