mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-10 14:14:19 +00:00
tests: improve audio tests (#1294)
This commit is contained in:
parent
4924320715
commit
799e5c690b
2 changed files with 10 additions and 6 deletions
|
@ -9,6 +9,10 @@ from . import test_media, test_mixins
|
||||||
|
|
||||||
|
|
||||||
def test_audio_Artist_attr(artist):
|
def test_audio_Artist_attr(artist):
|
||||||
|
artist_guids = [
|
||||||
|
"mbid://069a1c1f-14eb-4d36-b0a0-77dffbd67713",
|
||||||
|
"plex://artist/5d07bdaf403c64029060f8c4",
|
||||||
|
]
|
||||||
artist.reload()
|
artist.reload()
|
||||||
assert utils.is_datetime(artist.addedAt)
|
assert utils.is_datetime(artist.addedAt)
|
||||||
assert artist.albumSort == -1
|
assert artist.albumSort == -1
|
||||||
|
@ -17,8 +21,8 @@ def test_audio_Artist_attr(artist):
|
||||||
if artist.countries:
|
if artist.countries:
|
||||||
assert "United States of America" in [i.tag for i in artist.countries]
|
assert "United States of America" in [i.tag for i in artist.countries]
|
||||||
# assert "Electronic" in [i.tag for i in artist.genres]
|
# assert "Electronic" in [i.tag for i in artist.genres]
|
||||||
assert artist.guid == "plex://artist/5d07bdaf403c64029060f8c4"
|
assert artist.guid in artist_guids
|
||||||
assert "mbid://069a1c1f-14eb-4d36-b0a0-77dffbd67713" in [i.id for i in artist.guids]
|
assert artist_guids[0] in [i.id for i in artist.guids]
|
||||||
assert artist.index == 1
|
assert artist.index == 1
|
||||||
assert utils.is_metadata(artist._initpath)
|
assert utils.is_metadata(artist._initpath)
|
||||||
assert utils.is_metadata(artist.key)
|
assert utils.is_metadata(artist.key)
|
||||||
|
|
|
@ -785,15 +785,15 @@ def _test_library_search(library, obj): # noqa: C901
|
||||||
fields = library.listFields(obj.type)
|
fields = library.listFields(obj.type)
|
||||||
for field in fields:
|
for field in fields:
|
||||||
fieldAttr = field.key.split(".")[-1]
|
fieldAttr = field.key.split(".")[-1]
|
||||||
|
if fieldAttr in {"unmatched", "userRating"}:
|
||||||
|
continue
|
||||||
operators = library.listOperators(field.type)
|
operators = library.listOperators(field.type)
|
||||||
if field.type in {"tag", "string"}:
|
if field.type in {"tag", "string"}:
|
||||||
operators += [andOp]
|
operators += [andOp]
|
||||||
|
|
||||||
for operator in operators:
|
for operator in operators:
|
||||||
if (
|
if (
|
||||||
fieldAttr == "unmatched" and operator.key == "!="
|
fieldAttr in {"audienceRating", "rating"} and operator.key in {"=", "!="}
|
||||||
or fieldAttr in {"audienceRating", "rating"} and operator.key in {"=", "!="}
|
|
||||||
or fieldAttr == "userRating"
|
|
||||||
):
|
):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -846,7 +846,7 @@ def _do_test_library_search(library, obj, field, operator, searchValue):
|
||||||
if operator.key.startswith("!") or operator.key.startswith(">>") and (searchValue == 1 or searchValue == "1s"):
|
if operator.key.startswith("!") or operator.key.startswith(">>") and (searchValue == 1 or searchValue == "1s"):
|
||||||
assert obj not in results
|
assert obj not in results
|
||||||
else:
|
else:
|
||||||
assert obj in results
|
assert obj in results, f"Unable to search {obj.type} by {field.key} using {operator.key} and value {searchValue}."
|
||||||
|
|
||||||
|
|
||||||
def test_library_common(movies):
|
def test_library_common(movies):
|
||||||
|
|
Loading…
Reference in a new issue