示例#1
0
 def test_get_cli_args_with_command_type9(self):
     sys.argv = ['grease', 'help', 'install', 'to-do-stuff']
     rtr = GreaseRouter()
     cmd, context = rtr.get_arguments()
     self.assertTrue(isinstance(cmd, help))
     self.assertDictEqual(context,
                          {'grease_other_args': ['install', 'to-do-stuff']})
示例#2
0
 def test_get_cli_args_without_command(self):
     sys.argv = ['grease', '--text=utf-8', '--opt', 'var', '--ver:var']
     rtr = GreaseRouter()
     cmd, context = rtr.get_arguments()
     self.assertIsNone(cmd)
     self.assertDictEqual(context, {
         'opt': 'var',
         'text': 'utf-8',
         'ver': 'var',
         'grease_other_args': []
     })
示例#3
0
 def test_get_cli_args_with_command_type4(self):
     sys.argv = [
         'grease', '--text=utf-8', '--opt', 'var', 'help', '--ver:var'
     ]
     rtr = GreaseRouter()
     cmd, context = rtr.get_arguments()
     self.assertTrue(isinstance(cmd, help))
     self.assertDictEqual(context, {
         'opt': 'var',
         'text': 'utf-8',
         'ver': 'var',
         'grease_other_args': []
     })
示例#4
0
 def test_get_cli_args_with_command_type13(self):
     sys.argv = [
         'grease', '--foreground', 'help', '--test=var', '--test1:var1',
         '--test2', 'var2'
     ]
     rtr = GreaseRouter()
     cmd, context = rtr.get_arguments()
     self.assertTrue(isinstance(cmd, help))
     self.assertTrue(
         context, {
             'foreground': True,
             'test': 'var',
             'test1': 'var1',
             'test2': 'var2',
             'grease_other_args': []
         })
示例#5
0
 def test_no_SubCommand(self):
     sys.argv = ['grease']
     cmd = GreaseRouter()
     self.assertEqual(cmd.run(), 1)