def test_run_server_config(self, load_config, setup_logging, config, server): config.return_value = Mock(logfile_path="path") argv = ["--config", "/path/to/config"] run_server(argv=argv) load_config.assert_called_once_with("/path/to/config", {}) setup_logging.assert_called_once_with(False, False, False, "path") server.assert_called_once()
def test_run_server_debug(self, load_config, setup_logging, config, server): config.return_value = Mock(logfile_path="path") argv = ["--debug"] run_server(argv=argv) load_config.assert_called_once_with(None, {}) setup_logging.assert_called_once_with(False, False, True, "path") server.assert_called_once()
def test_run_server_override_single(self, load_config, setup_logging, config, server): config.return_value = Mock(logfile_path="path") argv = ["--override", "one:ONE"] run_server(argv=argv) load_config.assert_called_once_with(None, {"one": "ONE"}) setup_logging.assert_called_once_with(False, False, False, "path") server.assert_called_once()
def test_run_server_override_multiple(self, load_config, setup_logging, config, server): config.return_value = Mock(logfile_path="path") argv = [ "--override", "one:ONE", "--logfile", "/path/to/log", "--override", "two:TWO" ] run_server(argv=argv) load_config.assert_called_once_with(None, { "one": "ONE", "two": "TWO", "logfile_path": "/path/to/log" }) setup_logging.assert_called_once_with(False, False, False, "path") server.assert_called_once()
def test_run_server_help(self, _load_config, _setup_logging, config, _server): config.return_value = Mock(logfile_path="path") argv = ["--help"] with pytest.raises(SystemExit): run_server(argv=argv)