'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):

    User.objects.create(username='knownuser')
    response = self.client.get('/remote_user/', REMOTE_USER=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')
