Example #1
0
 def test_execute(self):
     command = BaseCommand()
     command.handle = mock.Mock()
     args = ['bar']
     kwargs = {'debug': True}
     command.execute(*args, **kwargs)
     command.handle.assert_called_once_with(*args, **kwargs)
Example #2
0
 def test_execute(self):
     command = BaseCommand()
     command.handle = mock.Mock()
     args = ['bar']
     kwargs = {'debug': True}
     command.execute(*args, **kwargs)
     command.handle.assert_called_once_with(*args, **kwargs)
Example #3
0
 def test_run_from_argv(self):
     command = BaseCommand()
     argv = ['vcs', 'foo', '--debug', 'bar', '--traceback']
     command.handle = mock.Mock()
     command.run_from_argv(argv)
     args = ['bar']
     kwargs = {'debug': True, 'traceback': True}
     command.handle.assert_called_once_with(*args, **kwargs)
Example #4
0
 def test_run_from_argv(self):
     command = BaseCommand()
     argv = ['vcs', 'foo', '--debug', 'bar', '--traceback']
     command.handle = mock.Mock()
     command.run_from_argv(argv)
     args = ['bar']
     kwargs = {'debug': True, 'traceback': True}
     command.handle.assert_called_once_with(*args, **kwargs)
Example #5
0
 def test_usage(self):
     command = BaseCommand()
     command.args = 'foo'
     self.assertEqual(command.usage('bar'),
         '%prog bar [options] foo')
Example #6
0
 def test_get_version(self):
     command = BaseCommand()
     self.assertEqual(command.get_version(), vcs.get_version())
Example #7
0
 def test_usage(self):
     command = BaseCommand()
     command.args = 'foo'
     self.assertEqual(command.usage('bar'), '%prog bar [options] foo')
Example #8
0
 def test_get_version(self):
     command = BaseCommand()
     self.assertEqual(command.get_version(), vcs.get_version())
Example #9
0
 def test_default_stderr(self):
     stream = StringIO()
     with mock.patch.object(sys, 'stderr', stream):
         command = BaseCommand()
         command.stderr.write(u'foobar')
         self.assertEqual(sys.stderr.getvalue(), u'foobar')