Skip to content

Commit a3e8504

Browse files
committed
add sanitization test
1 parent 04d4d01 commit a3e8504

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

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)