def test_task_sync_map_leaves(self): task = Task() task.configuration = TaskConfiguration() task.configuration["language"] = Language.ENG task.configuration["o_format"] = SyncMapFormat.TXT task.sync_map = self.dummy_sync_map() self.assertEqual(len(task.sync_map_leaves()), 3)
def test_output_sync_map_03(self): task = Task() task.configuration = TaskConfiguration() task.configuration.language = Language.EN task.configuration.os_file_format = SyncMapFormat.TXT task.sync_map = self.dummy_sync_map() output_path = tempfile.mkdtemp() path = task.output_sync_map_file(container_root_path=output_path) self.assertEqual(path, None) shutil.rmtree(output_path)
def test_output_sync_map(self): task = Task() task.configuration = TaskConfiguration() task.configuration["language"] = Language.ENG task.configuration["o_format"] = SyncMapFormat.TXT task.sync_map = self.dummy_sync_map() handler, output_file_path = gf.tmp_file(suffix=".txt") task.sync_map_file_path_absolute = output_file_path path = task.output_sync_map_file() self.assertIsNotNone(path) self.assertEqual(path, output_file_path) gf.delete_file(handler, output_file_path)
def test_output_sync_map(self): task = Task() task.configuration = TaskConfiguration() task.configuration.language = Language.EN task.configuration.os_file_format = SyncMapFormat.TXT task.sync_map = self.dummy_sync_map() handler, output_file_path = tempfile.mkstemp(suffix=".txt") task.sync_map_file_path_absolute = output_file_path path = task.output_sync_map_file() self.assertNotEqual(path, None) self.assertEqual(path, output_file_path) delete_file(handler, output_file_path)
def test_output_sync_map_06(self): task = Task() task.configuration = TaskConfiguration() task.configuration.language = Language.EN task.configuration.os_file_format = SyncMapFormat.SMIL task.configuration.os_file_smil_page_ref = "Text/page.xhtml" task.sync_map = self.dummy_sync_map() handler, output_file_path = tempfile.mkstemp(suffix=".smil") task.sync_map_file_path_absolute = output_file_path path = task.output_sync_map_file() self.assertEqual(path, None) os.close(handler) os.remove(output_file_path)
def test_output_sync_map_02(self): task = Task() task.configuration = TaskConfiguration() task.configuration.language = Language.EN task.configuration.os_file_format = SyncMapFormat.TXT task.sync_map = self.dummy_sync_map() handler, output_file_path = tempfile.mkstemp(suffix=".txt") task.sync_map_file_path = output_file_path output_path = tempfile.mkdtemp() path = task.output_sync_map_file(container_root_path=output_path) self.assertNotEqual(path, None) self.assertEqual(path, os.path.join(output_path, output_file_path)) os.close(handler) os.remove(output_file_path) shutil.rmtree(output_path)