MCPcopy Create free account
hub / github.com/CJackHwang/AIstudioProxyAPI / test_setup_logging

Function test_setup_logging

tests/api_utils/test_app.py:221–241  ·  view source on GitHub ↗

Test _setup_logging helper.

()

Source from the content-addressed store, hash-verified

219
220
221def test_setup_logging():
222 """Test _setup_logging helper."""
223 # Ensure state starts clean
224 state.log_ws_manager = None
225
226 with (
227 patch("api_utils.app.get_environment_variable") as mock_get_env,
228 patch("api_utils.app.setup_server_logging") as mock_setup,
229 ):
230 mock_get_env.side_effect = lambda key, default=None: {
231 "SERVER_LOG_LEVEL": "DEBUG",
232 "SERVER_REDIRECT_PRINT": "true",
233 }.get(key, default)
234
235 _setup_logging()
236
237 assert state.log_ws_manager is not None
238 mock_setup.assert_called_once()
239 args, kwargs = mock_setup.call_args
240 assert kwargs["log_level_name"] == "DEBUG"
241 assert kwargs["redirect_print_str"] == "true"
242
243
244def test_initialize_globals():

Callers

nothing calls this directly

Calls 2

_setup_loggingFunction · 0.90
getMethod · 0.45

Tested by

no test coverage detected