mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 19:59:50 +08:00
b035c02f78
Some checks are pending
Build and Push API & Web / build (api, DIFY_API_IMAGE_NAME, linux/amd64, build-api-amd64) (push) Waiting to run
Build and Push API & Web / build (api, DIFY_API_IMAGE_NAME, linux/arm64, build-api-arm64) (push) Waiting to run
Build and Push API & Web / build (web, DIFY_WEB_IMAGE_NAME, linux/amd64, build-web-amd64) (push) Waiting to run
Build and Push API & Web / build (web, DIFY_WEB_IMAGE_NAME, linux/arm64, build-web-arm64) (push) Waiting to run
Build and Push API & Web / create-manifest (api, DIFY_API_IMAGE_NAME, merge-api-images) (push) Blocked by required conditions
Build and Push API & Web / create-manifest (web, DIFY_WEB_IMAGE_NAME, merge-web-images) (push) Blocked by required conditions
Co-authored-by: -LAN- <laipz8200@outlook.com>
24 lines
941 B
Python
24 lines
941 B
Python
import pytest
|
|
from yarl import URL
|
|
|
|
|
|
def test_yarl_urls():
|
|
expected_1 = "https://dify.ai/api"
|
|
assert str(URL("https://dify.ai") / "api") == expected_1
|
|
assert str(URL("https://dify.ai/") / "api") == expected_1
|
|
|
|
expected_2 = "http://dify.ai:12345/api"
|
|
assert str(URL("http://dify.ai:12345") / "api") == expected_2
|
|
assert str(URL("http://dify.ai:12345/") / "api") == expected_2
|
|
|
|
expected_3 = "https://dify.ai/api/v1"
|
|
assert str(URL("https://dify.ai") / "api" / "v1") == expected_3
|
|
assert str(URL("https://dify.ai") / "api/v1") == expected_3
|
|
assert str(URL("https://dify.ai/") / "api/v1") == expected_3
|
|
assert str(URL("https://dify.ai/api") / "v1") == expected_3
|
|
assert str(URL("https://dify.ai/api/") / "v1") == expected_3
|
|
|
|
with pytest.raises(ValueError) as e1:
|
|
str(URL("https://dify.ai") / "/api")
|
|
assert str(e1.value) == "Appending path '/api' starting from slash is forbidden"
|