Exemplo n.º 1
0
 def test_command_with_difficult_params(self):
     program = CommandLine()
     program.parse_command_line('add "param_param_123_1"')
     state = program.get_state()
     self.assertEqual(state['state'], 'command with params')
     self.assertEqual(state['command'], 'add')
     self.assertEqual(state['command_params'], 'param_param_123_1')
Exemplo n.º 2
0
 def test_command_with_params(self):
     program = CommandLine()
     program.parse_command_line('add param')
     state = program.get_state()
     self.assertEqual(state['state'], 'command with params')
     self.assertEqual(state['command'], 'add')
     self.assertEqual(state['command_params'], 'param')
Exemplo n.º 3
0
 def test_command_with_params_and_key_optional_params_without_params(self):
     program = CommandLine()
     program.parse_command_line('add param -n')
     state = program.get_state()
     self.assertEqual(state['state'], 'command with params and key')
     self.assertEqual(state['command'], 'add')
     self.assertEqual(state['command_params'], 'param')
     self.assertEqual(state['key'], '-n')
Exemplo n.º 4
0
 def test_command_with_params_and_key_with_difficult_params(self):
     program = CommandLine()
     program.parse_command_line('add param -a "key_param_123_1"')
     state = program.get_state()
     self.assertEqual(state['state'], 'command with params and key with params')
     self.assertEqual(state['command'], 'add')
     self.assertEqual(state['command_params'], 'param')
     self.assertEqual(state['key'], '-a')
     self.assertEqual(state['key_params'], 'key_param_123_1')
Exemplo n.º 5
0
 def test_empty(self):
     program = CommandLine()
     program.parse_command_line('')
     state = program.get_state()
     self.assertEqual(state['state'], 'empty state')
Exemplo n.º 6
0
 def test_command(self):
     program = CommandLine()
     program.parse_command_line('add')
     state = program.get_state()
     self.assertEqual(state['state'], 'command')
     self.assertEqual(state['command'], 'add')