コード例 #1
0
    def test_context(self):
        if self._test_context is None:
            option_xml = ""
            if self.filtered_param:
                option_xml = '''<options><filter type="data_meta" ref="data1" key="dbkey" /></options>'''
            if self.metadata_filtered_param:
                option_xml = '''
                    <options options_filter_attribute="metadata.foo">
                      <filter type="add_value" value="bar" />
                      <filter type="add_value" value="baz" />
                    </options>'''
            param_xml = XML('''<param name="data2" type="data" format="txt">%s</param>''' % option_xml)
            self.param = basic.DataToolParameter(
                self.tool,
                param_xml,
            )
            trans = bunch.Bunch(
                app=self.app,
                get_current_user_roles=lambda: self.current_user_roles,
                workflow_building_mode=True,
            )
            self._test_context = dataset_matcher.get_dataset_matcher_factory(trans).dataset_matcher(
                param=self.param,
                other_values=self.other_values
            )

        return self._test_context
コード例 #2
0
    def param(self):
        if not self._param:
            multi_text = ""
            if self.multiple:
                multi_text = 'multiple="True"'
            optional_text = ""
            if self.optional:
                optional_text = 'optional="True"'
            template_xml = '''<param name="data2" type="data" ext="txt" %s %s></param>'''
            self.param_xml = XML(template_xml % (multi_text, optional_text))
            self._param = basic.DataToolParameter(self.mock_tool,
                                                  self.param_xml)

        return self._param
コード例 #3
0
    def test_context(self):
        if self._test_context is None:
            option_xml = ""
            if self.filtered_param:
                option_xml = '''<options><filter type="data_meta" ref="data1" key="dbkey" /></options>'''
            param_xml = XML('''<param name="data2" type="data" ext="txt">%s</param>''' % option_xml)
            self.param = basic.DataToolParameter(
                self.tool,
                param_xml,
            )

            self._test_context = dataset_matcher.DatasetMatcher(
                trans=bunch.Bunch(
                    app=self.app,
                    get_current_user_roles=lambda: self.current_user_roles,
                    workflow_building_mode=True,
                ),
                param=self.param,
                value=[],
                other_values=self.other_values
            )

        return self._test_context