def test_get_device_description_of_sonos_speaker_throws_when_getting_description_fails(
        sonos_device_info):
    responses.add(responses.GET,
                  'http://192.168.1.42:1400/xml/device_description.xml',
                  status=404)
    with raises(UpstreamError) as e:
        get_device_description("sonos", sonos_device_info)
    assert e.value.error_type == 404
def test_get_device_description_of_philips_hue_bridge_throws_when_getting_description_fails(
        philips_hue_bridge_device_info):
    responses.add(responses.GET,
                  'http://127.0.0.1:80/description.xml',
                  status=404)
    with raises(UpstreamError) as e:
        get_device_description("philips_hue", philips_hue_bridge_device_info)
    assert e.value.error_type == 404
Esempio n. 3
0
def test_get_device_description_of_soundtouch_speaker(soundtouch_device_info):
    expected = {
        "id": "192_168_1_23",
        "type": "soundtouch",
        "ip": "192.168.1.23",
        "port": 8090,
        "authenticationRequired": False,
        "name": "Bose Soundtouch",
        "extra": {},
    }
    assert get_device_description("bose_soundtouch", soundtouch_device_info) == expected
Esempio n. 4
0
def test_get_device_description_of_philips_hue_bridge(philips_hue_bridge_device_info, philips_hue_bridge_description):
    responses.add(responses.GET, 'http://127.0.0.1:80/description.xml', body=philips_hue_bridge_description, status=200)
    expected = {
        "id": "ph1",
        "name": "Philips Hue bridge",
        "authenticationRequired": True,
        "type": "philips_hue",
        "ip": "127.0.0.1",
        "extra": {},
    }
    assert get_device_description("philips_hue", philips_hue_bridge_device_info) == expected
Esempio n. 5
0
def test_get_device_description_of_sonos_speaker(sonos_device_info, sonos_speaker_description):
    responses.add(responses.GET, 'http://192.168.1.42:1400/xml/device_description.xml', body=sonos_speaker_description, status=200)
    expected = {
        "id": "123",
        "type": "sonos",
        "ip": "192.168.1.42",
        "authenticationRequired": False,
        "name": "192.168.1.42 Foo Bar",
        "extra": {
            "roomName": "Foo Bar",
        },
    }
    assert get_device_description("sonos", sonos_device_info) == expected