Skip to content

Commit c139cad

Browse files
committed
feat: 폴더 명 변경, test 코드 추가
1 parent 7f91f61 commit c139cad

27 files changed

+80
-23
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/src/.env
1+
/app/.env
22
/.aws-sam/
33
/.venv/
44
/template.yml

.idea/sonarlint/issuestore/2/7/2750f02fff5e2c74512db211085c9f923d330303

-2
This file was deleted.

.idea/sonarlint/issuestore/4/2/424f90f570be80aeb26d786c84fec6e9d156df7c

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/sonarlint/issuestore/f/6/f64891dc0c0c5e563d1cf4030a98e02fdf8b4b0c

-3
This file was deleted.

.idea/sonarlint/issuestore/index.pb

+15-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/sonarlint/securityhotspotstore/f/6/f64891dc0c0c5e563d1cf4030a98e02fdf8b4b0c

Whitespace-only changes.

.idea/sonarlint/securityhotspotstore/index.pb

+15-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/__init__.py app/__init__.py

File renamed without changes.
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/main.py app/main.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
from fastapi import FastAPI, Query
66
from mangum import Mangum
77

8-
from src.dto.get_recommendation_request import Get_recommendation_request
9-
from src.dto.get_recommendation_response import Get_recommendation_response
10-
from src.service.restaurant_service import get_restaurant_recommendation
8+
from app.dto.get_recommendation_request import Get_recommendation_request
9+
from app.dto.get_recommendation_response import Get_recommendation_response
10+
from app.service.restaurant_service import get_restaurant_recommendation
1111

1212
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
1313
load_dotenv(os.path.join(BASE_DIR, ".env"))
File renamed without changes.
File renamed without changes.

src/service/restaurant_service.py app/service/restaurant_service.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
from fastapi import HTTPException
77
import requests
88

9-
from src.dto.get_recommendation_response import Get_recommendation_response
10-
from src.service.genAI_service import generate_content
9+
from app.dto.get_recommendation_response import Get_recommendation_response
10+
from app.service.genAI_service import generate_content
1111

1212
MAX_RESTAURANT_NUM = 15
1313
load_dotenv()
167 Bytes
Binary file not shown.
Binary file not shown.

test/test_restaurant_service.py

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
from unittest.mock import patch
2+
3+
from app.dto.get_recommendation_request import Get_recommendation_request
4+
from app.dto.get_recommendation_response import Get_recommendation_response
5+
from app.service.restaurant_service import get_restaurant_recommendation
6+
7+
mock_kakao_result = [
8+
{
9+
'place_name': 'Mock Restaurant',
10+
'category_name': 'Food > Korean',
11+
'place_url': 'http://mock.restaurant',
12+
'distance': '100',
13+
'road_address_name': 'Mock Address'
14+
}
15+
]
16+
17+
mock_genAI_recommendation = """{'place_name': 'Mock Restaurant', 'category_name': 'Food > Korean', 'place_url': 'http://mock.restaurant', 'distance': '100', 'road_address_name': 'Mock Address'}"""
18+
19+
@patch('app.service.restaurant_service.get_kakao_search_result')
20+
@patch('app.service.restaurant_service.get_genAI_recommendation')
21+
def test_get_restaurant_recommendation(mock_get_genAI_recommendation, mock_get_kakao_search_result):
22+
mock_get_kakao_search_result.return_value = mock_kakao_result
23+
mock_get_genAI_recommendation.return_value = mock_genAI_recommendation
24+
25+
get_recommendation_req = Get_recommendation_request(
26+
longitude="127.06283102249932",
27+
latitude="37.514322572335935",
28+
theme="한식",
29+
tag=None
30+
)
31+
page = 1
32+
33+
response = get_restaurant_recommendation(get_recommendation_req, page)
34+
expected_response = Get_recommendation_response(
35+
title='Mock Restaurant',
36+
category='Food > Korean',
37+
link='http://mock.restaurant',
38+
distance='100',
39+
address='Mock Address'
40+
)
41+
42+
assert response == expected_response

0 commit comments

Comments
 (0)