mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 17:47:04 +03:00
Add test
This commit is contained in:
parent
85c96bb574
commit
dbd057b9a9
|
@ -224,7 +224,8 @@ class TestUserSetter(TestCase):
|
|||
def setUp(self):
|
||||
# Pass request object through session middleware so session is
|
||||
# available to login and logout functions
|
||||
self.request = Request(factory.get('/'))
|
||||
self.wrapped_request = factory.get('/')
|
||||
self.request = Request(self.wrapped_request)
|
||||
SessionMiddleware().process_request(self.request)
|
||||
|
||||
User.objects.create_user('ringo', 'starr@thebeatles.com', 'yellow')
|
||||
|
@ -244,6 +245,10 @@ class TestUserSetter(TestCase):
|
|||
logout(self.request)
|
||||
self.assertTrue(self.request.user.is_anonymous())
|
||||
|
||||
def test_logged_in_user_is_set_on_wrapped_request(self):
|
||||
login(self.request, self.user)
|
||||
self.assertEqual(self.wrapped_request.user, self.user)
|
||||
|
||||
|
||||
class TestAuthSetter(TestCase):
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user