def test_close_writer(self):
     path = test_setup.make_temp_path()
     writer = test_setup.make_writer(path)
     reader = test_setup.make_reader(path)
     writer.write(self.make_message("1"), flush=False)
     self.assertEquals(reader.read(), None)
     writer.close()
     self.assertEquals(reader.read().body, "1")
     reader.close()
 def test_close_reader(self):
     path = test_setup.make_temp_path()
     writer = test_setup.make_writer(path)
     writer.write(self.make_message("1"))
     writer.write(self.make_message("2"))
     writer.close()
     reader = test_setup.make_reader(path)
     self.assertEquals(reader.read().body, "1")
     reader.close()
     self.assertRaises(ValueError, reader.read)
 def test_destructive_dump(self):
     path = test_setup.make_temp_path()
     captive_queue = self.captive_rabbit.make_queue()
     queue = self.rabbit.queue(captive_queue.name)
     captive_queue.publish("foo")
     captive_queue.publish("bar")
     queue.dump(test_setup.make_writer(path), destructive=True)
     self.assertEqual(captive_queue.read(), None)
     queue.restore(test_setup.make_reader(path))
     self.assertEqual(captive_queue.read().body, "foo")
     self.assertEqual(captive_queue.read().body, "bar")
     self.assertEqual(captive_queue.read(), None)
Example #4
0
 def test_destructive_dump(self):
     path = test_setup.make_temp_path()
     captive_queue = self.captive_rabbit.make_queue()
     queue = self.rabbit.queue(captive_queue.name)
     captive_queue.publish("foo")
     captive_queue.publish("bar")
     queue.dump(test_setup.make_writer(path), destructive=True)
     self.assertEqual(captive_queue.read(), None)
     queue.restore(test_setup.make_reader(path))
     self.assertEqual(captive_queue.read().body, "foo")
     self.assertEqual(captive_queue.read().body, "bar")
     self.assertEqual(captive_queue.read(), None)