Exemplo n.º 1
0
def test_find_by_review_id(orm_drink_repository):
    with pytest.raises(ResourceNotFoundError):
        orm_drink_repository.find_by_drink_id(
            DrinkId.from_str("35a05a4b-d9ba-5122-af75-7c0022b8bbd8"))

    a = DrinkOrm.from_drink(
        Drink(
            id=DrinkId.build(drink_name="soju1", created_at=1234),
            name="soju1",
            image_url="soju_image1",
            type=DrinkType.SOJU,
            avg_rating=DrinkRating(),
            num_of_reviews=0,
            num_of_wish=0,
        ))

    actual = orm_drink_repository.find_by_drink_id(
        drink_id=DrinkId.build(drink_name="soju1", created_at=1234))
    expected = Drink(
        id=DrinkId.build(drink_name="soju1", created_at=1234),
        name="soju1",
        image_url="soju_image1",
        type=DrinkType.from_str("soju"),
        avg_rating=DrinkRating(),
        num_of_reviews=0,
        num_of_wish=0,
    )
    assert actual == expected
def test_add(orm_review_repository):
    review = Review(
        id=ReviewId.from_str("35a05a4b-d9ba-5122-af75-7c0022b8bbc1"),
        user_id=UserId(value="ME"),
        drink_id=DrinkId.from_str("335ca1a4-5175-5e41-8bac-40ffd840834c"),
        rating=ReviewRating(value=4),
        comment="456",
        created_at=1613807667,
        updated_at=1613807667,
    )
    orm_review_repository.add(review)

    actual = orm_review_repository.find_by_review_id(
        review_id=ReviewId.from_str("35a05a4b-d9ba-5122-af75-7c0022b8bbc1")
    )
    expected = Review(
        id=ReviewId.from_str("35a05a4b-d9ba-5122-af75-7c0022b8bbc1"),
        user_id=UserId(value="ME"),
        drink_id=DrinkId.from_str("335ca1a4-5175-5e41-8bac-40ffd840834c"),
        rating=ReviewRating(value=4),
        comment="456",
        created_at=1613807667,
        updated_at=1613807667,
    )
    assert actual == expected

    with pytest.raises(ResourceAlreadyExistError):
        orm_review_repository.add(review)
Exemplo n.º 3
0
def test_find_all(orm_drink_repository):
    actual = orm_drink_repository.find_all(query_param=QueryParam(
        type=DrinkType.from_str("soju"),
        filter=FilterType.from_str("review"),
        order=OrderType.from_str("descending"),
    ))
    expected = [
        Drink(
            id=DrinkId.build(drink_name="soju2", created_at=1234),
            name="soju2",
            image_url="soju_image2",
            type=DrinkType.from_str("soju"),
            avg_rating=DrinkRating(value=5),
            num_of_reviews=1,
            num_of_wish=1,
        ),
        Drink(
            id=DrinkId.build(drink_name="soju1", created_at=1234),
            name="soju1",
            image_url="soju_image1",
            type=DrinkType.from_str("soju"),
            avg_rating=DrinkRating(),
            num_of_reviews=0,
            num_of_wish=0,
        ),
    ]
    assert actual == expected
Exemplo n.º 4
0
def test_add(orm_drink_repository):
    drink = Drink(
        id=DrinkId.build(drink_name="wine", created_at=1234),
        name="wine",
        image_url="wine_image",
        type=DrinkType.from_str("wine"),
        avg_rating=DrinkRating(value=3),
        num_of_reviews=1,
        num_of_wish=1,
    )
    orm_drink_repository.add(drink)

    actual = orm_drink_repository.find_by_drink_id(
        drink_id=DrinkId.build(drink_name="wine", created_at=1234))
    expected = Drink(
        id=DrinkId.build(drink_name="wine", created_at=1234),
        name="wine",
        image_url="wine_image",
        type=DrinkType.from_str("wine"),
        avg_rating=DrinkRating(value=3),
        num_of_reviews=1,
        num_of_wish=1,
    )

    assert actual == expected

    with pytest.raises(ResourceAlreadyExistError):
        orm_drink_repository.add(drink)
