Remove test sync client in teardown

This commit is contained in:
JonnyWong16 2020-12-06 16:39:33 -08:00
parent 8e531537fd
commit 2a31fe3329
No known key found for this signature in database
GPG key ID: B1F1F9807184697A
2 changed files with 10 additions and 1 deletions

View file

@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
import time
import uuid
from datetime import datetime
from functools import partial
from os import environ

View file

@ -11,11 +11,21 @@ from plexapi import X_PLEX_IDENTIFIER
if __name__ == '__main__':
myplex = MyPlexAccount()
plex = PlexServer(token=myplex.authenticationToken)
# Remove the test server
for device in plex.myPlexAccount().devices():
if device.clientIdentifier == plex.machineIdentifier:
print('Removing device "%s", with id "%s"' % (device.name, device. clientIdentifier))
device.delete()
# Remove the test sync client
sync_client_identifier = 'sync-client-%s' % X_PLEX_IDENTIFIER
for device in plex.myPlexAccount().devices():
if device.clientIdentifier == sync_client_identifier:
print('Removing device "%s", with id "%s"' % (device.name, device. clientIdentifier))
device.delete()
break
# If we suddenly remove the client first we wouldn't be able to authenticate to delete the server
for device in plex.myPlexAccount().devices():
if device.clientIdentifier == X_PLEX_IDENTIFIER: