test_subs: Explicitly declare subdomains.

This commit is contained in:
Tim Abbott 2017-08-25 15:58:13 -07:00
parent 6caca80ab7
commit edc095db6d
2 changed files with 10 additions and 5 deletions

View File

@ -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):

View File

@ -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)