@@ -195,13 +195,8 @@ def test_serve_default_options(cli_runner):
195
195
# Use patches for run_servers and logging setup
196
196
with (
197
197
patch ("src.codegate.cli.run_servers" ) as mock_run ,
198
- patch ("src.codegate.cli.OriginLogger" ) as mock_origin_logger ,
199
198
patch ("src.codegate.cli.setup_logging" ) as mock_setup_logging ,
200
199
):
201
-
202
- logger_instance = MagicMock ()
203
- mock_origin_logger .return_value = logger_instance
204
-
205
200
# Invoke the CLI command
206
201
result = cli_runner .invoke (cli , ["serve" ])
207
202
@@ -211,9 +206,6 @@ def test_serve_default_options(cli_runner):
211
206
# Check if the logging setup was called with expected defaults
212
207
mock_setup_logging .assert_called_once_with (LogLevel .INFO , LogFormat .JSON )
213
208
214
- # Check if logging was done correctly
215
- mock_origin_logger .assert_called_with ("cli" )
216
-
217
209
# Validate run_servers was called once
218
210
mock_run .assert_called_once ()
219
211
@@ -222,13 +214,8 @@ def test_serve_custom_options(cli_runner):
222
214
"""Test serve command with custom options."""
223
215
with (
224
216
patch ("src.codegate.cli.run_servers" ) as mock_run ,
225
- patch ("src.codegate.cli.OriginLogger" ) as mock_origin_logger ,
226
217
patch ("src.codegate.cli.setup_logging" ) as mock_setup_logging ,
227
218
):
228
-
229
- logger_instance = MagicMock ()
230
- mock_origin_logger .return_value = logger_instance
231
-
232
219
# Invoke the CLI command with custom options
233
220
result = cli_runner .invoke (
234
221
cli ,
@@ -261,9 +248,6 @@ def test_serve_custom_options(cli_runner):
261
248
# Assert logging setup was called with the provided log level and format
262
249
mock_setup_logging .assert_called_once_with (LogLevel .DEBUG , LogFormat .TEXT )
263
250
264
- # Assert logger got called with the expected module name
265
- mock_origin_logger .assert_called_with ("cli" )
266
-
267
251
# Validate run_servers was called once
268
252
mock_run .assert_called_once ()
269
253
# Retrieve the actual Config object passed to run_servers
@@ -322,20 +306,14 @@ def test_serve_with_config_file(cli_runner, temp_config_file):
322
306
"""Test serve command with config file."""
323
307
with (
324
308
patch ("src.codegate.cli.run_servers" ) as mock_run ,
325
- patch ("src.codegate.cli.OriginLogger" ) as mock_origin_logger ,
326
309
patch ("src.codegate.cli.setup_logging" ) as mock_setup_logging ,
327
310
):
328
-
329
- logger_instance = MagicMock ()
330
- mock_origin_logger .return_value = logger_instance
331
-
332
311
# Invoke the CLI command with the configuration file
333
312
result = cli_runner .invoke (cli , ["serve" , "--config" , str (temp_config_file )])
334
313
335
314
# Assertions to ensure the CLI ran successfully
336
315
assert result .exit_code == 0
337
316
mock_setup_logging .assert_called_once_with (LogLevel .DEBUG , LogFormat .JSON )
338
- mock_origin_logger .assert_called_with ("cli" )
339
317
340
318
# Validate that run_servers was called with the expected configuration
341
319
mock_run .assert_called_once ()
@@ -370,13 +348,8 @@ def test_serve_priority_resolution(cli_runner: CliRunner, temp_config_file: Path
370
348
with (
371
349
patch .dict (os .environ , {"LOG_LEVEL" : "INFO" , "PORT" : "9999" }, clear = True ),
372
350
patch ("src.codegate.cli.run_servers" ) as mock_run ,
373
- patch ("src.codegate.cli.OriginLogger" ) as mock_origin_logger ,
374
351
patch ("src.codegate.cli.setup_logging" ) as mock_setup_logging ,
375
352
):
376
- # Set up mock logger
377
- logger_instance = MagicMock ()
378
- mock_origin_logger .return_value = logger_instance
379
-
380
353
# Execute CLI command with specific options overriding environment and config file settings
381
354
result = cli_runner .invoke (
382
355
cli ,
@@ -410,7 +383,6 @@ def test_serve_priority_resolution(cli_runner: CliRunner, temp_config_file: Path
410
383
411
384
# Ensure logging setup was called with the highest priority settings (CLI arguments)
412
385
mock_setup_logging .assert_called_once_with ("ERROR" , "TEXT" )
413
- mock_origin_logger .assert_called_with ("cli" )
414
386
415
387
# Verify that the run_servers was called with the overridden settings
416
388
config_arg = mock_run .call_args [0 ][0 ] # Assuming Config is the first positional arg
@@ -438,13 +410,8 @@ def test_serve_certificate_options(cli_runner: CliRunner) -> None:
438
410
"""Test serve command with certificate options."""
439
411
with (
440
412
patch ("src.codegate.cli.run_servers" ) as mock_run ,
441
- patch ("src.codegate.cli.OriginLogger" ) as mock_origin_logger ,
442
413
patch ("src.codegate.cli.setup_logging" ) as mock_setup_logging ,
443
414
):
444
- # Set up mock logger
445
- logger_instance = MagicMock ()
446
- mock_origin_logger .return_value = logger_instance
447
-
448
415
# Execute CLI command with certificate options
449
416
result = cli_runner .invoke (
450
417
cli ,
@@ -468,7 +435,6 @@ def test_serve_certificate_options(cli_runner: CliRunner) -> None:
468
435
469
436
# Ensure logging setup was called with expected arguments
470
437
mock_setup_logging .assert_called_once_with ("INFO" , "JSON" )
471
- mock_origin_logger .assert_called_with ("cli" )
472
438
473
439
# Verify that run_servers was called with the provided certificate options
474
440
config_arg = mock_run .call_args [0 ][0 ] # Assuming Config is the first positional arg
0 commit comments