Add Fix django.contrib.auth.middleware monkey patching for APITestCase
This patch rollbacks changes in APITestCase introduced in the
commit to unblock Horizon
plugins gates.
Closes-bug:
Closes-bug:
@@ -451,11 +451,10 @@ class BaseAdminViewTests(TestCase):
self.client.cookies[settings.SESSION_COOKIE_NAME] = store.session_key
-# NOTE(adriant): APITestCase was only needed for some openstack_auth
-# monkeypatching. With the new monkeypatch middleware from openstack_auth this
-# is not needed.
-# TODO(adriant): Clean up APITestCase usage in horizon plugins.
-APITestCase = TestCase
+class APITestCase(TestCase):
+ def setUp(self):
+ super(APITestCase, self).setUp()
+ utils.patch_middleware_get_user()
# APIMockTestCase was introduced to support mox to mock migration smoothly
