From 99edd920c5aa400165fa7d91116c4e00ed7d88cd Mon Sep 17 00:00:00 2001 From: Waseem Daher Date: Tue, 5 Feb 2013 14:06:35 -0500 Subject: [PATCH] tests: Make sure that our subscriptions list properly returns the invite-only bit. (imported from commit c060c6b350d335d5e94c07314fcfe7c766f2efcd) --- zephyr/tests.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/zephyr/tests.py b/zephyr/tests.py index cb989d49ec..72b4a3d0e3 100644 --- a/zephyr/tests.py +++ b/zephyr/tests.py @@ -1378,6 +1378,28 @@ class InviteOnlyStreamTest(AuthedTestCase): result = self.client.post("/api/v1/subscriptions/add", post_data) return result + def test_list_respects_invite_only_bit(self): + """ + Make sure that /json/subscriptions/list properly returns + the invite-only bit for streams that are invite-only + """ + email = 'hamlet@humbughq.com' + self.login(email) + + result1 = self.common_subscribe_to_stream(email, '["Saxony"]', invite_only=True) + self.assert_json_success(result1) + result2 = self.common_subscribe_to_stream(email, '["Normandy"]', invite_only=False) + self.assert_json_success(result2) + result = self.client.post("/json/subscriptions/list", {}) + self.assert_json_success(result) + json = simplejson.loads(result.content) + self.assertIn("subscriptions", json) + for sub in json["subscriptions"]: + if sub['name'] == "Normandy": + self.assertEqual(sub['invite_only'], False, "Normandy was mistakenly marked invite-only") + if sub['name'] == "Saxony": + self.assertEqual(sub['invite_only'], True, "Saxony was not properly marked invite-only") + def test_inviteonly(self): # Creating an invite-only stream is allowed email = 'hamlet@humbughq.com'