def _setup_airplay(loop, session, details): airplay_service = details.airplay_service() airplay_player = player.AirPlayPlayer(loop, session, details.address, airplay_service.port) airplay_http = HttpSession( session, 'http://{0}:{1}/'.format(details.address, airplay_service.port)) return AirPlayAPI(airplay_http, airplay_player)
async def test_verify_authenticated(self): http = HttpSession(self.session, 'http://127.0.0.1:{0}/'.format(self.server.port)) handler = srp.SRPAuthHandler() handler.initialize(binascii.unhexlify(DEVICE_AUTH_KEY)) verifier = AuthenticationVerifier(http, handler) self.assertTrue((await verifier.verify_authed()))
async def test_verify_invalid(self): http = HttpSession(self.session, 'http://127.0.0.1:{0}/'.format(self.server.port)) handler = srp.SRPAuthHandler() handler.initialize(INVALID_AUTH_KEY) verifier = AuthenticationVerifier(http, handler) with self.assertRaises(AuthenticationError): await verifier.verify_authed()
async def test_auth_successful(self): http = HttpSession(self.session, 'http://127.0.0.1:{0}/'.format(self.server.port)) handler = srp.SRPAuthHandler() handler.initialize(INVALID_AUTH_KEY) auther = DeviceAuthenticator(http, handler) await auther.start_authentication() with self.assertRaises(AuthenticationError): await auther.finish_authentication(DEVICE_IDENTIFIER, DEVICE_PIN)
async def test_auth_failed(self): http = HttpSession( self.session, 'http://127.0.0.1:{0}/'.format(self.server.port)) handler = srp.SRPAuthHandler() handler.initialize(binascii.unhexlify(DEVICE_AUTH_KEY)) auther = DeviceAuthenticator(http, handler) await auther.start_authentication() self.assertTrue((await auther.finish_authentication( DEVICE_IDENTIFIER, DEVICE_PIN)))
def __init__(self, loop, session, details): """Initialize a new Apple TV.""" super().__init__() self._session = session daap_http = HttpSession( session, 'http://{0}:{1}/'.format(details.address, details.port)) self._requester = DaapRequester(daap_http, details.login_id) self._apple_tv = BaseAppleTV(self._requester) self._atv_remote = RemoteControlInternal(self._apple_tv) self._atv_metadata = MetadataInternal(self._apple_tv, daap_http) self._atv_push_updater = PushUpdaterInternal(loop, self._apple_tv) airplay_player = player.AirPlayPlayer(loop, session, details.address, details.airplay_port) airplay_http = HttpSession( session, 'http://{0}:{1}/'.format(details.address, details.airplay_port)) self._airplay = AirPlayInternal(airplay_http, airplay_player)
def __init__(self, loop, session, config, airplay): """Initialize a new Apple TV.""" super().__init__() self._session = session self._dmap_service = config.get_service(Protocol.DMAP) daap_http = HttpSession( session, 'http://{0}:{1}/'.format(config.address, self._dmap_service.port)) self._requester = DaapRequester( daap_http, self._dmap_service.credentials) self._apple_tv = BaseDmapAppleTV(self._requester) self._dmap_remote = DmapRemoteControl(self._apple_tv) self._dmap_metadata = DmapMetadata(config.identifier, self._apple_tv) self._dmap_push_updater = DmapPushUpdater(loop, self._apple_tv, self) self._airplay = airplay
def __init__(self, loop, session, details, airplay): """Initialize a new Apple TV.""" super().__init__() self._session = session self._dmap_service = details.get_service(const.PROTOCOL_DMAP) daap_http = HttpSession( session, 'http://{0}:{1}/'.format(details.address, self._dmap_service.port)) self._requester = DaapRequester(daap_http, self._dmap_service.device_credentials) self._apple_tv = BaseDmapAppleTV(self._requester) self._dmap_remote = DmapRemoteControl(self._apple_tv) self._dmap_metadata = DmapMetadata(self._apple_tv, daap_http) self._dmap_push_updater = DmapPushUpdater(loop, self._apple_tv) self._dmap_pairing = pairing.DmapPairingHandler(loop) self._airplay = airplay