클린 코드를 위한 테스트 주도 개발
python
django
이용한 테스트 개발 공부하기 위한 책
http://www.yes24.com/Product/Goods/16886031
공부 순서
python 테스트 코드(책)
django 테스트 공부(책)
drf 테스트 공부(drf document)
통해서 공부해라
https://www.django-rest-framework.org/api-guide/testing/
from django.test import TestCase
from rest_framework import status
from rest_framework.test import APITestCase
class RestaurantTest(APITestCase):
"""
Postmane이 하는 일을 코드로 자동화
DB는 분리됨
"""
def test_restaurant_list(self):
url = '/api-view/restaurants/'
# request 같은 역할( http get 요청을 보냄)
response = self.client.get(url)
# assert 기대하는 것!! status code 가 200dlfkrh rleogka
self.assertEqual(response.status_code, status.HTTP_200_OK)
맛집
./manage.py test
response(length)