def test_login_success(self):
        self.client.login(username='authorized', password='pass')
        response = self.client.post(
            reverse('login_as_user', args=[self.destination_user.id])
        )
        self.assertEqual(response.status_code, 302)
        # Check the user is logged in in the session
        self.assertIn(auth.SESSION_KEY, self.client.session)
        self.assertEqual(str(self.client.session[auth.SESSION_KEY]), str(self.destination_user.id))
        # Check the 'exit_users_pk' is set so we know which user to change back to
        self.assertIn('exit_users_pk', self.client.session)
        pk, backend = self.client.session['exit_users_pk'][0]
        self.assertEqual(str(pk), str(self.authorized_user.pk))
        self.assertEqual(backend, 'django.contrib.auth.backends.ModelBackend')
Inject the cookies as client headers into the server's wsgi
dataset/ETHPy150Open adamcharnock/django-su/django_su/tests/test_views.py/LoginAsUserViewTestCase.test_login_success--crossover with--dataset/ETHPy150Open IanLewis/kay/kay/lib/werkzeug/test.py/_TestCookieJar.inject_wsgi