Test successful configuration initialization.
(tmp_path)
| 17 | |
| 18 | @pytest.mark.asyncio |
| 19 | async def test_initialize_config_success(tmp_path): |
| 20 | """Test successful configuration initialization.""" |
| 21 | # Create a temporary config file with valid JSON |
| 22 | config_data = { |
| 23 | "mcpServers": { |
| 24 | "TestServer": { |
| 25 | "command": "dummy_command", |
| 26 | "args": ["--dummy"], |
| 27 | "env": {"VAR": "value"}, |
| 28 | } |
| 29 | } |
| 30 | } |
| 31 | config_file = tmp_path / "config.json" |
| 32 | config_file.write_text(json.dumps(config_data)) |
| 33 | |
| 34 | # Reset the singleton first |
| 35 | ConfigManager._instance = None |
| 36 | |
| 37 | # Initialize config with the test file |
| 38 | config = initialize_config(config_file) |
| 39 | |
| 40 | # Verify the config was loaded |
| 41 | assert config is not None |
| 42 | assert "TestServer" in config.servers |
| 43 | server_config = config.servers["TestServer"] |
| 44 | assert server_config.command == "dummy_command" |
| 45 | assert server_config.args == ["--dummy"] |
| 46 | # env should contain VAR and PATH (inherited from environment) |
| 47 | assert "VAR" in server_config.env |
| 48 | assert server_config.env["VAR"] == "value" |
| 49 | assert "PATH" in server_config.env # PATH is auto-inherited |
| 50 | |
| 51 | |
| 52 | @pytest.mark.asyncio |
nothing calls this directly
no test coverage detected