Merge "Fix issue with subscription list in Redis"
This commit is contained in:
commit
39be4c7d58
@ -60,7 +60,7 @@ class SubscriptionController(base.Subscription):
|
|||||||
project,
|
project,
|
||||||
SUBSCRIPTION_IDS_SUFFIX)
|
SUBSCRIPTION_IDS_SUFFIX)
|
||||||
rank = client.zrank(subset_key, marker)
|
rank = client.zrank(subset_key, marker)
|
||||||
start = rank + 1 if rank else 0
|
start = rank + 1 if rank is not None else 0
|
||||||
|
|
||||||
cursor = (q for q in client.zrange(subset_key, start,
|
cursor = (q for q in client.zrange(subset_key, start,
|
||||||
start + limit - 1))
|
start + limit - 1))
|
||||||
|
@ -1053,6 +1053,31 @@ class SubscriptionControllerTest(ControllerBaseTest):
|
|||||||
subscriptions)))
|
subscriptions)))
|
||||||
self.assertEqual(5, len(subscriptions))
|
self.assertEqual(5, len(subscriptions))
|
||||||
|
|
||||||
|
def test_small_list(self):
|
||||||
|
subscriber = 'http://fake'
|
||||||
|
s_id = self.subscription_controller.create(
|
||||||
|
self.source,
|
||||||
|
subscriber,
|
||||||
|
self.ttl,
|
||||||
|
self.options,
|
||||||
|
project=self.project)
|
||||||
|
self.addCleanup(self.subscription_controller.delete, self.source,
|
||||||
|
s_id, self.project)
|
||||||
|
|
||||||
|
interaction = self.subscription_controller.list(self.source,
|
||||||
|
project=self.project)
|
||||||
|
subscriptions = list(next(interaction))
|
||||||
|
marker = next(interaction)
|
||||||
|
|
||||||
|
self.assertEqual(1, len(subscriptions))
|
||||||
|
|
||||||
|
interaction = (self.subscription_controller.list(self.source,
|
||||||
|
project=self.project,
|
||||||
|
marker=marker))
|
||||||
|
subscriptions = list(next(interaction))
|
||||||
|
|
||||||
|
self.assertEqual([], subscriptions)
|
||||||
|
|
||||||
@ddt.data(True, False)
|
@ddt.data(True, False)
|
||||||
def test_get_raises_if_subscription_does_not_exist(self, precreate_queue):
|
def test_get_raises_if_subscription_does_not_exist(self, precreate_queue):
|
||||||
self._precreate_queue(precreate_queue)
|
self._precreate_queue(precreate_queue)
|
||||||
|
Loading…
Reference in New Issue
Block a user