test(security): cover hostless HTTP URLs

This commit is contained in:
Rishi Gupta committed 2026-10-21 22:25:00 +05:30
1 parent 6f4782affa
commit fad73d94d9
1 file changed
+10
+10
View File
@@ -54,6 +54,16 @@ def test_validate_url_rejects_empty_scheme():
with pytest.raises(ValueError):
validate_url("//no-scheme.example.com")
@pytest.mark.parametrize("url", [
"http://",
"https://",
"http:///etc/passwd",
"https:///example.com/path",
])
def test_validate_url_rejects_missing_hostname(url):
with pytest.raises(ValueError, match="without a hostname"):
validate_url(url)
# ---------------------------------------------------------------------------
# safe_fetch - scheme and redirect guards (mocked network)