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 testDirectConnection(self):
		"""Test connect"""
		#self.setup()
		#1. Connect to local plex server
		server = PlexServer(constants.HOST, constants.PORT)
		if not server.isTokenRequired:
			self.assertTrue(server.isValid())
			data, url = server.getLibraryData()
			print(data)
			assert data is not None
		else:
			self.assertFalse(server.isValid())

		#2. Connect to an invalid server
		server = PlexServer('10.1.3.1', 32400)
		self.assertFalse(server.isValid())

		#3. Connect to a non-plex server
		server = PlexServer('www.google.com', 80)
		self.assertFalse(server.isValid())