def test_claim(self): msgs = [] num = random.randint(1, 9) for ii in range(num): msg_id = utils.random_unicode() claim_id = utils.random_unicode() age = utils.random_unicode() body = utils.random_unicode() ttl = utils.random_unicode() href = "http://example.com/%s" % msg_id info = {"href": href, "age": age, "body": body, "ttl": ttl, } msgs.append(info) id_ = _safe_id() href = "http://example.com/%s" % id_ info = {"href": href, "messages": msgs, } mgr = fakes.FakeQueueManager() mgr._message_manager = fakes.FakeQueueManager() clm = QueueClaim(manager=mgr, info=info) self.assertEqual(clm.id, id_) self.assertEqual(len(clm.messages), num)
def setUp(self): self.identity = fakes.FakeIdentity() self.client = fakes.FakeQueueClient(self.identity) self.client._manager = fakes.FakeQueueManager(self.client) self.queue = fakes.FakeQueue() self.queue.manager = self.client._manager