tests: Cause existing tests to pass after change to gather_subscriptions.

(imported from commit 3524a5d69d9228810ae863fdea9a9f007a1ca7db)
This commit is contained in:
Waseem Daher 2013-02-05 13:47:43 -05:00
parent 66850b5dcd
commit af45236968
1 changed files with 7 additions and 5 deletions

View File

@ -508,8 +508,8 @@ class SubscriptionPropertiesTest(AuthedTestCase):
for stream, color in json["stream_colors"]: for stream, color in json["stream_colors"]:
self.assertIsInstance(color, str) self.assertIsInstance(color, str)
self.assertIsInstance(stream, str) self.assertIsInstance(stream, str)
self.assertIn({'name': stream, 'in_home_view': True, 'color': color}, subs) self.assertIn({'name': stream, 'in_home_view': True, 'color': color, 'invite_only': False}, subs)
subs.remove({'name': stream, 'in_home_view': True, 'color': color}) subs.remove({'name': stream, 'in_home_view': True, 'color': color, 'invite_only': False})
self.assertFalse(subs) self.assertFalse(subs)
def test_set_stream_color(self): def test_set_stream_color(self):
@ -524,6 +524,7 @@ class SubscriptionPropertiesTest(AuthedTestCase):
sub = old_subs[0] sub = old_subs[0]
stream_name = sub['name'] stream_name = sub['name']
old_color = sub['color'] old_color = sub['color']
invite_only = sub['invite_only']
new_color = "#ffffff" # TODO: ensure that this is different from old_color new_color = "#ffffff" # TODO: ensure that this is different from old_color
result = self.client.post("/json/subscriptions/property", result = self.client.post("/json/subscriptions/property",
{"property": "stream_colors", {"property": "stream_colors",
@ -533,10 +534,10 @@ class SubscriptionPropertiesTest(AuthedTestCase):
self.assert_json_success(result) self.assert_json_success(result)
new_subs = gather_subscriptions(self.get_user_profile(test_email)) new_subs = gather_subscriptions(self.get_user_profile(test_email))
self.assertIn({'name': stream_name, 'in_home_view': True, 'color': new_color}, new_subs) self.assertIn({'name': stream_name, 'in_home_view': True, 'color': new_color, 'invite_only': invite_only}, new_subs)
old_subs.remove({'name': stream_name, 'in_home_view': True, 'color': old_color}) old_subs.remove({'name': stream_name, 'in_home_view': True, 'color': old_color, 'invite_only': invite_only})
new_subs.remove({'name': stream_name, 'in_home_view': True, 'color': new_color}) new_subs.remove({'name': stream_name, 'in_home_view': True, 'color': new_color, 'invite_only': invite_only})
self.assertEqual(old_subs, new_subs) self.assertEqual(old_subs, new_subs)
def test_set_color_missing_stream_name(self): def test_set_color_missing_stream_name(self):
@ -623,6 +624,7 @@ class SubscriptionAPITest(AuthedTestCase):
for stream in json["subscriptions"]: for stream in json["subscriptions"]:
self.assertIsInstance(stream['name'], str) self.assertIsInstance(stream['name'], str)
self.assertIsInstance(stream['color'], str) self.assertIsInstance(stream['color'], str)
self.assertIsInstance(stream['invite_only'], bool)
# check that the stream name corresponds to an actual stream # check that the stream name corresponds to an actual stream
try: try:
Stream.objects.get(name__iexact=stream['name'], realm=self.realm) Stream.objects.get(name__iexact=stream['name'], realm=self.realm)