diff --git a/zaqar/tests/unit/transport/wsgi/v2_0/test_subscriptions.py b/zaqar/tests/unit/transport/wsgi/v2_0/test_subscriptions.py index c17579c8e..bf7fd4c0f 100644 --- a/zaqar/tests/unit/transport/wsgi/v2_0/test_subscriptions.py +++ b/zaqar/tests/unit/transport/wsgi/v2_0/test_subscriptions.py @@ -176,6 +176,19 @@ class TestSubscriptionsMongoDB(base.V2Base): def test_list_works(self): self._list_subscription() + def test_list_empty(self): + resp = self.simulate_get(self.subscription_path, + headers=self.headers) + + self.assertEqual(falcon.HTTP_200, self.srmock.status) + + resp_doc = jsonutils.loads(resp[0]) + self.assertIsInstance(resp_doc, dict) + self.assertIn('subscriptions', resp_doc) + self.assertIn('links', resp_doc) + self.assertEqual([], resp_doc['subscriptions']) + self.assertEqual([], resp_doc['links']) + @ddt.data(1, 5, 10, 15) def test_listing_works_with_limit(self, limit): self._list_subscription(count=15, limit=limit) diff --git a/zaqar/transport/wsgi/v2_0/subscriptions.py b/zaqar/transport/wsgi/v2_0/subscriptions.py index 85b859755..6955b4a4f 100644 --- a/zaqar/transport/wsgi/v2_0/subscriptions.py +++ b/zaqar/transport/wsgi/v2_0/subscriptions.py @@ -142,7 +142,7 @@ class CollectionResource(object): kwargs['marker'] = next(results) or kwargs.get('marker', '') links = [] - if results: + if subscriptions: links = [ { 'rel': 'next',