django testcase 작성시 headers 작성 방법
def test_report_create(self): print("test_report_create") response = self.client.post(self.url, data={'title': 'hi', 'content': 'hello'}, **{'HTTP_AUTHORIZATION': self.access_token_1}) self.assertEqual(response.status_code, 200) 위와 같이 **을 붙여서 표현 하는데 이 때 'HTTP_'을 붙여서 표현하는 것이 중요하다. 참고글: https://ssamko.tistory.com/53 [Django] Test 코드 작성시 header 추가하기 Django를 API서버로만 이용할 때, 외부 사용자들에게 header를 통해 인증정보를..
파이썬/장고
2021. 7. 10. 14:38
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- Collections
- 알고리즘
- Command Line
- 자바
- Pattern
- PostgreSQL
- Spring
- 프로그래머스
- BFS
- Celery
- 파이썬
- 백준
- postgres
- django
- 카카오
- 그래프
- ubuntu
- dockerignore
- headers
- Java
- docker-compose
- env
- docker
- 2021 KAKAO BLIND RECRUITMENT
- thread
- 면접
- Python
- setattr
- DRF
- Linux
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
글 보관함