Python Django django.test.Client를 이용한 유닛 테스트

조회수 1899회

장고에서 제공하는 유닛테스트용 클래스 client 를 이용하여 제가 만든 웹페이지를 테스트해보고 싶습니다.

from django.conf import settings
from django.test import Client
settings.configure()

c = Client()
response = c.get('/')
print response.status_code
response = c.post('/login/', {'user_id':'test', 'user_pw':'testing'})
print response.status_code

테스트 코드는 다음과 같이 만들었습니다. 그런데 테스트를 실행해보니 AttributeError: 'module' object has no attribute 'ROOT_URLCONF' 에러가 발생합니다.

이런경우 어떻게하면 좋을까요?

1 답변

답변을 하려면 로그인이 필요합니다.

프로그래머스 커뮤니티는 개발자들을 위한 Q&A 서비스입니다. 로그인해야 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)