Add test_existing_subscriptions_autosubscription().

This commit is contained in:
Ashish Kumar 2016-06-21 19:24:18 +05:30 committed by Tim Abbott
parent 1328a10069
commit 9104468926
1 changed files with 13 additions and 0 deletions

View File

@ -1316,6 +1316,19 @@ class SubscriptionAPITest(AuthedTestCase):
{"stream": invalid_stream_name})
self.assert_json_error(result, "Invalid characters in stream name")
def test_existing_subscriptions_autosubscription(self):
# type: () -> None
"""
Call /json/subscriptions/exist on an existing stream and autosubscribe to it.
"""
stream_name = self.streams[0]
result = self.client.post("/json/subscriptions/exists",
{"stream": stream_name, "autosubscribe": True})
self.assert_json_success(result)
json = ujson.loads(result.content)
self.assertIn("exists", json)
self.assertTrue(json["exists"])
def get_subscription(self, user_profile, stream_name):
# type: (UserProfile, text_type) -> Subscription
stream = Stream.objects.get(realm=self.realm, name=stream_name)