Skip to content

Commit

Permalink
Speedwagon-500 Speedwagon Medusa Pre Curation script error
Browse files Browse the repository at this point in the history
  • Loading branch information
henryborchers committed Dec 7, 2023
1 parent 8838c16 commit facfd7c
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions tests/workflows/test_medua_preingest_curation.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,44 @@ def test_sort_item_data(self, workflow, monkeypatch):
"files": ["./some/file.txt"],
"directories": ["./some/directory/"],
}
def test_discover_task_metadata(self, workflow, default_args, monkeypatch):
initial_results = []

def isfile(path):
return path == "somefile.txt"
def isdir(path):
return path == "somedir"
def iterdir(self):
return []

def is_dir(self):
return self.name == 'somedir'

monkeypatch.setattr(workflow_medusa_preingest.os.path, "isdir", isdir)
monkeypatch.setattr(workflow_medusa_preingest.os.path, "isfile", isfile)
monkeypatch.setattr(workflow_medusa_preingest.Path, "iterdir", iterdir)
monkeypatch.setattr(workflow_medusa_preingest.Path, "is_dir", is_dir)

new_tasks = workflow.discover_task_metadata(
initial_results,
additional_data={
"to remove": [
"somefile.txt",
"somedir",
]
# "files": ["somefile.txt"],
# "directories": ["somedir"],
},
**default_args,
)

assert all(
new_task in new_tasks
for new_task in [
{"type": "file", "path": "somefile.txt"},
{"type": "directory", "path": "somedir"},
]
)
def test_get_additional_info_opens_dialog(
self,
workflow,
Expand Down

0 comments on commit facfd7c

Please sign in to comment.