MCPcopy Create free account
hub / github.com/CJackHwang/AIstudioProxyAPI / test_should_intercept

Function test_should_intercept

tests/api_utils/test_stream.py:17–33  ·  view source on GitHub ↗

Test domain interception matching (exact, wildcard, and non-matching cases).

(proxy_server)

Source from the content-addressed store, hash-verified

15
16
17def test_should_intercept(proxy_server):
18 """Test domain interception matching (exact, wildcard, and non-matching cases)."""
19 # Exact match
20 assert proxy_server.should_intercept("api.test.com") is True
21
22 # Wildcard match
23 assert proxy_server.should_intercept("sub.example.com") is True
24 assert proxy_server.should_intercept("deep.sub.example.com") is True
25
26 # No match
27 assert proxy_server.should_intercept("other.com") is False
28 assert proxy_server.should_intercept("example.org") is False
29
30 # Edge case: wildcard logic check
31 # "*.example.com" -> suffix ".example.com"
32 # "example.com" does not end with ".example.com"
33 assert proxy_server.should_intercept("example.com") is False
34
35
36@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 1

should_interceptMethod · 0.45

Tested by

no test coverage detected