views:

36

answers:

2

This just doesn't make any sense to me, how can the assertion fail when the arguments are identical?

======================================================================
FAIL: test_register_page_redirects_to_signin_page (forum.tests.test_views.ForumTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/Bryan/work/osqa/forum/tests/test_views.py", line 19, in test_register_page_redirects_to_signin_page
    self.assertRedirects(response, '/accounts/signin/')
  File "/usr/local/lib/python2.7/site-packages/Django-1.2.1-py2.7.egg/django/test/testcases.py", line 345, in assertRedirects
    (url, expected_url))
AssertionError: Response redirected to 'http://testserver/account/signin/', expected 'http://testserver/accounts/signin/'

Here is the test:

class ForumTestCase(TestCase):

    def test_register_page_redirects_to_signin_page(self):
        response = self.client.get('/account/register/', follow=True)
        self.assertRedirects(response, '/accounts/signin/')
        self.assertTemplateUsed(response, "auth/signin.html")
        self.assertEqual(response.status_code, 200)
+5  A: 

They're not entirely identical... are you sure that this line

self.assertRedirects(response, '/accounts/signin/')

shouldn't be

self.assertRedirects(response, '/account/signin/')

?

MvanGeest
+3  A: 

Because your arguments... aren't identical?

http://testserver/account/signin/
http://testserver/accounts/signin/
                         ^
Adam Maras