Exemplo n.º 5
0
def test_delete(orm_drink_repository):
    orm_drink_repository.find_by_drink_id(
        drink_id=DrinkId.build(drink_name="soju1", created_at=1234))

    orm_drink_repository.delete_by_drink_id(
        drink_id=DrinkId.build(drink_name="soju1", created_at=1234))

    with pytest.raises(ResourceNotFoundError):
        orm_drink_repository.delete_by_drink_id(
            drink_id=DrinkId.build(drink_name="soju1", created_at=1234))
def test_post_drinks(client, app):
    application_service_mock = mock.Mock(spec=DrinkApplicationService)
    application_service_mock.create_drink.return_value = FailedOutputDto.build_resource_conflict_error(
    )

    with app.container.drink_application_service.override(
            application_service_mock):
        response = client.post(
            "/drinks",
            json={
                "drink_id":
                str(
                    DrinkId(
                        value=uuid.uuid5(uuid.NAMESPACE_DNS, "drink_num_1"))),
                "drink_name":
                "wine_1",
                "drink_image_url":
                "picture_wine_1",
                "drink_type":
                "wine",
            },
        )

        assert response.status_code == 409
        assert response.json() == {
            "error_type": "Resource Conflict Error",
            "message": "",
        }

    application_service_mock.create_drink.return_value = CreateDrinkOutputDto()
    with app.container.drink_application_service.override(
            application_service_mock):
        response = client.post(
            "/drinks",
            json={
                "drink_id":
                str(
                    DrinkId(
                        value=uuid.uuid5(uuid.NAMESPACE_DNS, "drink_num_1"))),
                "drink_name":
                "wine_1",
                "drink_image_url":
                "picture_wine_1",
                "drink_type":
                "wine",
            },
        )
        assert response.status_code == 201
    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))
Exemplo n.º 8
0
    def find_all(self, query_param: QueryParam) -> List[Review]:
        if not query_param.user_id and not query_param.drink_id:
            raise InvalidParamInputError(
                f"drink_id: {query_param.drink_id} or user_id:{query_param.user_id}에 해당하는 값이 없습니다."
            )
        _query_param = {
            attr: value
            for attr, value in query_param
            if value and not isinstance(value, OrderType)
        }
        with self._session_factory() as session:

            order_type = desc(ReviewOrm.updated_at)
            # if order_type == OrderType.LIKE_DESC:
            #     order_type = desc(ReviewOrm.num_likes)
            # elif order_type == OrderType.LIKE_ASC:
            #     order_type = asc(ReviewOrm.num_likes)

            query = session.query(ReviewOrm)
            review_orms = query.filter_by(
                **_query_param).order_by(order_type).all()

            return [
                Review(
                    id=ReviewId(value=review_orm.id),
                    drink_id=DrinkId(value=review_orm.drink_id),
                    user_id=UserId(value=review_orm.user_id),
                    rating=ReviewRating(value=review_orm.rating),
                    comment=review_orm.comment,
                    created_at=review_orm.created_at,
                    updated_at=review_orm.updated_at,
                ) for review_orm in review_orms
            ]
 def to_wish(self) -> Wish:
     return Wish(
         id=WishId(value=self.id),
         user_id=UserId(value=self.user_id),
         drink_id=DrinkId(value=self.drink_id),
         created_at=self.created_at,
     )
def test_find_all(orm_review_repository):
    actual = orm_review_repository.find_all(QueryParam(drink_id="07a9627a-c930-4292-afd0-b6a2d55de3b2"))
    expected = [
        Review(
            id=ReviewId.from_str("afa213dd-d705-4f4d-953d-ad25e7181367"),
            user_id=UserId(value="jun"),
            drink_id=DrinkId.from_str("07a9627a-c930-4292-afd0-b6a2d55de3b2"),
            rating=ReviewRating(value=4),
            comment="first jun",
            created_at=1613807667,
            updated_at=3,
        ),
        Review(
            id=ReviewId.from_str("b329c178-46e3-4d67-9ae4-6624b651d3d1"),
            user_id=UserId(value="heumsi"),
            drink_id=DrinkId.from_str("07a9627a-c930-4292-afd0-b6a2d55de3b2"),
            rating=ReviewRating(value=3),
            comment="first heumsi",
            created_at=1613807667,
            updated_at=1,
        ),
    ]
    assert actual == expected

    actual = orm_review_repository.find_all(QueryParam(user_id="jun"))
    expected = [
        Review(
            id=ReviewId.from_str("afa213dd-d705-4f4d-953d-ad25e7181367"),
            user_id=UserId(value="jun"),
            drink_id=DrinkId.from_str("07a9627a-c930-4292-afd0-b6a2d55de3b2"),
            rating=ReviewRating(value=4),
            comment="first jun",
            created_at=1613807667,
            updated_at=3,
        ),
        Review(
            id=ReviewId.from_str("bcbfdb54-acb7-5443-926a-42e882ef7db0"),
            user_id=UserId(value="jun"),
            drink_id=DrinkId.from_str("335ca1a4-5175-5e41-8bac-40ffd840834d"),
            rating=ReviewRating(value=4),
            comment="second jun",
            created_at=1613807667,
            updated_at=2,
        ),
    ]
    assert actual == expected
