티스토리 뷰

파이썬/장고

DRF Testcase headers 처리

글을 쓰는 개발자 2021. 7. 9. 12:16
반응형
    def test_report_create(self):
        print("test_report_create")
        access_token = self.common_report_create({"email": "12@kakao.com", "password": "django_kakao_test"})
        response = RequestsClient().post('http://127.0.0.1:8000/api/report', data={'title': 'hi', 'content': 'hello'},
                                         headers={'Authorization': access_token})
        self.assertEqual(response.status_code, 200)

 

 

response = self.client.post(url, data={'content': 'test', 'color': Color.RED, 'title': 'hello',
                                               'start': datetime.today(), 'end': datetime.today()},
                                    **{'HTTP_AUTHORIZATION': self.success_token})
반응형

'파이썬 > 장고' 카테고리의 다른 글

django testcase 작성시 headers 작성 방법  (1) 2021.07.10
django testcase user create  (0) 2021.07.09
django test response body 가져오기  (0) 2021.07.09
Django user 비밀번호 암호화  (0) 2021.07.06
Django kakao OAuth login 구현  (0) 2021.06.29
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
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
글 보관함