Files
galaxy/test/integration/test_model_store_scripts.py
T
John Chilton c5bf63bc91 Add DEFERRED datasets to Galaxy
- Improves options and display around discarded datasets.
- Adds new APIs for importing model stores.
- Adds support to model store layer for importing/exporting workflow invocations and APIs and tests to support this.
- Add new DEFERRED dataset state - with APIs for materializing them or the option to defer them on the worker node if using tool_evaluation_strategy=remote on the job destination.
- UI and API options for uploading deferred datasets individually or into collections.
2022-05-23 19:48:47 -04:00

40 lines
1.5 KiB
Python

import json
import os
from galaxy.model.store.load_objects import main
from galaxy.model.unittest_utils.store_fixtures import (
history_model_store_dict,
one_hda_model_store_dict,
TEST_HISTORY_NAME,
)
from galaxy_test.base.populators import DatasetPopulator
from galaxy_test.driver.integration_util import IntegrationTestCase
class ModelStoreScriptsIntegrationTestCase(IntegrationTestCase):
# TODO: test build_objects also...
def setUp(self):
super().setUp()
self.dataset_populator = DatasetPopulator(self.galaxy_interactor)
self.json_store_path = os.path.join(self._tempdir, "store.json")
def test_import_contents_from_json(self):
self._write_store_json(one_hda_model_store_dict())
history_id = self.dataset_populator.new_history()
script_args = ["-t", history_id, "-u", self.url, "-k", self.galaxy_interactor.api_key, self.json_store_path]
main(script_args)
def test_import_history_from_json(self):
self._write_store_json(history_model_store_dict())
script_args = ["-u", self.url, "-k", self.galaxy_interactor.api_key, self.json_store_path]
history_names = [h["name"] for h in self.dataset_populator.get_histories()]
assert TEST_HISTORY_NAME not in history_names
main(script_args)
history_names = [h["name"] for h in self.dataset_populator.get_histories()]
assert TEST_HISTORY_NAME in history_names
def _write_store_json(self, as_dict) -> None:
with open(self.json_store_path, "w") as f:
json.dump(as_dict, f)