from mcp.cloudflare_safe.cloudflare_api import parse_cloudflared_config_ingress def test_parse_cloudflared_config_ingress_extracts_hostnames_and_services(): sample = """\ tunnel: 00000000-0000-0000-0000-000000000000 credentials-file: /etc/cloudflared/0000.json ingress: - hostname: "api.example.com" service: http://127.0.0.1:8080 - hostname: app.example.com service: "http://127.0.0.1:3000" - service: http_status:404 """ rules = parse_cloudflared_config_ingress(sample) assert rules == [ {"hostname": "api.example.com", "service": "http://127.0.0.1:8080"}, {"hostname": "app.example.com", "service": "http://127.0.0.1:3000"}, ]