fix validate_url test

pull/22766/head
chenguowei 9 months ago
parent b5251c1d63
commit 50fb68e245

@ -66,7 +66,7 @@ class TestArizeConfig:
def test_endpoint_validation_with_path(self):
"""Test endpoint validation normalizes URL by removing path"""
config = ArizeConfig(endpoint="https://custom.arize.com/api/v1")
assert config.endpoint == "https://custom.arize.com"
assert config.endpoint == "https://custom.arize.com/api/v1"
def test_endpoint_validation_invalid_scheme(self):
"""Test endpoint validation rejects invalid schemes"""
@ -104,7 +104,7 @@ class TestPhoenixConfig:
def test_endpoint_validation_with_path(self):
"""Test endpoint validation normalizes URL by removing path"""
config = PhoenixConfig(endpoint="https://custom.phoenix.com/api/v1")
assert config.endpoint == "https://custom.phoenix.com"
assert config.endpoint == "https://custom.phoenix.com/api/v1"
class TestLangfuseConfig:
@ -321,7 +321,7 @@ class TestAliyunConfig:
config = AliyunConfig(
license_key="test_license", endpoint="https://tracing-analysis-dc-hz.aliyuncs.com/api/v1/traces"
)
assert config.endpoint == "https://tracing-analysis-dc-hz.aliyuncs.com"
assert config.endpoint == "https://tracing-analysis-dc-hz.aliyuncs.com/api/v1/traces"
def test_endpoint_validation_invalid_scheme(self):
"""Test endpoint validation rejects invalid schemes"""
@ -366,9 +366,9 @@ class TestConfigIntegration:
license_key="test_license", endpoint="https://tracing-analysis-dc-hz.aliyuncs.com/api/v1/traces"
)
assert arize_config.endpoint == "https://arize.com"
assert phoenix_config.endpoint == "https://phoenix.com"
assert aliyun_config.endpoint == "https://tracing-analysis-dc-hz.aliyuncs.com"
assert arize_config.endpoint == "https://arize.com/api/v1/test"
assert phoenix_config.endpoint == "https://phoenix.com/api/v2/"
assert aliyun_config.endpoint == "https://tracing-analysis-dc-hz.aliyuncs.com/api/v1/traces"
def test_project_default_values(self):
"""Test that project default values are set correctly"""

@ -19,17 +19,17 @@ class TestValidateUrl:
def test_url_with_path_removed(self):
"""Test that URL path is removed during normalization"""
result = validate_url("https://example.com/api/v1/test", "https://default.com")
assert result == "https://example.com"
assert result == "https://example.com/api/v1/test"
def test_url_with_query_removed(self):
"""Test that URL query parameters are removed"""
result = validate_url("https://example.com?param=value", "https://default.com")
assert result == "https://example.com"
assert result == "https://example.com?param=value"
def test_url_with_fragment_removed(self):
"""Test that URL fragments are removed"""
result = validate_url("https://example.com#section", "https://default.com")
assert result == "https://example.com"
assert result == "https://example.com#section"
def test_empty_url_returns_default(self):
"""Test empty URL returns default"""

Loading…
Cancel
Save