From b7eda89485cbef37f18b1c2ce6304b36565ebfd1 Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Thu, 25 Apr 2024 12:06:28 +0200 Subject: [PATCH] Add test to verify export dataset without hid works --- test/unit/data/model/test_model_store.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/unit/data/model/test_model_store.py b/test/unit/data/model/test_model_store.py index 5e0163ce12bb..7fae0bdcbdd3 100644 --- a/test/unit/data/model/test_model_store.py +++ b/test/unit/data/model/test_model_store.py @@ -545,6 +545,21 @@ def validate_invocation_collection_crate_directory(crate_directory): assert dataset in root["hasPart"] +def test_export_history_with_missing_hid(): + # The dataset's hid was used to compose the file name during the export but it + # can be missing sometimes. We now use the dataset's encoded id instead. + app = _mock_app() + u, history, d1, d2, j = _setup_simple_cat_job(app) + + # Remove hid from d1 + d1.hid = None + app.commit() + + temp_directory = mkdtemp() + with store.DirectoryModelExportStore(temp_directory, app=app, export_files="copy") as export_store: + export_store.export_history(history) + + def test_export_history_to_ro_crate(tmp_path): app = _mock_app() u, history, d1, d2, j = _setup_simple_cat_job(app)