Beispiel #1
0
 def test_parse_cli_exits_with_good_param_bad_flag(self):
     args = ['good_param=good_value', '-w']
     parser = CLIParser(args, check_assertions=True)
     parser.add_param('good_param', {'good_val'}) # add good_param to the parser as a valid command line flag with "good_val" as a valid value
     with self.assertRaises(SystemExit) as sys_exit:
         parser.parse_cli()
     self.assertEqual(sys_exit.exception.code, 1)
Beispiel #2
0
 def test_parse_cli_good_params(self):
     args = ['sdir=.', 'tdir=test', 'good_param=good_val2']
     parser = CLIParser(args, check_assertions=True)
     parser.add_param('good_param', {'good_val1', 'good_val2'})
     parser.parse_cli()
     oracle = {'sdir': '.', 'tdir': 'test', 'lang': Languages.PYTHON, 'framework': Frameworks.UNITTEST, 'good_param': 'good_val2'}
     for key in oracle:
         self.assertEqual(parser.get_parameter(key).get_value(), oracle[key])
Beispiel #3
0
 def test_parse_cli_multiple_good_params(self):
     args = ['sdir=.', 'tdir=test', 'good_param1=val1', 'good_param2=val3']
     parser = CLIParser(args, check_assertions=True)
     parser.add_param('good_param1', {'val1', 'val2'})
     parser.add_param('good_param2', {'val3', 'val4'})
     parser.parse_cli()
     param_oracle = {'sdir': '.', 'tdir': 'test', 'lang': Languages.PYTHON, 'good_param1': 'val1', 'good_param2': 'val3'}
     for key in param_oracle:
         self.assertEqual(parser.get_parameter(key).get_value(), param_oracle[key])