'Request a logout after logging in'

def test_logout(self):

    self.client.login(username='testclient', password='password')
    response = self.client.get('/login_protected_view/')
    self.assertEqual(response.status_code, 200)
    self.assertEqual(response.context['user'].username, 'testclient')
    self.client.logout()
    response = self.client.get('/login_protected_view/')
    self.assertRedirects(response, '/accounts/login/?next=/login_protected_view/')
