def test_Orchestrator_with_threshold(self): Registration.create( topic="MyTopic1", container="busybox", creator="me", threshold=1, timeout=15 ) inboxer = Inboxer(os.path.join(self.TEST_DIR, "master_inbox"), os.path.join(self.TEST_DIR, "container_inboxes")) orchestrator = Orchestrator(inboxer) inboxer.add_file_by_bytes("MyTopic1", "This is some data") self.assertEqual(len(inboxer.get_inbox_list("MyTopic1")), 0)
def test_add_file_by_bytes(self): master_inbox_path = os.path.join(self.TEST_DIR, "master_inbox") container_inboxes_path = os.path.join(self.TEST_DIR, "container_inboxes") # Initialize inboxer using a tmp directory for unit testing inboxer = Inboxer(master_inbox_path, container_inboxes_path) counter = inboxer.add_file_by_bytes("MyTopic", "This is a test file weeee") master_inbox_destination = os.path.join(master_inbox_path, "MyTopic", str(counter)) self.assertEqual(os.path.exists(master_inbox_destination), True)