해결된 질문
작성
·
249
0
C:\github\django_my_website (master -> origin)
(venv) λ python manage.py test
Creating test database for alias 'default'...
System check identified no issues (0 silenced).
E
======================================================================
ERROR: test_post_list (blog.tests.TestView)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\github\django_my_website\blog\tests.py", line 9, in test_post_list
response = self.client.get('/blog/')
File "C:\github\django_my_website\venv\lib\site-packages\django\test\client.py", line 535, in get
response = super().get(path, data=data, secure=secure, **extra)
File "C:\github\django_my_website\venv\lib\site-packages\django\test\client.py", line 347, in get
**extra,
File "C:\github\django_my_website\venv\lib\site-packages\django\test\client.py", line 422, in generic
return self.request(**r)
File "C:\github\django_my_website\venv\lib\site-packages\django\test\client.py", line 503, in request
raise exc_value
File "C:\github\django_my_website\venv\lib\site-packages\django\core\handlers\exception.py", line 34, in inner
response = get_response(request)
File "C:\github\django_my_website\venv\lib\site-packages\django\core\handlers\base.py", line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File "C:\github\django_my_website\venv\lib\site-packages\django\core\handlers\base.py", line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
TypeError: __init__() takes 1 positional argument but 2 were given
----------------------------------------------------------------------
Ran 1 test in 0.441s
FAILED (errors=1)
Destroying test database for alias 'default'...
=========================================================
from django.test import TestCase, Client
from bs4 import BeautifulSoup
class TestView(TestCase):
def setUp(self):
self.client = Client()
def test_post_list(self):
response = self.client.get('/blog/')
self.assertEqual(response.status_code, 200)
soup = BeautifulSoup(response.content, 'html.parser')
title = soup.title
print(title)
'Post List 페이지 테스트 코드 작성하기 part A' 부분을 하던중
위 처럼 작성을 하고 test를 했는데 영상과 다르게 나왔습니다.
그런데 왜 그런지 모르겠습니다.
답변 3
1
0
0