def test_run_help_should_give_run_help(self): with mock.patch('sys.stdout', new=io.StringIO()) as fake_out: with self.assertRaises(SystemExit): manage() self.assertIn( 'Run the HTTP server as configured to handle requests', fake_out.getvalue())
#!/usr/bin/env python from skill_sdk.manage import manage manage()
def test_test(self, exit_mock, test_mock, report_mock, cov_mock): manage() test_mock.assert_called_once() report_mock.assert_called_once() cov_mock.assert_called_once()
def test_run_with_t(self, main_mock): manage() main_mock.assert_called_with(local=False, dev=True, cache=True)
def test_run_with_l_removed(self, main_mock): """ Make sure "--local" param is stripped from arguments list before being passed to Gunicorn """ manage() import sys self.assertNotIn('--local', sys.argv)
def test_run_should_run_runner(self, main_mock): manage() main_mock.assert_called_with(dev=False, local=False, cache=True)
def test_help_should_give_help(self): with mock.patch('sys.stdout', new=io.StringIO()) as fake_out: with self.assertRaises(SystemExit): manage() self.assertIn('usage: manage.py', fake_out.getvalue())
def test_manage_translate(self, *args): with patch('sys.exit') as exit_mock: manage() exit_mock.assert_called_once_with('ok')
def test_version(self): with mock.patch('sys.stdout', new=io.StringIO()) as fake_out: manage() self.assertIn('1', fake_out.getvalue()) self.assertNotIn(' ', fake_out.getvalue())