def test_find_reviews_success(
    review_repository_mock,
    review_id,
    drink_id,
    user_id,
    rating,
    created_at,
):
    drink_id_2 = "335ca1a4-5175-5e41-8bac-40ffd840835c"
    user_id_2 = "meme"
    review_id_2 = ReviewId.build(user_id=user_id_2, drink_id=drink_id_2)

    review_repository_mock.find_all.return_value = [
        Review(
            id=review_id,
            drink_id=drink_id,
            user_id=UserId(value=user_id),
            rating=ReviewRating(value=rating),
            comment="hello",
            created_at=created_at,
            updated_at=created_at,
        ),
        Review(
            id=review_id_2,
            drink_id=DrinkId.from_str(drink_id_2),
            user_id=UserId(value=user_id_2),
            rating=ReviewRating(value=rating),
            comment="olleh",
            created_at=created_at,
            updated_at=created_at,
        ),
    ]
    review_application_service = ReviewApplicationService(
        review_repository=review_repository_mock)

    input_dto = FindReviewsInputDto(query_param=QueryParam())
    actual = review_application_service.find_reviews(input_dto)
    expected = FindReviewsOutputDto(items=[
        FindReviewsOutputDto.Item(
            review_id=str(review_id),
            drink_id=str(drink_id),
            user_id=str(user_id),
            rating=int(rating),
            comment="hello",
            created_at=created_at,
            updated_at=created_at,
        ),
        FindReviewsOutputDto.Item(
            review_id=str(review_id_2),
            drink_id=str(drink_id_2),
            user_id=str(user_id_2),
            rating=int(rating),
            comment="olleh",
            created_at=created_at,
            updated_at=created_at,
        ),
    ])
    assert actual == expected
def test_find_all(orm_wish_repository):
    actual = orm_wish_repository.find_all(
        QueryParam(drink_id="335ca1a4-5175-5e41-8bac-40ffd840834c"))
    expected = [
        Wish(
            id=WishId.from_str("bcbfdb54-acb7-5443-926a-42e882ef7db0"),
            user_id=UserId(value="heumsi"),
            drink_id=DrinkId.from_str("335ca1a4-5175-5e41-8bac-40ffd840834c"),
            created_at=1613807667.0,
        ),
        Wish(
            id=WishId.from_str("35a05a4b-d9ba-5122-af75-7c0022b8bbd9"),
            user_id=UserId(value="joon"),
            drink_id=DrinkId.from_str("335ca1a4-5175-5e41-8bac-40ffd840834c"),
            created_at=1613807667.0,
        ),
    ]
    assert actual == expected
def drink_no_review():
    return Drink(
        id=DrinkId.build(drink_name="soju1", created_at=1234),
        name="soju1",
        image_url="soju_image1",
        type=DrinkType.from_str("soju"),
        avg_rating=DrinkRating(),
        num_of_reviews=0,
        num_of_wish=0,
    )
def drink_two_reviews():
    return Drink(
        id=DrinkId.build(drink_name="soju3", created_at=1234),
        name="soju3",
        image_url="soju_image3",
        type=DrinkType.from_str("soju"),
        avg_rating=DrinkRating(value=4.5),
        num_of_reviews=2,
        num_of_wish=2,
    )
