1212orig_login = auth .login
1313
1414
15+ @override_settings (MIDDLEWARE_CLASSES = MIDDLEWARE_CLASSES , DEMO_MODE = True )
1516class 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