Skip to content

Commit b1a3218

Browse files
committed
add unit test for test_utils
1 parent 664e070 commit b1a3218

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,34 @@
9999
True,
100100
"https://example.com/home/user/file%20%0A",
101101
),
102+
# No path component
103+
("http://example.com", False, "http://example.com"),
104+
("http://example.com", True, "https://example.com"),
105+
# Root path only
106+
("http://example.com/", False, "http://example.com/"),
107+
("http://example.com/", True, "https://example.com/"),
108+
# Scheme downgrade (https input, enable_https=False)
109+
(
110+
"https://example.com/usr/local/bin",
111+
False,
112+
"http://example.com/usr/local/bin",
113+
),
114+
(
115+
"https://example.com/usr/local/bin",
116+
True,
117+
"https://example.com/usr/local/bin",
118+
),
119+
# Netloc with port
120+
(
121+
"http://example.com:8080/data/file.bin",
122+
False,
123+
"http://example.com:8080/data/file.bin",
124+
),
125+
(
126+
"http://example.com:8080/data/file.bin",
127+
True,
128+
"https://example.com:8080/data/file.bin",
129+
),
102130
),
103131
)
104132
def test_process_raw_url(_input: str, _enable_https: bool, _expected: str):

0 commit comments

Comments
 (0)