1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/01933aab375c/ Changeset: 01933aab375c User: jmchilton Date: 2014-02-28 21:49:46 Summary: Test cases for filtering tool parameters on other parameter values. Includes test case that is broken without JJ's contributions in pull request #343. Affected #: 2 files diff -r edff37d76463a468753477080f65886d4a53619e -r 01933aab375c87302106e851a77e425e51d0394a test/unit/tools/test_select_parameters.py --- a/test/unit/tools/test_select_parameters.py +++ b/test/unit/tools/test_select_parameters.py @@ -48,6 +48,24 @@ self.options_xml = '''<options><filter type="data_meta" ref="input_bam" key="dbkey"/></options>''' assert self.param.need_late_validation( self.trans, { "series": [ { "my_name": "42", "input_bam": basic.RuntimeValue() } ] } ) + def test_filter_param_value( self ): + self.options_xml = '''<options from_data_table="test_table"><filter type="param_value" ref="input_bam" column="0" /></options>''' + assert ("testname1", "testpath1", False) in self.param.get_options( self.trans, { "input_bam": "testname1" } ) + assert ("testname2", "testpath2", False) in self.param.get_options( self.trans, { "input_bam": "testname2" } ) + assert len( self.param.get_options( self.trans, { "input_bam": "testname3" } ) ) == 0 + + def test_filter_param_value2( self ): + # Same test as above, but filtering on a different column. + self.options_xml = '''<options from_data_table="test_table"><filter type="param_value" ref="input_bam" column="1" /></options>''' + assert ("testname1", "testpath1", False) in self.param.get_options( self.trans, { "input_bam": "testpath1" } ) + assert ("testname2", "testpath2", False) in self.param.get_options( self.trans, { "input_bam": "testpath2" } ) + assert len( self.param.get_options( self.trans, { "input_bam": "testpath3" } ) ) == 0 + + def test_filter_nested( self ): + # Test filtering a parameter inside a conditional (not currently supported.) + self.options_xml = '''<options from_data_table="test_table"><filter type="param_value" ref="input_bam" column="1" /></options>''' + assert ("testname1", "testpath1", False) in self.param.get_options( self.trans, {"condtional1" : { "input_bam": "testpath1", "my_name": 42 } } ) + # TODO: Good deal of overlap here with DataToolParameterTestCase, # refactor. def setUp( self ): @@ -59,6 +77,7 @@ self.test_history = model.History() self.app.model.context.add( self.test_history ) self.app.model.context.flush() + self.app.tool_data_tables[ "test_table" ] = MockToolDataTable() self.trans = bunch.Bunch( app=self.app, get_history=lambda: self.test_history, @@ -91,3 +110,16 @@ self._param = basic.SelectToolParameter( self.mock_tool, self.param_xml ) return self._param + + +class MockToolDataTable( object ): + + def __init__( self ): + self.columns = dict( + name=0, + value=1, + ) + self.missing_index_file = None + + def get_fields( self ): + return [ [ "testname1", "testpath1" ], [ "testname2", "testpath2" ] ] diff -r edff37d76463a468753477080f65886d4a53619e -r 01933aab375c87302106e851a77e425e51d0394a test/unit/tools_support.py --- a/test/unit/tools_support.py +++ b/test/unit/tools_support.py @@ -121,6 +121,7 @@ from galaxy.security import GalaxyRBACAgent self.job_queue = NoopQueue() self.security_agent = GalaxyRBACAgent( self.model ) + self.tool_data_tables = {} class MockContext(object): Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.