Fix history import for datasets with tags

and tag dataset used for history import/export tests
This commit is contained in:
mvdbeek
2022-01-07 17:16:45 +01:00
parent 7fecc4b5e9
commit a2ede0331e
2 changed files with 9 additions and 2 deletions
+1 -1
View File
@@ -61,7 +61,7 @@ class JobImportHistoryArchiveWrapper:
self.app.config.external_chown_script,
"history import archive directory"
)
model_store = store.get_import_model_store_for_directory(archive_dir, app=self.app, user=user)
model_store = store.get_import_model_store_for_directory(archive_dir, app=self.app, user=user, tag_handler=self.app.tag_handler.create_tag_handler_session())
job = jiha.job
with model_store.target_history(default_history=job.history) as new_history:
+8 -1
View File
@@ -270,6 +270,10 @@ class BaseDatasetPopulator(BasePopulator):
return tool_response
def tag_dataset(self, history_id, hda_id, tags):
url = f"histories/{history_id}/contents/{hda_id}"
return self._put(url, {'tags': tags}, json=True).json()
def wait_for_tool_run(self, history_id: str, run_response: requests.Response, timeout: timeout_type = DEFAULT_TIMEOUT, assert_ok: bool = True):
job = self.check_run(run_response)
self.wait_for_job(job["id"], timeout=timeout)
@@ -674,7 +678,10 @@ class BaseDatasetPopulator(BasePopulator):
def setup_history_for_export_testing(self, history_name):
history_id = self.new_history(name=history_name)
self.new_dataset(history_id, content="1 2 3")
hda = self.new_dataset(history_id, content="1 2 3")
tags = ['name:name']
response = self.tag_dataset(history_id, hda['id'], tags=tags)
assert response['tags'] == tags
deleted_hda = self.new_dataset(history_id, content="1 2 3", wait=True)
self.delete_dataset(history_id, deleted_hda["id"])
deleted_details = self.get_history_dataset_details(history_id, id=deleted_hda["id"])