'Make sure that /api/v1/users/me/subscriptions properly returns
the invite-only bit for streams that are invite-only'

def test_list_respects_invite_only_bit(self):

    email = self.example_email('hamlet')
    self.login(email)
    result1 = self.common_subscribe_to_streams(email, ['Saxony'], invite_only=True)
    self.assert_json_success(result1)
    result2 = self.common_subscribe_to_streams(email, ['Normandy'], invite_only=False)
    self.assert_json_success(result2)
    result = self.client_get('/api/v1/users/me/subscriptions', **self.api_auth(email))
    self.assert_json_success(result)
    json = ujson.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')
