Issue #8 resolved

assertRedirects: response code was 302 (expected 200)

yrikk
created an issue

Code: {{{

!python

259 def test_remove_category(self): 260 """Test of category removing""" 261 262 self._do_authenticate(username=self.admin.username, 263 password=self.password) 264 # Create category 265 category = Category.objects.create(slug='/test1/', title='title') 266 len1 = Category.objects.all().count() 267 # Try to remove 268 url = reverse('remove_category', kwargs={'pk': category.id}) 269 response = self.app.get(url) 270 # Argee to remove 271 url = reverse('remove_category_force', kwargs={'pk': category.id}) 272 self.assertContains(response, url) 273 # Remove 274 response = self.app.get(url) 275 self.assertRedirects(response, reverse('list_categories')) }}}

Trace: {{{

!python

"/users/cccccaaa/Desktop/django_projects/salesbooster/salesbooster/backend/tests/cms_tests.py", line 275, in test_remove_category self.assertRedirects(response, reverse('list_categories')) File "/Users/cccccaaa/Desktop/django_projects/salesbooster/.env/lib/python2.6/site-packages/django/test/testcases.py", line 396, in assertRedirects (path, redirect_response.status_code, target_status_code)) AssertionError: 302 != 200 : Couldn't retrieve redirection page '/backend/cms/list-categories/': response code was 302 (expected 200) }}}

Is it normal that assertRedirects waits for 200 code?

Comments (5)

  1. Log in to comment