def test_raise_ambiguity_error_two_visible_argument(self): parser = shell.CinderClientArgumentParser(add_help=False) parser.add_argument('--test-parameter', dest="visible_param1", action='store_true') parser.add_argument('--test_parameter', dest="visible_param2", action='store_true') self.assertRaises(SystemExit, parser.parse_args, ['--test'])
def test_ambiguity_solved_for_one_visible_argument(self): parser = shell.CinderClientArgumentParser(add_help=False) parser.add_argument('--test-parameter', dest='visible_param', action='store_true') parser.add_argument('--test_parameter', dest='hidden_param', action='store_true', help=argparse.SUPPRESS) opts = parser.parse_args(['--test']) # visible argument must be set self.assertTrue(opts.visible_param) self.assertFalse(opts.hidden_param)