'Request a page that is protected with @login, but use an inactive login'

@override_settings(AUTHENTICATION_BACKENDS=['django.contrib.auth.backends.ModelBackend', 'django.contrib.auth.backends.AllowAllUsersModelBackend'])
def test_view_with_inactive_force_login(self):

    response = self.client.get('/login_protected_view/')
    self.assertRedirects(response, '/accounts/login/?next=/login_protected_view/')
    self.client.force_login(self.u2, backend='django.contrib.auth.backends.AllowAllUsersModelBackend')
    response = self.client.get('/login_protected_view/')
    self.assertEqual(response.status_code, 200)
    self.assertEqual(response.context['user'].username, 'inactive')
