Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 5
0
 def test_usage(self):
     command = BaseCommand()
     command.args = 'foo'
     self.assertEqual(command.usage('bar'),
         '%prog bar [options] foo')
Esempio n. 6
0
 def test_get_version(self):
     command = BaseCommand()
     self.assertEqual(command.get_version(), vcs.get_version())
Esempio n. 7
0
 def test_usage(self):
     command = BaseCommand()
     command.args = 'foo'
     self.assertEqual(command.usage('bar'), '%prog bar [options] foo')
Esempio n. 8
0
 def test_get_version(self):
     command = BaseCommand()
     self.assertEqual(command.get_version(), vcs.get_version())
Esempio n. 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')