python-plexapi/tests/test_mixins.py

59 lines
1.3 KiB
Python
Raw Normal View History

2021-01-24 14:40:02 -08:00
# -*- coding: utf-8 -*-
TEST_MIXIN_TAG = "Test Tag"
2021-01-24 15:03:23 -08:00
def _test_mixins_tag(obj, attr, tag_method):
2021-02-11 09:16:04 -08:00
add_tag_method = getattr(obj, "add" + tag_method)
remove_tag_method = getattr(obj, "remove" + tag_method)
2021-01-24 14:40:02 -08:00
assert TEST_MIXIN_TAG not in [tag.tag for tag in getattr(obj, attr)]
add_tag_method(TEST_MIXIN_TAG)
obj.reload()
assert TEST_MIXIN_TAG in [tag.tag for tag in getattr(obj, attr)]
remove_tag_method(TEST_MIXIN_TAG)
obj.reload()
2021-02-06 20:35:47 -08:00
assert TEST_MIXIN_TAG not in [tag.tag for tag in getattr(obj, attr)]
2021-01-24 14:40:02 -08:00
def edit_collection(obj):
2021-02-11 09:16:04 -08:00
_test_mixins_tag(obj, "collections", "Collection")
2021-01-24 14:40:02 -08:00
def edit_country(obj):
2021-02-11 09:16:04 -08:00
_test_mixins_tag(obj, "countries", "Country")
2021-01-24 14:40:02 -08:00
def edit_director(obj):
2021-02-11 09:16:04 -08:00
_test_mixins_tag(obj, "directors", "Director")
2021-01-24 14:40:02 -08:00
def edit_genre(obj):
2021-02-11 09:16:04 -08:00
_test_mixins_tag(obj, "genres", "Genre")
2021-01-24 14:40:02 -08:00
def edit_label(obj):
2021-02-11 09:16:04 -08:00
_test_mixins_tag(obj, "labels", "Label")
2021-01-24 14:40:02 -08:00
def edit_mood(obj):
2021-02-11 09:16:04 -08:00
_test_mixins_tag(obj, "moods", "Mood")
2021-01-24 14:40:02 -08:00
def edit_producer(obj):
2021-02-11 09:16:04 -08:00
_test_mixins_tag(obj, "producers", "Producer")
2021-01-24 14:40:02 -08:00
def edit_similar_artist(obj):
2021-02-11 09:16:04 -08:00
_test_mixins_tag(obj, "similar", "SimilarArtist")
2021-01-24 14:40:02 -08:00
def edit_style(obj):
2021-02-11 09:16:04 -08:00
_test_mixins_tag(obj, "styles", "Style")
2021-01-24 14:40:02 -08:00
def edit_tag(obj):
2021-02-11 09:16:04 -08:00
_test_mixins_tag(obj, "tags", "Tag")
2021-01-24 14:40:02 -08:00
def edit_writer(obj):
2021-02-11 09:16:04 -08:00
_test_mixins_tag(obj, "writers", "Writer")