Skip to content

Commit d5dc3ee

Browse files
committed
add sanitization test
1 parent 22e81e5 commit d5dc3ee

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/utils/test_sanitize.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import pytest
2+
3+
from src.utils.sanitize import sanitize_url
4+
5+
6+
@pytest.mark.parametrize(
7+
("url", "expected"),
8+
[
9+
(None, None),
10+
("", ""),
11+
("https://example.com/data.tar.bz2", "https://example.com/data.tar.bz2"),
12+
("https://user@example.com/data.tar.bz2", "https://***@example.com/data.tar.bz2"),
13+
("https://user:secret@example.com/data.tar.bz2", "https://***@example.com/data.tar.bz2"),
14+
("https://user:secret@example.com:8443/data.tar.bz2", "https://***@example.com:8443/data.tar.bz2"),
15+
],
16+
)
17+
def test_sanitize_url(url: str | None, expected: str | None):
18+
assert sanitize_url(url) == expected

0 commit comments

Comments
 (0)