def test_wrong_host(self, m): self.setup_matcher(m) gateway = XfinityGateway('10.0.0.3') with self.assertRaises(ValueError): gateway.scan_devices()
def test_invalid_host(self, m): self.setup_matcher(m) gateway = XfinityGateway('10.0.0.2') with self.assertRaises(requests.exceptions.RequestException): gateway.scan_devices()
def test_get_device_name_valid(self, m): self.setup_matcher(m) gateway = XfinityGateway('10.0.0.1') gateway.scan_devices() self.assertEqual(gateway.get_device_name('18:65:90:00:00:00'), 'Colbys-iPhone')
def get_scanner(hass, config): """Validate the configuration and return an Xfinity Gateway scanner.""" gateway = XfinityGateway(config[DOMAIN][CONF_HOST]) scanner = None try: gateway.scan_devices() scanner = XfinityDeviceScanner(gateway) except (RequestException, ValueError): _LOGGER.error( "Error communicating with Xfinity Gateway. " "Check host: %s", gateway.host) return scanner
def get_scanner(hass, config): """Validate the configuration and return an Xfinity Gateway scanner.""" from xfinity_gateway import XfinityGateway gateway = XfinityGateway(config[DOMAIN][CONF_HOST]) scanner = None try: gateway.scan_devices() scanner = XfinityDeviceScanner(gateway) except (RequestException, ValueError): _LOGGER.error("Error communicating with Xfinity Gateway. " "Check host: %s", gateway.host) return scanner
def get_scanner(hass, config): """Validate the configuration and return an Xfinity Gateway scanner.""" _LOGGER.warning( "The Xfinity Gateway has been deprecated and will be removed from " "Home Assistant in version 0.109. Please remove it from your " "configuration. ") gateway = XfinityGateway(config[DOMAIN][CONF_HOST]) scanner = None try: gateway.scan_devices() scanner = XfinityDeviceScanner(gateway) except (RequestException, ValueError): _LOGGER.error( "Error communicating with Xfinity Gateway. Check host: %s", gateway.host) return scanner
def test_scan_devices(self, m): self.setup_matcher(m) gateway = XfinityGateway('10.0.0.1') self.assertEqual(gateway.scan_devices(), self.CONNECTED_DEVICES.keys())