I tried to create a test in my tests.py for the first time and I keep receiving errors such as:
Traceback (most recent call last):
File "/actinbox/task/tests.py", line 86, in test_task_view_with_no_task
self.assertEqual(response.status_code, 200)
AssertionError: 302 != 200
this is my tests.py
class TaskViewTests(TestCase):
def test_task_view_with_no_task(self):
"""
If no task exist, an appropriate message should be displayed.
"""
userName = 'esutek'
response = self.client.get(reverse('actuser:task',args=(userName,)))
self.assertEqual(response.status_code, 200)
self.assertContains(response, "No task are available.")
self.assertQuerysetEqual(response.context['taskList'], [])
However it gives me this error message. I don't have any clue why this happened. I just followed the tutorial.
Actually I got 2 urls...
this is from the project
url(r'^(?P<userName>[0-9a-zA-Z--]+)/', include('actuser.urls', namespace="actuser")),
and this one is from actuser.urls
url(r'^task/$', views.task, name='task'),
Aucun commentaire:
Enregistrer un commentaire