def test_add_and_retrieve_messages(self): queue = self._make_one() queue.add(DummyMessage('one')) self.assertEqual(len(queue), 1) self.failUnless(queue) queue.add(DummyMessage('two')) self.assertEqual(len(queue), 2) self.assertEqual(queue.pop_next(), 'one') self.assertEqual(len(queue), 1) self.assertEqual(queue.pop_next(), 'two') self.assertEqual(len(queue), 0) self.failIf(queue)
def test_is_duplicate_true(self): queue = self._make_one() message = DummyMessage('one') queue.add(message) self.failUnless(queue.is_duplicate(message))