def drink_one_review():
    return Drink(
        id=DrinkId.build(drink_name="soju2", created_at=1234),
        name="soju2",
        image_url="soju_image2",
        type=DrinkType.from_str("soju"),
        avg_rating=DrinkRating(value=5),
        num_of_reviews=1,
        num_of_wish=1,
    )
Exemplo n.º 16
0
def test_update(orm_drink_repository):
    old_drink = orm_drink_repository.find_by_drink_id(
        DrinkId.build(drink_name="soju1", created_at=1234))

    new_drink = Drink(
        id=old_drink.id,
        name=old_drink.name,
        image_url=old_drink.image_url,
        type=old_drink.type,
        avg_rating=DrinkRating(value=4.5),
        num_of_reviews=2,
        num_of_wish=1,
    )
    orm_drink_repository.update(new_drink)

    actual = orm_drink_repository.find_by_drink_id(
        DrinkId.build(drink_name="soju1", created_at=1234))
    expected = new_drink
    assert actual == expected
Exemplo n.º 17
0
 def to_review(self) -> Review:
     return Review(
         id=ReviewId(value=self.id),
         user_id=UserId(value=self.user_id),
         drink_id=DrinkId(value=self.drink_id),
         rating=ReviewRating(value=self.rating),
         comment=self.comment,
         created_at=self.created_at,
         updated_at=self.updated_at,
     )
def test_find(orm_wish_repository):
    actual = orm_wish_repository.find(QueryParam(user_id="heumsi"))
    expected = Wish(
        id=WishId.from_str("bcbfdb54-acb7-5443-926a-42e882ef7db0"),
        user_id=UserId(value="heumsi"),
        drink_id=DrinkId.from_str("335ca1a4-5175-5e41-8bac-40ffd840834c"),
        created_at=1613807667.0,
    )
    assert actual == expected

    actual = orm_wish_repository.find(
        QueryParam(user_id="heumsi",
                   drink_id="335ca1a4-5175-5e41-8bac-40ffd840834c"))
    expected = Wish(
        id=WishId.from_str("bcbfdb54-acb7-5443-926a-42e882ef7db0"),
        user_id=UserId(value="heumsi"),
        drink_id=DrinkId.from_str("335ca1a4-5175-5e41-8bac-40ffd840834c"),
        created_at=1613807667.0,
    )
    assert actual == expected
Exemplo n.º 19
0
def wish_application_service():
    wish_repository_mock = mock.Mock(spec=WishRepository)
    wish_repository_mock.find_all.return_value = [
        Wish(
            id=WishId.build(user_id="heumsi",
                            drink_id="335ca1a4-5175-5e41-8bac-40ffd840834c"),
            user_id=UserId(value="heumsi"),
            drink_id=DrinkId.from_str("335ca1a4-5175-5e41-8bac-40ffd840834c"),
            created_at=1613113664.931505,
        ),
        Wish(
            id=WishId.build(user_id="joon",
                            drink_id="335ca1a4-5175-5e41-8bac-40ffd840834c"),
            user_id=UserId(value="joon"),
            drink_id=DrinkId.from_str("335ca1a4-5175-5e41-8bac-40ffd840834c"),
            created_at=1613113664.931505,
        ),
    ]

    return WishApplicationService(wish_repository=wish_repository_mock)
def setup(database):
    with database.session() as session:
        session.query(ReviewOrm).delete()
        session.add_all(
            [
                ReviewOrm.from_review(
                    Review(
                        id=ReviewId.from_str("afa213dd-d705-4f4d-953d-ad25e7181367"),
                        user_id=UserId(value="jun"),
                        drink_id=DrinkId.from_str("07a9627a-c930-4292-afd0-b6a2d55de3b2"),
                        rating=ReviewRating(value=4),
                        comment="first jun",
                        created_at=1613807667,
                        updated_at=3,
                    )
                ),
                ReviewOrm.from_review(
                    Review(
                        id=ReviewId.from_str("b329c178-46e3-4d67-9ae4-6624b651d3d1"),
                        user_id=UserId(value="heumsi"),
                        drink_id=DrinkId.from_str("07a9627a-c930-4292-afd0-b6a2d55de3b2"),
                        rating=ReviewRating(value=3),
                        comment="first heumsi",
                        created_at=1613807667,
                        updated_at=1,
                    )
                ),
                ReviewOrm.from_review(
                    Review(
                        id=ReviewId.from_str("bcbfdb54-acb7-5443-926a-42e882ef7db0"),
                        user_id=UserId(value="jun"),
                        drink_id=DrinkId.from_str("335ca1a4-5175-5e41-8bac-40ffd840834d"),
                        rating=ReviewRating(value=4),
                        comment="second jun",
                        created_at=1613807667,
                        updated_at=2,
                    )
                ),
            ]
        )
        session.commit()
