Test _setup_logging helper.
()
| 219 | |
| 220 | |
| 221 | def 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 | |
| 244 | def test_initialize_globals(): |
nothing calls this directly
no test coverage detected