mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-12 20:15:26 +00:00
rabbit fixes
This commit is contained in:
1 parent
cdbc4695ea
commit
f4331cd3a3
31 files changed
+470
-87
No files matched your search
@@ -259,3 +259,22 @@ class TestValidateUrlExtended:
|
||||
def test_allows_localhost_ip_with_flag(self):
|
||||
result = validate_url("http://10.0.0.1", allow_localhost=True)
|
||||
assert result == "http://10.0.0.1"
|
||||
|
||||
|
||||
class TestValidateUrlMalformed:
|
||||
"""A URL ``urlparse`` cannot parse fails validation instead of escaping."""
|
||||
|
||||
def test_unclosed_ipv6_bracket_raises_ssrf_error(self):
|
||||
with pytest.raises(SSRFError) as exc_info:
|
||||
validate_url("http://[bad")
|
||||
assert "invalid url" in str(exc_info.value).lower()
|
||||
|
||||
def test_unclosed_ipv6_bracket_without_scheme_raises_ssrf_error(self):
|
||||
with pytest.raises(SSRFError):
|
||||
validate_url("[bad")
|
||||
|
||||
def test_safe_variant_reports_failure(self):
|
||||
is_valid, url, error = validate_url_safe("http://[bad")
|
||||
assert is_valid is False
|
||||
assert url == "http://[bad"
|
||||
assert error
|
||||
Reference in new issue
Block a user