def setup(database):
    with database.session() as session:
        session.query(WishOrm).delete()
        session.add_all([
            WishOrm.from_wish(
                Wish(
                    id=WishId.from_str("bcbfdb54-acb7-5443-926a-42e882ef7db0"),
                    user_id=UserId(value="heumsi"),
                    drink_id=DrinkId.from_str(
                        "335ca1a4-5175-5e41-8bac-40ffd840834c"),
                    created_at=1613807667,
                )),
            WishOrm.from_wish(
                Wish(
                    id=WishId.from_str("35a05a4b-d9ba-5122-af75-7c0022b8bbd9"),
                    user_id=UserId(value="joon"),
                    drink_id=DrinkId.from_str(
                        "335ca1a4-5175-5e41-8bac-40ffd840834c"),
                    created_at=1613807667,
                )),
        ])
        session.commit()
Exemplo n.º 22
0
    def add_drink_wish(self, input_dto: AddDrinkWishInputDto) -> Union[AddDrinkWishOutputDto, FailedOutputDto]:
        try:
            drink = self._drink_repository.find_by_drink_id(DrinkId.from_str(input_dto.drink_id))

            drink.add_wish()
            self._drink_repository.update(drink)

            return AddDrinkWishOutputDto()

        except ResourceNotFoundError as e:
            return FailedOutputDto.build_resource_not_found_error(message=str(e))
        except Exception as e:
            return FailedOutputDto.build_system_error(message=str(e))
Exemplo n.º 23
0
    def delete_drink(self, input_dto: DeleteDrinkInputDto) -> Union[DeleteDrinkOutputDto, FailedOutputDto]:
        try:
            drink_id = DrinkId.from_str(input_dto.drink_id)
            if self._drink_repository.find_by_drink_id(drink_id) is None:
                return FailedOutputDto.build_resource_not_found_error(f"{str(drink_id)}의 술을 찾을 수 없습니다.")

            self._drink_repository.delete_by_drink_id(drink_id)

            return DeleteDrinkOutputDto()

        except ResourceNotFoundError as e:
            return FailedOutputDto.build_resource_not_found_error(message=str(e))
        except Exception as e:
            return FailedOutputDto.build_system_error(message=str(e))
Exemplo n.º 24
0
    def delete_drink_review(
        self, input_dto: DeleteDrinkReviewInputDto
    ) -> Union[DeleteDrinkReviewOutputDto, FailedOutputDto]:
        try:
            drink = self._drink_repository.find_by_drink_id(DrinkId.from_str(input_dto.drink_id))

            drink.delete_rating(input_dto.drink_rating)
            self._drink_repository.update(drink)

            return DeleteDrinkReviewOutputDto()

        except ResourceNotFoundError as e:
            return FailedOutputDto.build_resource_not_found_error(message=str(e))
        except Exception as e:
            return FailedOutputDto.build_system_error(message=str(e))
Exemplo n.º 25
0
def setup(database):
    with database.session() as session:
        session.query(DrinkOrm).delete()
        session.add_all([
            DrinkOrm.from_drink(
                Drink(
                    id=DrinkId.build(drink_name="soju1", created_at=1234),
                    name="soju1",
                    image_url="soju_image1",
                    type=DrinkType.SOJU,
                    avg_rating=DrinkRating(),
                    num_of_reviews=0,
                    num_of_wish=0,
                )),
            DrinkOrm.from_drink(
                Drink(
                    id=DrinkId.build(drink_name="soju2", created_at=1234),
                    name="soju2",
                    image_url="soju_image2",
                    type=DrinkType.SOJU,
                    avg_rating=DrinkRating(value=5),
                    num_of_reviews=1,
                    num_of_wish=1,
                )),
            DrinkOrm.from_drink(
                Drink(
                    id=DrinkId.build(drink_name="beer", created_at=1234),
                    name="beer",
                    image_url="beer_image",
                    type=DrinkType.BEER,
                    avg_rating=DrinkRating(value=4.5),
                    num_of_reviews=2,
                    num_of_wish=2,
                )),
        ])
        session.commit()
