44
55import argparse
66import json
7+ import logging
78import os
89import sys
910from io import StringIO
@@ -24,7 +25,7 @@ def test_cli_config_has_correct_default_values() -> None:
2425
2526 assert config .host == "0.0.0.0" # noqa: S104
2627 assert config .port == 5000
27- assert config .log_level == 20
28+ assert config .log_level == logging . INFO
2829 assert config .lambda_endpoint == "http://127.0.0.1:3001"
2930 assert config .local_runner_endpoint == "http://0.0.0.0:5000"
3031 assert config .local_runner_region == "us-west-2"
@@ -38,7 +39,7 @@ def test_cli_config_from_environment_uses_defaults_when_no_env_vars() -> None:
3839
3940 assert config .host == "0.0.0.0" # noqa: S104
4041 assert config .port == 5000
41- assert config .log_level == 20
42+ assert config .log_level == logging . INFO
4243 assert config .lambda_endpoint == "http://127.0.0.1:3001"
4344 assert config .local_runner_endpoint == "http://0.0.0.0:5000"
4445 assert config .local_runner_region == "us-west-2"
@@ -50,7 +51,7 @@ def test_cli_config_from_environment_uses_all_env_vars_when_set() -> None:
5051 env_vars = {
5152 "AWS_DEX_HOST" : "127.0.0.1" ,
5253 "AWS_DEX_PORT" : "8080" ,
53- "AWS_DEX_LOG_LEVEL" : "10 " ,
54+ "AWS_DEX_LOG_LEVEL" : "DEBUG " ,
5455 "AWS_DEX_LAMBDA_ENDPOINT" : "http://localhost:4000" ,
5556 "AWS_DEX_LOCAL_RUNNER_ENDPOINT" : "http://localhost:8080" ,
5657 "AWS_DEX_LOCAL_RUNNER_REGION" : "us-east-1" ,
@@ -62,7 +63,7 @@ def test_cli_config_from_environment_uses_all_env_vars_when_set() -> None:
6263
6364 assert config .host == "127.0.0.1"
6465 assert config .port == 8080
65- assert config .log_level == 10
66+ assert config .log_level == logging . DEBUG
6667 assert config .lambda_endpoint == "http://localhost:4000"
6768 assert config .local_runner_endpoint == "http://localhost:8080"
6869 assert config .local_runner_region == "us-east-1"
@@ -82,7 +83,7 @@ def test_cli_config_from_environment_uses_partial_env_vars_with_defaults() -> No
8283 assert config .host == "192.168.1.1"
8384 assert config .port == 9000
8485 # Other values should be defaults
85- assert config .log_level == 20
86+ assert config .log_level == logging . INFO
8687 assert config .lambda_endpoint == "http://127.0.0.1:3001"
8788
8889
@@ -173,7 +174,7 @@ def test_start_server_command_parses_arguments_correctly() -> None:
173174 "--port" ,
174175 "8080" ,
175176 "--log-level" ,
176- "10 " ,
177+ "DEBUG " ,
177178 "--lambda-endpoint" ,
178179 "http://localhost:4000" ,
179180 "--local-runner-endpoint" ,
@@ -303,7 +304,7 @@ def test_logging_configuration_uses_specified_log_level() -> None:
303304 with patch ("logging.basicConfig" ) as mock_basic_config :
304305 with patch ("sys.stdout" , new_callable = StringIO ):
305306 with patch .object (app , "start_server_command" , return_value = 0 ):
306- app .run (["start-server" , "--log-level" , "10 " ])
307+ app .run (["start-server" , "--log-level" , "DEBUG " ])
307308
308309 mock_basic_config .assert_called_once ()
309310 call_args = mock_basic_config .call_args
@@ -348,7 +349,7 @@ def test_start_server_command_works_with_mocked_dependencies() -> None:
348349 "--port" ,
349350 "8080" ,
350351 "--log-level" ,
351- "10 " ,
352+ "DEBUG " ,
352353 ]
353354 )
354355
@@ -359,7 +360,7 @@ def test_start_server_command_works_with_mocked_dependencies() -> None:
359360 call_args = mock_web_runner .call_args [0 ][0 ] # First positional argument
360361 assert call_args .web_service .host == "127.0.0.1"
361362 assert call_args .web_service .port == 8080
362- assert call_args .web_service .log_level == 10
363+ assert call_args .web_service .log_level == "DEBUG"
363364
364365
365366def test_start_server_command_handles_server_startup_errors () -> None :
@@ -398,7 +399,7 @@ def test_start_server_command_creates_correct_web_runner_config() -> None:
398399 "--port" ,
399400 "9000" ,
400401 "--log-level" ,
401- "30 " ,
402+ "WARNING " ,
402403 "--lambda-endpoint" ,
403404 "http://custom-lambda:4000" ,
404405 "--local-runner-endpoint" ,
@@ -419,7 +420,7 @@ def test_start_server_command_creates_correct_web_runner_config() -> None:
419420 # Verify web service configuration
420421 assert config .web_service .host == "192.168.1.100"
421422 assert config .web_service .port == 9000
422- assert config .web_service .log_level == 30
423+ assert config .web_service .log_level == "WARNING"
423424
424425 # Verify Lambda service configuration
425426 assert config .lambda_endpoint == "http://custom-lambda:4000"
0 commit comments