def testMyPlexConnection(self): self.setup() print(self.getCurrentDateTime() + "1. Create PlexManager") plexManager = PlexManager({ 'platform':'Boxee', 'platformversion':'System.BuildVersion', 'provides':'player', 'product':'Plexee', 'version':'1.0', 'device':'Windows', 'deviceid':'xxx' }) print(self.getCurrentDateTime() + "1. END PlexManager") print(self.getCurrentDateTime() + "2. Do Plex Login") plexManager.clearMyPlex() self.assertTrue(plexManager.myPlexLogin(constants.USERNAME, constants.PASSWORD),'Login succeeded') token = plexManager.myplex.authenticationToken print('TOKEN: %s' % token) assert token is not None print(self.getCurrentDateTime() + "2. END Plex Login") print(self.getCurrentDateTime() + "3. Connect to server") server = PlexServer.Manual(constants.HOST, constants.PORT, token) #token server.connect() print(self.getCurrentDateTime() + "3. END Connect to server") print(self.getCurrentDateTime() + "4. Get data") data, url = server.getLibraryData() print(data) assert data is not None print(self.getCurrentDateTime() + "4. END Get data")
def testUsers(self): plexManager = PlexManager({ 'platform':'Boxee', 'platformversion':'System.BuildVersion', 'provides':'player', 'product':'Plexee', 'version':'1.0', 'device':'Windows', 'deviceid':'xxx' }) plexManager.clearMyPlex() self.assertEqual(plexManager.myPlexLogin(constants.USERNAME, constants.PASSWORD), 0, 'Login succeeded') users = plexManager.getLocalUsers() print('Users: %d' % len(users)) self.assertNotEqual(0, len(users), "Users set up")
def testMyPlexConnection(self): self.setup() plexManager = PlexManager({ 'platform':'Boxee', 'platformversion':'System.BuildVersion', 'provides':'player', 'product':'Plexee', 'version':'1.0', 'device':'Windows', 'deviceid':'xxx' }) plexManager.clearMyPlex() self.assertEqual(plexManager.myPlexLogin(constants.USERNAME, constants.PASSWORD), 0, 'Login succeeded') token = plexManager.myplex.authenticationToken print('TOKEN: %s' % token) assert token is not None server = PlexServer(constants.HOST, constants.PORT, token) data, url = server.getLibraryData() print(data) assert data is not None
def testMyPlexUsers(self): self.setup() print(self.getCurrentDateTime() + "1. Create PlexManager") plexManager = PlexManager({ 'platform':'Boxee', 'platformversion':'System.BuildVersion', 'provides':'player', 'product':'Plexee', 'version':'1.0', 'device':'Windows', 'deviceid':'xxx' }) print(self.getCurrentDateTime() + "1. END PlexManager") print(self.getCurrentDateTime() + "2. Do Plex Login") plexManager.clearMyPlex() self.assertTrue(plexManager.myPlexLogin(constants.USERNAME, constants.PASSWORD), 'Login succeeded') token = plexManager.myplex.authenticationToken print('TOKEN: %s' % token) assert token is not None print(self.getCurrentDateTime() + "2. END Plex Login") result = plexManager.switchUser('1311516','1399') self.assertEqual(result, PlexManager.SUCCESS) result = plexManager.switchUser('1311516','139') self.assertEqual(result, PlexManager.ERR_USER_PIN_FAILED)