Ejemplo n.º 1
0
 def test_parse_cli_exits_with_good_flag_bad_param(self):
     args = ['-g', 'bad_param=bad_val']
     parser = CLIParser(args, check_assertions=True)
     parser.add_flag('-g', None) # add g to the parser as a valid command line flag
     with self.assertRaises(SystemExit) as sys_exit:
         parser.parse_cli()
     self.assertEqual(sys_exit.exception.code, 1)
Ejemplo n.º 2
0
 def test_parse_cli_multiple_good_flags(self):
     args = ['sdir=.', 'tdir=test', '-g', '-u', '-v'] # currently -g, -t, -v have no real functionality. if these flags are added as actual functional flags, this test should be updated
     parser = CLIParser(args, check_assertions=True)
     parser.add_flag('-g', None)
     parser.add_flag('-u', None)
     parser.add_flag('-v', None)
     parser.parse_cli()
     flag_oracle = {'-g': True, '-g': True, '-u': True, '-v': True, '-h': False}
     for key in flag_oracle:
         self.assertEqual(parser.get_flag(key).get_value(), flag_oracle[key])
Ejemplo n.º 3
0
 def test_parse_cli_one_good_flag(self):
     args = ['sdir=.', 'tdir=test', '-g']
     parser = CLIParser(args, check_assertions=True)
     parser.add_flag('-g', None)
     parser.parse_cli()
     param_oracle = {'sdir': '.', 'tdir': 'test', 'lang': Languages.PYTHON, 'framework': Frameworks.UNITTEST}
     flag_oracle = {'-h': False, '-g': True, '-s': False, '-t': False}
     for key in param_oracle:
         self.assertEqual(parser.get_parameter(key).get_value(), param_oracle[key])
     for key in flag_oracle:
         self.assertEqual(parser.get_flag(key).get_value(), flag_oracle[key])