def test_header_disappears(self):
    '\n        Tests that a logged in user is logged out automatically when\n        the REMOTE_USER header disappears during the same browser session.\n        '
    User.objects.create(username='knownuser')
    response = self.client.get('/remote_user/', **{self.header: self.known_user})
    self.assertEqual(response.context['user'].username, 'knownuser')
    response = self.client.get('/remote_user/')
    self.assertEqual(response.context['user'].is_anonymous(), True)
    User.objects.create_user(username='modeluser', password='foo')
    self.client.login(username='modeluser', password='foo')
    authenticate(username='modeluser', password='foo')
    response = self.client.get('/remote_user/')
    self.assertEqual(response.context['user'].username, 'modeluser')
Tests that a logged in user is logged out automatically when
the REMOTE_USER header disappears during the same browser session.
def test_header_disappears(self):
    '\n        Tests that a logged in user is logged out automatically when\n        the REMOTE_USER header disappears during the same browser session.\n        '
    User.objects.create(username='knownuser')
    response = self.client.get('/remote_user/', **{self.header: self.known_user})
    self.assertEqual(response.context['user'].username, 'knownuser')
    response = self.client.get('/remote_user/')
    self.assertEqual(response.context['user'].is_anonymous(), True)
    User.objects.create_user(username='modeluser', password='foo')
    self.client.login(username='modeluser', password='foo')
    authenticate(username='modeluser', password='foo')
    response = self.client.get('/remote_user/')
    self.assertEqual(response.context['user'].username, 'modeluser')