示例#1
0
def test_config_controller_failed(hass, mock_ctrl, mock_scanner):
    """Test for controller failure."""
    config = {
        'device_tracker': {
            CONF_PLATFORM: unifi.DOMAIN,
            CONF_USERNAME: '******',
            CONF_PASSWORD: '******',
        }
    }
    mock_ctrl.side_effect = APIError('/', 500, 'foo', {}, None)
    result = unifi.get_scanner(hass, config)
    assert result is False
示例#2
0
def test_scanner_update_error():
    """Test the scanner update for error."""
    ctrl = mock.MagicMock()
    ctrl.get_clients.side_effect = APIError('/', 500, 'foo', {}, None)
    unifi.UnifiScanner(ctrl, DEFAULT_DETECTION_TIME)