Ejemplo n.º 1
0
    def test_get_command(self):
        obs = _get_command('QIIME', '1.9.1', 'Split libraries FASTQ')
        exp = qdb.software.Command(1)
        self.assertEqual(obs, exp)

        # It does not exist
        with self.assertRaises(HTTPError):
            _get_command('QIIME', '1.9.1', 'UNKNOWN')
Ejemplo n.º 2
0
    def test_get_command(self):
        obs = _get_command('QIIME', '1.9.1', 'Split libraries FASTQ')
        exp = qdb.software.Command(1)
        self.assertEqual(obs, exp)

        # It does not exist
        with self.assertRaises(HTTPError):
            _get_command('QIIME', '1.9.1', 'UNKNOWN')
Ejemplo n.º 3
0
    def test_post(self):
        data = {
            'name': 'New Command',
            'description': 'Command added for testing',
            'required_parameters': dumps(
                {'in_data': ['artifact:["FASTA"]', None]}),
            'optional_parameters': dumps(
                {'param1': ['string', ''],
                 'param2': ['float', '1.5'],
                 'param3': ['boolean', 'True'],
                 'param4': ['mchoice:["opt1", "opt2", "opt3"]',
                            dumps(['opt1', 'opt2'])]}),
            'outputs': dumps({'out1': 'BIOM'}),
            'default_parameter_sets': dumps(
                {'dflt1': {'param1': 'test',
                           'param2': '2.4',
                           'param3': 'False'}})
            }
        obs = self.post('/qiita_db/plugins/QIIME/1.9.1/commands/', data=data,
                        headers=self.header)
        self.assertEqual(obs.code, 200)
        obs = _get_command('QIIME', '1.9.1', 'New Command')
        self.assertEqual(obs.name, 'New Command')
        self.assertFalse(obs.analysis_only)

        # Create a new command that is analysis only
        data = {
            'name': 'New analysis command',
            'description': 'Analysis command added for testing',
            'required_parameters': dumps(
                {'in_data': ['artifact:["BIOM"]', None]}),
            'optional_parameters': dumps(
                {'param1': ['string', 'default'],
                 'param4': ['mchoice:["opt1", "opt2", "opt3"]',
                            dumps(['opt1', 'opt2']), None, True]}),
            'outputs': dumps({'outtable': 'BIOM'}),
            'default_parameter_sets': dumps({'dflt1': {'param1': 'test'}}),
            'analysis_only': True
        }
        obs = self.post('/qiita_db/plugins/QIIME/1.9.1/commands/', data=data,
                        headers=self.header)
        self.assertEqual(obs.code, 200)
        obs = _get_command('QIIME', '1.9.1', 'New analysis command')
        self.assertEqual(obs.name, 'New analysis command')
        self.assertTrue(obs.analysis_only)
        self.assertEqual(obs.merging_scheme,
                         {'parameters': ['param4'], 'outputs': [],
                          'ignore_parent_command': False})
Ejemplo n.º 4
0
 def test_post(self):
     data = {
         'name':
         'New Command',
         'description':
         'Command added for testing',
         'required_parameters':
         dumps({'in_data': ['artifact:["FASTA"]', None]}),
         'optional_parameters':
         dumps({
             'param1': ['string', ''],
             'param2': ['float', '1.5'],
             'param3': ['boolean', 'True']
         }),
         'outputs':
         dumps({'out1': 'BIOM'}),
         'default_parameter_sets':
         dumps({
             'dflt1': {
                 'param1': 'test',
                 'param2': '2.4',
                 'param3': 'False'
             }
         })
     }
     obs = self.post('/qiita_db/plugins/QIIME/1.9.1/commands/',
                     data=data,
                     headers=self.header)
     self.assertEqual(obs.code, 200)
     obs = _get_command('QIIME', '1.9.1', 'New Command')
     self.assertEqual(obs.name, 'New Command')
Ejemplo n.º 5
0
    def test_post(self):
        data = {
            'name': 'New Command',
            'description': 'Command added for testing',
            'required_parameters': dumps(
                {'in_data': ['artifact:["FASTA"]', None]}),
            'optional_parameters': dumps(
                {'param1': ['string', ''],
                 'param2': ['float', '1.5'],
                 'param3': ['boolean', 'True'],
                 'param4': ['mchoice:["opt1", "opt2", "opt3"]',
                            dumps(['opt1', 'opt2'])]}),
            'outputs': dumps({'out1': 'BIOM'}),
            'default_parameter_sets': dumps(
                {'dflt1': {'param1': 'test',
                           'param2': '2.4',
                           'param3': 'False'}})
            }
        obs = self.post('/qiita_db/plugins/QIIME/1.9.1/commands/', data=data,
                        headers=self.header)
        self.assertEqual(obs.code, 200)
        obs = _get_command('QIIME', '1.9.1', 'New Command')
        self.assertEqual(obs.name, 'New Command')
        self.assertFalse(obs.analysis_only)

        # Create a new command that is analysis only
        data = {
            'name': 'New analysis command',
            'description': 'Analysis command added for testing',
            'required_parameters': dumps(
                {'in_data': ['artifact:["BIOM"]', None]}),
            'optional_parameters': dumps(
                {'param1': ['string', 'default'],
                 'param4': ['mchoice:["opt1", "opt2", "opt3"]',
                            dumps(['opt1', 'opt2']), None, True]}),
            'outputs': dumps({'outtable': 'BIOM'}),
            'default_parameter_sets': dumps({'dflt1': {'param1': 'test'}}),
            'analysis_only': True
        }
        obs = self.post('/qiita_db/plugins/QIIME/1.9.1/commands/', data=data,
                        headers=self.header)
        self.assertEqual(obs.code, 200)
        obs = _get_command('QIIME', '1.9.1', 'New analysis command')
        self.assertEqual(obs.name, 'New analysis command')
        self.assertTrue(obs.analysis_only)
        self.assertEqual(obs.merging_scheme,
                         {'parameters': ['param4'], 'outputs': []})
Ejemplo n.º 6
0
 def test_post(self):
     data = {
         'name': 'New Command',
         'description': 'Command added for testing',
         'required_parameters': dumps(
             {'in_data': ['artifact:["FASTA"]', None]}),
         'optional_parameters': dumps({'param1': ['string', ''],
                                       'param2': ['float', '1.5'],
                                       'param3': ['boolean', 'True']}),
         'outputs': dumps({'out1': 'BIOM'}),
         'default_parameter_sets': dumps(
             {'dflt1': {'param1': 'test',
                        'param2': '2.4',
                        'param3': 'False'}})
         }
     obs = self.post('/qiita_db/plugins/QIIME/1.9.1/commands/', data=data,
                     headers=self.header)
     self.assertEqual(obs.code, 200)
     obs = _get_command('QIIME', '1.9.1', 'New Command')
     self.assertEqual(obs.name, 'New Command')