mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 10:16:11 +00:00
Add tests for strip_credentials
This commit is contained in:
parent
f7ce255160
commit
cfc532377e
1 changed files with 21 additions and 1 deletions
|
@ -15,7 +15,7 @@ else:
|
||||||
|
|
||||||
import pytest
|
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}
|
item1 = {"foo": 123, "bar": 456, "baz": 789}
|
||||||
|
|
||||||
|
@ -77,3 +77,23 @@ def test_values(item, keys, expected):
|
||||||
)
|
)
|
||||||
def test_convert_to_local(utctime, timezone, expected):
|
def test_convert_to_local(utctime, timezone, expected):
|
||||||
assert convert_to_local(utctime, timezone=zoneinfo.ZoneInfo(timezone)) == expected
|
assert convert_to_local(utctime, timezone=zoneinfo.ZoneInfo(timezone)) == expected
|
||||||
|
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
"url,expected",
|
||||||
|
[
|
||||||
|
("smb://user:pass@server.test/media", "smb://server.test/media"),
|
||||||
|
("smb://server.test/media", "smb://server.test/media"),
|
||||||
|
("smb://user:pass@192.0.2.1/media", "smb://192.0.2.1/media"),
|
||||||
|
("smb://user@192.0.2.1/media", "smb://192.0.2.1/media"),
|
||||||
|
("nfs://server.test/media", "nfs://server.test/media"),
|
||||||
|
("sftp://user:pass@server.test/media", "sftp://server.test/media"),
|
||||||
|
("file://media/movies", "file://media/movies"),
|
||||||
|
("/media/movies", "/media/movies"),
|
||||||
|
("http://user:pass@server.test/media", "http://server.test/media"),
|
||||||
|
("https://user:pass@server.test/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
|
||||||
|
|
Loading…
Reference in a new issue