def test_delete(orm_wish_repository):
    with pytest.raises(ResourceNotFoundError):
        orm_wish_repository.find(QueryParam(user_id="not exist user"))

    actual = orm_wish_repository.delete_by_wish_id(
        wish_id=WishId.from_str("bcbfdb54-acb7-5443-926a-42e882ef7db0"))
    expected = Wish(
        id=WishId.from_str("bcbfdb54-acb7-5443-926a-42e882ef7db0"),
        user_id=UserId(value="heumsi"),
        drink_id=DrinkId.from_str("335ca1a4-5175-5e41-8bac-40ffd840834c"),
        created_at=1613807667.0,
    )
    assert actual == expected

    with pytest.raises(ResourceNotFoundError):
        orm_wish_repository.find(query_param=QueryParam(user_id="heumsi"))
Exemplo n.º 27
0
    def create_drink(self, input_dto: CreateDrinkInputDto) -> Union[CreateDrinkOutputDto, FailedOutputDto]:
        try:
            drink = Drink(
                id=DrinkId.build(drink_name=input_dto.drink_name, created_at=time.time()),
                name=input_dto.drink_name,
                image_url=input_dto.drink_image_url,
                type=DrinkType.from_str(input_dto.drink_type),
            )

            self._drink_repository.add(drink)

            return CreateDrinkOutputDto()

        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_find_by_review_id(orm_review_repository):
    with pytest.raises(ResourceNotFoundError):
        orm_review_repository.find_by_review_id(ReviewId.from_str("35a05a4b-d9ba-5122-af75-7c0022b8bbd8"))

    actual = orm_review_repository.find_by_review_id(
        review_id=ReviewId.from_str("afa213dd-d705-4f4d-953d-ad25e7181367")
    )
    expected = Review(
        id=ReviewId.from_str("afa213dd-d705-4f4d-953d-ad25e7181367"),
        user_id=UserId(value="jun"),
        drink_id=DrinkId.from_str("07a9627a-c930-4292-afd0-b6a2d55de3b2"),
        rating=ReviewRating(value=4),
        comment="first jun",
        created_at=1613807667,
        updated_at=3,
    )
    assert actual == expected
def test_add(orm_wish_repository):
    wish = Wish(
        id=WishId.build(user_id="siheum",
                        drink_id="335ca1a4-5175-5e41-8bac-40ffd840834c"),
        user_id=UserId(value="siheum"),
        drink_id=DrinkId.from_str("335ca1a4-5175-5e41-8bac-40ffd840834c"),
        created_at=1613807667,
    )
    orm_wish_repository.add(wish)

    actual = orm_wish_repository.find(
        QueryParam(user_id="siheum",
                   drink_id="335ca1a4-5175-5e41-8bac-40ffd840834c"))
    expected = wish
    assert actual == expected

    with pytest.raises(ResourceAlreadyExistError):
        orm_wish_repository.add(wish)
def test_find(orm_review_repository):
    actual = orm_review_repository.find(
        query_param=QueryParam(drink_id="07a9627a-c930-4292-afd0-b6a2d55de3b2", user_id="jun")
    )
    expected = Review(
        id=ReviewId.from_str("afa213dd-d705-4f4d-953d-ad25e7181367"),
        user_id=UserId(value="jun"),
        drink_id=DrinkId.from_str("07a9627a-c930-4292-afd0-b6a2d55de3b2"),
        rating=ReviewRating(value=4),
        comment="first jun",
        created_at=1613807667,
        updated_at=3,
    )
    assert actual == expected

    with pytest.raises(InvalidParamInputError):
        orm_review_repository.find(query_param=QueryParam(user_id="jun"))

    with pytest.raises(InvalidParamInputError):
        orm_review_repository.find(query_param=QueryParam(drink_id="07a9627a-c930-4292-afd0-b6a2d55de3b2"))