Skip to content

Commit

Permalink
Add tests for strip_credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
sundermann committed Dec 16, 2024
1 parent f7ce255 commit cfc5323
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion tests/test_helper_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import pytest

from jellyfin_kodi.helper.utils import values, convert_to_local
from jellyfin_kodi.helper.utils import values, convert_to_local, strip_credentials

item1 = {"foo": 123, "bar": 456, "baz": 789}

Expand Down Expand Up @@ -77,3 +77,23 @@ def test_values(item, keys, expected):
)
def test_convert_to_local(utctime, timezone, expected):
assert convert_to_local(utctime, timezone=zoneinfo.ZoneInfo(timezone)) == expected

@pytest.mark.parametrize(
"url,expected",
[
("smb://user:[email protected]/media", "smb://server.test/media"),
("smb://server.test/media", "smb://server.test/media"),
("smb://user:[email protected]/media", "smb://192.0.2.1/media"),
("smb://[email protected]/media", "smb://192.0.2.1/media"),
("nfs://server.test/media", "nfs://server.test/media"),
("sftp://user:[email protected]/media", "sftp://server.test/media"),
("file://media/movies", "file://media/movies"),
("/media/movies", "/media/movies"),
("http://user:[email protected]/media", "http://server.test/media"),
("https://user:[email protected]/media", "https://server.test/media"),
("http://server.test/media", "http://server.test/media"),
("https://server.test/media", "https://server.test/media"),
],
)
def test_strip_credentials(url, expected):
assert strip_credentials(url) == expected

0 comments on commit cfc5323

Please sign in to comment.