diff --git a/zerver/lib/test_classes.py b/zerver/lib/test_classes.py index 580d8c9200..bf40b809af 100644 --- a/zerver/lib/test_classes.py +++ b/zerver/lib/test_classes.py @@ -499,12 +499,14 @@ class ZulipTestCase(TestCase): bulk_remove_subscriptions([user_profile], [stream]) # Subscribe to a stream by making an API request - def common_subscribe_to_streams(self, email, streams, extra_post_data={}, invite_only=False): - # type: (Text, Iterable[Text], Dict[str, Any], bool) -> HttpResponse + def common_subscribe_to_streams(self, email, streams, extra_post_data={}, invite_only=False, + **kwargs): + # type: (Text, Iterable[Text], Dict[str, Any], bool, **Any) -> HttpResponse post_data = {'subscriptions': ujson.dumps([{"name": stream} for stream in streams]), 'invite_only': ujson.dumps(invite_only)} post_data.update(extra_post_data) - result = self.client_post("/api/v1/users/me/subscriptions", post_data, **self.api_auth(email)) + result = self.client_post("/api/v1/users/me/subscriptions", post_data, + **self.api_auth(email), **kwargs) return result def send_json_payload(self, user_profile, url, payload, stream_name=None, **post_params): diff --git a/zerver/tests/test_subs.py b/zerver/tests/test_subs.py index 1b98f699bf..9a06c7a2d8 100644 --- a/zerver/tests/test_subs.py +++ b/zerver/tests/test_subs.py @@ -1458,6 +1458,7 @@ class SubscriptionAPITest(ZulipTestCase): extra_post_data=dict( announce='true' ), + subdomain="testrealm", ) self.assert_json_success(result) @@ -1836,6 +1837,7 @@ class SubscriptionAPITest(ZulipTestCase): self.mit_email("starnine"), streams, dict(principals=ujson.dumps([self.mit_email("starnine")])), + subdomain="zephyr", ) # Make sure Zephyr mirroring realms such as MIT do not get # any tornado subscription events @@ -2486,7 +2488,8 @@ class GetSubscribersTest(ZulipTestCase): email, ["mit_invite_only"], dict(principals=ujson.dumps(users_to_subscribe)), - invite_only=True) + invite_only=True, + subdomain="zephyr") self.assert_json_success(ret) with queries_captured() as queries: @@ -2644,6 +2647,6 @@ class AccessStreamTest(ZulipTestCase): access_stream_by_name(sipbtest, mit_stream.name) # But they can access streams they are subscribed to - self.common_subscribe_to_streams(sipbtest.email, [mit_stream.name]) + self.common_subscribe_to_streams(sipbtest.email, [mit_stream.name], subdomain="zephyr") access_stream_by_id(sipbtest, mit_stream.id) access_stream_by_name(sipbtest, mit_stream.name)