test_remote_billing: Extract remote server / realm login methods.

This commit is contained in:
Aman Agrawal 2023-12-15 13:08:32 +00:00 committed by Tim Abbott
parent 1f7b3d7a2d
commit 53b7e956ea
1 changed files with 7 additions and 3 deletions

View File

@ -40,8 +40,7 @@ if TYPE_CHECKING:
from django.test.client import _MonkeyPatchedWSGIResponse as TestHttpResponse from django.test.client import _MonkeyPatchedWSGIResponse as TestHttpResponse
@override_settings(PUSH_NOTIFICATION_BOUNCER_URL="https://push.zulip.org.example.com") class RemoteRealmBillingTestCase(BouncerTestCase):
class RemoteBillingAuthenticationTest(BouncerTestCase):
def execute_remote_billing_authentication_flow( def execute_remote_billing_authentication_flow(
self, self,
user: UserProfile, user: UserProfile,
@ -169,6 +168,9 @@ class RemoteBillingAuthenticationTest(BouncerTestCase):
# depending on the set up and intent of the test. # depending on the set up and intent of the test.
return result return result
@override_settings(PUSH_NOTIFICATION_BOUNCER_URL="https://push.zulip.org.example.com")
class RemoteBillingAuthenticationTest(RemoteRealmBillingTestCase):
@responses.activate @responses.activate
def test_remote_billing_authentication_flow(self) -> None: def test_remote_billing_authentication_flow(self) -> None:
self.login("desdemona") self.login("desdemona")
@ -756,7 +758,7 @@ class RemoteBillingAuthenticationTest(BouncerTestCase):
self.assertEqual(server_plan.status, CustomerPlan.ACTIVE) self.assertEqual(server_plan.status, CustomerPlan.ACTIVE)
class LegacyServerLoginTest(BouncerTestCase): class RemoteServerTestCase(BouncerTestCase):
@override @override
def setUp(self) -> None: def setUp(self) -> None:
super().setUp() super().setUp()
@ -870,6 +872,8 @@ class LegacyServerLoginTest(BouncerTestCase):
return result return result
class LegacyServerLoginTest(RemoteServerTestCase):
def test_server_login_get(self) -> None: def test_server_login_get(self) -> None:
result = self.client_get("/serverlogin/", subdomain="selfhosting") result = self.client_get("/serverlogin/", subdomain="selfhosting")
self.assertEqual(result.status_code, 200) self.assertEqual(result.status_code, 200)