mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Allow specification of multiple data manager configuration files...
... use this to create API functional tests for data managers.
This commit is contained in:
@@ -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 )
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -3,10 +3,8 @@
|
||||
<columns>value, name, path</columns>
|
||||
<file path="${__HERE__}/testalpha.loc" />
|
||||
</table>
|
||||
<!--
|
||||
<table name="testbeta" comment_char="#">
|
||||
<columns>value, foo, bar, path</columns>
|
||||
<columns>value, path</columns>
|
||||
<file path="${__HERE__}/testbeta.loc" />
|
||||
</table>
|
||||
-->
|
||||
</tables>
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<tool id="data_manager" name="Test Data Manager" tool_type="manage_data" version="0.0.1">
|
||||
<configfiles>
|
||||
<configfile name="static_test_data">{"data_tables": {"testbeta": [{"value": "newvalue", "path": "newvalue.txt"}]}}</configfile>
|
||||
</configfiles>
|
||||
<command>
|
||||
mkdir $out_file.files_path ;
|
||||
echo "A new value" > $out_file.files_path/newvalue.txt;
|
||||
cp $static_test_data $out_file
|
||||
</command>
|
||||
<inputs>
|
||||
<param type="text" name="ignored_value" value="" label="Ignored" />
|
||||
</inputs>
|
||||
<outputs>
|
||||
<data name="out_file" format="data_manager_json"/>
|
||||
</outputs>
|
||||
</tool>
|
||||
@@ -0,0 +1,16 @@
|
||||
<data_managers tool_path="test/functional/tools">
|
||||
<data_manager tool_file="data_manager.xml" id="test_data_manager" version="1.0">
|
||||
<data_table name="testbeta">
|
||||
<output>
|
||||
<column name="value" />
|
||||
<column name="path" output_ref="out_file" >
|
||||
<move type="directory" relativize_symlinks="True">
|
||||
<target base="${GALAXY_DATA_MANAGER_DATA_PATH}">testbeta/${value}</target>
|
||||
</move>
|
||||
<value_translation>${GALAXY_DATA_MANAGER_DATA_PATH}/testbeta/${value}/${path}</value_translation>
|
||||
<value_translation type="function">abspath</value_translation>
|
||||
</column>
|
||||
</output>
|
||||
</data_table>
|
||||
</data_manager>
|
||||
</data_managers>
|
||||
Reference in New Issue
Block a user