"""Tests for configuration module.""" import os from network_mcp.config import get_default_community, get_snmp_timeout def test_default_community_from_env(monkeypatch): monkeypatch.setenv("SNMP_COMMUNITY", "my_secret") assert get_default_community() == "my_secret" def test_default_community_fallback(monkeypatch): monkeypatch.delenv("SNMP_COMMUNITY", raising=False) # Without config file, should return "public" monkeypatch.setenv("NETWORK_MCP_CONFIG_DIR", "/tmp/nonexistent-mcp-test") assert get_default_community() == "public" def test_snmp_timeout_from_env(monkeypatch): monkeypatch.setenv("SNMP_TIMEOUT", "10.0") assert get_snmp_timeout() == 10.0 def test_snmp_timeout_default(monkeypatch): monkeypatch.delenv("SNMP_TIMEOUT", raising=False) assert get_snmp_timeout() == 5.0