Exemplo n.º 1
0
    def test_wrong_host(self, m):
        self.setup_matcher(m)

        gateway = XfinityGateway('10.0.0.3')

        with self.assertRaises(ValueError):
            gateway.scan_devices()
Exemplo n.º 2
0
    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()
Exemplo n.º 3
0
    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')
Exemplo n.º 4
0
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
Exemplo n.º 5
0
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
Exemplo n.º 6
0
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
Exemplo n.º 7
0
    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())