Stephen Cefali 4 years ago
parent
commit
b94ed3b1aa
1 changed files with 2 additions and 4 deletions
  1. 2 4
      tests/sentry/demo/test_middleware.py

+ 2 - 4
tests/sentry/demo/test_middleware.py

@@ -12,6 +12,7 @@ from sentry.utils import auth
 orig_login = auth.login
 
 
+@override_settings(MIDDLEWARE_CLASSES=MIDDLEWARE_CLASSES, DEMO_MODE=True)
 class DemoMiddlewareTest(APITestCase):
     def setUp(self):
         super().setUp()
@@ -25,20 +26,18 @@ class DemoMiddlewareTest(APITestCase):
             kwargs={"organization_slug": self.organization2.slug},
         )
 
-    @override_settings(MIDDLEWARE_CLASSES=MIDDLEWARE_CLASSES, DEMO_MODE=False)
+    @override_settings(DEMO_MODE=False)
     def test_demo_mode_disabled(self):
         with pytest.raises(Exception) as e:
             self.client.get(self.url)
         assert "Demo mode misconfigured" in str(e)
 
-    @override_settings(MIDDLEWARE_CLASSES=MIDDLEWARE_CLASSES)
     @mock.patch("sentry.demo.middleware.auth.login", side_effect=orig_login)
     def test_switch_to_logged_in(self, mock_auth_login):
         response = self.client.get(self.url)
         assert response.status_code == 200, response.content
         mock_auth_login.assert_called_once_with(mock.ANY, self.user2)
 
-    @override_settings(MIDDLEWARE_CLASSES=MIDDLEWARE_CLASSES)
     @mock.patch("sentry.demo.middleware.auth.login", side_effect=orig_login)
     def test_keep_logged_in(self, mock_auth_login):
         self.login_as(self.user2)
@@ -46,7 +45,6 @@ class DemoMiddlewareTest(APITestCase):
         assert response.status_code == 200, response.content
         assert mock_auth_login.call_count == 0
 
-    @override_settings(MIDDLEWARE_CLASSES=MIDDLEWARE_CLASSES)
     def test_non_org_route(self):
         url = reverse("sentry-account-settings")
         response = self.client.get(url)