Skip to content

Commit b94ed3b

Browse files
author
Stephen Cefali
authored
fix tests (#24444)
1 parent 072bb3d commit b94ed3b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

tests/sentry/demo/test_middleware.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
orig_login = auth.login
1313

1414

15+
@override_settings(MIDDLEWARE_CLASSES=MIDDLEWARE_CLASSES, DEMO_MODE=True)
1516
class DemoMiddlewareTest(APITestCase):
1617
def setUp(self):
1718
super().setUp()
@@ -25,28 +26,25 @@ def setUp(self):
2526
kwargs={"organization_slug": self.organization2.slug},
2627
)
2728

28-
@override_settings(MIDDLEWARE_CLASSES=MIDDLEWARE_CLASSES, DEMO_MODE=False)
29+
@override_settings(DEMO_MODE=False)
2930
def test_demo_mode_disabled(self):
3031
with pytest.raises(Exception) as e:
3132
self.client.get(self.url)
3233
assert "Demo mode misconfigured" in str(e)
3334

34-
@override_settings(MIDDLEWARE_CLASSES=MIDDLEWARE_CLASSES)
3535
@mock.patch("sentry.demo.middleware.auth.login", side_effect=orig_login)
3636
def test_switch_to_logged_in(self, mock_auth_login):
3737
response = self.client.get(self.url)
3838
assert response.status_code == 200, response.content
3939
mock_auth_login.assert_called_once_with(mock.ANY, self.user2)
4040

41-
@override_settings(MIDDLEWARE_CLASSES=MIDDLEWARE_CLASSES)
4241
@mock.patch("sentry.demo.middleware.auth.login", side_effect=orig_login)
4342
def test_keep_logged_in(self, mock_auth_login):
4443
self.login_as(self.user2)
4544
response = self.client.get(self.url)
4645
assert response.status_code == 200, response.content
4746
assert mock_auth_login.call_count == 0
4847

49-
@override_settings(MIDDLEWARE_CLASSES=MIDDLEWARE_CLASSES)
5048
def test_non_org_route(self):
5149
url = reverse("sentry-account-settings")
5250
response = self.client.get(url)

0 commit comments

Comments
 (0)