From b0e43e567e487aff8d0864597fd6224da0451550 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Mon, 15 Dec 2014 00:20:35 -0500 Subject: [PATCH] Allow specification of multiple data manager configuration files... ... use this to create API functional tests for data managers. --- lib/galaxy/tools/data_manager/manager.py | 5 ++++- scripts/functional_tests.py | 7 +++++++ test/api/test_tool_data.py | 19 +++++++++++++++++++ .../tool-data/sample_tool_data_tables.xml | 4 +--- test/functional/tool-data/testbeta.loc | 0 test/functional/tools/data_manager.xml | 16 ++++++++++++++++ .../tools/sample_data_manager_conf.xml | 16 ++++++++++++++++ 7 files changed, 63 insertions(+), 4 deletions(-) create mode 100644 test/functional/tool-data/testbeta.loc create mode 100644 test/functional/tools/data_manager.xml create mode 100644 test/functional/tools/sample_data_manager_conf.xml diff --git a/lib/galaxy/tools/data_manager/manager.py b/lib/galaxy/tools/data_manager/manager.py index ef4ae4d8c52..088e7c9a54f 100644 --- a/lib/galaxy/tools/data_manager/manager.py +++ b/lib/galaxy/tools/data_manager/manager.py @@ -25,7 +25,10 @@ class DataManagers( object ): self.managed_data_tables = odict() self.tool_path = None self.filename = xml_filename or self.app.config.data_manager_config_file - self.load_from_xml( self.filename ) + for filename in util.listify( self.filename ): + if not filename: + continue + self.load_from_xml( filename ) if self.app.config.shed_data_manager_config_file: self.load_from_xml( self.app.config.shed_data_manager_config_file, store_tool_path=False, replace_existing=True ) diff --git a/scripts/functional_tests.py b/scripts/functional_tests.py index 142ace2faee..8196013af9c 100644 --- a/scripts/functional_tests.py +++ b/scripts/functional_tests.py @@ -241,6 +241,12 @@ def main(): if os.path.exists( tool_data_config ): default_tool_data_config = tool_data_config tool_data_table_config_path = '%s,test/functional/tool-data/sample_tool_data_tables.xml' % default_tool_data_config + + default_data_manager_config = 'config/data_manager_conf.xml.sample' + for data_manager_config in ['config/data_manager_conf.xml', 'data_manager_conf.xml' ]: + if os.path.exists( data_manager_config ): + default_data_manager_config = data_manager_config + data_manager_config_file = "%s,test/functional/tools/sample_data_manager_conf.xml" % default_data_manager_config shed_tool_data_table_config = 'config/shed_tool_data_table_conf.xml' tool_dependency_dir = os.environ.get( 'GALAXY_TOOL_DEPENDENCY_DIR', None ) use_distributed_object_store = os.environ.get( 'GALAXY_USE_DISTRIBUTED_OBJECT_STORE', False ) @@ -329,6 +335,7 @@ def main(): master_api_key=master_api_key, use_tasked_jobs=True, enable_beta_tool_formats=True, + data_manager_config_file=data_manager_config_file, ) if install_database_connection is not None: kwargs[ 'install_database_connection' ] = install_database_connection diff --git a/test/api/test_tool_data.py b/test/api/test_tool_data.py index f1f154a2eff..6e461567613 100644 --- a/test/api/test_tool_data.py +++ b/test/api/test_tool_data.py @@ -1,6 +1,9 @@ """ Tests for the tool data API. """ +import json + from base import api +from .helpers import DatasetPopulator import operator @@ -42,3 +45,19 @@ class ToolDataApiTestCase( api.ApiTestCase ): self._assert_status_code_is( show_field_response, 200 ) content = show_field_response.content assert content == "This is data 1.", content + + def test_create_data_with_manager(self): + dataset_populator = DatasetPopulator( self.galaxy_interactor ) + history_id = dataset_populator.new_history() + payload = dataset_populator.run_tool_payload( + tool_id="data_manager", + inputs={"ignored_value": "moo"}, + history_id=history_id, + ) + create_response = self._post( "tools", data=payload ) + self._assert_status_code_is( create_response, 200 ) + dataset_populator.wait_for_history( history_id, assert_ok=True ) + show_response = self._get( "tool_data/testbeta", admin=True ) + print show_response.content + assert False + diff --git a/test/functional/tool-data/sample_tool_data_tables.xml b/test/functional/tool-data/sample_tool_data_tables.xml index 5cf9cc88c7a..ac42063caae 100644 --- a/test/functional/tool-data/sample_tool_data_tables.xml +++ b/test/functional/tool-data/sample_tool_data_tables.xml @@ -3,10 +3,8 @@ value, name, path - diff --git a/test/functional/tool-data/testbeta.loc b/test/functional/tool-data/testbeta.loc new file mode 100644 index 00000000000..e69de29bb2d diff --git a/test/functional/tools/data_manager.xml b/test/functional/tools/data_manager.xml new file mode 100644 index 00000000000..33261485299 --- /dev/null +++ b/test/functional/tools/data_manager.xml @@ -0,0 +1,16 @@ + + + {"data_tables": {"testbeta": [{"value": "newvalue", "path": "newvalue.txt"}]}} + + + mkdir $out_file.files_path ; + echo "A new value" > $out_file.files_path/newvalue.txt; + cp $static_test_data $out_file + + + + + + + + diff --git a/test/functional/tools/sample_data_manager_conf.xml b/test/functional/tools/sample_data_manager_conf.xml new file mode 100644 index 00000000000..e325f6b1381 --- /dev/null +++ b/test/functional/tools/sample_data_manager_conf.xml @@ -0,0 +1,16 @@ + + + + + + + + testbeta/${value} + + ${GALAXY_DATA_MANAGER_DATA_PATH}/testbeta/${value}/${path} + abspath + + + + +