Files
vm-cloudflare/tests/test_mcp_cloudflare_safe_ingress.py
Vault Sovereign f0b8d962de
Some checks failed
WAF Intelligence Guardrail / waf-intel (push) Waiting to run
Cloudflare Registry Validation / validate-registry (push) Has been cancelled
chore: pre-migration snapshot
Layer0, MCP servers, Terraform consolidation
2025-12-27 01:52:27 +00:00

23 lines
681 B
Python

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"},
]