update test

check server current allowMediaDeletion
test for redundant toggles
This commit is contained in:
blacktwin 2020-02-26 08:57:42 -05:00
parent 59bca994e5
commit ec8491c2e1

View file

@ -272,12 +272,38 @@ def test_server_downloadDatabases(tmpdir, plex):
def test_server_allowMediaDeletion(account): def test_server_allowMediaDeletion(account):
plex = PlexServer(utils.SERVER_BASEURL, account.authenticationToken) plex = PlexServer(utils.SERVER_BASEURL, account.authenticationToken)
plex._allowMediaDeletion(True) # Check server current allowMediaDeletion setting
time.sleep(1) if plex.allowMediaDeletion:
plex = PlexServer(utils.SERVER_BASEURL, account.authenticationToken) # If allowed then test disallowed
assert plex.allowMediaDeletion == True plex._allowMediaDeletion(False)
plex = PlexServer(utils.SERVER_BASEURL, account.authenticationToken) time.sleep(1)
plex._allowMediaDeletion(False) plex = PlexServer(utils.SERVER_BASEURL, account.authenticationToken)
time.sleep(1) assert plex.allowMediaDeletion is None
plex = PlexServer(utils.SERVER_BASEURL, account.authenticationToken) # Test redundant toggle
assert plex.allowMediaDeletion == None with pytest.raises(BadRequest):
plex._allowMediaDeletion(False)
plex._allowMediaDeletion(True)
time.sleep(1)
plex = PlexServer(utils.SERVER_BASEURL, account.authenticationToken)
assert plex.allowMediaDeletion is True
# Test redundant toggle
with pytest.raises(BadRequest):
plex._allowMediaDeletion(True)
else:
# If disallowed then test allowed
plex._allowMediaDeletion(True)
time.sleep(1)
plex = PlexServer(utils.SERVER_BASEURL, account.authenticationToken)
assert plex.allowMediaDeletion is True
# Test redundant toggle
with pytest.raises(BadRequest):
plex._allowMediaDeletion(True)
plex._allowMediaDeletion(False)
time.sleep(1)
plex = PlexServer(utils.SERVER_BASEURL, account.authenticationToken)
assert plex.allowMediaDeletion is None
# Test redundant toggle
with pytest.raises(BadRequest):
plex._allowMediaDeletion(False)