python-plexapi/tests/test_settings.py
Elan Ruusamäe 7580fc84a9
Use cached_property decorator (#1065)
* Use @cached_property in PlexSession.user

* Use @cached_property in PlexServer.library

* Use @cached_property in PlexServer.settings

* Tests: Update clearing plex.settings cache

* Use @cached_property in LibrarySection.totalSize

* Add backports.cached-property==1.0.2; python_version<="3.7" dependency

* Import cached_property from dist or backports

* Add backports.cached-property to requirements_dev.txt

* Remove version pin for backports.cached-property in requirements.txt

Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>

Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
2022-12-21 11:51:45 -08:00

26 lines
703 B
Python

def test_settings_group(plex):
assert plex.settings.group("general")
def test_settings_get(plex):
value = plex.settings.get("FriendlyName").value
assert isinstance(value, str)
def test_settings_set(plex):
cd = plex.settings.get("autoEmptyTrash")
old_value = cd.value
new_value = not old_value
cd.set(new_value)
plex.settings.save()
del plex.__dict__['settings']
assert plex.settings.get("autoEmptyTrash").value == new_value
def test_settings_set_str(plex):
cd = plex.settings.get("OnDeckWindow")
new_value = 99
cd.set(new_value)
plex.settings.save()
del plex.__dict__['settings']
assert plex.settings.get("OnDeckWindow").value == 99