예제 #1
0
파일: test_cli.py 프로젝트: lukaszb/vcs
    def test_run_command(self):
        manager = ExecutionManager(stdout=io.StringIO(),
            stderr=io.StringIO())

        class Command(BaseCommand):

            def run_from_argv(self, argv):
                self.stdout.write(u'foo')
                self.stderr.write(u'bar')

        with mock.patch.object(manager, 'get_command_class') as m:
            m.return_value = Command
            manager.run_command('cmd', manager.argv)
            self.assertEqual(manager.stdout.getvalue(), u'foo')
            self.assertEqual(manager.stderr.getvalue(), u'bar')
예제 #2
0
파일: test_cli.py 프로젝트: lukaszb/vcs
 def test_execute_calls_run_command_if_argv_given(self):
     manager = ExecutionManager(argv=['vcs', 'show', '-h'])
     manager.run_command = mock.Mock()
     manager.execute()
     # we also check argv passed to the command
     manager.run_command.assert_called_once_with('show',
         ['vcs', 'show', '-h'])