diff --git a/tests/components/lifx/snapshots/test_diagnostics.ambr b/tests/components/lifx/snapshots/test_diagnostics.ambr new file mode 100644 index 00000000000..82499c3632e --- /dev/null +++ b/tests/components/lifx/snapshots/test_diagnostics.ambr @@ -0,0 +1,292 @@ +# serializer version: 1 +# name: test_bulb_diagnostics + dict({ + 'data': dict({ + 'brightness': 3, + 'features': dict({ + 'buttons': False, + 'chain': False, + 'color': True, + 'extended_multizone': False, + 'hev': False, + 'infrared': False, + 'matrix': False, + 'max_kelvin': 9000, + 'min_kelvin': 2500, + 'multizone': False, + 'relays': False, + }), + 'firmware': '3.00', + 'hue': 1, + 'kelvin': 4, + 'power': 0, + 'product_id': 1, + 'saturation': 2, + 'vendor': None, + }), + 'entry': dict({ + 'data': dict({ + 'host': '**REDACTED**', + }), + 'title': 'My Bulb', + }), + }) +# --- +# name: test_clean_bulb_diagnostics + dict({ + 'data': dict({ + 'brightness': 3, + 'features': dict({ + 'buttons': False, + 'chain': False, + 'color': True, + 'extended_multizone': False, + 'hev': True, + 'infrared': False, + 'matrix': False, + 'max_kelvin': 9000, + 'min_kelvin': 1500, + 'multizone': False, + 'relays': False, + }), + 'firmware': '3.00', + 'hev': dict({ + 'hev_config': dict({ + 'duration': 7200, + 'indication': False, + }), + 'hev_cycle': dict({ + 'duration': 7200, + 'last_power': False, + 'remaining': 30, + }), + 'last_result': 0, + }), + 'hue': 1, + 'kelvin': 4, + 'power': 0, + 'product_id': 90, + 'saturation': 2, + 'vendor': None, + }), + 'entry': dict({ + 'data': dict({ + 'host': '**REDACTED**', + }), + 'title': 'My Bulb', + }), + }) +# --- +# name: test_infrared_bulb_diagnostics + dict({ + 'data': dict({ + 'brightness': 3, + 'features': dict({ + 'buttons': False, + 'chain': False, + 'color': True, + 'extended_multizone': False, + 'hev': False, + 'infrared': True, + 'matrix': False, + 'max_kelvin': 9000, + 'min_kelvin': 1500, + 'multizone': False, + 'relays': False, + }), + 'firmware': '3.00', + 'hue': 1, + 'infrared': dict({ + 'brightness': 65535, + }), + 'kelvin': 4, + 'power': 0, + 'product_id': 29, + 'saturation': 2, + 'vendor': None, + }), + 'entry': dict({ + 'data': dict({ + 'host': '**REDACTED**', + }), + 'title': 'My Bulb', + }), + }) +# --- +# name: test_legacy_multizone_bulb_diagnostics + dict({ + 'data': dict({ + 'brightness': 3, + 'features': dict({ + 'buttons': False, + 'chain': False, + 'color': True, + 'extended_multizone': False, + 'hev': False, + 'infrared': False, + 'matrix': False, + 'max_kelvin': 9000, + 'min_kelvin': 2500, + 'multizone': True, + 'relays': False, + }), + 'firmware': '3.00', + 'hue': 1, + 'kelvin': 4, + 'power': 0, + 'product_id': 31, + 'saturation': 2, + 'vendor': None, + 'zones': dict({ + 'count': 8, + 'state': dict({ + '0': dict({ + 'brightness': 65535, + 'hue': 54612, + 'kelvin': 3500, + 'saturation': 65535, + }), + '1': dict({ + 'brightness': 65535, + 'hue': 54612, + 'kelvin': 3500, + 'saturation': 65535, + }), + '2': dict({ + 'brightness': 65535, + 'hue': 54612, + 'kelvin': 3500, + 'saturation': 65535, + }), + '3': dict({ + 'brightness': 65535, + 'hue': 54612, + 'kelvin': 3500, + 'saturation': 65535, + }), + '4': dict({ + 'brightness': 65535, + 'hue': 46420, + 'kelvin': 3500, + 'saturation': 65535, + }), + '5': dict({ + 'brightness': 65535, + 'hue': 46420, + 'kelvin': 3500, + 'saturation': 65535, + }), + '6': dict({ + 'brightness': 65535, + 'hue': 46420, + 'kelvin': 3500, + 'saturation': 65535, + }), + '7': dict({ + 'brightness': 65535, + 'hue': 46420, + 'kelvin': 3500, + 'saturation': 65535, + }), + }), + }), + }), + 'entry': dict({ + 'data': dict({ + 'host': '**REDACTED**', + }), + 'title': 'My Bulb', + }), + }) +# --- +# name: test_multizone_bulb_diagnostics + dict({ + 'data': dict({ + 'brightness': 3, + 'features': dict({ + 'buttons': False, + 'chain': False, + 'color': True, + 'extended_multizone': True, + 'hev': False, + 'infrared': False, + 'matrix': False, + 'max_kelvin': 9000, + 'min_ext_mz_firmware': 1532997580, + 'min_ext_mz_firmware_components': list([ + 2, + 77, + ]), + 'min_kelvin': 1500, + 'multizone': True, + 'relays': False, + }), + 'firmware': '3.00', + 'hue': 1, + 'kelvin': 4, + 'power': 0, + 'product_id': 38, + 'saturation': 2, + 'vendor': None, + 'zones': dict({ + 'count': 8, + 'state': dict({ + '0': dict({ + 'brightness': 65535, + 'hue': 54612, + 'kelvin': 3500, + 'saturation': 65535, + }), + '1': dict({ + 'brightness': 65535, + 'hue': 54612, + 'kelvin': 3500, + 'saturation': 65535, + }), + '2': dict({ + 'brightness': 65535, + 'hue': 54612, + 'kelvin': 3500, + 'saturation': 65535, + }), + '3': dict({ + 'brightness': 65535, + 'hue': 54612, + 'kelvin': 3500, + 'saturation': 65535, + }), + '4': dict({ + 'brightness': 65535, + 'hue': 46420, + 'kelvin': 3500, + 'saturation': 65535, + }), + '5': dict({ + 'brightness': 65535, + 'hue': 46420, + 'kelvin': 3500, + 'saturation': 65535, + }), + '6': dict({ + 'brightness': 65535, + 'hue': 46420, + 'kelvin': 3500, + 'saturation': 65535, + }), + '7': dict({ + 'brightness': 65535, + 'hue': 46420, + 'kelvin': 3500, + 'saturation': 65535, + }), + }), + }), + }), + 'entry': dict({ + 'data': dict({ + 'host': '**REDACTED**', + }), + 'title': 'My Bulb', + }), + }) +# --- diff --git a/tests/components/lifx/test_diagnostics.py b/tests/components/lifx/test_diagnostics.py index 22e335612f8..5883ac046e7 100644 --- a/tests/components/lifx/test_diagnostics.py +++ b/tests/components/lifx/test_diagnostics.py @@ -1,5 +1,7 @@ """Test LIFX diagnostics.""" +from syrupy.assertion import SnapshotAssertion + from homeassistant.components import lifx from homeassistant.const import CONF_HOST from homeassistant.core import HomeAssistant @@ -25,7 +27,9 @@ from tests.typing import ClientSessionGenerator async def test_bulb_diagnostics( - hass: HomeAssistant, hass_client: ClientSessionGenerator + hass: HomeAssistant, + hass_client: ClientSessionGenerator, + snapshot: SnapshotAssertion, ) -> None: """Test diagnostics for a standard bulb.""" config_entry = MockConfigEntry( @@ -45,36 +49,13 @@ async def test_bulb_diagnostics( await hass.async_block_till_done() diag = await get_diagnostics_for_config_entry(hass, hass_client, config_entry) - assert diag == { - "data": { - "brightness": 3, - "features": { - "buttons": False, - "chain": False, - "color": True, - "extended_multizone": False, - "hev": False, - "infrared": False, - "matrix": False, - "max_kelvin": 9000, - "min_kelvin": 2500, - "multizone": False, - "relays": False, - }, - "firmware": "3.00", - "hue": 1, - "kelvin": 4, - "power": 0, - "product_id": 1, - "saturation": 2, - "vendor": None, - }, - "entry": {"data": {"host": "**REDACTED**"}, "title": "My Bulb"}, - } + assert diag == snapshot async def test_clean_bulb_diagnostics( - hass: HomeAssistant, hass_client: ClientSessionGenerator + hass: HomeAssistant, + hass_client: ClientSessionGenerator, + snapshot: SnapshotAssertion, ) -> None: """Test diagnostics for a standard bulb.""" config_entry = MockConfigEntry( @@ -94,41 +75,13 @@ async def test_clean_bulb_diagnostics( await hass.async_block_till_done() diag = await get_diagnostics_for_config_entry(hass, hass_client, config_entry) - assert diag == { - "data": { - "brightness": 3, - "features": { - "buttons": False, - "chain": False, - "color": True, - "extended_multizone": False, - "hev": True, - "infrared": False, - "matrix": False, - "max_kelvin": 9000, - "min_kelvin": 1500, - "multizone": False, - "relays": False, - }, - "firmware": "3.00", - "hev": { - "hev_config": {"duration": 7200, "indication": False}, - "hev_cycle": {"duration": 7200, "last_power": False, "remaining": 30}, - "last_result": 0, - }, - "hue": 1, - "kelvin": 4, - "power": 0, - "product_id": 90, - "saturation": 2, - "vendor": None, - }, - "entry": {"data": {"host": "**REDACTED**"}, "title": "My Bulb"}, - } + assert diag == snapshot async def test_infrared_bulb_diagnostics( - hass: HomeAssistant, hass_client: ClientSessionGenerator + hass: HomeAssistant, + hass_client: ClientSessionGenerator, + snapshot: SnapshotAssertion, ) -> None: """Test diagnostics for a standard bulb.""" config_entry = MockConfigEntry( @@ -148,37 +101,13 @@ async def test_infrared_bulb_diagnostics( await hass.async_block_till_done() diag = await get_diagnostics_for_config_entry(hass, hass_client, config_entry) - assert diag == { - "data": { - "brightness": 3, - "features": { - "buttons": False, - "chain": False, - "color": True, - "extended_multizone": False, - "hev": False, - "infrared": True, - "matrix": False, - "max_kelvin": 9000, - "min_kelvin": 1500, - "multizone": False, - "relays": False, - }, - "firmware": "3.00", - "hue": 1, - "infrared": {"brightness": 65535}, - "kelvin": 4, - "power": 0, - "product_id": 29, - "saturation": 2, - "vendor": None, - }, - "entry": {"data": {"host": "**REDACTED**"}, "title": "My Bulb"}, - } + assert diag == snapshot async def test_legacy_multizone_bulb_diagnostics( - hass: HomeAssistant, hass_client: ClientSessionGenerator + hass: HomeAssistant, + hass_client: ClientSessionGenerator, + snapshot: SnapshotAssertion, ) -> None: """Test diagnostics for a standard bulb.""" config_entry = MockConfigEntry( @@ -225,89 +154,13 @@ async def test_legacy_multizone_bulb_diagnostics( await hass.async_block_till_done() diag = await get_diagnostics_for_config_entry(hass, hass_client, config_entry) - assert diag == { - "data": { - "brightness": 3, - "features": { - "buttons": False, - "chain": False, - "color": True, - "extended_multizone": False, - "hev": False, - "infrared": False, - "matrix": False, - "max_kelvin": 9000, - "min_kelvin": 2500, - "multizone": True, - "relays": False, - }, - "firmware": "3.00", - "hue": 1, - "kelvin": 4, - "power": 0, - "product_id": 31, - "saturation": 2, - "vendor": None, - "zones": { - "count": 8, - "state": { - "0": { - "brightness": 65535, - "hue": 54612, - "kelvin": 3500, - "saturation": 65535, - }, - "1": { - "brightness": 65535, - "hue": 54612, - "kelvin": 3500, - "saturation": 65535, - }, - "2": { - "brightness": 65535, - "hue": 54612, - "kelvin": 3500, - "saturation": 65535, - }, - "3": { - "brightness": 65535, - "hue": 54612, - "kelvin": 3500, - "saturation": 65535, - }, - "4": { - "brightness": 65535, - "hue": 46420, - "kelvin": 3500, - "saturation": 65535, - }, - "5": { - "brightness": 65535, - "hue": 46420, - "kelvin": 3500, - "saturation": 65535, - }, - "6": { - "brightness": 65535, - "hue": 46420, - "kelvin": 3500, - "saturation": 65535, - }, - "7": { - "brightness": 65535, - "hue": 46420, - "kelvin": 3500, - "saturation": 65535, - }, - }, - }, - }, - "entry": {"data": {"host": "**REDACTED**"}, "title": "My Bulb"}, - } + assert diag == snapshot async def test_multizone_bulb_diagnostics( - hass: HomeAssistant, hass_client: ClientSessionGenerator + hass: HomeAssistant, + hass_client: ClientSessionGenerator, + snapshot: SnapshotAssertion, ) -> None: """Test diagnostics for a standard bulb.""" config_entry = MockConfigEntry( @@ -355,84 +208,4 @@ async def test_multizone_bulb_diagnostics( await hass.async_block_till_done() diag = await get_diagnostics_for_config_entry(hass, hass_client, config_entry) - assert diag == { - "data": { - "brightness": 3, - "features": { - "buttons": False, - "chain": False, - "color": True, - "extended_multizone": True, - "hev": False, - "infrared": False, - "matrix": False, - "max_kelvin": 9000, - "min_ext_mz_firmware": 1532997580, - "min_ext_mz_firmware_components": [2, 77], - "min_kelvin": 1500, - "multizone": True, - "relays": False, - }, - "firmware": "3.00", - "hue": 1, - "kelvin": 4, - "power": 0, - "product_id": 38, - "saturation": 2, - "vendor": None, - "zones": { - "count": 8, - "state": { - "0": { - "brightness": 65535, - "hue": 54612, - "kelvin": 3500, - "saturation": 65535, - }, - "1": { - "brightness": 65535, - "hue": 54612, - "kelvin": 3500, - "saturation": 65535, - }, - "2": { - "brightness": 65535, - "hue": 54612, - "kelvin": 3500, - "saturation": 65535, - }, - "3": { - "brightness": 65535, - "hue": 54612, - "kelvin": 3500, - "saturation": 65535, - }, - "4": { - "brightness": 65535, - "hue": 46420, - "kelvin": 3500, - "saturation": 65535, - }, - "5": { - "brightness": 65535, - "hue": 46420, - "kelvin": 3500, - "saturation": 65535, - }, - "6": { - "brightness": 65535, - "hue": 46420, - "kelvin": 3500, - "saturation": 65535, - }, - "7": { - "brightness": 65535, - "hue": 46420, - "kelvin": 3500, - "saturation": 65535, - }, - }, - }, - }, - "entry": {"data": {"host": "**REDACTED**"}, "title": "My Bulb"}, - } + assert diag == snapshot