Hi everyone,

I set up a bare-bones project with one view decorated with
@login_required.
I created an initial_data.json fixture with a user.
I called self.client.login(username='foobar', passowrd='foobar') and
it returned True.
I assigned a response variable from self.client.get('/protected/')

and self.assertEqual(response.status_code, 200) fails.

Instead, it's returning a 302 to 'http://testserver/accounts/login/?
next=/protected
Why is that?

Here is my test case:

class SimpleTest(TestCase):
    def test_protected(self):
        logged_in = self.client.login(username='foobar',
passowrd='foobar')
        self.failUnless(logged_in)

        response = self.client.get('/protected/')
        self.assertEqual(response.status_code, 200)

Which results in:
AssertionError: 302 != 200

What am I doing wrong? Any help GREATLY appreciated!
Brandon

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to