コード例 #1
0
ファイル: test_commands.py プロジェクト: iter8ve/handroll
 def test_register_returns_parser(self):
     subparsers = mock.Mock()
     expected_parser = mock.Mock()
     subparsers.add_parser.return_value = expected_parser
     command = Command()
     parser = command.register(subparsers)
     self.assertEqual(expected_parser, parser)
コード例 #2
0
 def test_register_command_attributes(self):
     subparsers = mock.Mock()
     command = Command()
     command.register(subparsers)
     subparsers.add_parser.assert_called_once_with(
         'command', description='the command description',
         help='the command help')
コード例 #3
0
 def test_register_returns_parser(self):
     subparsers = mock.Mock()
     expected_parser = mock.Mock()
     subparsers.add_parser.return_value = expected_parser
     command = Command()
     parser = command.register(subparsers)
     self.assertEqual(expected_parser, parser)
コード例 #4
0
ファイル: test_commands.py プロジェクト: iter8ve/handroll
 def test_register_command_attributes(self):
     subparsers = mock.Mock()
     command = Command()
     command.register(subparsers)
     subparsers.add_parser.assert_called_once_with(
         'command',
         description='the command description',
         help='the command help')
コード例 #5
0
ファイル: test_commands.py プロジェクト: iter8ve/handroll
 def test_run_not_implemented(self):
     args = mock.Mock()
     command = Command()
     with self.assertRaises(NotImplementedError):
         command.run(args)
コード例 #6
0
ファイル: test_commands.py プロジェクト: iter8ve/handroll
 def test_register_run_as_func(self):
     subparsers = mock.Mock()
     command = Command()
     parser = command.register(subparsers)
     parser.set_defaults.assert_called_once_with(func=command.run)
コード例 #7
0
 def test_run_not_implemented(self):
     args = mock.Mock()
     command = Command()
     with self.assertRaises(NotImplementedError):
         command.run(args)
コード例 #8
0
 def test_register_run_as_func(self):
     subparsers = mock.Mock()
     command = Command()
     parser = command.register(subparsers)
     parser.set_defaults.assert_called_once_with(func=command.run)