mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
settings: Rework how push notifications service is configured.
Instead of the PUSH_NOTIFICATIONS_BOUNCER_URL and SUBMIT_USAGE_STATISTICS settings, we want servers to configure individual ZULIP_SERVICE_* settings, while maintaining backward compatibility with the old settings. Thus, if all the new ZULIP_SERVICE_* are at their default False value, but the legacy settings are activated, they need to be translated in computed_settings to the modern way.
This commit is contained in:
committed by
Tim Abbott
parent
722842a0aa
commit
4a93149435
@@ -5,7 +5,6 @@ from unittest import mock
|
||||
import responses
|
||||
import time_machine
|
||||
from django.conf import settings
|
||||
from django.test import override_settings
|
||||
from django.utils.timezone import now as timezone_now
|
||||
from typing_extensions import override
|
||||
|
||||
@@ -28,7 +27,7 @@ from zerver.lib.rate_limiter import RateLimitedIPAddr
|
||||
from zerver.lib.remote_server import send_server_data_to_push_bouncer
|
||||
from zerver.lib.send_email import FromAddress
|
||||
from zerver.lib.test_classes import BouncerTestCase
|
||||
from zerver.lib.test_helpers import ratelimit_rule
|
||||
from zerver.lib.test_helpers import activate_push_notification_service, ratelimit_rule
|
||||
from zerver.lib.timestamp import datetime_to_timestamp
|
||||
from zerver.models import Realm, UserProfile
|
||||
from zerver.models.realms import get_realm
|
||||
@@ -187,7 +186,7 @@ class RemoteRealmBillingTestCase(BouncerTestCase):
|
||||
return result
|
||||
|
||||
|
||||
@override_settings(PUSH_NOTIFICATION_BOUNCER_URL="https://push.zulip.org.example.com")
|
||||
@activate_push_notification_service()
|
||||
class SelfHostedBillingEndpointBasicTest(RemoteRealmBillingTestCase):
|
||||
@responses.activate
|
||||
def test_self_hosted_billing_endpoints(self) -> None:
|
||||
@@ -209,7 +208,7 @@ class SelfHostedBillingEndpointBasicTest(RemoteRealmBillingTestCase):
|
||||
self_hosted_billing_url = "/self-hosted-billing/"
|
||||
self_hosted_billing_json_url = "/json/self-hosted-billing"
|
||||
|
||||
with self.settings(PUSH_NOTIFICATION_BOUNCER_URL=None):
|
||||
with self.settings(ZULIP_SERVICE_PUSH_NOTIFICATIONS=False):
|
||||
with self.settings(CORPORATE_ENABLED=True):
|
||||
result = self.client_get(self_hosted_billing_url)
|
||||
self.assertEqual(result.status_code, 404)
|
||||
@@ -278,13 +277,13 @@ class SelfHostedBillingEndpointBasicTest(RemoteRealmBillingTestCase):
|
||||
)
|
||||
|
||||
|
||||
@override_settings(PUSH_NOTIFICATION_BOUNCER_URL="https://push.zulip.org.example.com")
|
||||
@activate_push_notification_service()
|
||||
class RemoteBillingAuthenticationTest(RemoteRealmBillingTestCase):
|
||||
def test_self_hosted_config_error_page(self) -> None:
|
||||
self.login("desdemona")
|
||||
|
||||
with (
|
||||
self.settings(CORPORATE_ENABLED=False, PUSH_NOTIFICATION_BOUNCER_URL=None),
|
||||
self.settings(CORPORATE_ENABLED=False, ZULIP_SERVICE_PUSH_NOTIFICATIONS=False),
|
||||
self.assertLogs("django.request"),
|
||||
):
|
||||
result = self.client_get("/self-hosted-billing/not-configured/")
|
||||
@@ -299,7 +298,7 @@ class RemoteBillingAuthenticationTest(RemoteRealmBillingTestCase):
|
||||
self.assertEqual(result.status_code, 404)
|
||||
|
||||
# Also doesn't make sense on zulipchat.com (where CORPORATE_ENABLED is True).
|
||||
with self.settings(CORPORATE_ENABLED=True, PUSH_NOTIFICATION_BOUNCER_URL=None):
|
||||
with self.settings(CORPORATE_ENABLED=True, ZULIP_SERVICE_PUSH_NOTIFICATIONS=False):
|
||||
result = self.client_get("/self-hosted-billing/not-configured/")
|
||||
self.assertEqual(result.status_code, 404)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user