diff --git a/tests/components/uptimerobot/common.py b/tests/components/uptimerobot/common.py index 7a404e3d877..513526da758 100644 --- a/tests/components/uptimerobot/common.py +++ b/tests/components/uptimerobot/common.py @@ -47,7 +47,13 @@ MOCK_UPTIMEROBOT_MONITOR_PAUSED = { "type": 1, "url": "http://example.com", } - +MOCK_UPTIMEROBOT_MONITOR_2 = { + "id": 5678, + "friendly_name": "Test monitor 2", + "status": 2, + "type": 1, + "url": "http://example2.com", +} MOCK_UPTIMEROBOT_CONFIG_ENTRY_DATA = { "domain": DOMAIN, diff --git a/tests/components/uptimerobot/test_binary_sensor.py b/tests/components/uptimerobot/test_binary_sensor.py index 13e4a556d18..a7b3c616dd7 100644 --- a/tests/components/uptimerobot/test_binary_sensor.py +++ b/tests/components/uptimerobot/test_binary_sensor.py @@ -15,6 +15,7 @@ from homeassistant.util import dt as dt_util from .common import ( MOCK_UPTIMEROBOT_MONITOR, + MOCK_UPTIMEROBOT_MONITOR_2, UPTIMEROBOT_BINARY_SENSOR_TEST_ENTITY, mock_uptimerobot_api_response, setup_uptimerobot_integration, @@ -65,20 +66,8 @@ async def test_binary_sensor_dynamic(hass: HomeAssistant) -> None: "pyuptimerobot.UptimeRobot.async_get_monitors", return_value=mock_uptimerobot_api_response( data=[ - { - "id": 1234, - "friendly_name": "Test monitor", - "status": 2, - "type": 1, - "url": "http://example.com", - }, - { - "id": 5678, - "friendly_name": "Test monitor 2", - "status": 2, - "type": 1, - "url": "http://example2.com", - }, + MOCK_UPTIMEROBOT_MONITOR, + MOCK_UPTIMEROBOT_MONITOR_2, ] ), ): diff --git a/tests/components/uptimerobot/test_sensor.py b/tests/components/uptimerobot/test_sensor.py index 26f7432f99c..e5d6b12596d 100644 --- a/tests/components/uptimerobot/test_sensor.py +++ b/tests/components/uptimerobot/test_sensor.py @@ -12,6 +12,7 @@ from homeassistant.util import dt as dt_util from .common import ( MOCK_UPTIMEROBOT_MONITOR, + MOCK_UPTIMEROBOT_MONITOR_2, STATE_UP, UPTIMEROBOT_SENSOR_TEST_ENTITY, mock_uptimerobot_api_response, @@ -69,20 +70,8 @@ async def test_sensor_dynamic(hass: HomeAssistant) -> None: "pyuptimerobot.UptimeRobot.async_get_monitors", return_value=mock_uptimerobot_api_response( data=[ - { - "id": 1234, - "friendly_name": "Test monitor", - "status": 2, - "type": 1, - "url": "http://example.com", - }, - { - "id": 5678, - "friendly_name": "Test monitor 2", - "status": 2, - "type": 1, - "url": "http://example2.com", - }, + MOCK_UPTIMEROBOT_MONITOR, + MOCK_UPTIMEROBOT_MONITOR_2, ] ), ): diff --git a/tests/components/uptimerobot/test_switch.py b/tests/components/uptimerobot/test_switch.py index e42b46db861..7dc35021064 100644 --- a/tests/components/uptimerobot/test_switch.py +++ b/tests/components/uptimerobot/test_switch.py @@ -21,6 +21,7 @@ from homeassistant.util import dt as dt_util from .common import ( MOCK_UPTIMEROBOT_CONFIG_ENTRY_DATA, MOCK_UPTIMEROBOT_MONITOR, + MOCK_UPTIMEROBOT_MONITOR_2, MOCK_UPTIMEROBOT_MONITOR_PAUSED, UPTIMEROBOT_SWITCH_TEST_ENTITY, MockApiResponseKey, @@ -197,20 +198,8 @@ async def test_switch_dynamic(hass: HomeAssistant) -> None: "pyuptimerobot.UptimeRobot.async_get_monitors", return_value=mock_uptimerobot_api_response( data=[ - { - "id": 1234, - "friendly_name": "Test monitor", - "status": 2, - "type": 1, - "url": "http://example.com", - }, - { - "id": 5678, - "friendly_name": "Test monitor 2", - "status": 2, - "type": 1, - "url": "http://example2.com", - }, + MOCK_UPTIMEROBOT_MONITOR, + MOCK_UPTIMEROBOT_MONITOR_2, ] ), ):