def test_get_file_system_data_child_is_sbml(cls): with tempfile.TemporaryDirectory() as tempdir: test_path = os.path.join(tempdir, "parent_dir") os.mkdir(test_path) test_file_path = os.path.join(test_path, "test_file.sbml") Path(test_file_path).touch() with unittest.mock.patch("handlers.util.ls.build_child") as mock_build_child: ls.get_file_system_data(test_path, tempdir) mock_build_child.assert_called_once_with\ (text="test_file.sbml", f_type="sbml-model", p_path=tempdir)
def test_get_file_system_data_child_is_exp(cls): with tempfile.TemporaryDirectory() as tempdir: test_path = os.path.join(tempdir, "parent_dir") os.mkdir(test_path) test_dir_path = os.path.join(test_path, "test_dir.wkgp") os.mkdir(test_dir_path) with unittest.mock.patch("handlers.util.ls.build_child") as mock_build_child: ls.get_file_system_data(test_path, tempdir) mock_build_child.assert_called_once_with\ (text="test_dir.wkgp", f_type="workflow-group", p_path=tempdir)
def test_get_file_system_data_no_children(cls): with tempfile.TemporaryDirectory() as tempdir: test_path = os.path.join(tempdir, "empty_dir") os.mkdir(test_path) children = ls.get_file_system_data(test_path, tempdir) assert len(children) == 0
def test_get_file_system_data_dir_not_found(self): with tempfile.TemporaryDirectory() as tempdir: test_path = os.path.join(tempdir, "nonexistent_dir") with self.assertRaises(StochSSFileNotFoundError): ls.get_file_system_data(test_path, tempdir)