diff --git a/tests/common.py b/tests/common.py index 519b53cd991..72c18822e00 100644 --- a/tests/common.py +++ b/tests/common.py @@ -397,11 +397,22 @@ def async_fire_time_changed( fire_time_changed = threadsafe_callback_factory(async_fire_time_changed) -def load_fixture(filename): +def get_fixture_path(filename: str, integration: str | None = None) -> pathlib.Path: + """Get path of fixture.""" + if integration is None and "/" in filename and not filename.startswith("helpers/"): + integration, filename = filename.split("/", 1) + + if integration is None: + return pathlib.Path(__file__).parent.joinpath("fixtures", filename) + else: + return pathlib.Path(__file__).parent.joinpath( + "components", integration, "fixtures", filename + ) + + +def load_fixture(filename, integration=None): """Load a fixture.""" - path = os.path.join(os.path.dirname(__file__), "fixtures", filename) - with open(path, encoding="utf-8") as fptr: - return fptr.read() + return get_fixture_path(filename, integration).read_text() def mock_state_change_event(hass, new_state, old_state=None): diff --git a/tests/components/abode/conftest.py b/tests/components/abode/conftest.py index 21d64a644a9..472587781ca 100644 --- a/tests/components/abode/conftest.py +++ b/tests/components/abode/conftest.py @@ -10,16 +10,18 @@ from tests.components.light.conftest import mock_light_profiles # noqa: F401 def requests_mock_fixture(requests_mock): """Fixture to provide a requests mocker.""" # Mocks the login response for abodepy. - requests_mock.post(CONST.LOGIN_URL, text=load_fixture("abode_login.json")) + requests_mock.post(CONST.LOGIN_URL, text=load_fixture("login.json", "abode")) # Mocks the logout response for abodepy. - requests_mock.post(CONST.LOGOUT_URL, text=load_fixture("abode_logout.json")) + requests_mock.post(CONST.LOGOUT_URL, text=load_fixture("logout.json", "abode")) # Mocks the oauth claims response for abodepy. requests_mock.get( - CONST.OAUTH_TOKEN_URL, text=load_fixture("abode_oauth_claims.json") + CONST.OAUTH_TOKEN_URL, text=load_fixture("oauth_claims.json", "abode") ) # Mocks the panel response for abodepy. - requests_mock.get(CONST.PANEL_URL, text=load_fixture("abode_panel.json")) + requests_mock.get(CONST.PANEL_URL, text=load_fixture("panel.json", "abode")) # Mocks the automations response for abodepy. - requests_mock.get(CONST.AUTOMATION_URL, text=load_fixture("abode_automation.json")) + requests_mock.get( + CONST.AUTOMATION_URL, text=load_fixture("automation.json", "abode") + ) # Mocks the devices response for abodepy. - requests_mock.get(CONST.DEVICES_URL, text=load_fixture("abode_devices.json")) + requests_mock.get(CONST.DEVICES_URL, text=load_fixture("devices.json", "abode")) diff --git a/tests/fixtures/abode_automation.json b/tests/components/abode/fixtures/automation.json similarity index 100% rename from tests/fixtures/abode_automation.json rename to tests/components/abode/fixtures/automation.json diff --git a/tests/fixtures/abode_automation_changed.json b/tests/components/abode/fixtures/automation_changed.json similarity index 100% rename from tests/fixtures/abode_automation_changed.json rename to tests/components/abode/fixtures/automation_changed.json diff --git a/tests/fixtures/abode_devices.json b/tests/components/abode/fixtures/devices.json similarity index 100% rename from tests/fixtures/abode_devices.json rename to tests/components/abode/fixtures/devices.json diff --git a/tests/fixtures/abode_login.json b/tests/components/abode/fixtures/login.json similarity index 100% rename from tests/fixtures/abode_login.json rename to tests/components/abode/fixtures/login.json diff --git a/tests/fixtures/abode_logout.json b/tests/components/abode/fixtures/logout.json similarity index 100% rename from tests/fixtures/abode_logout.json rename to tests/components/abode/fixtures/logout.json diff --git a/tests/fixtures/abode_oauth_claims.json b/tests/components/abode/fixtures/oauth_claims.json similarity index 100% rename from tests/fixtures/abode_oauth_claims.json rename to tests/components/abode/fixtures/oauth_claims.json diff --git a/tests/fixtures/abode_panel.json b/tests/components/abode/fixtures/panel.json similarity index 100% rename from tests/fixtures/abode_panel.json rename to tests/components/abode/fixtures/panel.json diff --git a/tests/fixtures/accuweather/current_conditions_data.json b/tests/components/accuweather/fixtures/current_conditions_data.json similarity index 100% rename from tests/fixtures/accuweather/current_conditions_data.json rename to tests/components/accuweather/fixtures/current_conditions_data.json diff --git a/tests/fixtures/accuweather/forecast_data.json b/tests/components/accuweather/fixtures/forecast_data.json similarity index 100% rename from tests/fixtures/accuweather/forecast_data.json rename to tests/components/accuweather/fixtures/forecast_data.json diff --git a/tests/fixtures/accuweather/location_data.json b/tests/components/accuweather/fixtures/location_data.json similarity index 100% rename from tests/fixtures/accuweather/location_data.json rename to tests/components/accuweather/fixtures/location_data.json diff --git a/tests/fixtures/advantage_air/getSystemData.json b/tests/components/advantage_air/fixtures/getSystemData.json similarity index 100% rename from tests/fixtures/advantage_air/getSystemData.json rename to tests/components/advantage_air/fixtures/getSystemData.json diff --git a/tests/fixtures/advantage_air/setAircon.json b/tests/components/advantage_air/fixtures/setAircon.json similarity index 100% rename from tests/fixtures/advantage_air/setAircon.json rename to tests/components/advantage_air/fixtures/setAircon.json diff --git a/tests/fixtures/aemet/station-3195-data.json b/tests/components/aemet/fixtures/station-3195-data.json similarity index 100% rename from tests/fixtures/aemet/station-3195-data.json rename to tests/components/aemet/fixtures/station-3195-data.json diff --git a/tests/fixtures/aemet/station-3195.json b/tests/components/aemet/fixtures/station-3195.json similarity index 100% rename from tests/fixtures/aemet/station-3195.json rename to tests/components/aemet/fixtures/station-3195.json diff --git a/tests/fixtures/aemet/station-list-data.json b/tests/components/aemet/fixtures/station-list-data.json similarity index 100% rename from tests/fixtures/aemet/station-list-data.json rename to tests/components/aemet/fixtures/station-list-data.json diff --git a/tests/fixtures/aemet/station-list.json b/tests/components/aemet/fixtures/station-list.json similarity index 100% rename from tests/fixtures/aemet/station-list.json rename to tests/components/aemet/fixtures/station-list.json diff --git a/tests/fixtures/aemet/town-28065-forecast-daily-data.json b/tests/components/aemet/fixtures/town-28065-forecast-daily-data.json similarity index 100% rename from tests/fixtures/aemet/town-28065-forecast-daily-data.json rename to tests/components/aemet/fixtures/town-28065-forecast-daily-data.json diff --git a/tests/fixtures/aemet/town-28065-forecast-daily.json b/tests/components/aemet/fixtures/town-28065-forecast-daily.json similarity index 100% rename from tests/fixtures/aemet/town-28065-forecast-daily.json rename to tests/components/aemet/fixtures/town-28065-forecast-daily.json diff --git a/tests/fixtures/aemet/town-28065-forecast-hourly-data.json b/tests/components/aemet/fixtures/town-28065-forecast-hourly-data.json similarity index 100% rename from tests/fixtures/aemet/town-28065-forecast-hourly-data.json rename to tests/components/aemet/fixtures/town-28065-forecast-hourly-data.json diff --git a/tests/fixtures/aemet/town-28065-forecast-hourly.json b/tests/components/aemet/fixtures/town-28065-forecast-hourly.json similarity index 100% rename from tests/fixtures/aemet/town-28065-forecast-hourly.json rename to tests/components/aemet/fixtures/town-28065-forecast-hourly.json diff --git a/tests/fixtures/aemet/town-id28065.json b/tests/components/aemet/fixtures/town-id28065.json similarity index 100% rename from tests/fixtures/aemet/town-id28065.json rename to tests/components/aemet/fixtures/town-id28065.json diff --git a/tests/fixtures/aemet/town-list.json b/tests/components/aemet/fixtures/town-list.json similarity index 100% rename from tests/fixtures/aemet/town-list.json rename to tests/components/aemet/fixtures/town-list.json diff --git a/tests/fixtures/agent_dvr/objects.json b/tests/components/agent_dvr/fixtures/objects.json similarity index 100% rename from tests/fixtures/agent_dvr/objects.json rename to tests/components/agent_dvr/fixtures/objects.json diff --git a/tests/fixtures/agent_dvr/status.json b/tests/components/agent_dvr/fixtures/status.json similarity index 100% rename from tests/fixtures/agent_dvr/status.json rename to tests/components/agent_dvr/fixtures/status.json diff --git a/tests/components/airly/__init__.py b/tests/components/airly/__init__.py index 64f2059857a..452df6d9c27 100644 --- a/tests/components/airly/__init__.py +++ b/tests/components/airly/__init__.py @@ -23,7 +23,7 @@ async def init_integration(hass, aioclient_mock) -> MockConfigEntry: }, ) - aioclient_mock.get(API_POINT_URL, text=load_fixture("airly_valid_station.json")) + aioclient_mock.get(API_POINT_URL, text=load_fixture("valid_station.json", "airly")) entry.add_to_hass(hass) await hass.config_entries.async_setup(entry.entry_id) await hass.async_block_till_done() diff --git a/tests/fixtures/airly_no_station.json b/tests/components/airly/fixtures/no_station.json similarity index 100% rename from tests/fixtures/airly_no_station.json rename to tests/components/airly/fixtures/no_station.json diff --git a/tests/fixtures/airly_valid_station.json b/tests/components/airly/fixtures/valid_station.json similarity index 100% rename from tests/fixtures/airly_valid_station.json rename to tests/components/airly/fixtures/valid_station.json diff --git a/tests/components/airly/test_config_flow.py b/tests/components/airly/test_config_flow.py index c19618da0a7..8b593e85cf4 100644 --- a/tests/components/airly/test_config_flow.py +++ b/tests/components/airly/test_config_flow.py @@ -48,7 +48,7 @@ async def test_invalid_api_key(hass, aioclient_mock): async def test_invalid_location(hass, aioclient_mock): """Test that errors are shown when location is invalid.""" - aioclient_mock.get(API_POINT_URL, text=load_fixture("airly_no_station.json")) + aioclient_mock.get(API_POINT_URL, text=load_fixture("no_station.json", "airly")) aioclient_mock.get( API_NEAREST_URL, @@ -64,7 +64,7 @@ async def test_invalid_location(hass, aioclient_mock): async def test_duplicate_error(hass, aioclient_mock): """Test that errors are shown when duplicates are added.""" - aioclient_mock.get(API_POINT_URL, text=load_fixture("airly_valid_station.json")) + aioclient_mock.get(API_POINT_URL, text=load_fixture("valid_station.json", "airly")) MockConfigEntry(domain=DOMAIN, unique_id="123-456", data=CONFIG).add_to_hass(hass) result = await hass.config_entries.flow.async_init( @@ -77,7 +77,7 @@ async def test_duplicate_error(hass, aioclient_mock): async def test_create_entry(hass, aioclient_mock): """Test that the user step works.""" - aioclient_mock.get(API_POINT_URL, text=load_fixture("airly_valid_station.json")) + aioclient_mock.get(API_POINT_URL, text=load_fixture("valid_station.json", "airly")) with patch("homeassistant.components.airly.async_setup_entry", return_value=True): result = await hass.config_entries.flow.async_init( @@ -95,9 +95,11 @@ async def test_create_entry(hass, aioclient_mock): async def test_create_entry_with_nearest_method(hass, aioclient_mock): """Test that the user step works with nearest method.""" - aioclient_mock.get(API_POINT_URL, text=load_fixture("airly_no_station.json")) + aioclient_mock.get(API_POINT_URL, text=load_fixture("no_station.json", "airly")) - aioclient_mock.get(API_NEAREST_URL, text=load_fixture("airly_valid_station.json")) + aioclient_mock.get( + API_NEAREST_URL, text=load_fixture("valid_station.json", "airly") + ) with patch("homeassistant.components.airly.async_setup_entry", return_value=True): result = await hass.config_entries.flow.async_init( diff --git a/tests/components/airly/test_init.py b/tests/components/airly/test_init.py index 252c01c124a..434c7e5022f 100644 --- a/tests/components/airly/test_init.py +++ b/tests/components/airly/test_init.py @@ -66,7 +66,7 @@ async def test_config_without_unique_id(hass, aioclient_mock): }, ) - aioclient_mock.get(API_POINT_URL, text=load_fixture("airly_valid_station.json")) + aioclient_mock.get(API_POINT_URL, text=load_fixture("valid_station.json", "airly")) entry.add_to_hass(hass) await hass.config_entries.async_setup(entry.entry_id) assert entry.state is ConfigEntryState.LOADED @@ -87,7 +87,7 @@ async def test_config_with_turned_off_station(hass, aioclient_mock): }, ) - aioclient_mock.get(API_POINT_URL, text=load_fixture("airly_no_station.json")) + aioclient_mock.get(API_POINT_URL, text=load_fixture("no_station.json", "airly")) entry.add_to_hass(hass) await hass.config_entries.async_setup(entry.entry_id) assert entry.state is ConfigEntryState.SETUP_RETRY @@ -115,7 +115,7 @@ async def test_update_interval(hass, aioclient_mock): aioclient_mock.get( API_POINT_URL, - text=load_fixture("airly_valid_station.json"), + text=load_fixture("valid_station.json", "airly"), headers=HEADERS, ) entry.add_to_hass(hass) @@ -152,7 +152,7 @@ async def test_update_interval(hass, aioclient_mock): aioclient_mock.get( "https://airapi.airly.eu/v2/measurements/point?lat=66.660000&lng=111.110000", - text=load_fixture("airly_valid_station.json"), + text=load_fixture("valid_station.json", "airly"), headers=HEADERS, ) entry.add_to_hass(hass) @@ -203,7 +203,7 @@ async def test_migrate_device_entry(hass, aioclient_mock, old_identifier): }, ) - aioclient_mock.get(API_POINT_URL, text=load_fixture("airly_valid_station.json")) + aioclient_mock.get(API_POINT_URL, text=load_fixture("valid_station.json", "airly")) config_entry.add_to_hass(hass) device_reg = mock_device_registry(hass) diff --git a/tests/components/airly/test_sensor.py b/tests/components/airly/test_sensor.py index cd17c692176..71912bb768b 100644 --- a/tests/components/airly/test_sensor.py +++ b/tests/components/airly/test_sensor.py @@ -149,7 +149,7 @@ async def test_availability(hass, aioclient_mock): assert state.state == STATE_UNAVAILABLE aioclient_mock.clear_requests() - aioclient_mock.get(API_POINT_URL, text=load_fixture("airly_valid_station.json")) + aioclient_mock.get(API_POINT_URL, text=load_fixture("valid_station.json", "airly")) future = utcnow() + timedelta(minutes=120) async_fire_time_changed(hass, future) await hass.async_block_till_done() diff --git a/tests/fixtures/ambee/air_quality.json b/tests/components/ambee/fixtures/air_quality.json similarity index 100% rename from tests/fixtures/ambee/air_quality.json rename to tests/components/ambee/fixtures/air_quality.json diff --git a/tests/fixtures/ambee/pollen.json b/tests/components/ambee/fixtures/pollen.json similarity index 100% rename from tests/fixtures/ambee/pollen.json rename to tests/components/ambee/fixtures/pollen.json diff --git a/tests/fixtures/august/get_activity.bridge_offline.json b/tests/components/august/fixtures/get_activity.bridge_offline.json similarity index 100% rename from tests/fixtures/august/get_activity.bridge_offline.json rename to tests/components/august/fixtures/get_activity.bridge_offline.json diff --git a/tests/fixtures/august/get_activity.bridge_online.json b/tests/components/august/fixtures/get_activity.bridge_online.json similarity index 100% rename from tests/fixtures/august/get_activity.bridge_online.json rename to tests/components/august/fixtures/get_activity.bridge_online.json diff --git a/tests/fixtures/august/get_activity.doorbell_motion.json b/tests/components/august/fixtures/get_activity.doorbell_motion.json similarity index 100% rename from tests/fixtures/august/get_activity.doorbell_motion.json rename to tests/components/august/fixtures/get_activity.doorbell_motion.json diff --git a/tests/fixtures/august/get_activity.jammed.json b/tests/components/august/fixtures/get_activity.jammed.json similarity index 100% rename from tests/fixtures/august/get_activity.jammed.json rename to tests/components/august/fixtures/get_activity.jammed.json diff --git a/tests/fixtures/august/get_activity.lock.json b/tests/components/august/fixtures/get_activity.lock.json similarity index 100% rename from tests/fixtures/august/get_activity.lock.json rename to tests/components/august/fixtures/get_activity.lock.json diff --git a/tests/fixtures/august/get_activity.lock_from_autorelock.json b/tests/components/august/fixtures/get_activity.lock_from_autorelock.json similarity index 100% rename from tests/fixtures/august/get_activity.lock_from_autorelock.json rename to tests/components/august/fixtures/get_activity.lock_from_autorelock.json diff --git a/tests/fixtures/august/get_activity.lock_from_bluetooth.json b/tests/components/august/fixtures/get_activity.lock_from_bluetooth.json similarity index 100% rename from tests/fixtures/august/get_activity.lock_from_bluetooth.json rename to tests/components/august/fixtures/get_activity.lock_from_bluetooth.json diff --git a/tests/fixtures/august/get_activity.lock_from_keypad.json b/tests/components/august/fixtures/get_activity.lock_from_keypad.json similarity index 100% rename from tests/fixtures/august/get_activity.lock_from_keypad.json rename to tests/components/august/fixtures/get_activity.lock_from_keypad.json diff --git a/tests/fixtures/august/get_activity.locking.json b/tests/components/august/fixtures/get_activity.locking.json similarity index 100% rename from tests/fixtures/august/get_activity.locking.json rename to tests/components/august/fixtures/get_activity.locking.json diff --git a/tests/fixtures/august/get_activity.unlocking.json b/tests/components/august/fixtures/get_activity.unlocking.json similarity index 100% rename from tests/fixtures/august/get_activity.unlocking.json rename to tests/components/august/fixtures/get_activity.unlocking.json diff --git a/tests/fixtures/august/get_doorbell.json b/tests/components/august/fixtures/get_doorbell.json similarity index 100% rename from tests/fixtures/august/get_doorbell.json rename to tests/components/august/fixtures/get_doorbell.json diff --git a/tests/fixtures/august/get_doorbell.nobattery.json b/tests/components/august/fixtures/get_doorbell.nobattery.json similarity index 100% rename from tests/fixtures/august/get_doorbell.nobattery.json rename to tests/components/august/fixtures/get_doorbell.nobattery.json diff --git a/tests/fixtures/august/get_doorbell.offline.json b/tests/components/august/fixtures/get_doorbell.offline.json similarity index 100% rename from tests/fixtures/august/get_doorbell.offline.json rename to tests/components/august/fixtures/get_doorbell.offline.json diff --git a/tests/fixtures/august/get_lock.doorsense_init.json b/tests/components/august/fixtures/get_lock.doorsense_init.json similarity index 100% rename from tests/fixtures/august/get_lock.doorsense_init.json rename to tests/components/august/fixtures/get_lock.doorsense_init.json diff --git a/tests/fixtures/august/get_lock.low_keypad_battery.json b/tests/components/august/fixtures/get_lock.low_keypad_battery.json similarity index 100% rename from tests/fixtures/august/get_lock.low_keypad_battery.json rename to tests/components/august/fixtures/get_lock.low_keypad_battery.json diff --git a/tests/fixtures/august/get_lock.offline.json b/tests/components/august/fixtures/get_lock.offline.json similarity index 100% rename from tests/fixtures/august/get_lock.offline.json rename to tests/components/august/fixtures/get_lock.offline.json diff --git a/tests/fixtures/august/get_lock.online.json b/tests/components/august/fixtures/get_lock.online.json similarity index 100% rename from tests/fixtures/august/get_lock.online.json rename to tests/components/august/fixtures/get_lock.online.json diff --git a/tests/fixtures/august/get_lock.online.unknown_state.json b/tests/components/august/fixtures/get_lock.online.unknown_state.json similarity index 100% rename from tests/fixtures/august/get_lock.online.unknown_state.json rename to tests/components/august/fixtures/get_lock.online.unknown_state.json diff --git a/tests/fixtures/august/get_lock.online_missing_doorsense.json b/tests/components/august/fixtures/get_lock.online_missing_doorsense.json similarity index 100% rename from tests/fixtures/august/get_lock.online_missing_doorsense.json rename to tests/components/august/fixtures/get_lock.online_missing_doorsense.json diff --git a/tests/fixtures/august/get_lock.online_with_doorsense.json b/tests/components/august/fixtures/get_lock.online_with_doorsense.json similarity index 100% rename from tests/fixtures/august/get_lock.online_with_doorsense.json rename to tests/components/august/fixtures/get_lock.online_with_doorsense.json diff --git a/tests/fixtures/august/get_locks.json b/tests/components/august/fixtures/get_locks.json similarity index 100% rename from tests/fixtures/august/get_locks.json rename to tests/components/august/fixtures/get_locks.json diff --git a/tests/fixtures/august/lock_open.json b/tests/components/august/fixtures/lock_open.json similarity index 100% rename from tests/fixtures/august/lock_open.json rename to tests/components/august/fixtures/lock_open.json diff --git a/tests/fixtures/august/unlock_closed.json b/tests/components/august/fixtures/unlock_closed.json similarity index 100% rename from tests/fixtures/august/unlock_closed.json rename to tests/components/august/fixtures/unlock_closed.json diff --git a/tests/fixtures/awair/awair-offline.json b/tests/components/awair/fixtures/awair-offline.json similarity index 100% rename from tests/fixtures/awair/awair-offline.json rename to tests/components/awair/fixtures/awair-offline.json diff --git a/tests/fixtures/awair/awair-r2.json b/tests/components/awair/fixtures/awair-r2.json similarity index 100% rename from tests/fixtures/awair/awair-r2.json rename to tests/components/awair/fixtures/awair-r2.json diff --git a/tests/fixtures/awair/awair.json b/tests/components/awair/fixtures/awair.json similarity index 100% rename from tests/fixtures/awair/awair.json rename to tests/components/awair/fixtures/awair.json diff --git a/tests/fixtures/awair/devices.json b/tests/components/awair/fixtures/devices.json similarity index 100% rename from tests/fixtures/awair/devices.json rename to tests/components/awair/fixtures/devices.json diff --git a/tests/fixtures/awair/glow.json b/tests/components/awair/fixtures/glow.json similarity index 100% rename from tests/fixtures/awair/glow.json rename to tests/components/awair/fixtures/glow.json diff --git a/tests/fixtures/awair/mint.json b/tests/components/awair/fixtures/mint.json similarity index 100% rename from tests/fixtures/awair/mint.json rename to tests/components/awair/fixtures/mint.json diff --git a/tests/fixtures/awair/no_devices.json b/tests/components/awair/fixtures/no_devices.json similarity index 100% rename from tests/fixtures/awair/no_devices.json rename to tests/components/awair/fixtures/no_devices.json diff --git a/tests/fixtures/awair/omni.json b/tests/components/awair/fixtures/omni.json similarity index 100% rename from tests/fixtures/awair/omni.json rename to tests/components/awair/fixtures/omni.json diff --git a/tests/fixtures/awair/user.json b/tests/components/awair/fixtures/user.json similarity index 100% rename from tests/fixtures/awair/user.json rename to tests/components/awair/fixtures/user.json diff --git a/tests/fixtures/bayesian/configuration.yaml b/tests/components/bayesian/fixtures/configuration.yaml similarity index 100% rename from tests/fixtures/bayesian/configuration.yaml rename to tests/components/bayesian/fixtures/configuration.yaml diff --git a/tests/components/bayesian/test_binary_sensor.py b/tests/components/bayesian/test_binary_sensor.py index 9c181e90deb..c2f289b0697 100644 --- a/tests/components/bayesian/test_binary_sensor.py +++ b/tests/components/bayesian/test_binary_sensor.py @@ -1,6 +1,5 @@ """The test for the bayesian sensor platform.""" import json -from os import path from unittest.mock import patch from homeassistant import config as hass_config @@ -19,6 +18,8 @@ from homeassistant.const import ( from homeassistant.core import Context, callback from homeassistant.setup import async_setup_component +from tests.common import get_fixture_path + async def test_load_values_when_added_to_hass(hass): """Test that sensor initializes with observations of relevant entities.""" @@ -666,11 +667,8 @@ async def test_reload(hass): assert hass.states.get("binary_sensor.test") - yaml_path = path.join( - _get_fixtures_base_path(), - "fixtures", - "bayesian/configuration.yaml", - ) + yaml_path = get_fixture_path("configuration.yaml", "bayesian") + with patch.object(hass_config, "YAML_CONFIG_FILE", yaml_path): await hass.services.async_call( DOMAIN, @@ -686,10 +684,6 @@ async def test_reload(hass): assert hass.states.get("binary_sensor.test2") -def _get_fixtures_base_path(): - return path.dirname(path.dirname(path.dirname(__file__))) - - async def test_template_triggers(hass): """Test sensor with template triggers.""" hass.states.async_set("input_boolean.test", STATE_OFF) diff --git a/tests/fixtures/blueprint/community_post.json b/tests/components/blueprint/fixtures/community_post.json similarity index 100% rename from tests/fixtures/blueprint/community_post.json rename to tests/components/blueprint/fixtures/community_post.json diff --git a/tests/fixtures/blueprint/github_gist.json b/tests/components/blueprint/fixtures/github_gist.json similarity index 100% rename from tests/fixtures/blueprint/github_gist.json rename to tests/components/blueprint/fixtures/github_gist.json diff --git a/tests/components/brother/__init__.py b/tests/components/brother/__init__.py index b4706d56fba..57cbe8b71de 100644 --- a/tests/components/brother/__init__.py +++ b/tests/components/brother/__init__.py @@ -22,7 +22,7 @@ async def init_integration(hass, skip_setup=False) -> MockConfigEntry: if not skip_setup: with patch( "brother.Brother._get_data", - return_value=json.loads(load_fixture("brother_printer_data.json")), + return_value=json.loads(load_fixture("printer_data.json", "brother")), ): await hass.config_entries.async_setup(entry.entry_id) await hass.async_block_till_done() diff --git a/tests/fixtures/brother_printer_data.json b/tests/components/brother/fixtures/printer_data.json similarity index 100% rename from tests/fixtures/brother_printer_data.json rename to tests/components/brother/fixtures/printer_data.json diff --git a/tests/components/brother/test_config_flow.py b/tests/components/brother/test_config_flow.py index b7e4b31cfab..70c42884bf9 100644 --- a/tests/components/brother/test_config_flow.py +++ b/tests/components/brother/test_config_flow.py @@ -28,7 +28,7 @@ async def test_create_entry_with_hostname(hass): """Test that the user step works with printer hostname.""" with patch( "brother.Brother._get_data", - return_value=json.loads(load_fixture("brother_printer_data.json")), + return_value=json.loads(load_fixture("printer_data.json", "brother")), ): result = await hass.config_entries.flow.async_init( DOMAIN, context={"source": SOURCE_USER}, data=CONFIG @@ -44,7 +44,7 @@ async def test_create_entry_with_ipv4_address(hass): """Test that the user step works with printer IPv4 address.""" with patch( "brother.Brother._get_data", - return_value=json.loads(load_fixture("brother_printer_data.json")), + return_value=json.loads(load_fixture("printer_data.json", "brother")), ): result = await hass.config_entries.flow.async_init( DOMAIN, @@ -62,7 +62,7 @@ async def test_create_entry_with_ipv6_address(hass): """Test that the user step works with printer IPv6 address.""" with patch( "brother.Brother._get_data", - return_value=json.loads(load_fixture("brother_printer_data.json")), + return_value=json.loads(load_fixture("printer_data.json", "brother")), ): result = await hass.config_entries.flow.async_init( DOMAIN, @@ -123,7 +123,7 @@ async def test_device_exists_abort(hass): """Test we abort config flow if Brother printer already configured.""" with patch( "brother.Brother._get_data", - return_value=json.loads(load_fixture("brother_printer_data.json")), + return_value=json.loads(load_fixture("printer_data.json", "brother")), ): MockConfigEntry(domain=DOMAIN, unique_id="0123456789", data=CONFIG).add_to_hass( hass @@ -172,7 +172,7 @@ async def test_zeroconf_device_exists_abort(hass): """Test we abort zeroconf flow if Brother printer already configured.""" with patch( "brother.Brother._get_data", - return_value=json.loads(load_fixture("brother_printer_data.json")), + return_value=json.loads(load_fixture("printer_data.json", "brother")), ): MockConfigEntry(domain=DOMAIN, unique_id="0123456789", data=CONFIG).add_to_hass( hass @@ -209,7 +209,7 @@ async def test_zeroconf_confirm_create_entry(hass): """Test zeroconf confirmation and create config entry.""" with patch( "brother.Brother._get_data", - return_value=json.loads(load_fixture("brother_printer_data.json")), + return_value=json.loads(load_fixture("printer_data.json", "brother")), ): result = await hass.config_entries.flow.async_init( diff --git a/tests/components/brother/test_sensor.py b/tests/components/brother/test_sensor.py index b51577b5f3d..1f103390b0a 100644 --- a/tests/components/brother/test_sensor.py +++ b/tests/components/brother/test_sensor.py @@ -46,7 +46,7 @@ async def test_sensors(hass): test_time = datetime(2019, 11, 11, 9, 10, 32, tzinfo=UTC) with patch("brother.datetime", utcnow=Mock(return_value=test_time)), patch( "brother.Brother._get_data", - return_value=json.loads(load_fixture("brother_printer_data.json")), + return_value=json.loads(load_fixture("printer_data.json", "brother")), ): await hass.config_entries.async_setup(entry.entry_id) await hass.async_block_till_done() @@ -296,7 +296,7 @@ async def test_availability(hass): future = utcnow() + timedelta(minutes=10) with patch( "brother.Brother._get_data", - return_value=json.loads(load_fixture("brother_printer_data.json")), + return_value=json.loads(load_fixture("printer_data.json", "brother")), ): async_fire_time_changed(hass, future) await hass.async_block_till_done() @@ -311,7 +311,7 @@ async def test_manual_update_entity(hass): """Test manual update entity via service homeasasistant/update_entity.""" await init_integration(hass) - data = json.loads(load_fixture("brother_printer_data.json")) + data = json.loads(load_fixture("printer_data.json", "brother")) await async_setup_component(hass, "homeassistant", {}) with patch( diff --git a/tests/fixtures/bsblan/info.json b/tests/components/bsblan/fixtures/info.json similarity index 100% rename from tests/fixtures/bsblan/info.json rename to tests/components/bsblan/fixtures/info.json diff --git a/tests/fixtures/climacell/v3_forecast_daily.json b/tests/components/climacell/fixtures/v3_forecast_daily.json similarity index 100% rename from tests/fixtures/climacell/v3_forecast_daily.json rename to tests/components/climacell/fixtures/v3_forecast_daily.json diff --git a/tests/fixtures/climacell/v3_forecast_hourly.json b/tests/components/climacell/fixtures/v3_forecast_hourly.json similarity index 100% rename from tests/fixtures/climacell/v3_forecast_hourly.json rename to tests/components/climacell/fixtures/v3_forecast_hourly.json diff --git a/tests/fixtures/climacell/v3_forecast_nowcast.json b/tests/components/climacell/fixtures/v3_forecast_nowcast.json similarity index 100% rename from tests/fixtures/climacell/v3_forecast_nowcast.json rename to tests/components/climacell/fixtures/v3_forecast_nowcast.json diff --git a/tests/fixtures/climacell/v3_realtime.json b/tests/components/climacell/fixtures/v3_realtime.json similarity index 100% rename from tests/fixtures/climacell/v3_realtime.json rename to tests/components/climacell/fixtures/v3_realtime.json diff --git a/tests/fixtures/climacell/v4.json b/tests/components/climacell/fixtures/v4.json similarity index 100% rename from tests/fixtures/climacell/v4.json rename to tests/components/climacell/fixtures/v4.json diff --git a/tests/fixtures/command_line/configuration.yaml b/tests/components/command_line/fixtures/configuration.yaml similarity index 100% rename from tests/fixtures/command_line/configuration.yaml rename to tests/components/command_line/fixtures/configuration.yaml diff --git a/tests/components/command_line/test_cover.py b/tests/components/command_line/test_cover.py index d0b36d31c37..0a37449c184 100644 --- a/tests/components/command_line/test_cover.py +++ b/tests/components/command_line/test_cover.py @@ -18,7 +18,7 @@ from homeassistant.const import ( from homeassistant.core import HomeAssistant import homeassistant.util.dt as dt_util -from tests.common import async_fire_time_changed +from tests.common import async_fire_time_changed, get_fixture_path async def setup_test_entity(hass: HomeAssistant, config_dict: dict[str, Any]) -> None: @@ -133,11 +133,7 @@ async def test_reload(hass: HomeAssistant) -> None: assert entity_state assert entity_state.state == "unknown" - yaml_path = os.path.join( - os.path.dirname(os.path.dirname(os.path.dirname(__file__))), - "fixtures", - "command_line/configuration.yaml", - ) + yaml_path = get_fixture_path("configuration.yaml", "command_line") with patch.object(hass_config, "YAML_CONFIG_FILE", yaml_path): await hass.services.async_call( "command_line", diff --git a/tests/components/dexcom/__init__.py b/tests/components/dexcom/__init__.py index 16c6f4b4d45..acf03725d32 100644 --- a/tests/components/dexcom/__init__.py +++ b/tests/components/dexcom/__init__.py @@ -16,7 +16,7 @@ CONFIG = { CONF_SERVER: SERVER_US, } -GLUCOSE_READING = GlucoseReading(json.loads(load_fixture("dexcom_data.json"))) +GLUCOSE_READING = GlucoseReading(json.loads(load_fixture("data.json", "dexcom"))) async def init_integration(hass) -> MockConfigEntry: diff --git a/tests/fixtures/dexcom_data.json b/tests/components/dexcom/fixtures/data.json similarity index 100% rename from tests/fixtures/dexcom_data.json rename to tests/components/dexcom/fixtures/data.json diff --git a/tests/fixtures/directv/info-get-locations.json b/tests/components/directv/fixtures/info-get-locations.json similarity index 100% rename from tests/fixtures/directv/info-get-locations.json rename to tests/components/directv/fixtures/info-get-locations.json diff --git a/tests/fixtures/directv/info-get-version.json b/tests/components/directv/fixtures/info-get-version.json similarity index 100% rename from tests/fixtures/directv/info-get-version.json rename to tests/components/directv/fixtures/info-get-version.json diff --git a/tests/fixtures/directv/info-mode-error.json b/tests/components/directv/fixtures/info-mode-error.json similarity index 100% rename from tests/fixtures/directv/info-mode-error.json rename to tests/components/directv/fixtures/info-mode-error.json diff --git a/tests/fixtures/directv/info-mode-standby.json b/tests/components/directv/fixtures/info-mode-standby.json similarity index 100% rename from tests/fixtures/directv/info-mode-standby.json rename to tests/components/directv/fixtures/info-mode-standby.json diff --git a/tests/fixtures/directv/info-mode.json b/tests/components/directv/fixtures/info-mode.json similarity index 100% rename from tests/fixtures/directv/info-mode.json rename to tests/components/directv/fixtures/info-mode.json diff --git a/tests/fixtures/directv/remote-process-key.json b/tests/components/directv/fixtures/remote-process-key.json similarity index 100% rename from tests/fixtures/directv/remote-process-key.json rename to tests/components/directv/fixtures/remote-process-key.json diff --git a/tests/fixtures/directv/tv-get-tuned-movie.json b/tests/components/directv/fixtures/tv-get-tuned-movie.json similarity index 100% rename from tests/fixtures/directv/tv-get-tuned-movie.json rename to tests/components/directv/fixtures/tv-get-tuned-movie.json diff --git a/tests/fixtures/directv/tv-get-tuned-music.json b/tests/components/directv/fixtures/tv-get-tuned-music.json similarity index 100% rename from tests/fixtures/directv/tv-get-tuned-music.json rename to tests/components/directv/fixtures/tv-get-tuned-music.json diff --git a/tests/fixtures/directv/tv-get-tuned-restricted.json b/tests/components/directv/fixtures/tv-get-tuned-restricted.json similarity index 100% rename from tests/fixtures/directv/tv-get-tuned-restricted.json rename to tests/components/directv/fixtures/tv-get-tuned-restricted.json diff --git a/tests/fixtures/directv/tv-get-tuned.json b/tests/components/directv/fixtures/tv-get-tuned.json similarity index 100% rename from tests/fixtures/directv/tv-get-tuned.json rename to tests/components/directv/fixtures/tv-get-tuned.json diff --git a/tests/fixtures/directv/tv-tune.json b/tests/components/directv/fixtures/tv-tune.json similarity index 100% rename from tests/fixtures/directv/tv-tune.json rename to tests/components/directv/fixtures/tv-tune.json diff --git a/tests/fixtures/ecobee/ecobee-data.json b/tests/components/ecobee/fixtures/ecobee-data.json similarity index 100% rename from tests/fixtures/ecobee/ecobee-data.json rename to tests/components/ecobee/fixtures/ecobee-data.json diff --git a/tests/fixtures/ecobee/ecobee-token.json b/tests/components/ecobee/fixtures/ecobee-token.json similarity index 100% rename from tests/fixtures/ecobee/ecobee-token.json rename to tests/components/ecobee/fixtures/ecobee-token.json diff --git a/tests/fixtures/efergy/budget.json b/tests/components/efergy/fixtures/budget.json similarity index 100% rename from tests/fixtures/efergy/budget.json rename to tests/components/efergy/fixtures/budget.json diff --git a/tests/fixtures/efergy/current_values_multi.json b/tests/components/efergy/fixtures/current_values_multi.json similarity index 100% rename from tests/fixtures/efergy/current_values_multi.json rename to tests/components/efergy/fixtures/current_values_multi.json diff --git a/tests/fixtures/efergy/current_values_single.json b/tests/components/efergy/fixtures/current_values_single.json similarity index 100% rename from tests/fixtures/efergy/current_values_single.json rename to tests/components/efergy/fixtures/current_values_single.json diff --git a/tests/fixtures/efergy/daily_cost.json b/tests/components/efergy/fixtures/daily_cost.json similarity index 100% rename from tests/fixtures/efergy/daily_cost.json rename to tests/components/efergy/fixtures/daily_cost.json diff --git a/tests/fixtures/efergy/daily_energy.json b/tests/components/efergy/fixtures/daily_energy.json similarity index 100% rename from tests/fixtures/efergy/daily_energy.json rename to tests/components/efergy/fixtures/daily_energy.json diff --git a/tests/fixtures/efergy/instant.json b/tests/components/efergy/fixtures/instant.json similarity index 100% rename from tests/fixtures/efergy/instant.json rename to tests/components/efergy/fixtures/instant.json diff --git a/tests/fixtures/efergy/monthly_cost.json b/tests/components/efergy/fixtures/monthly_cost.json similarity index 100% rename from tests/fixtures/efergy/monthly_cost.json rename to tests/components/efergy/fixtures/monthly_cost.json diff --git a/tests/fixtures/efergy/monthly_energy.json b/tests/components/efergy/fixtures/monthly_energy.json similarity index 100% rename from tests/fixtures/efergy/monthly_energy.json rename to tests/components/efergy/fixtures/monthly_energy.json diff --git a/tests/fixtures/efergy/status.json b/tests/components/efergy/fixtures/status.json similarity index 100% rename from tests/fixtures/efergy/status.json rename to tests/components/efergy/fixtures/status.json diff --git a/tests/fixtures/efergy/weekly_cost.json b/tests/components/efergy/fixtures/weekly_cost.json similarity index 100% rename from tests/fixtures/efergy/weekly_cost.json rename to tests/components/efergy/fixtures/weekly_cost.json diff --git a/tests/fixtures/efergy/weekly_energy.json b/tests/components/efergy/fixtures/weekly_energy.json similarity index 100% rename from tests/fixtures/efergy/weekly_energy.json rename to tests/components/efergy/fixtures/weekly_energy.json diff --git a/tests/fixtures/efergy/yearly_cost.json b/tests/components/efergy/fixtures/yearly_cost.json similarity index 100% rename from tests/fixtures/efergy/yearly_cost.json rename to tests/components/efergy/fixtures/yearly_cost.json diff --git a/tests/fixtures/efergy/yearly_energy.json b/tests/components/efergy/fixtures/yearly_energy.json similarity index 100% rename from tests/fixtures/efergy/yearly_energy.json rename to tests/components/efergy/fixtures/yearly_energy.json diff --git a/tests/fixtures/elgato/info.json b/tests/components/elgato/fixtures/info.json similarity index 100% rename from tests/fixtures/elgato/info.json rename to tests/components/elgato/fixtures/info.json diff --git a/tests/fixtures/elgato/settings-color.json b/tests/components/elgato/fixtures/settings-color.json similarity index 100% rename from tests/fixtures/elgato/settings-color.json rename to tests/components/elgato/fixtures/settings-color.json diff --git a/tests/fixtures/elgato/settings.json b/tests/components/elgato/fixtures/settings.json similarity index 100% rename from tests/fixtures/elgato/settings.json rename to tests/components/elgato/fixtures/settings.json diff --git a/tests/fixtures/elgato/state-color.json b/tests/components/elgato/fixtures/state-color.json similarity index 100% rename from tests/fixtures/elgato/state-color.json rename to tests/components/elgato/fixtures/state-color.json diff --git a/tests/fixtures/elgato/state.json b/tests/components/elgato/fixtures/state.json similarity index 100% rename from tests/fixtures/elgato/state.json rename to tests/components/elgato/fixtures/state.json diff --git a/tests/fixtures/filesize/configuration.yaml b/tests/components/filesize/fixtures/configuration.yaml similarity index 100% rename from tests/fixtures/filesize/configuration.yaml rename to tests/components/filesize/fixtures/configuration.yaml diff --git a/tests/components/filesize/test_sensor.py b/tests/components/filesize/test_sensor.py index 8bb79a8088a..72d0d112f17 100644 --- a/tests/components/filesize/test_sensor.py +++ b/tests/components/filesize/test_sensor.py @@ -10,6 +10,8 @@ from homeassistant.components.filesize.sensor import CONF_FILE_PATHS from homeassistant.const import SERVICE_RELOAD from homeassistant.setup import async_setup_component +from tests.common import get_fixture_path + TEST_DIR = os.path.join(os.path.dirname(__file__)) TEST_FILE = os.path.join(TEST_DIR, "mock_file_test_filesize.txt") @@ -70,11 +72,7 @@ async def test_reload(hass, tmpdir): assert hass.states.get("sensor.file") - yaml_path = os.path.join( - _get_fixtures_base_path(), - "fixtures", - "filesize/configuration.yaml", - ) + yaml_path = get_fixture_path("configuration.yaml", "filesize") with patch.object(hass_config, "YAML_CONFIG_FILE", yaml_path), patch.object( hass.config, "is_allowed_path", return_value=True ): @@ -87,7 +85,3 @@ async def test_reload(hass, tmpdir): await hass.async_block_till_done() assert hass.states.get("sensor.file") is None - - -def _get_fixtures_base_path(): - return os.path.dirname(os.path.dirname(os.path.dirname(__file__))) diff --git a/tests/fixtures/filter/configuration.yaml b/tests/components/filter/fixtures/configuration.yaml similarity index 100% rename from tests/fixtures/filter/configuration.yaml rename to tests/components/filter/fixtures/configuration.yaml diff --git a/tests/components/filter/test_sensor.py b/tests/components/filter/test_sensor.py index 89e8758c661..ec831b79670 100644 --- a/tests/components/filter/test_sensor.py +++ b/tests/components/filter/test_sensor.py @@ -1,6 +1,5 @@ """The test for the data filter sensor platform.""" from datetime import timedelta -from os import path from unittest.mock import patch from pytest import fixture @@ -30,7 +29,11 @@ import homeassistant.core as ha from homeassistant.setup import async_setup_component import homeassistant.util.dt as dt_util -from tests.common import assert_setup_component, async_init_recorder_component +from tests.common import ( + assert_setup_component, + async_init_recorder_component, + get_fixture_path, +) @fixture @@ -184,11 +187,7 @@ async def test_source_state_none(hass, values): assert state.state == "0.0" # Force Template Reload - yaml_path = path.join( - _get_fixtures_base_path(), - "fixtures", - "template/sensor_configuration.yaml", - ) + yaml_path = get_fixture_path("sensor_configuration.yaml", "template") with patch.object(hass_config, "YAML_CONFIG_FILE", yaml_path): await hass.services.async_call( "template", @@ -478,11 +477,8 @@ async def test_reload(hass): assert hass.states.get("sensor.test") - yaml_path = path.join( - _get_fixtures_base_path(), - "fixtures", - "filter/configuration.yaml", - ) + yaml_path = get_fixture_path("configuration.yaml", "filter") + with patch.object(hass_config, "YAML_CONFIG_FILE", yaml_path): await hass.services.async_call( DOMAIN, @@ -496,7 +492,3 @@ async def test_reload(hass): assert hass.states.get("sensor.test") is None assert hass.states.get("sensor.filtered_realistic_humidity") - - -def _get_fixtures_base_path(): - return path.dirname(path.dirname(path.dirname(__file__))) diff --git a/tests/fixtures/flo/device_info_response.json b/tests/components/flo/fixtures/device_info_response.json similarity index 100% rename from tests/fixtures/flo/device_info_response.json rename to tests/components/flo/fixtures/device_info_response.json diff --git a/tests/fixtures/flo/device_info_response_closed.json b/tests/components/flo/fixtures/device_info_response_closed.json similarity index 100% rename from tests/fixtures/flo/device_info_response_closed.json rename to tests/components/flo/fixtures/device_info_response_closed.json diff --git a/tests/fixtures/flo/device_info_response_detector.json b/tests/components/flo/fixtures/device_info_response_detector.json similarity index 100% rename from tests/fixtures/flo/device_info_response_detector.json rename to tests/components/flo/fixtures/device_info_response_detector.json diff --git a/tests/fixtures/flo/location_info_base_response.json b/tests/components/flo/fixtures/location_info_base_response.json similarity index 100% rename from tests/fixtures/flo/location_info_base_response.json rename to tests/components/flo/fixtures/location_info_base_response.json diff --git a/tests/fixtures/flo/location_info_expand_devices_response.json b/tests/components/flo/fixtures/location_info_expand_devices_response.json similarity index 100% rename from tests/fixtures/flo/location_info_expand_devices_response.json rename to tests/components/flo/fixtures/location_info_expand_devices_response.json diff --git a/tests/fixtures/flo/user_info_base_response.json b/tests/components/flo/fixtures/user_info_base_response.json similarity index 100% rename from tests/fixtures/flo/user_info_base_response.json rename to tests/components/flo/fixtures/user_info_base_response.json diff --git a/tests/fixtures/flo/user_info_expand_locations_response.json b/tests/components/flo/fixtures/user_info_expand_locations_response.json similarity index 100% rename from tests/fixtures/flo/user_info_expand_locations_response.json rename to tests/components/flo/fixtures/user_info_expand_locations_response.json diff --git a/tests/fixtures/flo/water_consumption_info_response.json b/tests/components/flo/fixtures/water_consumption_info_response.json similarity index 100% rename from tests/fixtures/flo/water_consumption_info_response.json rename to tests/components/flo/fixtures/water_consumption_info_response.json diff --git a/tests/fixtures/foobot_data.json b/tests/components/foobot/fixtures/data.json similarity index 100% rename from tests/fixtures/foobot_data.json rename to tests/components/foobot/fixtures/data.json diff --git a/tests/fixtures/foobot_devices.json b/tests/components/foobot/fixtures/devices.json similarity index 100% rename from tests/fixtures/foobot_devices.json rename to tests/components/foobot/fixtures/devices.json diff --git a/tests/components/foobot/test_sensor.py b/tests/components/foobot/test_sensor.py index ec19fb7b94f..7ffa3987110 100644 --- a/tests/components/foobot/test_sensor.py +++ b/tests/components/foobot/test_sensor.py @@ -32,10 +32,11 @@ async def test_default_setup(hass, aioclient_mock): """Test the default setup.""" aioclient_mock.get( re.compile("api.foobot.io/v2/owner/.*"), - text=load_fixture("foobot_devices.json"), + text=load_fixture("devices.json", "foobot"), ) aioclient_mock.get( - re.compile("api.foobot.io/v2/device/.*"), text=load_fixture("foobot_data.json") + re.compile("api.foobot.io/v2/device/.*"), + text=load_fixture("data.json", "foobot"), ) assert await async_setup_component(hass, sensor.DOMAIN, {"sensor": VALID_CONFIG}) await hass.async_block_till_done() diff --git a/tests/fixtures/generic/configuration.yaml b/tests/components/generic/fixtures/configuration.yaml similarity index 100% rename from tests/fixtures/generic/configuration.yaml rename to tests/components/generic/fixtures/configuration.yaml diff --git a/tests/components/generic/test_camera.py b/tests/components/generic/test_camera.py index 36a9304cdc1..9f72520105e 100644 --- a/tests/components/generic/test_camera.py +++ b/tests/components/generic/test_camera.py @@ -1,7 +1,6 @@ """The tests for generic camera component.""" import asyncio from http import HTTPStatus -from os import path from unittest.mock import patch import httpx @@ -13,6 +12,8 @@ from homeassistant.components.websocket_api.const import TYPE_RESULT from homeassistant.const import SERVICE_RELOAD from homeassistant.setup import async_setup_component +from tests.common import get_fixture_path + @respx.mock async def test_fetching_url(hass, hass_client): @@ -379,11 +380,8 @@ async def test_reloading(hass, hass_client): body = await resp.text() assert body == "hello world" - yaml_path = path.join( - _get_fixtures_base_path(), - "fixtures", - "generic/configuration.yaml", - ) + yaml_path = get_fixture_path("configuration.yaml", "generic") + with patch.object(hass_config, "YAML_CONFIG_FILE", yaml_path): await hass.services.async_call( DOMAIN, @@ -456,7 +454,3 @@ async def test_timeout_cancelled(hass, hass_client): assert respx.calls.call_count == total_calls assert resp.status == HTTPStatus.OK assert await resp.text() == "hello world" - - -def _get_fixtures_base_path(): - return path.dirname(path.dirname(path.dirname(__file__))) diff --git a/tests/fixtures/generic_thermostat/configuration.yaml b/tests/components/generic_thermostat/fixtures/configuration.yaml similarity index 100% rename from tests/fixtures/generic_thermostat/configuration.yaml rename to tests/components/generic_thermostat/fixtures/configuration.yaml diff --git a/tests/components/generic_thermostat/test_climate.py b/tests/components/generic_thermostat/test_climate.py index 4015887efbb..a1896c94d2f 100644 --- a/tests/components/generic_thermostat/test_climate.py +++ b/tests/components/generic_thermostat/test_climate.py @@ -1,6 +1,5 @@ """The tests for the generic_thermostat.""" import datetime -from os import path from unittest.mock import patch import pytest @@ -43,6 +42,7 @@ from tests.common import ( assert_setup_component, async_fire_time_changed, async_mock_service, + get_fixture_path, mock_restore_cache, ) from tests.components.climate import common @@ -1486,11 +1486,7 @@ async def test_reload(hass): assert len(hass.states.async_all()) == 1 assert hass.states.get("climate.test") is not None - yaml_path = path.join( - _get_fixtures_base_path(), - "fixtures", - "generic_thermostat/configuration.yaml", - ) + yaml_path = get_fixture_path("configuration.yaml", "generic_thermostat") with patch.object(hass_config, "YAML_CONFIG_FILE", yaml_path): await hass.services.async_call( GENERIC_THERMOSTAT_DOMAIN, @@ -1503,7 +1499,3 @@ async def test_reload(hass): assert len(hass.states.async_all()) == 1 assert hass.states.get("climate.test") is None assert hass.states.get("climate.reload") - - -def _get_fixtures_base_path(): - return path.dirname(path.dirname(path.dirname(__file__))) diff --git a/tests/fixtures/gios/indexes.json b/tests/components/gios/fixtures/indexes.json similarity index 100% rename from tests/fixtures/gios/indexes.json rename to tests/components/gios/fixtures/indexes.json diff --git a/tests/fixtures/gios/sensors.json b/tests/components/gios/fixtures/sensors.json similarity index 100% rename from tests/fixtures/gios/sensors.json rename to tests/components/gios/fixtures/sensors.json diff --git a/tests/fixtures/gios/station.json b/tests/components/gios/fixtures/station.json similarity index 100% rename from tests/fixtures/gios/station.json rename to tests/components/gios/fixtures/station.json diff --git a/tests/fixtures/google_maps_elevation.json b/tests/components/google/fixtures/maps_elevation.json similarity index 100% rename from tests/fixtures/google_maps_elevation.json rename to tests/components/google/fixtures/maps_elevation.json diff --git a/tests/fixtures/group/configuration.yaml b/tests/components/group/fixtures/configuration.yaml similarity index 100% rename from tests/fixtures/group/configuration.yaml rename to tests/components/group/fixtures/configuration.yaml diff --git a/tests/fixtures/group/fan_configuration.yaml b/tests/components/group/fixtures/fan_configuration.yaml similarity index 100% rename from tests/fixtures/group/fan_configuration.yaml rename to tests/components/group/fixtures/fan_configuration.yaml diff --git a/tests/components/group/test_binary_sensor.py b/tests/components/group/test_binary_sensor.py index 7bf62a16a42..0738c31eb62 100644 --- a/tests/components/group/test_binary_sensor.py +++ b/tests/components/group/test_binary_sensor.py @@ -1,6 +1,4 @@ """The tests for the Group Binary Sensor platform.""" -from os import path - from homeassistant.components.binary_sensor import DOMAIN as BINARY_SENSOR_DOMAIN from homeassistant.components.group import DOMAIN from homeassistant.const import ATTR_ENTITY_ID, STATE_OFF, STATE_ON, STATE_UNAVAILABLE @@ -145,7 +143,3 @@ async def test_state_reporting_any(hass): entry = entity_registry.async_get("binary_sensor.binary_sensor_group") assert entry assert entry.unique_id == "unique_identifier" - - -def _get_fixtures_base_path(): - return path.dirname(path.dirname(path.dirname(__file__))) diff --git a/tests/components/group/test_fan.py b/tests/components/group/test_fan.py index 10770e3de06..abb1dcf245a 100644 --- a/tests/components/group/test_fan.py +++ b/tests/components/group/test_fan.py @@ -1,5 +1,4 @@ """The tests for the group fan platform.""" -from os import path from unittest.mock import patch import pytest @@ -38,7 +37,7 @@ from homeassistant.core import CoreState from homeassistant.helpers import entity_registry as er from homeassistant.setup import async_setup_component -from tests.common import assert_setup_component +from tests.common import assert_setup_component, get_fixture_path FAN_GROUP = "fan.fan_group" @@ -379,11 +378,7 @@ async def test_reload(hass, setup_comp): await hass.async_block_till_done() assert hass.states.get(FAN_GROUP).state == STATE_OFF - yaml_path = path.join( - _get_fixtures_base_path(), - "fixtures", - "group/fan_configuration.yaml", - ) + yaml_path = get_fixture_path("fan_configuration.yaml", "group") with patch.object(hass_config, "YAML_CONFIG_FILE", yaml_path): await hass.services.async_call( "group", @@ -397,10 +392,6 @@ async def test_reload(hass, setup_comp): assert hass.states.get("fan.upstairs_fans") is not None -def _get_fixtures_base_path(): - return path.dirname(path.dirname(path.dirname(__file__))) - - @pytest.mark.parametrize("config_count", [(CONFIG_FULL_SUPPORT, 2)]) async def test_service_calls(hass, setup_comp): """Test calling services.""" diff --git a/tests/components/group/test_light.py b/tests/components/group/test_light.py index e1a45d6fe53..843f15c7113 100644 --- a/tests/components/group/test_light.py +++ b/tests/components/group/test_light.py @@ -1,5 +1,4 @@ """The tests for the Group Light platform.""" -from os import path import unittest.mock from unittest.mock import MagicMock, patch @@ -53,6 +52,8 @@ from homeassistant.const import ( from homeassistant.helpers import entity_registry as er from homeassistant.setup import async_setup_component +from tests.common import get_fixture_path + async def test_default_state(hass): """Test light group default state.""" @@ -1379,11 +1380,7 @@ async def test_reload(hass): await hass.async_block_till_done() assert hass.states.get("light.light_group").state == STATE_ON - yaml_path = path.join( - _get_fixtures_base_path(), - "fixtures", - "group/configuration.yaml", - ) + yaml_path = get_fixture_path("configuration.yaml", "group") with patch.object(hass_config, "YAML_CONFIG_FILE", yaml_path): await hass.services.async_call( DOMAIN, @@ -1421,11 +1418,7 @@ async def test_reload_with_platform_not_setup(hass): ) await hass.async_block_till_done() - yaml_path = path.join( - _get_fixtures_base_path(), - "fixtures", - "group/configuration.yaml", - ) + yaml_path = get_fixture_path("configuration.yaml", "group") with patch.object(hass_config, "YAML_CONFIG_FILE", yaml_path): await hass.services.async_call( DOMAIN, @@ -1458,11 +1451,7 @@ async def test_reload_with_base_integration_platform_not_setup(hass): hass.states.async_set("light.outside_patio_lights", STATE_OFF) hass.states.async_set("light.outside_patio_lights_2", STATE_OFF) - yaml_path = path.join( - _get_fixtures_base_path(), - "fixtures", - "group/configuration.yaml", - ) + yaml_path = get_fixture_path("configuration.yaml", "group") with patch.object(hass_config, "YAML_CONFIG_FILE", yaml_path): await hass.services.async_call( DOMAIN, @@ -1513,7 +1502,3 @@ async def test_nested_group(hass): assert state is not None assert state.state == STATE_ON assert state.attributes.get(ATTR_ENTITY_ID) == ["light.bedroom_group"] - - -def _get_fixtures_base_path(): - return path.dirname(path.dirname(path.dirname(__file__))) diff --git a/tests/components/group/test_notify.py b/tests/components/group/test_notify.py index a0f210c68a2..ad0be58dd16 100644 --- a/tests/components/group/test_notify.py +++ b/tests/components/group/test_notify.py @@ -1,5 +1,4 @@ """The tests for the notify.group platform.""" -from os import path from unittest.mock import MagicMock, patch from homeassistant import config as hass_config @@ -9,6 +8,8 @@ import homeassistant.components.group.notify as group import homeassistant.components.notify as notify from homeassistant.setup import async_setup_component +from tests.common import get_fixture_path + async def test_send_message_with_data(hass): """Test sending a message with to a notify group.""" @@ -110,11 +111,8 @@ async def test_reload_notify(hass): assert hass.services.has_service(notify.DOMAIN, "demo2") assert hass.services.has_service(notify.DOMAIN, "group_notify") - yaml_path = path.join( - _get_fixtures_base_path(), - "fixtures", - "group/configuration.yaml", - ) + yaml_path = get_fixture_path("configuration.yaml", "group") + with patch.object(hass_config, "YAML_CONFIG_FILE", yaml_path): await hass.services.async_call( "group", @@ -128,7 +126,3 @@ async def test_reload_notify(hass): assert hass.services.has_service(notify.DOMAIN, "demo2") assert not hass.services.has_service(notify.DOMAIN, "group_notify") assert hass.services.has_service(notify.DOMAIN, "new_group_notify") - - -def _get_fixtures_base_path(): - return path.dirname(path.dirname(path.dirname(__file__))) diff --git a/tests/fixtures/here_travel_time/attribution_response.json b/tests/components/here_travel_time/fixtures/attribution_response.json similarity index 100% rename from tests/fixtures/here_travel_time/attribution_response.json rename to tests/components/here_travel_time/fixtures/attribution_response.json diff --git a/tests/fixtures/here_travel_time/bike_response.json b/tests/components/here_travel_time/fixtures/bike_response.json similarity index 100% rename from tests/fixtures/here_travel_time/bike_response.json rename to tests/components/here_travel_time/fixtures/bike_response.json diff --git a/tests/fixtures/here_travel_time/car_enabled_response.json b/tests/components/here_travel_time/fixtures/car_enabled_response.json similarity index 100% rename from tests/fixtures/here_travel_time/car_enabled_response.json rename to tests/components/here_travel_time/fixtures/car_enabled_response.json diff --git a/tests/fixtures/here_travel_time/car_response.json b/tests/components/here_travel_time/fixtures/car_response.json similarity index 100% rename from tests/fixtures/here_travel_time/car_response.json rename to tests/components/here_travel_time/fixtures/car_response.json diff --git a/tests/fixtures/here_travel_time/car_shortest_response.json b/tests/components/here_travel_time/fixtures/car_shortest_response.json similarity index 100% rename from tests/fixtures/here_travel_time/car_shortest_response.json rename to tests/components/here_travel_time/fixtures/car_shortest_response.json diff --git a/tests/fixtures/here_travel_time/pedestrian_response.json b/tests/components/here_travel_time/fixtures/pedestrian_response.json similarity index 100% rename from tests/fixtures/here_travel_time/pedestrian_response.json rename to tests/components/here_travel_time/fixtures/pedestrian_response.json diff --git a/tests/fixtures/here_travel_time/public_response.json b/tests/components/here_travel_time/fixtures/public_response.json similarity index 100% rename from tests/fixtures/here_travel_time/public_response.json rename to tests/components/here_travel_time/fixtures/public_response.json diff --git a/tests/fixtures/here_travel_time/public_time_table_response.json b/tests/components/here_travel_time/fixtures/public_time_table_response.json similarity index 100% rename from tests/fixtures/here_travel_time/public_time_table_response.json rename to tests/components/here_travel_time/fixtures/public_time_table_response.json diff --git a/tests/fixtures/here_travel_time/routing_error_invalid_credentials.json b/tests/components/here_travel_time/fixtures/routing_error_invalid_credentials.json similarity index 100% rename from tests/fixtures/here_travel_time/routing_error_invalid_credentials.json rename to tests/components/here_travel_time/fixtures/routing_error_invalid_credentials.json diff --git a/tests/fixtures/here_travel_time/routing_error_no_route_found.json b/tests/components/here_travel_time/fixtures/routing_error_no_route_found.json similarity index 100% rename from tests/fixtures/here_travel_time/routing_error_no_route_found.json rename to tests/components/here_travel_time/fixtures/routing_error_no_route_found.json diff --git a/tests/fixtures/here_travel_time/truck_response.json b/tests/components/here_travel_time/fixtures/truck_response.json similarity index 100% rename from tests/fixtures/here_travel_time/truck_response.json rename to tests/components/here_travel_time/fixtures/truck_response.json diff --git a/tests/fixtures/history_stats/configuration.yaml b/tests/components/history_stats/fixtures/configuration.yaml similarity index 100% rename from tests/fixtures/history_stats/configuration.yaml rename to tests/components/history_stats/fixtures/configuration.yaml diff --git a/tests/components/history_stats/test_sensor.py b/tests/components/history_stats/test_sensor.py index 01ce5bf06b3..105943d4444 100644 --- a/tests/components/history_stats/test_sensor.py +++ b/tests/components/history_stats/test_sensor.py @@ -1,7 +1,6 @@ """The test for the History Statistics sensor platform.""" # pylint: disable=protected-access from datetime import datetime, timedelta -from os import path import unittest from unittest.mock import patch @@ -18,6 +17,7 @@ import homeassistant.util.dt as dt_util from tests.common import ( async_init_recorder_component, + get_fixture_path, get_test_home_assistant, init_recorder_component, ) @@ -253,11 +253,7 @@ async def test_reload(hass): assert hass.states.get("sensor.test") - yaml_path = path.join( - _get_fixtures_base_path(), - "fixtures", - "history_stats/configuration.yaml", - ) + yaml_path = get_fixture_path("configuration.yaml", "history_stats") with patch.object(hass_config, "YAML_CONFIG_FILE", yaml_path): await hass.services.async_call( DOMAIN, @@ -427,7 +423,3 @@ async def async_test_measure(hass): assert hass.states.get("sensor.sensor2").state == STATE_UNKNOWN assert hass.states.get("sensor.sensor3").state == "2" assert hass.states.get("sensor.sensor4").state == "50.0" - - -def _get_fixtures_base_path(): - return path.dirname(path.dirname(path.dirname(__file__))) diff --git a/tests/fixtures/homekit/configuration.yaml b/tests/components/homekit/fixtures/configuration.yaml similarity index 100% rename from tests/fixtures/homekit/configuration.yaml rename to tests/components/homekit/fixtures/configuration.yaml diff --git a/tests/components/homekit/test_homekit.py b/tests/components/homekit/test_homekit.py index e77980d4c2c..58aa9741fa3 100644 --- a/tests/components/homekit/test_homekit.py +++ b/tests/components/homekit/test_homekit.py @@ -68,7 +68,7 @@ from homeassistant.util import json as json_util from .util import PATH_HOMEKIT, async_init_entry, async_init_integration -from tests.common import MockConfigEntry +from tests.common import MockConfigEntry, get_fixture_path IP_ADDRESS = "127.0.0.1" @@ -1536,11 +1536,7 @@ async def test_reload(hass, mock_zeroconf): entry.title, devices=[], ) - yaml_path = os.path.join( - _get_fixtures_base_path(), - "fixtures", - "homekit/configuration.yaml", - ) + yaml_path = get_fixture_path("configuration.yaml", "homekit") with patch.object(hass_config, "YAML_CONFIG_FILE", yaml_path), patch( f"{PATH_HOMEKIT}.HomeKit" ) as mock_homekit2, patch.object(homekit.bridge, "add_accessory"), patch( @@ -1577,10 +1573,6 @@ async def test_reload(hass, mock_zeroconf): ) -def _get_fixtures_base_path(): - return os.path.dirname(os.path.dirname(os.path.dirname(__file__))) - - async def test_homekit_start_in_accessory_mode( hass, hk_driver, mock_zeroconf, device_reg ): diff --git a/tests/fixtures/homekit_controller/anker_eufycam.json b/tests/components/homekit_controller/fixtures/anker_eufycam.json similarity index 100% rename from tests/fixtures/homekit_controller/anker_eufycam.json rename to tests/components/homekit_controller/fixtures/anker_eufycam.json diff --git a/tests/fixtures/homekit_controller/aqara_gateway.json b/tests/components/homekit_controller/fixtures/aqara_gateway.json similarity index 100% rename from tests/fixtures/homekit_controller/aqara_gateway.json rename to tests/components/homekit_controller/fixtures/aqara_gateway.json diff --git a/tests/fixtures/homekit_controller/aqara_switch.json b/tests/components/homekit_controller/fixtures/aqara_switch.json similarity index 100% rename from tests/fixtures/homekit_controller/aqara_switch.json rename to tests/components/homekit_controller/fixtures/aqara_switch.json diff --git a/tests/fixtures/homekit_controller/arlo_baby.json b/tests/components/homekit_controller/fixtures/arlo_baby.json similarity index 100% rename from tests/fixtures/homekit_controller/arlo_baby.json rename to tests/components/homekit_controller/fixtures/arlo_baby.json diff --git a/tests/fixtures/homekit_controller/ecobee3.json b/tests/components/homekit_controller/fixtures/ecobee3.json similarity index 100% rename from tests/fixtures/homekit_controller/ecobee3.json rename to tests/components/homekit_controller/fixtures/ecobee3.json diff --git a/tests/fixtures/homekit_controller/ecobee3_no_sensors.json b/tests/components/homekit_controller/fixtures/ecobee3_no_sensors.json similarity index 100% rename from tests/fixtures/homekit_controller/ecobee3_no_sensors.json rename to tests/components/homekit_controller/fixtures/ecobee3_no_sensors.json diff --git a/tests/fixtures/homekit_controller/ecobee_occupancy.json b/tests/components/homekit_controller/fixtures/ecobee_occupancy.json similarity index 100% rename from tests/fixtures/homekit_controller/ecobee_occupancy.json rename to tests/components/homekit_controller/fixtures/ecobee_occupancy.json diff --git a/tests/fixtures/homekit_controller/eve_degree.json b/tests/components/homekit_controller/fixtures/eve_degree.json similarity index 100% rename from tests/fixtures/homekit_controller/eve_degree.json rename to tests/components/homekit_controller/fixtures/eve_degree.json diff --git a/tests/fixtures/homekit_controller/haa_fan.json b/tests/components/homekit_controller/fixtures/haa_fan.json similarity index 100% rename from tests/fixtures/homekit_controller/haa_fan.json rename to tests/components/homekit_controller/fixtures/haa_fan.json diff --git a/tests/fixtures/homekit_controller/home_assistant_bridge_fan.json b/tests/components/homekit_controller/fixtures/home_assistant_bridge_fan.json similarity index 100% rename from tests/fixtures/homekit_controller/home_assistant_bridge_fan.json rename to tests/components/homekit_controller/fixtures/home_assistant_bridge_fan.json diff --git a/tests/fixtures/homekit_controller/hue_bridge.json b/tests/components/homekit_controller/fixtures/hue_bridge.json similarity index 100% rename from tests/fixtures/homekit_controller/hue_bridge.json rename to tests/components/homekit_controller/fixtures/hue_bridge.json diff --git a/tests/fixtures/homekit_controller/koogeek_ls1.json b/tests/components/homekit_controller/fixtures/koogeek_ls1.json similarity index 100% rename from tests/fixtures/homekit_controller/koogeek_ls1.json rename to tests/components/homekit_controller/fixtures/koogeek_ls1.json diff --git a/tests/fixtures/homekit_controller/koogeek_p1eu.json b/tests/components/homekit_controller/fixtures/koogeek_p1eu.json similarity index 100% rename from tests/fixtures/homekit_controller/koogeek_p1eu.json rename to tests/components/homekit_controller/fixtures/koogeek_p1eu.json diff --git a/tests/fixtures/homekit_controller/koogeek_sw2.json b/tests/components/homekit_controller/fixtures/koogeek_sw2.json similarity index 100% rename from tests/fixtures/homekit_controller/koogeek_sw2.json rename to tests/components/homekit_controller/fixtures/koogeek_sw2.json diff --git a/tests/fixtures/homekit_controller/lennox_e30.json b/tests/components/homekit_controller/fixtures/lennox_e30.json similarity index 100% rename from tests/fixtures/homekit_controller/lennox_e30.json rename to tests/components/homekit_controller/fixtures/lennox_e30.json diff --git a/tests/fixtures/homekit_controller/lg_tv.json b/tests/components/homekit_controller/fixtures/lg_tv.json similarity index 100% rename from tests/fixtures/homekit_controller/lg_tv.json rename to tests/components/homekit_controller/fixtures/lg_tv.json diff --git a/tests/fixtures/homekit_controller/mysa_living.json b/tests/components/homekit_controller/fixtures/mysa_living.json similarity index 100% rename from tests/fixtures/homekit_controller/mysa_living.json rename to tests/components/homekit_controller/fixtures/mysa_living.json diff --git a/tests/fixtures/homekit_controller/netamo_doorbell.json b/tests/components/homekit_controller/fixtures/netamo_doorbell.json similarity index 100% rename from tests/fixtures/homekit_controller/netamo_doorbell.json rename to tests/components/homekit_controller/fixtures/netamo_doorbell.json diff --git a/tests/fixtures/homekit_controller/rainmachine-pro-8.json b/tests/components/homekit_controller/fixtures/rainmachine-pro-8.json similarity index 100% rename from tests/fixtures/homekit_controller/rainmachine-pro-8.json rename to tests/components/homekit_controller/fixtures/rainmachine-pro-8.json diff --git a/tests/fixtures/homekit_controller/ryse_smart_bridge.json b/tests/components/homekit_controller/fixtures/ryse_smart_bridge.json similarity index 100% rename from tests/fixtures/homekit_controller/ryse_smart_bridge.json rename to tests/components/homekit_controller/fixtures/ryse_smart_bridge.json diff --git a/tests/fixtures/homekit_controller/ryse_smart_bridge_four_shades.json b/tests/components/homekit_controller/fixtures/ryse_smart_bridge_four_shades.json similarity index 100% rename from tests/fixtures/homekit_controller/ryse_smart_bridge_four_shades.json rename to tests/components/homekit_controller/fixtures/ryse_smart_bridge_four_shades.json diff --git a/tests/fixtures/homekit_controller/simpleconnect_fan.json b/tests/components/homekit_controller/fixtures/simpleconnect_fan.json similarity index 100% rename from tests/fixtures/homekit_controller/simpleconnect_fan.json rename to tests/components/homekit_controller/fixtures/simpleconnect_fan.json diff --git a/tests/fixtures/homekit_controller/velux_gateway.json b/tests/components/homekit_controller/fixtures/velux_gateway.json similarity index 100% rename from tests/fixtures/homekit_controller/velux_gateway.json rename to tests/components/homekit_controller/fixtures/velux_gateway.json diff --git a/tests/fixtures/homekit_controller/vocolinc_flowerbud.json b/tests/components/homekit_controller/fixtures/vocolinc_flowerbud.json similarity index 100% rename from tests/fixtures/homekit_controller/vocolinc_flowerbud.json rename to tests/components/homekit_controller/fixtures/vocolinc_flowerbud.json diff --git a/tests/fixtures/hunterdouglas_powerview/fwversion.json b/tests/components/hunterdouglas_powerview/fixtures/fwversion.json similarity index 100% rename from tests/fixtures/hunterdouglas_powerview/fwversion.json rename to tests/components/hunterdouglas_powerview/fixtures/fwversion.json diff --git a/tests/fixtures/hunterdouglas_powerview/userdata.json b/tests/components/hunterdouglas_powerview/fixtures/userdata.json similarity index 100% rename from tests/fixtures/hunterdouglas_powerview/userdata.json rename to tests/components/hunterdouglas_powerview/fixtures/userdata.json diff --git a/tests/fixtures/hunterdouglas_powerview/userdata_v1.json b/tests/components/hunterdouglas_powerview/fixtures/userdata_v1.json similarity index 100% rename from tests/fixtures/hunterdouglas_powerview/userdata_v1.json rename to tests/components/hunterdouglas_powerview/fixtures/userdata_v1.json diff --git a/tests/fixtures/hvv_departures/check_name.json b/tests/components/hvv_departures/fixtures/check_name.json similarity index 100% rename from tests/fixtures/hvv_departures/check_name.json rename to tests/components/hvv_departures/fixtures/check_name.json diff --git a/tests/fixtures/hvv_departures/config_entry.json b/tests/components/hvv_departures/fixtures/config_entry.json similarity index 100% rename from tests/fixtures/hvv_departures/config_entry.json rename to tests/components/hvv_departures/fixtures/config_entry.json diff --git a/tests/fixtures/hvv_departures/departure_list.json b/tests/components/hvv_departures/fixtures/departure_list.json similarity index 100% rename from tests/fixtures/hvv_departures/departure_list.json rename to tests/components/hvv_departures/fixtures/departure_list.json diff --git a/tests/fixtures/hvv_departures/init.json b/tests/components/hvv_departures/fixtures/init.json similarity index 100% rename from tests/fixtures/hvv_departures/init.json rename to tests/components/hvv_departures/fixtures/init.json diff --git a/tests/fixtures/hvv_departures/options.json b/tests/components/hvv_departures/fixtures/options.json similarity index 100% rename from tests/fixtures/hvv_departures/options.json rename to tests/components/hvv_departures/fixtures/options.json diff --git a/tests/fixtures/hvv_departures/station_information.json b/tests/components/hvv_departures/fixtures/station_information.json similarity index 100% rename from tests/fixtures/hvv_departures/station_information.json rename to tests/components/hvv_departures/fixtures/station_information.json diff --git a/tests/fixtures/insteon/aldb_data.json b/tests/components/insteon/fixtures/aldb_data.json similarity index 100% rename from tests/fixtures/insteon/aldb_data.json rename to tests/components/insteon/fixtures/aldb_data.json diff --git a/tests/fixtures/insteon/kpl_properties.json b/tests/components/insteon/fixtures/kpl_properties.json similarity index 100% rename from tests/fixtures/insteon/kpl_properties.json rename to tests/components/insteon/fixtures/kpl_properties.json diff --git a/tests/components/ipp/__init__.py b/tests/components/ipp/__init__.py index 1e269438ad5..ec1001b5772 100644 --- a/tests/components/ipp/__init__.py +++ b/tests/components/ipp/__init__.py @@ -1,6 +1,4 @@ """Tests for the IPP integration.""" -import os - import aiohttp from pyipp import IPPConnectionUpgradeRequired, IPPError @@ -15,7 +13,7 @@ from homeassistant.const import ( ) from homeassistant.core import HomeAssistant -from tests.common import MockConfigEntry +from tests.common import MockConfigEntry, get_fixture_path from tests.test_util.aiohttp import AiohttpClientMocker ATTR_HOSTNAME = "hostname" @@ -63,9 +61,7 @@ MOCK_ZEROCONF_IPPS_SERVICE_INFO = { def load_fixture_binary(filename): """Load a binary fixture.""" - path = os.path.join(os.path.dirname(__file__), "..", "..", "fixtures", filename) - with open(path, "rb") as fptr: - return fptr.read() + return get_fixture_path(filename, "ipp").read_bytes() def mock_connection( @@ -97,11 +93,11 @@ def mock_connection( aioclient_mock.post(f"{ipp_url}{base_path}", exc=IPPConnectionUpgradeRequired) return - fixture = "ipp/get-printer-attributes.bin" + fixture = "get-printer-attributes.bin" if no_unique_id: - fixture = "ipp/get-printer-attributes-success-nodata.bin" + fixture = "get-printer-attributes-success-nodata.bin" elif version_not_supported: - fixture = "ipp/get-printer-attributes-error-0x0503.bin" + fixture = "get-printer-attributes-error-0x0503.bin" if parse_error: content = "BAD" diff --git a/tests/fixtures/ipp/get-printer-attributes-error-0x0503.bin b/tests/components/ipp/fixtures/get-printer-attributes-error-0x0503.bin similarity index 100% rename from tests/fixtures/ipp/get-printer-attributes-error-0x0503.bin rename to tests/components/ipp/fixtures/get-printer-attributes-error-0x0503.bin diff --git a/tests/fixtures/ipp/get-printer-attributes-success-nodata.bin b/tests/components/ipp/fixtures/get-printer-attributes-success-nodata.bin similarity index 100% rename from tests/fixtures/ipp/get-printer-attributes-success-nodata.bin rename to tests/components/ipp/fixtures/get-printer-attributes-success-nodata.bin diff --git a/tests/fixtures/ipp/get-printer-attributes.bin b/tests/components/ipp/fixtures/get-printer-attributes.bin similarity index 100% rename from tests/fixtures/ipp/get-printer-attributes.bin rename to tests/components/ipp/fixtures/get-printer-attributes.bin diff --git a/tests/fixtures/lcn/config.json b/tests/components/lcn/fixtures/config.json similarity index 100% rename from tests/fixtures/lcn/config.json rename to tests/components/lcn/fixtures/config.json diff --git a/tests/fixtures/lcn/config_entry_myhome.json b/tests/components/lcn/fixtures/config_entry_myhome.json similarity index 100% rename from tests/fixtures/lcn/config_entry_myhome.json rename to tests/components/lcn/fixtures/config_entry_myhome.json diff --git a/tests/fixtures/lcn/config_entry_pchk.json b/tests/components/lcn/fixtures/config_entry_pchk.json similarity index 100% rename from tests/fixtures/lcn/config_entry_pchk.json rename to tests/components/lcn/fixtures/config_entry_pchk.json diff --git a/tests/fixtures/mazda/get_vehicle_status.json b/tests/components/mazda/fixtures/get_vehicle_status.json similarity index 100% rename from tests/fixtures/mazda/get_vehicle_status.json rename to tests/components/mazda/fixtures/get_vehicle_status.json diff --git a/tests/fixtures/mazda/get_vehicles.json b/tests/components/mazda/fixtures/get_vehicles.json similarity index 100% rename from tests/fixtures/mazda/get_vehicles.json rename to tests/components/mazda/fixtures/get_vehicles.json diff --git a/tests/fixtures/melissa_cur_settings.json b/tests/components/melissa/fixtures/cur_settings.json similarity index 100% rename from tests/fixtures/melissa_cur_settings.json rename to tests/components/melissa/fixtures/cur_settings.json diff --git a/tests/fixtures/melissa_fetch_devices.json b/tests/components/melissa/fixtures/fetch_devices.json similarity index 100% rename from tests/fixtures/melissa_fetch_devices.json rename to tests/components/melissa/fixtures/fetch_devices.json diff --git a/tests/fixtures/melissa_status.json b/tests/components/melissa/fixtures/status.json similarity index 100% rename from tests/fixtures/melissa_status.json rename to tests/components/melissa/fixtures/status.json diff --git a/tests/components/melissa/test_climate.py b/tests/components/melissa/test_climate.py index 590c5149f9e..224a878b065 100644 --- a/tests/components/melissa/test_climate.py +++ b/tests/components/melissa/test_climate.py @@ -25,13 +25,13 @@ def melissa_mock(): """Use this to mock the melissa api.""" api = Mock() api.async_fetch_devices = AsyncMock( - return_value=json.loads(load_fixture("melissa_fetch_devices.json")) + return_value=json.loads(load_fixture("fetch_devices.json", "melissa")) ) api.async_status = AsyncMock( - return_value=json.loads(load_fixture("melissa_status.json")) + return_value=json.loads(load_fixture("status.json", "melissa")) ) api.async_cur_settings = AsyncMock( - return_value=json.loads(load_fixture("melissa_cur_settings.json")) + return_value=json.loads(load_fixture("cur_settings.json", "melissa")) ) api.async_send = AsyncMock(return_value=True) diff --git a/tests/fixtures/min_max/configuration.yaml b/tests/components/min_max/fixtures/configuration.yaml similarity index 100% rename from tests/fixtures/min_max/configuration.yaml rename to tests/components/min_max/fixtures/configuration.yaml diff --git a/tests/components/min_max/test_sensor.py b/tests/components/min_max/test_sensor.py index c6c352a8c3e..1712a9027ca 100644 --- a/tests/components/min_max/test_sensor.py +++ b/tests/components/min_max/test_sensor.py @@ -1,5 +1,4 @@ """The test for the min/max sensor platform.""" -from os import path import statistics from unittest.mock import patch @@ -16,6 +15,8 @@ from homeassistant.const import ( ) from homeassistant.setup import async_setup_component +from tests.common import get_fixture_path + VALUES = [17, 20, 15.3] COUNT = len(VALUES) MIN_VALUE = min(VALUES) @@ -365,11 +366,8 @@ async def test_reload(hass): assert hass.states.get("sensor.test") - yaml_path = path.join( - _get_fixtures_base_path(), - "fixtures", - "min_max/configuration.yaml", - ) + yaml_path = get_fixture_path("configuration.yaml", "min_max") + with patch.object(hass_config, "YAML_CONFIG_FILE", yaml_path): await hass.services.async_call( DOMAIN, @@ -383,7 +381,3 @@ async def test_reload(hass): assert hass.states.get("sensor.test") is None assert hass.states.get("sensor.second_test") - - -def _get_fixtures_base_path(): - return path.dirname(path.dirname(path.dirname(__file__))) diff --git a/tests/fixtures/modern_forms/device_info.json b/tests/components/modern_forms/fixtures/device_info.json similarity index 100% rename from tests/fixtures/modern_forms/device_info.json rename to tests/components/modern_forms/fixtures/device_info.json diff --git a/tests/fixtures/modern_forms/device_info_no_light.json b/tests/components/modern_forms/fixtures/device_info_no_light.json similarity index 100% rename from tests/fixtures/modern_forms/device_info_no_light.json rename to tests/components/modern_forms/fixtures/device_info_no_light.json diff --git a/tests/fixtures/modern_forms/device_status.json b/tests/components/modern_forms/fixtures/device_status.json similarity index 100% rename from tests/fixtures/modern_forms/device_status.json rename to tests/components/modern_forms/fixtures/device_status.json diff --git a/tests/fixtures/modern_forms/device_status_no_light.json b/tests/components/modern_forms/fixtures/device_status_no_light.json similarity index 100% rename from tests/fixtures/modern_forms/device_status_no_light.json rename to tests/components/modern_forms/fixtures/device_status_no_light.json diff --git a/tests/fixtures/modern_forms/device_status_timers_active.json b/tests/components/modern_forms/fixtures/device_status_timers_active.json similarity index 100% rename from tests/fixtures/modern_forms/device_status_timers_active.json rename to tests/components/modern_forms/fixtures/device_status_timers_active.json diff --git a/tests/fixtures/mqtt/configuration.yaml b/tests/components/mqtt/fixtures/configuration.yaml similarity index 100% rename from tests/fixtures/mqtt/configuration.yaml rename to tests/components/mqtt/fixtures/configuration.yaml diff --git a/tests/components/mqtt/test_light.py b/tests/components/mqtt/test_light.py index bf327796f57..58b607bb777 100644 --- a/tests/components/mqtt/test_light.py +++ b/tests/components/mqtt/test_light.py @@ -153,7 +153,6 @@ light: payload_off: "off" """ -from os import path from unittest.mock import call, patch import pytest @@ -198,7 +197,11 @@ from .test_common import ( help_test_update_with_json_attrs_not_dict, ) -from tests.common import assert_setup_component, async_fire_mqtt_message +from tests.common import ( + assert_setup_component, + async_fire_mqtt_message, + get_fixture_path, +) from tests.components.light import common DEFAULT_CONFIG = { @@ -3389,11 +3392,8 @@ async def test_reloadable(hass, mqtt_mock): assert hass.states.get("light.test") assert len(hass.states.async_all("light")) == 1 - yaml_path = path.join( - _get_fixtures_base_path(), - "fixtures", - "mqtt/configuration.yaml", - ) + yaml_path = get_fixture_path("configuration.yaml", "mqtt") + with patch.object(hass_config, "YAML_CONFIG_FILE", yaml_path): await hass.services.async_call( "mqtt", @@ -3407,7 +3407,3 @@ async def test_reloadable(hass, mqtt_mock): assert hass.states.get("light.test") is None assert hass.states.get("light.reload") - - -def _get_fixtures_base_path(): - return path.dirname(path.dirname(path.dirname(__file__))) diff --git a/tests/fixtures/myq/devices.json b/tests/components/myq/fixtures/devices.json similarity index 100% rename from tests/fixtures/myq/devices.json rename to tests/components/myq/fixtures/devices.json diff --git a/tests/fixtures/mysensors/distance_sensor_state.json b/tests/components/mysensors/fixtures/distance_sensor_state.json similarity index 100% rename from tests/fixtures/mysensors/distance_sensor_state.json rename to tests/components/mysensors/fixtures/distance_sensor_state.json diff --git a/tests/fixtures/mysensors/energy_sensor_state.json b/tests/components/mysensors/fixtures/energy_sensor_state.json similarity index 100% rename from tests/fixtures/mysensors/energy_sensor_state.json rename to tests/components/mysensors/fixtures/energy_sensor_state.json diff --git a/tests/fixtures/mysensors/gps_sensor_state.json b/tests/components/mysensors/fixtures/gps_sensor_state.json similarity index 100% rename from tests/fixtures/mysensors/gps_sensor_state.json rename to tests/components/mysensors/fixtures/gps_sensor_state.json diff --git a/tests/fixtures/mysensors/power_sensor_state.json b/tests/components/mysensors/fixtures/power_sensor_state.json similarity index 100% rename from tests/fixtures/mysensors/power_sensor_state.json rename to tests/components/mysensors/fixtures/power_sensor_state.json diff --git a/tests/fixtures/mysensors/sound_sensor_state.json b/tests/components/mysensors/fixtures/sound_sensor_state.json similarity index 100% rename from tests/fixtures/mysensors/sound_sensor_state.json rename to tests/components/mysensors/fixtures/sound_sensor_state.json diff --git a/tests/fixtures/mysensors/temperature_sensor_state.json b/tests/components/mysensors/fixtures/temperature_sensor_state.json similarity index 100% rename from tests/fixtures/mysensors/temperature_sensor_state.json rename to tests/components/mysensors/fixtures/temperature_sensor_state.json diff --git a/tests/fixtures/netatmo/events.txt b/tests/components/netatmo/fixtures/events.txt similarity index 100% rename from tests/fixtures/netatmo/events.txt rename to tests/components/netatmo/fixtures/events.txt diff --git a/tests/fixtures/netatmo/gethomecoachsdata.json b/tests/components/netatmo/fixtures/gethomecoachsdata.json similarity index 100% rename from tests/fixtures/netatmo/gethomecoachsdata.json rename to tests/components/netatmo/fixtures/gethomecoachsdata.json diff --git a/tests/fixtures/netatmo/gethomedata.json b/tests/components/netatmo/fixtures/gethomedata.json similarity index 100% rename from tests/fixtures/netatmo/gethomedata.json rename to tests/components/netatmo/fixtures/gethomedata.json diff --git a/tests/fixtures/netatmo/getpublicdata.json b/tests/components/netatmo/fixtures/getpublicdata.json similarity index 100% rename from tests/fixtures/netatmo/getpublicdata.json rename to tests/components/netatmo/fixtures/getpublicdata.json diff --git a/tests/fixtures/netatmo/getstationsdata.json b/tests/components/netatmo/fixtures/getstationsdata.json similarity index 100% rename from tests/fixtures/netatmo/getstationsdata.json rename to tests/components/netatmo/fixtures/getstationsdata.json diff --git a/tests/fixtures/netatmo/homesdata.json b/tests/components/netatmo/fixtures/homesdata.json similarity index 100% rename from tests/fixtures/netatmo/homesdata.json rename to tests/components/netatmo/fixtures/homesdata.json diff --git a/tests/fixtures/netatmo/homestatus.json b/tests/components/netatmo/fixtures/homestatus.json similarity index 100% rename from tests/fixtures/netatmo/homestatus.json rename to tests/components/netatmo/fixtures/homestatus.json diff --git a/tests/fixtures/netatmo/ping.json b/tests/components/netatmo/fixtures/ping.json similarity index 100% rename from tests/fixtures/netatmo/ping.json rename to tests/components/netatmo/fixtures/ping.json diff --git a/tests/fixtures/nexia/mobile_houses_123456.json b/tests/components/nexia/fixtures/mobile_houses_123456.json similarity index 100% rename from tests/fixtures/nexia/mobile_houses_123456.json rename to tests/components/nexia/fixtures/mobile_houses_123456.json diff --git a/tests/fixtures/nexia/session_123456.json b/tests/components/nexia/fixtures/session_123456.json similarity index 100% rename from tests/fixtures/nexia/session_123456.json rename to tests/components/nexia/fixtures/session_123456.json diff --git a/tests/fixtures/nexia/sign_in.json b/tests/components/nexia/fixtures/sign_in.json similarity index 100% rename from tests/fixtures/nexia/sign_in.json rename to tests/components/nexia/fixtures/sign_in.json diff --git a/tests/fixtures/nut/5E650I.json b/tests/components/nut/fixtures/5E650I.json similarity index 100% rename from tests/fixtures/nut/5E650I.json rename to tests/components/nut/fixtures/5E650I.json diff --git a/tests/fixtures/nut/5E850I.json b/tests/components/nut/fixtures/5E850I.json similarity index 100% rename from tests/fixtures/nut/5E850I.json rename to tests/components/nut/fixtures/5E850I.json diff --git a/tests/fixtures/nut/BACKUPSES600M1.json b/tests/components/nut/fixtures/BACKUPSES600M1.json similarity index 100% rename from tests/fixtures/nut/BACKUPSES600M1.json rename to tests/components/nut/fixtures/BACKUPSES600M1.json diff --git a/tests/fixtures/nut/CP1350C.json b/tests/components/nut/fixtures/CP1350C.json similarity index 100% rename from tests/fixtures/nut/CP1350C.json rename to tests/components/nut/fixtures/CP1350C.json diff --git a/tests/fixtures/nut/CP1500PFCLCD.json b/tests/components/nut/fixtures/CP1500PFCLCD.json similarity index 100% rename from tests/fixtures/nut/CP1500PFCLCD.json rename to tests/components/nut/fixtures/CP1500PFCLCD.json diff --git a/tests/fixtures/nut/DL650ELCD.json b/tests/components/nut/fixtures/DL650ELCD.json similarity index 100% rename from tests/fixtures/nut/DL650ELCD.json rename to tests/components/nut/fixtures/DL650ELCD.json diff --git a/tests/fixtures/nut/PR3000RT2U.json b/tests/components/nut/fixtures/PR3000RT2U.json similarity index 100% rename from tests/fixtures/nut/PR3000RT2U.json rename to tests/components/nut/fixtures/PR3000RT2U.json diff --git a/tests/fixtures/nut/blazer_usb.json b/tests/components/nut/fixtures/blazer_usb.json similarity index 100% rename from tests/fixtures/nut/blazer_usb.json rename to tests/components/nut/fixtures/blazer_usb.json diff --git a/tests/fixtures/ozw/binary_sensor.json b/tests/components/ozw/fixtures/binary_sensor.json similarity index 100% rename from tests/fixtures/ozw/binary_sensor.json rename to tests/components/ozw/fixtures/binary_sensor.json diff --git a/tests/fixtures/ozw/binary_sensor_alt.json b/tests/components/ozw/fixtures/binary_sensor_alt.json similarity index 100% rename from tests/fixtures/ozw/binary_sensor_alt.json rename to tests/components/ozw/fixtures/binary_sensor_alt.json diff --git a/tests/fixtures/ozw/climate.json b/tests/components/ozw/fixtures/climate.json similarity index 100% rename from tests/fixtures/ozw/climate.json rename to tests/components/ozw/fixtures/climate.json diff --git a/tests/fixtures/ozw/climate_network_dump.csv b/tests/components/ozw/fixtures/climate_network_dump.csv similarity index 100% rename from tests/fixtures/ozw/climate_network_dump.csv rename to tests/components/ozw/fixtures/climate_network_dump.csv diff --git a/tests/fixtures/ozw/cover.json b/tests/components/ozw/fixtures/cover.json similarity index 100% rename from tests/fixtures/ozw/cover.json rename to tests/components/ozw/fixtures/cover.json diff --git a/tests/fixtures/ozw/cover_gdo.json b/tests/components/ozw/fixtures/cover_gdo.json similarity index 100% rename from tests/fixtures/ozw/cover_gdo.json rename to tests/components/ozw/fixtures/cover_gdo.json diff --git a/tests/fixtures/ozw/cover_gdo_network_dump.csv b/tests/components/ozw/fixtures/cover_gdo_network_dump.csv similarity index 100% rename from tests/fixtures/ozw/cover_gdo_network_dump.csv rename to tests/components/ozw/fixtures/cover_gdo_network_dump.csv diff --git a/tests/fixtures/ozw/cover_network_dump.csv b/tests/components/ozw/fixtures/cover_network_dump.csv similarity index 100% rename from tests/fixtures/ozw/cover_network_dump.csv rename to tests/components/ozw/fixtures/cover_network_dump.csv diff --git a/tests/fixtures/ozw/fan.json b/tests/components/ozw/fixtures/fan.json similarity index 100% rename from tests/fixtures/ozw/fan.json rename to tests/components/ozw/fixtures/fan.json diff --git a/tests/fixtures/ozw/fan_network_dump.csv b/tests/components/ozw/fixtures/fan_network_dump.csv similarity index 100% rename from tests/fixtures/ozw/fan_network_dump.csv rename to tests/components/ozw/fixtures/fan_network_dump.csv diff --git a/tests/fixtures/ozw/generic_network_dump.csv b/tests/components/ozw/fixtures/generic_network_dump.csv similarity index 100% rename from tests/fixtures/ozw/generic_network_dump.csv rename to tests/components/ozw/fixtures/generic_network_dump.csv diff --git a/tests/fixtures/ozw/light.json b/tests/components/ozw/fixtures/light.json similarity index 100% rename from tests/fixtures/ozw/light.json rename to tests/components/ozw/fixtures/light.json diff --git a/tests/fixtures/ozw/light_network_dump.csv b/tests/components/ozw/fixtures/light_network_dump.csv similarity index 100% rename from tests/fixtures/ozw/light_network_dump.csv rename to tests/components/ozw/fixtures/light_network_dump.csv diff --git a/tests/fixtures/ozw/light_new_ozw_network_dump.csv b/tests/components/ozw/fixtures/light_new_ozw_network_dump.csv similarity index 100% rename from tests/fixtures/ozw/light_new_ozw_network_dump.csv rename to tests/components/ozw/fixtures/light_new_ozw_network_dump.csv diff --git a/tests/fixtures/ozw/light_no_cw_network_dump.csv b/tests/components/ozw/fixtures/light_no_cw_network_dump.csv similarity index 100% rename from tests/fixtures/ozw/light_no_cw_network_dump.csv rename to tests/components/ozw/fixtures/light_no_cw_network_dump.csv diff --git a/tests/fixtures/ozw/light_no_rgb.json b/tests/components/ozw/fixtures/light_no_rgb.json similarity index 100% rename from tests/fixtures/ozw/light_no_rgb.json rename to tests/components/ozw/fixtures/light_no_rgb.json diff --git a/tests/fixtures/ozw/light_no_ww_network_dump.csv b/tests/components/ozw/fixtures/light_no_ww_network_dump.csv similarity index 100% rename from tests/fixtures/ozw/light_no_ww_network_dump.csv rename to tests/components/ozw/fixtures/light_no_ww_network_dump.csv diff --git a/tests/fixtures/ozw/light_pure_rgb.json b/tests/components/ozw/fixtures/light_pure_rgb.json similarity index 100% rename from tests/fixtures/ozw/light_pure_rgb.json rename to tests/components/ozw/fixtures/light_pure_rgb.json diff --git a/tests/fixtures/ozw/light_rgb.json b/tests/components/ozw/fixtures/light_rgb.json similarity index 100% rename from tests/fixtures/ozw/light_rgb.json rename to tests/components/ozw/fixtures/light_rgb.json diff --git a/tests/fixtures/ozw/light_wc_network_dump.csv b/tests/components/ozw/fixtures/light_wc_network_dump.csv similarity index 100% rename from tests/fixtures/ozw/light_wc_network_dump.csv rename to tests/components/ozw/fixtures/light_wc_network_dump.csv diff --git a/tests/fixtures/ozw/lock.json b/tests/components/ozw/fixtures/lock.json similarity index 100% rename from tests/fixtures/ozw/lock.json rename to tests/components/ozw/fixtures/lock.json diff --git a/tests/fixtures/ozw/lock_network_dump.csv b/tests/components/ozw/fixtures/lock_network_dump.csv similarity index 100% rename from tests/fixtures/ozw/lock_network_dump.csv rename to tests/components/ozw/fixtures/lock_network_dump.csv diff --git a/tests/fixtures/ozw/migration_fixture.csv b/tests/components/ozw/fixtures/migration_fixture.csv similarity index 100% rename from tests/fixtures/ozw/migration_fixture.csv rename to tests/components/ozw/fixtures/migration_fixture.csv diff --git a/tests/fixtures/ozw/sensor.json b/tests/components/ozw/fixtures/sensor.json similarity index 100% rename from tests/fixtures/ozw/sensor.json rename to tests/components/ozw/fixtures/sensor.json diff --git a/tests/fixtures/ozw/sensor_string_value_network_dump.csv b/tests/components/ozw/fixtures/sensor_string_value_network_dump.csv similarity index 100% rename from tests/fixtures/ozw/sensor_string_value_network_dump.csv rename to tests/components/ozw/fixtures/sensor_string_value_network_dump.csv diff --git a/tests/fixtures/ozw/switch.json b/tests/components/ozw/fixtures/switch.json similarity index 100% rename from tests/fixtures/ozw/switch.json rename to tests/components/ozw/fixtures/switch.json diff --git a/tests/fixtures/p1_monitor/phases.json b/tests/components/p1_monitor/fixtures/phases.json similarity index 100% rename from tests/fixtures/p1_monitor/phases.json rename to tests/components/p1_monitor/fixtures/phases.json diff --git a/tests/fixtures/p1_monitor/settings.json b/tests/components/p1_monitor/fixtures/settings.json similarity index 100% rename from tests/fixtures/p1_monitor/settings.json rename to tests/components/p1_monitor/fixtures/settings.json diff --git a/tests/fixtures/p1_monitor/smartmeter.json b/tests/components/p1_monitor/fixtures/smartmeter.json similarity index 100% rename from tests/fixtures/p1_monitor/smartmeter.json rename to tests/components/p1_monitor/fixtures/smartmeter.json diff --git a/tests/fixtures/ping/configuration.yaml b/tests/components/ping/fixtures/configuration.yaml similarity index 100% rename from tests/fixtures/ping/configuration.yaml rename to tests/components/ping/fixtures/configuration.yaml diff --git a/tests/components/ping/test_binary_sensor.py b/tests/components/ping/test_binary_sensor.py index 3ffb2bb95d5..e5021ad6ac2 100644 --- a/tests/components/ping/test_binary_sensor.py +++ b/tests/components/ping/test_binary_sensor.py @@ -1,5 +1,4 @@ """The test for the ping binary_sensor platform.""" -from os import path from unittest.mock import patch import pytest @@ -8,6 +7,8 @@ from homeassistant import config as hass_config, setup from homeassistant.components.ping import DOMAIN from homeassistant.const import SERVICE_RELOAD +from tests.common import get_fixture_path + @pytest.fixture def mock_ping(): @@ -37,11 +38,7 @@ async def test_reload(hass, mock_ping): assert hass.states.get("binary_sensor.test") - yaml_path = path.join( - _get_fixtures_base_path(), - "fixtures", - "ping/configuration.yaml", - ) + yaml_path = get_fixture_path("configuration.yaml", "ping") with patch.object(hass_config, "YAML_CONFIG_FILE", yaml_path): await hass.services.async_call( DOMAIN, @@ -55,7 +52,3 @@ async def test_reload(hass, mock_ping): assert hass.states.get("binary_sensor.test") is None assert hass.states.get("binary_sensor.test2") - - -def _get_fixtures_base_path(): - return path.dirname(path.dirname(path.dirname(__file__))) diff --git a/tests/fixtures/plex/album.xml b/tests/components/plex/fixtures/album.xml similarity index 100% rename from tests/fixtures/plex/album.xml rename to tests/components/plex/fixtures/album.xml diff --git a/tests/fixtures/plex/artist_albums.xml b/tests/components/plex/fixtures/artist_albums.xml similarity index 100% rename from tests/fixtures/plex/artist_albums.xml rename to tests/components/plex/fixtures/artist_albums.xml diff --git a/tests/fixtures/plex/children_20.xml b/tests/components/plex/fixtures/children_20.xml similarity index 100% rename from tests/fixtures/plex/children_20.xml rename to tests/components/plex/fixtures/children_20.xml diff --git a/tests/fixtures/plex/children_200.xml b/tests/components/plex/fixtures/children_200.xml similarity index 100% rename from tests/fixtures/plex/children_200.xml rename to tests/components/plex/fixtures/children_200.xml diff --git a/tests/fixtures/plex/children_30.xml b/tests/components/plex/fixtures/children_30.xml similarity index 100% rename from tests/fixtures/plex/children_30.xml rename to tests/components/plex/fixtures/children_30.xml diff --git a/tests/fixtures/plex/children_300.xml b/tests/components/plex/fixtures/children_300.xml similarity index 100% rename from tests/fixtures/plex/children_300.xml rename to tests/components/plex/fixtures/children_300.xml diff --git a/tests/fixtures/plex/empty_library.xml b/tests/components/plex/fixtures/empty_library.xml similarity index 100% rename from tests/fixtures/plex/empty_library.xml rename to tests/components/plex/fixtures/empty_library.xml diff --git a/tests/fixtures/plex/empty_payload.xml b/tests/components/plex/fixtures/empty_payload.xml similarity index 100% rename from tests/fixtures/plex/empty_payload.xml rename to tests/components/plex/fixtures/empty_payload.xml diff --git a/tests/fixtures/plex/grandchildren_300.xml b/tests/components/plex/fixtures/grandchildren_300.xml similarity index 100% rename from tests/fixtures/plex/grandchildren_300.xml rename to tests/components/plex/fixtures/grandchildren_300.xml diff --git a/tests/fixtures/plex/library.xml b/tests/components/plex/fixtures/library.xml similarity index 100% rename from tests/fixtures/plex/library.xml rename to tests/components/plex/fixtures/library.xml diff --git a/tests/fixtures/plex/library_movies_all.xml b/tests/components/plex/fixtures/library_movies_all.xml similarity index 100% rename from tests/fixtures/plex/library_movies_all.xml rename to tests/components/plex/fixtures/library_movies_all.xml diff --git a/tests/fixtures/plex/library_movies_collections.xml b/tests/components/plex/fixtures/library_movies_collections.xml similarity index 100% rename from tests/fixtures/plex/library_movies_collections.xml rename to tests/components/plex/fixtures/library_movies_collections.xml diff --git a/tests/fixtures/plex/library_movies_filtertypes.xml b/tests/components/plex/fixtures/library_movies_filtertypes.xml similarity index 100% rename from tests/fixtures/plex/library_movies_filtertypes.xml rename to tests/components/plex/fixtures/library_movies_filtertypes.xml diff --git a/tests/fixtures/plex/library_movies_metadata.xml b/tests/components/plex/fixtures/library_movies_metadata.xml similarity index 100% rename from tests/fixtures/plex/library_movies_metadata.xml rename to tests/components/plex/fixtures/library_movies_metadata.xml diff --git a/tests/fixtures/plex/library_movies_size.xml b/tests/components/plex/fixtures/library_movies_size.xml similarity index 100% rename from tests/fixtures/plex/library_movies_size.xml rename to tests/components/plex/fixtures/library_movies_size.xml diff --git a/tests/fixtures/plex/library_movies_sort.xml b/tests/components/plex/fixtures/library_movies_sort.xml similarity index 100% rename from tests/fixtures/plex/library_movies_sort.xml rename to tests/components/plex/fixtures/library_movies_sort.xml diff --git a/tests/fixtures/plex/library_music_all.xml b/tests/components/plex/fixtures/library_music_all.xml similarity index 100% rename from tests/fixtures/plex/library_music_all.xml rename to tests/components/plex/fixtures/library_music_all.xml diff --git a/tests/fixtures/plex/library_music_collections.xml b/tests/components/plex/fixtures/library_music_collections.xml similarity index 100% rename from tests/fixtures/plex/library_music_collections.xml rename to tests/components/plex/fixtures/library_music_collections.xml diff --git a/tests/fixtures/plex/library_music_metadata.xml b/tests/components/plex/fixtures/library_music_metadata.xml similarity index 100% rename from tests/fixtures/plex/library_music_metadata.xml rename to tests/components/plex/fixtures/library_music_metadata.xml diff --git a/tests/fixtures/plex/library_music_size.xml b/tests/components/plex/fixtures/library_music_size.xml similarity index 100% rename from tests/fixtures/plex/library_music_size.xml rename to tests/components/plex/fixtures/library_music_size.xml diff --git a/tests/fixtures/plex/library_music_sort.xml b/tests/components/plex/fixtures/library_music_sort.xml similarity index 100% rename from tests/fixtures/plex/library_music_sort.xml rename to tests/components/plex/fixtures/library_music_sort.xml diff --git a/tests/fixtures/plex/library_sections.xml b/tests/components/plex/fixtures/library_sections.xml similarity index 100% rename from tests/fixtures/plex/library_sections.xml rename to tests/components/plex/fixtures/library_sections.xml diff --git a/tests/fixtures/plex/library_tvshows_all.xml b/tests/components/plex/fixtures/library_tvshows_all.xml similarity index 100% rename from tests/fixtures/plex/library_tvshows_all.xml rename to tests/components/plex/fixtures/library_tvshows_all.xml diff --git a/tests/fixtures/plex/library_tvshows_collections.xml b/tests/components/plex/fixtures/library_tvshows_collections.xml similarity index 100% rename from tests/fixtures/plex/library_tvshows_collections.xml rename to tests/components/plex/fixtures/library_tvshows_collections.xml diff --git a/tests/fixtures/plex/library_tvshows_metadata.xml b/tests/components/plex/fixtures/library_tvshows_metadata.xml similarity index 100% rename from tests/fixtures/plex/library_tvshows_metadata.xml rename to tests/components/plex/fixtures/library_tvshows_metadata.xml diff --git a/tests/fixtures/plex/library_tvshows_most_recent.xml b/tests/components/plex/fixtures/library_tvshows_most_recent.xml similarity index 100% rename from tests/fixtures/plex/library_tvshows_most_recent.xml rename to tests/components/plex/fixtures/library_tvshows_most_recent.xml diff --git a/tests/fixtures/plex/library_tvshows_size.xml b/tests/components/plex/fixtures/library_tvshows_size.xml similarity index 100% rename from tests/fixtures/plex/library_tvshows_size.xml rename to tests/components/plex/fixtures/library_tvshows_size.xml diff --git a/tests/fixtures/plex/library_tvshows_size_episodes.xml b/tests/components/plex/fixtures/library_tvshows_size_episodes.xml similarity index 100% rename from tests/fixtures/plex/library_tvshows_size_episodes.xml rename to tests/components/plex/fixtures/library_tvshows_size_episodes.xml diff --git a/tests/fixtures/plex/library_tvshows_size_seasons.xml b/tests/components/plex/fixtures/library_tvshows_size_seasons.xml similarity index 100% rename from tests/fixtures/plex/library_tvshows_size_seasons.xml rename to tests/components/plex/fixtures/library_tvshows_size_seasons.xml diff --git a/tests/fixtures/plex/library_tvshows_sort.xml b/tests/components/plex/fixtures/library_tvshows_sort.xml similarity index 100% rename from tests/fixtures/plex/library_tvshows_sort.xml rename to tests/components/plex/fixtures/library_tvshows_sort.xml diff --git a/tests/fixtures/plex/livetv_sessions.xml b/tests/components/plex/fixtures/livetv_sessions.xml similarity index 100% rename from tests/fixtures/plex/livetv_sessions.xml rename to tests/components/plex/fixtures/livetv_sessions.xml diff --git a/tests/fixtures/plex/media_1.xml b/tests/components/plex/fixtures/media_1.xml similarity index 100% rename from tests/fixtures/plex/media_1.xml rename to tests/components/plex/fixtures/media_1.xml diff --git a/tests/fixtures/plex/media_100.xml b/tests/components/plex/fixtures/media_100.xml similarity index 100% rename from tests/fixtures/plex/media_100.xml rename to tests/components/plex/fixtures/media_100.xml diff --git a/tests/fixtures/plex/media_200.xml b/tests/components/plex/fixtures/media_200.xml similarity index 100% rename from tests/fixtures/plex/media_200.xml rename to tests/components/plex/fixtures/media_200.xml diff --git a/tests/fixtures/plex/media_30.xml b/tests/components/plex/fixtures/media_30.xml similarity index 100% rename from tests/fixtures/plex/media_30.xml rename to tests/components/plex/fixtures/media_30.xml diff --git a/tests/fixtures/plex/player_plexweb_resources.xml b/tests/components/plex/fixtures/player_plexweb_resources.xml similarity index 100% rename from tests/fixtures/plex/player_plexweb_resources.xml rename to tests/components/plex/fixtures/player_plexweb_resources.xml diff --git a/tests/fixtures/plex/playlist_500.xml b/tests/components/plex/fixtures/playlist_500.xml similarity index 100% rename from tests/fixtures/plex/playlist_500.xml rename to tests/components/plex/fixtures/playlist_500.xml diff --git a/tests/fixtures/plex/playlists.xml b/tests/components/plex/fixtures/playlists.xml similarity index 100% rename from tests/fixtures/plex/playlists.xml rename to tests/components/plex/fixtures/playlists.xml diff --git a/tests/fixtures/plex/playqueue_1234.xml b/tests/components/plex/fixtures/playqueue_1234.xml similarity index 100% rename from tests/fixtures/plex/playqueue_1234.xml rename to tests/components/plex/fixtures/playqueue_1234.xml diff --git a/tests/fixtures/plex/playqueue_created.xml b/tests/components/plex/fixtures/playqueue_created.xml similarity index 100% rename from tests/fixtures/plex/playqueue_created.xml rename to tests/components/plex/fixtures/playqueue_created.xml diff --git a/tests/fixtures/plex/plex_server_accounts.xml b/tests/components/plex/fixtures/plex_server_accounts.xml similarity index 100% rename from tests/fixtures/plex/plex_server_accounts.xml rename to tests/components/plex/fixtures/plex_server_accounts.xml diff --git a/tests/fixtures/plex/plex_server_base.xml b/tests/components/plex/fixtures/plex_server_base.xml similarity index 100% rename from tests/fixtures/plex/plex_server_base.xml rename to tests/components/plex/fixtures/plex_server_base.xml diff --git a/tests/fixtures/plex/plex_server_clients.xml b/tests/components/plex/fixtures/plex_server_clients.xml similarity index 100% rename from tests/fixtures/plex/plex_server_clients.xml rename to tests/components/plex/fixtures/plex_server_clients.xml diff --git a/tests/fixtures/plex/plextv_account.xml b/tests/components/plex/fixtures/plextv_account.xml similarity index 100% rename from tests/fixtures/plex/plextv_account.xml rename to tests/components/plex/fixtures/plextv_account.xml diff --git a/tests/fixtures/plex/plextv_resources_base.xml b/tests/components/plex/fixtures/plextv_resources_base.xml similarity index 100% rename from tests/fixtures/plex/plextv_resources_base.xml rename to tests/components/plex/fixtures/plextv_resources_base.xml diff --git a/tests/fixtures/plex/plextv_shared_users.xml b/tests/components/plex/fixtures/plextv_shared_users.xml similarity index 100% rename from tests/fixtures/plex/plextv_shared_users.xml rename to tests/components/plex/fixtures/plextv_shared_users.xml diff --git a/tests/fixtures/plex/security_token.xml b/tests/components/plex/fixtures/security_token.xml similarity index 100% rename from tests/fixtures/plex/security_token.xml rename to tests/components/plex/fixtures/security_token.xml diff --git a/tests/fixtures/plex/session_base.xml b/tests/components/plex/fixtures/session_base.xml similarity index 100% rename from tests/fixtures/plex/session_base.xml rename to tests/components/plex/fixtures/session_base.xml diff --git a/tests/fixtures/plex/session_live_tv.xml b/tests/components/plex/fixtures/session_live_tv.xml similarity index 100% rename from tests/fixtures/plex/session_live_tv.xml rename to tests/components/plex/fixtures/session_live_tv.xml diff --git a/tests/fixtures/plex/session_photo.xml b/tests/components/plex/fixtures/session_photo.xml similarity index 100% rename from tests/fixtures/plex/session_photo.xml rename to tests/components/plex/fixtures/session_photo.xml diff --git a/tests/fixtures/plex/session_plexweb.xml b/tests/components/plex/fixtures/session_plexweb.xml similarity index 100% rename from tests/fixtures/plex/session_plexweb.xml rename to tests/components/plex/fixtures/session_plexweb.xml diff --git a/tests/fixtures/plex/session_transient.xml b/tests/components/plex/fixtures/session_transient.xml similarity index 100% rename from tests/fixtures/plex/session_transient.xml rename to tests/components/plex/fixtures/session_transient.xml diff --git a/tests/fixtures/plex/session_unknown.xml b/tests/components/plex/fixtures/session_unknown.xml similarity index 100% rename from tests/fixtures/plex/session_unknown.xml rename to tests/components/plex/fixtures/session_unknown.xml diff --git a/tests/fixtures/plex/show_seasons.xml b/tests/components/plex/fixtures/show_seasons.xml similarity index 100% rename from tests/fixtures/plex/show_seasons.xml rename to tests/components/plex/fixtures/show_seasons.xml diff --git a/tests/fixtures/plex/sonos_resources.xml b/tests/components/plex/fixtures/sonos_resources.xml similarity index 100% rename from tests/fixtures/plex/sonos_resources.xml rename to tests/components/plex/fixtures/sonos_resources.xml diff --git a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_all_devices.json b/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_all_devices.json similarity index 100% rename from tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_all_devices.json rename to tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_all_devices.json diff --git a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/02cf28bfec924855854c544690a609ef.json b/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/02cf28bfec924855854c544690a609ef.json similarity index 100% rename from tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/02cf28bfec924855854c544690a609ef.json rename to tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/02cf28bfec924855854c544690a609ef.json diff --git a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/21f2b542c49845e6bb416884c55778d6.json b/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/21f2b542c49845e6bb416884c55778d6.json similarity index 100% rename from tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/21f2b542c49845e6bb416884c55778d6.json rename to tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/21f2b542c49845e6bb416884c55778d6.json diff --git a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/4a810418d5394b3f82727340b91ba740.json b/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/4a810418d5394b3f82727340b91ba740.json similarity index 100% rename from tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/4a810418d5394b3f82727340b91ba740.json rename to tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/4a810418d5394b3f82727340b91ba740.json diff --git a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/675416a629f343c495449970e2ca37b5.json b/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/675416a629f343c495449970e2ca37b5.json similarity index 100% rename from tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/675416a629f343c495449970e2ca37b5.json rename to tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/675416a629f343c495449970e2ca37b5.json diff --git a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/680423ff840043738f42cc7f1ff97a36.json b/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/680423ff840043738f42cc7f1ff97a36.json similarity index 100% rename from tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/680423ff840043738f42cc7f1ff97a36.json rename to tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/680423ff840043738f42cc7f1ff97a36.json diff --git a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/6a3bf693d05e48e0b460c815a4fdd09d.json b/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/6a3bf693d05e48e0b460c815a4fdd09d.json similarity index 100% rename from tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/6a3bf693d05e48e0b460c815a4fdd09d.json rename to tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/6a3bf693d05e48e0b460c815a4fdd09d.json diff --git a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/78d1126fc4c743db81b61c20e88342a7.json b/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/78d1126fc4c743db81b61c20e88342a7.json similarity index 100% rename from tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/78d1126fc4c743db81b61c20e88342a7.json rename to tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/78d1126fc4c743db81b61c20e88342a7.json diff --git a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/90986d591dcd426cae3ec3e8111ff730.json b/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/90986d591dcd426cae3ec3e8111ff730.json similarity index 100% rename from tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/90986d591dcd426cae3ec3e8111ff730.json rename to tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/90986d591dcd426cae3ec3e8111ff730.json diff --git a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/a28f588dc4a049a483fd03a30361ad3a.json b/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/a28f588dc4a049a483fd03a30361ad3a.json similarity index 100% rename from tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/a28f588dc4a049a483fd03a30361ad3a.json rename to tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/a28f588dc4a049a483fd03a30361ad3a.json diff --git a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/a2c3583e0a6349358998b760cea82d2a.json b/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/a2c3583e0a6349358998b760cea82d2a.json similarity index 100% rename from tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/a2c3583e0a6349358998b760cea82d2a.json rename to tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/a2c3583e0a6349358998b760cea82d2a.json diff --git a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/b310b72a0e354bfab43089919b9a88bf.json b/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/b310b72a0e354bfab43089919b9a88bf.json similarity index 100% rename from tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/b310b72a0e354bfab43089919b9a88bf.json rename to tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/b310b72a0e354bfab43089919b9a88bf.json diff --git a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/b59bcebaf94b499ea7d46e4a66fb62d8.json b/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/b59bcebaf94b499ea7d46e4a66fb62d8.json similarity index 100% rename from tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/b59bcebaf94b499ea7d46e4a66fb62d8.json rename to tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/b59bcebaf94b499ea7d46e4a66fb62d8.json diff --git a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/cd0ddb54ef694e11ac18ed1cbce5dbbd.json b/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/cd0ddb54ef694e11ac18ed1cbce5dbbd.json similarity index 100% rename from tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/cd0ddb54ef694e11ac18ed1cbce5dbbd.json rename to tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/cd0ddb54ef694e11ac18ed1cbce5dbbd.json diff --git a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/d3da73bde12a47d5a6b8f9dad971f2ec.json b/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/d3da73bde12a47d5a6b8f9dad971f2ec.json similarity index 100% rename from tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/d3da73bde12a47d5a6b8f9dad971f2ec.json rename to tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/d3da73bde12a47d5a6b8f9dad971f2ec.json diff --git a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/df4a4a8169904cdb9c03d61a21f42140.json b/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/df4a4a8169904cdb9c03d61a21f42140.json similarity index 100% rename from tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/df4a4a8169904cdb9c03d61a21f42140.json rename to tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/df4a4a8169904cdb9c03d61a21f42140.json diff --git a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/e7693eb9582644e5b865dba8d4447cf1.json b/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/e7693eb9582644e5b865dba8d4447cf1.json similarity index 100% rename from tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/e7693eb9582644e5b865dba8d4447cf1.json rename to tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/e7693eb9582644e5b865dba8d4447cf1.json diff --git a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/f1fee6043d3642a9b0a65297455f008e.json b/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/f1fee6043d3642a9b0a65297455f008e.json similarity index 100% rename from tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/f1fee6043d3642a9b0a65297455f008e.json rename to tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/f1fee6043d3642a9b0a65297455f008e.json diff --git a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/fe799307f1624099878210aa0b9f1475.json b/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/fe799307f1624099878210aa0b9f1475.json similarity index 100% rename from tests/fixtures/plugwise/adam_multiple_devices_per_zone/get_device_data/fe799307f1624099878210aa0b9f1475.json rename to tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/get_device_data/fe799307f1624099878210aa0b9f1475.json diff --git a/tests/fixtures/plugwise/adam_multiple_devices_per_zone/notifications.json b/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/notifications.json similarity index 100% rename from tests/fixtures/plugwise/adam_multiple_devices_per_zone/notifications.json rename to tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/notifications.json diff --git a/tests/fixtures/plugwise/anna_heatpump/get_all_devices.json b/tests/components/plugwise/fixtures/anna_heatpump/get_all_devices.json similarity index 100% rename from tests/fixtures/plugwise/anna_heatpump/get_all_devices.json rename to tests/components/plugwise/fixtures/anna_heatpump/get_all_devices.json diff --git a/tests/fixtures/plugwise/anna_heatpump/get_device_data/015ae9ea3f964e668e490fa39da3870b.json b/tests/components/plugwise/fixtures/anna_heatpump/get_device_data/015ae9ea3f964e668e490fa39da3870b.json similarity index 100% rename from tests/fixtures/plugwise/anna_heatpump/get_device_data/015ae9ea3f964e668e490fa39da3870b.json rename to tests/components/plugwise/fixtures/anna_heatpump/get_device_data/015ae9ea3f964e668e490fa39da3870b.json diff --git a/tests/fixtures/plugwise/anna_heatpump/get_device_data/1cbf783bb11e4a7c8a6843dee3a86927.json b/tests/components/plugwise/fixtures/anna_heatpump/get_device_data/1cbf783bb11e4a7c8a6843dee3a86927.json similarity index 100% rename from tests/fixtures/plugwise/anna_heatpump/get_device_data/1cbf783bb11e4a7c8a6843dee3a86927.json rename to tests/components/plugwise/fixtures/anna_heatpump/get_device_data/1cbf783bb11e4a7c8a6843dee3a86927.json diff --git a/tests/fixtures/plugwise/anna_heatpump/get_device_data/3cb70739631c4d17a86b8b12e8a5161b.json b/tests/components/plugwise/fixtures/anna_heatpump/get_device_data/3cb70739631c4d17a86b8b12e8a5161b.json similarity index 100% rename from tests/fixtures/plugwise/anna_heatpump/get_device_data/3cb70739631c4d17a86b8b12e8a5161b.json rename to tests/components/plugwise/fixtures/anna_heatpump/get_device_data/3cb70739631c4d17a86b8b12e8a5161b.json diff --git a/tests/fixtures/plugwise/anna_heatpump/notifications.json b/tests/components/plugwise/fixtures/anna_heatpump/notifications.json similarity index 100% rename from tests/fixtures/plugwise/anna_heatpump/notifications.json rename to tests/components/plugwise/fixtures/anna_heatpump/notifications.json diff --git a/tests/fixtures/plugwise/p1v3_full_option/get_all_devices.json b/tests/components/plugwise/fixtures/p1v3_full_option/get_all_devices.json similarity index 100% rename from tests/fixtures/plugwise/p1v3_full_option/get_all_devices.json rename to tests/components/plugwise/fixtures/p1v3_full_option/get_all_devices.json diff --git a/tests/fixtures/plugwise/p1v3_full_option/get_device_data/e950c7d5e1ee407a858e2a8b5016c8b3.json b/tests/components/plugwise/fixtures/p1v3_full_option/get_device_data/e950c7d5e1ee407a858e2a8b5016c8b3.json similarity index 100% rename from tests/fixtures/plugwise/p1v3_full_option/get_device_data/e950c7d5e1ee407a858e2a8b5016c8b3.json rename to tests/components/plugwise/fixtures/p1v3_full_option/get_device_data/e950c7d5e1ee407a858e2a8b5016c8b3.json diff --git a/tests/fixtures/plugwise/p1v3_full_option/notifications.json b/tests/components/plugwise/fixtures/p1v3_full_option/notifications.json similarity index 100% rename from tests/fixtures/plugwise/p1v3_full_option/notifications.json rename to tests/components/plugwise/fixtures/p1v3_full_option/notifications.json diff --git a/tests/fixtures/plugwise/stretch_v31/get_all_devices.json b/tests/components/plugwise/fixtures/stretch_v31/get_all_devices.json similarity index 100% rename from tests/fixtures/plugwise/stretch_v31/get_all_devices.json rename to tests/components/plugwise/fixtures/stretch_v31/get_all_devices.json diff --git a/tests/fixtures/plugwise/stretch_v31/get_device_data/059e4d03c7a34d278add5c7a4a781d19.json b/tests/components/plugwise/fixtures/stretch_v31/get_device_data/059e4d03c7a34d278add5c7a4a781d19.json similarity index 100% rename from tests/fixtures/plugwise/stretch_v31/get_device_data/059e4d03c7a34d278add5c7a4a781d19.json rename to tests/components/plugwise/fixtures/stretch_v31/get_device_data/059e4d03c7a34d278add5c7a4a781d19.json diff --git a/tests/fixtures/plugwise/stretch_v31/get_device_data/5871317346d045bc9f6b987ef25ee638.json b/tests/components/plugwise/fixtures/stretch_v31/get_device_data/5871317346d045bc9f6b987ef25ee638.json similarity index 100% rename from tests/fixtures/plugwise/stretch_v31/get_device_data/5871317346d045bc9f6b987ef25ee638.json rename to tests/components/plugwise/fixtures/stretch_v31/get_device_data/5871317346d045bc9f6b987ef25ee638.json diff --git a/tests/fixtures/plugwise/stretch_v31/get_device_data/5ca521ac179d468e91d772eeeb8a2117.json b/tests/components/plugwise/fixtures/stretch_v31/get_device_data/5ca521ac179d468e91d772eeeb8a2117.json similarity index 100% rename from tests/fixtures/plugwise/stretch_v31/get_device_data/5ca521ac179d468e91d772eeeb8a2117.json rename to tests/components/plugwise/fixtures/stretch_v31/get_device_data/5ca521ac179d468e91d772eeeb8a2117.json diff --git a/tests/fixtures/plugwise/stretch_v31/get_device_data/71e1944f2a944b26ad73323e399efef0.json b/tests/components/plugwise/fixtures/stretch_v31/get_device_data/71e1944f2a944b26ad73323e399efef0.json similarity index 100% rename from tests/fixtures/plugwise/stretch_v31/get_device_data/71e1944f2a944b26ad73323e399efef0.json rename to tests/components/plugwise/fixtures/stretch_v31/get_device_data/71e1944f2a944b26ad73323e399efef0.json diff --git a/tests/fixtures/plugwise/stretch_v31/get_device_data/99f89d097be34fca88d8598c6dbc18ea.json b/tests/components/plugwise/fixtures/stretch_v31/get_device_data/99f89d097be34fca88d8598c6dbc18ea.json similarity index 100% rename from tests/fixtures/plugwise/stretch_v31/get_device_data/99f89d097be34fca88d8598c6dbc18ea.json rename to tests/components/plugwise/fixtures/stretch_v31/get_device_data/99f89d097be34fca88d8598c6dbc18ea.json diff --git a/tests/fixtures/plugwise/stretch_v31/get_device_data/aac7b735042c4832ac9ff33aae4f453b.json b/tests/components/plugwise/fixtures/stretch_v31/get_device_data/aac7b735042c4832ac9ff33aae4f453b.json similarity index 100% rename from tests/fixtures/plugwise/stretch_v31/get_device_data/aac7b735042c4832ac9ff33aae4f453b.json rename to tests/components/plugwise/fixtures/stretch_v31/get_device_data/aac7b735042c4832ac9ff33aae4f453b.json diff --git a/tests/fixtures/plugwise/stretch_v31/get_device_data/cfe95cf3de1948c0b8955125bf754614.json b/tests/components/plugwise/fixtures/stretch_v31/get_device_data/cfe95cf3de1948c0b8955125bf754614.json similarity index 100% rename from tests/fixtures/plugwise/stretch_v31/get_device_data/cfe95cf3de1948c0b8955125bf754614.json rename to tests/components/plugwise/fixtures/stretch_v31/get_device_data/cfe95cf3de1948c0b8955125bf754614.json diff --git a/tests/fixtures/plugwise/stretch_v31/get_device_data/d03738edfcc947f7b8f4573571d90d2d.json b/tests/components/plugwise/fixtures/stretch_v31/get_device_data/d03738edfcc947f7b8f4573571d90d2d.json similarity index 100% rename from tests/fixtures/plugwise/stretch_v31/get_device_data/d03738edfcc947f7b8f4573571d90d2d.json rename to tests/components/plugwise/fixtures/stretch_v31/get_device_data/d03738edfcc947f7b8f4573571d90d2d.json diff --git a/tests/fixtures/plugwise/stretch_v31/get_device_data/d950b314e9d8499f968e6db8d82ef78c.json b/tests/components/plugwise/fixtures/stretch_v31/get_device_data/d950b314e9d8499f968e6db8d82ef78c.json similarity index 100% rename from tests/fixtures/plugwise/stretch_v31/get_device_data/d950b314e9d8499f968e6db8d82ef78c.json rename to tests/components/plugwise/fixtures/stretch_v31/get_device_data/d950b314e9d8499f968e6db8d82ef78c.json diff --git a/tests/fixtures/plugwise/stretch_v31/get_device_data/e1c884e7dede431dadee09506ec4f859.json b/tests/components/plugwise/fixtures/stretch_v31/get_device_data/e1c884e7dede431dadee09506ec4f859.json similarity index 100% rename from tests/fixtures/plugwise/stretch_v31/get_device_data/e1c884e7dede431dadee09506ec4f859.json rename to tests/components/plugwise/fixtures/stretch_v31/get_device_data/e1c884e7dede431dadee09506ec4f859.json diff --git a/tests/fixtures/plugwise/stretch_v31/get_device_data/e309b52ea5684cf1a22f30cf0cd15051.json b/tests/components/plugwise/fixtures/stretch_v31/get_device_data/e309b52ea5684cf1a22f30cf0cd15051.json similarity index 100% rename from tests/fixtures/plugwise/stretch_v31/get_device_data/e309b52ea5684cf1a22f30cf0cd15051.json rename to tests/components/plugwise/fixtures/stretch_v31/get_device_data/e309b52ea5684cf1a22f30cf0cd15051.json diff --git a/tests/fixtures/plugwise/stretch_v31/notifications.json b/tests/components/plugwise/fixtures/stretch_v31/notifications.json similarity index 100% rename from tests/fixtures/plugwise/stretch_v31/notifications.json rename to tests/components/plugwise/fixtures/stretch_v31/notifications.json diff --git a/tests/fixtures/powerwall/device_type.json b/tests/components/powerwall/fixtures/device_type.json similarity index 100% rename from tests/fixtures/powerwall/device_type.json rename to tests/components/powerwall/fixtures/device_type.json diff --git a/tests/fixtures/powerwall/meters.json b/tests/components/powerwall/fixtures/meters.json similarity index 100% rename from tests/fixtures/powerwall/meters.json rename to tests/components/powerwall/fixtures/meters.json diff --git a/tests/fixtures/powerwall/site_info.json b/tests/components/powerwall/fixtures/site_info.json similarity index 100% rename from tests/fixtures/powerwall/site_info.json rename to tests/components/powerwall/fixtures/site_info.json diff --git a/tests/fixtures/powerwall/sitemaster.json b/tests/components/powerwall/fixtures/sitemaster.json similarity index 100% rename from tests/fixtures/powerwall/sitemaster.json rename to tests/components/powerwall/fixtures/sitemaster.json diff --git a/tests/fixtures/powerwall/status.json b/tests/components/powerwall/fixtures/status.json similarity index 100% rename from tests/fixtures/powerwall/status.json rename to tests/components/powerwall/fixtures/status.json diff --git a/tests/fixtures/pushbullet_devices.json b/tests/components/pushbullet/fixtures/devices.json similarity index 100% rename from tests/fixtures/pushbullet_devices.json rename to tests/components/pushbullet/fixtures/devices.json diff --git a/tests/components/pushbullet/test_notify.py b/tests/components/pushbullet/test_notify.py index 6e1de0b9824..a9186652f64 100644 --- a/tests/components/pushbullet/test_notify.py +++ b/tests/components/pushbullet/test_notify.py @@ -18,7 +18,7 @@ def mock_pushbullet(): with patch.object( PushBullet, "_get_data", - return_value=json.loads(load_fixture("pushbullet_devices.json")), + return_value=json.loads(load_fixture("devices.json", "pushbullet")), ): yield diff --git a/tests/fixtures/pvpc_hourly_pricing/PVPC_CURV_DD_2019_10_26.json b/tests/components/pvpc_hourly_pricing/fixtures/PVPC_CURV_DD_2019_10_26.json similarity index 100% rename from tests/fixtures/pvpc_hourly_pricing/PVPC_CURV_DD_2019_10_26.json rename to tests/components/pvpc_hourly_pricing/fixtures/PVPC_CURV_DD_2019_10_26.json diff --git a/tests/fixtures/pvpc_hourly_pricing/PVPC_CURV_DD_2019_10_27.json b/tests/components/pvpc_hourly_pricing/fixtures/PVPC_CURV_DD_2019_10_27.json similarity index 100% rename from tests/fixtures/pvpc_hourly_pricing/PVPC_CURV_DD_2019_10_27.json rename to tests/components/pvpc_hourly_pricing/fixtures/PVPC_CURV_DD_2019_10_27.json diff --git a/tests/fixtures/pvpc_hourly_pricing/PVPC_CURV_DD_2019_10_29.json b/tests/components/pvpc_hourly_pricing/fixtures/PVPC_CURV_DD_2019_10_29.json similarity index 100% rename from tests/fixtures/pvpc_hourly_pricing/PVPC_CURV_DD_2019_10_29.json rename to tests/components/pvpc_hourly_pricing/fixtures/PVPC_CURV_DD_2019_10_29.json diff --git a/tests/fixtures/pvpc_hourly_pricing/PVPC_CURV_DD_2021_06_01.json b/tests/components/pvpc_hourly_pricing/fixtures/PVPC_CURV_DD_2021_06_01.json similarity index 100% rename from tests/fixtures/pvpc_hourly_pricing/PVPC_CURV_DD_2021_06_01.json rename to tests/components/pvpc_hourly_pricing/fixtures/PVPC_CURV_DD_2021_06_01.json diff --git a/tests/fixtures/renault/action.set_ac_start.json b/tests/components/renault/fixtures/action.set_ac_start.json similarity index 100% rename from tests/fixtures/renault/action.set_ac_start.json rename to tests/components/renault/fixtures/action.set_ac_start.json diff --git a/tests/fixtures/renault/action.set_ac_stop.json b/tests/components/renault/fixtures/action.set_ac_stop.json similarity index 100% rename from tests/fixtures/renault/action.set_ac_stop.json rename to tests/components/renault/fixtures/action.set_ac_stop.json diff --git a/tests/fixtures/renault/action.set_charge_mode.json b/tests/components/renault/fixtures/action.set_charge_mode.json similarity index 100% rename from tests/fixtures/renault/action.set_charge_mode.json rename to tests/components/renault/fixtures/action.set_charge_mode.json diff --git a/tests/fixtures/renault/action.set_charge_schedules.json b/tests/components/renault/fixtures/action.set_charge_schedules.json similarity index 100% rename from tests/fixtures/renault/action.set_charge_schedules.json rename to tests/components/renault/fixtures/action.set_charge_schedules.json diff --git a/tests/fixtures/renault/action.set_charge_start.json b/tests/components/renault/fixtures/action.set_charge_start.json similarity index 100% rename from tests/fixtures/renault/action.set_charge_start.json rename to tests/components/renault/fixtures/action.set_charge_start.json diff --git a/tests/fixtures/renault/battery_status_charging.json b/tests/components/renault/fixtures/battery_status_charging.json similarity index 100% rename from tests/fixtures/renault/battery_status_charging.json rename to tests/components/renault/fixtures/battery_status_charging.json diff --git a/tests/fixtures/renault/battery_status_not_charging.json b/tests/components/renault/fixtures/battery_status_not_charging.json similarity index 100% rename from tests/fixtures/renault/battery_status_not_charging.json rename to tests/components/renault/fixtures/battery_status_not_charging.json diff --git a/tests/fixtures/renault/charge_mode_always.json b/tests/components/renault/fixtures/charge_mode_always.json similarity index 100% rename from tests/fixtures/renault/charge_mode_always.json rename to tests/components/renault/fixtures/charge_mode_always.json diff --git a/tests/fixtures/renault/charge_mode_schedule.json b/tests/components/renault/fixtures/charge_mode_schedule.json similarity index 100% rename from tests/fixtures/renault/charge_mode_schedule.json rename to tests/components/renault/fixtures/charge_mode_schedule.json diff --git a/tests/fixtures/renault/charging_settings.json b/tests/components/renault/fixtures/charging_settings.json similarity index 100% rename from tests/fixtures/renault/charging_settings.json rename to tests/components/renault/fixtures/charging_settings.json diff --git a/tests/fixtures/renault/cockpit_ev.json b/tests/components/renault/fixtures/cockpit_ev.json similarity index 100% rename from tests/fixtures/renault/cockpit_ev.json rename to tests/components/renault/fixtures/cockpit_ev.json diff --git a/tests/fixtures/renault/cockpit_fuel.json b/tests/components/renault/fixtures/cockpit_fuel.json similarity index 100% rename from tests/fixtures/renault/cockpit_fuel.json rename to tests/components/renault/fixtures/cockpit_fuel.json diff --git a/tests/fixtures/renault/hvac_status.json b/tests/components/renault/fixtures/hvac_status.json similarity index 100% rename from tests/fixtures/renault/hvac_status.json rename to tests/components/renault/fixtures/hvac_status.json diff --git a/tests/fixtures/renault/location.json b/tests/components/renault/fixtures/location.json similarity index 100% rename from tests/fixtures/renault/location.json rename to tests/components/renault/fixtures/location.json diff --git a/tests/fixtures/renault/no_data.json b/tests/components/renault/fixtures/no_data.json similarity index 100% rename from tests/fixtures/renault/no_data.json rename to tests/components/renault/fixtures/no_data.json diff --git a/tests/fixtures/renault/vehicle_captur_fuel.json b/tests/components/renault/fixtures/vehicle_captur_fuel.json similarity index 100% rename from tests/fixtures/renault/vehicle_captur_fuel.json rename to tests/components/renault/fixtures/vehicle_captur_fuel.json diff --git a/tests/fixtures/renault/vehicle_captur_phev.json b/tests/components/renault/fixtures/vehicle_captur_phev.json similarity index 100% rename from tests/fixtures/renault/vehicle_captur_phev.json rename to tests/components/renault/fixtures/vehicle_captur_phev.json diff --git a/tests/fixtures/renault/vehicle_zoe_40.json b/tests/components/renault/fixtures/vehicle_zoe_40.json similarity index 100% rename from tests/fixtures/renault/vehicle_zoe_40.json rename to tests/components/renault/fixtures/vehicle_zoe_40.json diff --git a/tests/fixtures/renault/vehicle_zoe_50.json b/tests/components/renault/fixtures/vehicle_zoe_50.json similarity index 100% rename from tests/fixtures/renault/vehicle_zoe_50.json rename to tests/components/renault/fixtures/vehicle_zoe_50.json diff --git a/tests/fixtures/rest/configuration.yaml b/tests/components/rest/fixtures/configuration.yaml similarity index 100% rename from tests/fixtures/rest/configuration.yaml rename to tests/components/rest/fixtures/configuration.yaml diff --git a/tests/fixtures/rest/configuration_empty.yaml b/tests/components/rest/fixtures/configuration_empty.yaml similarity index 100% rename from tests/fixtures/rest/configuration_empty.yaml rename to tests/components/rest/fixtures/configuration_empty.yaml diff --git a/tests/fixtures/rest/configuration_invalid.notyaml b/tests/components/rest/fixtures/configuration_invalid.notyaml similarity index 100% rename from tests/fixtures/rest/configuration_invalid.notyaml rename to tests/components/rest/fixtures/configuration_invalid.notyaml diff --git a/tests/fixtures/rest/configuration_top_level.yaml b/tests/components/rest/fixtures/configuration_top_level.yaml similarity index 100% rename from tests/fixtures/rest/configuration_top_level.yaml rename to tests/components/rest/fixtures/configuration_top_level.yaml diff --git a/tests/components/rest/test_binary_sensor.py b/tests/components/rest/test_binary_sensor.py index a0cd7d5108c..6daffcb2a5e 100644 --- a/tests/components/rest/test_binary_sensor.py +++ b/tests/components/rest/test_binary_sensor.py @@ -2,7 +2,6 @@ import asyncio from http import HTTPStatus -from os import path from unittest.mock import MagicMock, patch import httpx @@ -21,6 +20,8 @@ from homeassistant.const import ( ) from homeassistant.setup import async_setup_component +from tests.common import get_fixture_path + async def test_setup_missing_basic_config(hass): """Test setup with configuration missing required entries.""" @@ -397,11 +398,7 @@ async def test_reload(hass): assert hass.states.get("binary_sensor.mockrest") - yaml_path = path.join( - _get_fixtures_base_path(), - "fixtures", - "rest/configuration.yaml", - ) + yaml_path = get_fixture_path("configuration.yaml", "rest") with patch.object(hass_config, "YAML_CONFIG_FILE", yaml_path): await hass.services.async_call( "rest", @@ -433,7 +430,3 @@ async def test_setup_query_params(hass): ) await hass.async_block_till_done() assert len(hass.states.async_all("binary_sensor")) == 1 - - -def _get_fixtures_base_path(): - return path.dirname(path.dirname(path.dirname(__file__))) diff --git a/tests/components/rest/test_init.py b/tests/components/rest/test_init.py index ddd5356525d..988f88b348e 100644 --- a/tests/components/rest/test_init.py +++ b/tests/components/rest/test_init.py @@ -3,7 +3,6 @@ import asyncio from datetime import timedelta from http import HTTPStatus -from os import path from unittest.mock import patch import respx @@ -19,7 +18,7 @@ from homeassistant.const import ( from homeassistant.setup import async_setup_component from homeassistant.util.dt import utcnow -from tests.common import async_fire_time_changed +from tests.common import async_fire_time_changed, get_fixture_path @respx.mock @@ -220,11 +219,8 @@ async def test_reload(hass): assert hass.states.get("sensor.mockrest") - yaml_path = path.join( - _get_fixtures_base_path(), - "fixtures", - "rest/configuration_top_level.yaml", - ) + yaml_path = get_fixture_path("configuration_top_level.yaml", "rest") + with patch.object(hass_config, "YAML_CONFIG_FILE", yaml_path): await hass.services.async_call( "rest", @@ -272,11 +268,8 @@ async def test_reload_and_remove_all(hass): assert hass.states.get("sensor.mockrest") - yaml_path = path.join( - _get_fixtures_base_path(), - "fixtures", - "rest/configuration_empty.yaml", - ) + yaml_path = get_fixture_path("configuration_empty.yaml", "rest") + with patch.object(hass_config, "YAML_CONFIG_FILE", yaml_path): await hass.services.async_call( "rest", @@ -320,11 +313,7 @@ async def test_reload_fails_to_read_configuration(hass): assert len(hass.states.async_all()) == 1 - yaml_path = path.join( - _get_fixtures_base_path(), - "fixtures", - "rest/configuration_invalid.notyaml", - ) + yaml_path = get_fixture_path("configuration_invalid.notyaml", "rest") with patch.object(hass_config, "YAML_CONFIG_FILE", yaml_path): await hass.services.async_call( "rest", @@ -337,10 +326,6 @@ async def test_reload_fails_to_read_configuration(hass): assert len(hass.states.async_all()) == 1 -def _get_fixtures_base_path(): - return path.dirname(path.dirname(path.dirname(__file__))) - - @respx.mock async def test_multiple_rest_endpoints(hass): """Test multiple rest endpoints.""" diff --git a/tests/components/rest/test_notify.py b/tests/components/rest/test_notify.py index fb7b8a31238..31567ae63f0 100644 --- a/tests/components/rest/test_notify.py +++ b/tests/components/rest/test_notify.py @@ -1,5 +1,4 @@ """The tests for the rest.notify platform.""" -from os import path from unittest.mock import patch import respx @@ -10,6 +9,8 @@ from homeassistant.components.rest import DOMAIN from homeassistant.const import SERVICE_RELOAD from homeassistant.setup import async_setup_component +from tests.common import get_fixture_path + @respx.mock async def test_reload_notify(hass): @@ -33,11 +34,8 @@ async def test_reload_notify(hass): assert hass.services.has_service(notify.DOMAIN, DOMAIN) - yaml_path = path.join( - _get_fixtures_base_path(), - "fixtures", - "rest/configuration.yaml", - ) + yaml_path = get_fixture_path("configuration.yaml", "rest") + with patch.object(hass_config, "YAML_CONFIG_FILE", yaml_path): await hass.services.async_call( DOMAIN, @@ -49,7 +47,3 @@ async def test_reload_notify(hass): assert not hass.services.has_service(notify.DOMAIN, DOMAIN) assert hass.services.has_service(notify.DOMAIN, "rest_reloaded") - - -def _get_fixtures_base_path(): - return path.dirname(path.dirname(path.dirname(__file__))) diff --git a/tests/components/rest/test_sensor.py b/tests/components/rest/test_sensor.py index a576acb2fe3..d37fb047f8f 100644 --- a/tests/components/rest/test_sensor.py +++ b/tests/components/rest/test_sensor.py @@ -1,7 +1,6 @@ """The tests for the REST sensor platform.""" import asyncio from http import HTTPStatus -from os import path from unittest.mock import MagicMock, patch import httpx @@ -23,6 +22,8 @@ from homeassistant.const import ( ) from homeassistant.setup import async_setup_component +from tests.common import get_fixture_path + async def test_setup_missing_config(hass): """Test setup with configuration missing required entries.""" @@ -786,11 +787,7 @@ async def test_reload(hass): assert hass.states.get("sensor.mockrest") - yaml_path = path.join( - _get_fixtures_base_path(), - "fixtures", - "rest/configuration.yaml", - ) + yaml_path = get_fixture_path("configuration.yaml", "rest") with patch.object(hass_config, "YAML_CONFIG_FILE", yaml_path): await hass.services.async_call( "rest", @@ -802,7 +799,3 @@ async def test_reload(hass): assert hass.states.get("sensor.mockreset") is None assert hass.states.get("sensor.rollout") - - -def _get_fixtures_base_path(): - return path.dirname(path.dirname(path.dirname(__file__))) diff --git a/tests/components/ring/conftest.py b/tests/components/ring/conftest.py index cda662aab64..2b6edf86132 100644 --- a/tests/components/ring/conftest.py +++ b/tests/components/ring/conftest.py @@ -18,38 +18,39 @@ def requests_mock_fixture(): # Mocks the response for authenticating mock.post( - "https://oauth.ring.com/oauth/token", text=load_fixture("ring_oauth.json") + "https://oauth.ring.com/oauth/token", + text=load_fixture("oauth.json", "ring"), ) # Mocks the response for getting the login session mock.post( "https://api.ring.com/clients_api/session", - text=load_fixture("ring_session.json"), + text=load_fixture("session.json", "ring"), ) # Mocks the response for getting all the devices mock.get( "https://api.ring.com/clients_api/ring_devices", - text=load_fixture("ring_devices.json"), + text=load_fixture("devices.json", "ring"), ) mock.get( "https://api.ring.com/clients_api/dings/active", - text=load_fixture("ring_ding_active.json"), + text=load_fixture("ding_active.json", "ring"), ) # Mocks the response for getting the history of a device mock.get( re.compile( r"https:\/\/api\.ring\.com\/clients_api\/doorbots\/\d+\/history" ), - text=load_fixture("ring_doorbots.json"), + text=load_fixture("doorbots.json", "ring"), ) # Mocks the response for getting the health of a device mock.get( re.compile(r"https:\/\/api\.ring\.com\/clients_api\/doorbots\/\d+\/health"), - text=load_fixture("ring_doorboot_health_attrs.json"), + text=load_fixture("doorboot_health_attrs.json", "ring"), ) # Mocks the response for getting a chimes health mock.get( re.compile(r"https:\/\/api\.ring\.com\/clients_api\/chimes\/\d+\/health"), - text=load_fixture("ring_chime_health_attrs.json"), + text=load_fixture("chime_health_attrs.json", "ring"), ) yield mock diff --git a/tests/fixtures/ring_chime_health_attrs.json b/tests/components/ring/fixtures/chime_health_attrs.json similarity index 100% rename from tests/fixtures/ring_chime_health_attrs.json rename to tests/components/ring/fixtures/chime_health_attrs.json diff --git a/tests/fixtures/ring_devices.json b/tests/components/ring/fixtures/devices.json similarity index 100% rename from tests/fixtures/ring_devices.json rename to tests/components/ring/fixtures/devices.json diff --git a/tests/fixtures/ring_devices_updated.json b/tests/components/ring/fixtures/devices_updated.json similarity index 100% rename from tests/fixtures/ring_devices_updated.json rename to tests/components/ring/fixtures/devices_updated.json diff --git a/tests/fixtures/ring_ding_active.json b/tests/components/ring/fixtures/ding_active.json similarity index 100% rename from tests/fixtures/ring_ding_active.json rename to tests/components/ring/fixtures/ding_active.json diff --git a/tests/fixtures/ring_doorboot_health_attrs.json b/tests/components/ring/fixtures/doorboot_health_attrs.json similarity index 100% rename from tests/fixtures/ring_doorboot_health_attrs.json rename to tests/components/ring/fixtures/doorboot_health_attrs.json diff --git a/tests/fixtures/ring_doorbot_siren_on_response.json b/tests/components/ring/fixtures/doorbot_siren_on_response.json similarity index 100% rename from tests/fixtures/ring_doorbot_siren_on_response.json rename to tests/components/ring/fixtures/doorbot_siren_on_response.json diff --git a/tests/fixtures/ring_doorbots.json b/tests/components/ring/fixtures/doorbots.json similarity index 100% rename from tests/fixtures/ring_doorbots.json rename to tests/components/ring/fixtures/doorbots.json diff --git a/tests/fixtures/ring_oauth.json b/tests/components/ring/fixtures/oauth.json similarity index 100% rename from tests/fixtures/ring_oauth.json rename to tests/components/ring/fixtures/oauth.json diff --git a/tests/fixtures/ring_session.json b/tests/components/ring/fixtures/session.json similarity index 100% rename from tests/fixtures/ring_session.json rename to tests/components/ring/fixtures/session.json diff --git a/tests/components/ring/test_init.py b/tests/components/ring/test_init.py index c7a87ae880a..860102f9fc8 100644 --- a/tests/components/ring/test_init.py +++ b/tests/components/ring/test_init.py @@ -18,23 +18,23 @@ async def test_setup(hass, requests_mock): await async_setup_component(hass, ring.DOMAIN, {}) requests_mock.post( - "https://oauth.ring.com/oauth/token", text=load_fixture("ring_oauth.json") + "https://oauth.ring.com/oauth/token", text=load_fixture("oauth.json", "ring") ) requests_mock.post( "https://api.ring.com/clients_api/session", - text=load_fixture("ring_session.json"), + text=load_fixture("session.json", "ring"), ) requests_mock.get( "https://api.ring.com/clients_api/ring_devices", - text=load_fixture("ring_devices.json"), + text=load_fixture("devices.json", "ring"), ) requests_mock.get( "https://api.ring.com/clients_api/chimes/999999/health", - text=load_fixture("ring_chime_health_attrs.json"), + text=load_fixture("chime_health_attrs.json", "ring"), ) requests_mock.get( "https://api.ring.com/clients_api/doorbots/987652/health", - text=load_fixture("ring_doorboot_health_attrs.json"), + text=load_fixture("doorboot_health_attrs.json", "ring"), ) assert await ring.async_setup(hass, VALID_CONFIG) diff --git a/tests/components/ring/test_light.py b/tests/components/ring/test_light.py index 603c0bf3e84..1b8150364bc 100644 --- a/tests/components/ring/test_light.py +++ b/tests/components/ring/test_light.py @@ -44,7 +44,7 @@ async def test_light_can_be_turned_on(hass, requests_mock): # Mocks the response for turning a light on requests_mock.put( "https://api.ring.com/clients_api/doorbots/765432/floodlight_light_on", - text=load_fixture("ring_doorbot_siren_on_response.json"), + text=load_fixture("doorbot_siren_on_response.json", "ring"), ) state = hass.states.get("light.front_light") @@ -67,7 +67,7 @@ async def test_updates_work(hass, requests_mock): # Changes the return to indicate that the light is now on. requests_mock.get( "https://api.ring.com/clients_api/ring_devices", - text=load_fixture("ring_devices_updated.json"), + text=load_fixture("devices_updated.json", "ring"), ) await hass.services.async_call("ring", "update", {}, blocking=True) diff --git a/tests/components/ring/test_switch.py b/tests/components/ring/test_switch.py index ab81ed5c69a..ed4e9024292 100644 --- a/tests/components/ring/test_switch.py +++ b/tests/components/ring/test_switch.py @@ -45,7 +45,7 @@ async def test_siren_can_be_turned_on(hass, requests_mock): # Mocks the response for turning a siren on requests_mock.put( "https://api.ring.com/clients_api/doorbots/765432/siren_on", - text=load_fixture("ring_doorbot_siren_on_response.json"), + text=load_fixture("doorbot_siren_on_response.json", "ring"), ) state = hass.states.get("switch.front_siren") @@ -68,7 +68,7 @@ async def test_updates_work(hass, requests_mock): # Changes the return to indicate that the siren is now on. requests_mock.get( "https://api.ring.com/clients_api/ring_devices", - text=load_fixture("ring_devices_updated.json"), + text=load_fixture("devices_updated.json", "ring"), ) await hass.services.async_call("ring", "update", {}, blocking=True) diff --git a/tests/fixtures/roku/active-app-netflix.xml b/tests/components/roku/fixtures/active-app-netflix.xml similarity index 100% rename from tests/fixtures/roku/active-app-netflix.xml rename to tests/components/roku/fixtures/active-app-netflix.xml diff --git a/tests/fixtures/roku/active-app-pluto.xml b/tests/components/roku/fixtures/active-app-pluto.xml similarity index 100% rename from tests/fixtures/roku/active-app-pluto.xml rename to tests/components/roku/fixtures/active-app-pluto.xml diff --git a/tests/fixtures/roku/active-app-roku.xml b/tests/components/roku/fixtures/active-app-roku.xml similarity index 100% rename from tests/fixtures/roku/active-app-roku.xml rename to tests/components/roku/fixtures/active-app-roku.xml diff --git a/tests/fixtures/roku/active-app-screensaver.xml b/tests/components/roku/fixtures/active-app-screensaver.xml similarity index 100% rename from tests/fixtures/roku/active-app-screensaver.xml rename to tests/components/roku/fixtures/active-app-screensaver.xml diff --git a/tests/fixtures/roku/active-app-tvinput-dtv.xml b/tests/components/roku/fixtures/active-app-tvinput-dtv.xml similarity index 100% rename from tests/fixtures/roku/active-app-tvinput-dtv.xml rename to tests/components/roku/fixtures/active-app-tvinput-dtv.xml diff --git a/tests/fixtures/roku/apps-tv.xml b/tests/components/roku/fixtures/apps-tv.xml similarity index 100% rename from tests/fixtures/roku/apps-tv.xml rename to tests/components/roku/fixtures/apps-tv.xml diff --git a/tests/fixtures/roku/apps.xml b/tests/components/roku/fixtures/apps.xml similarity index 100% rename from tests/fixtures/roku/apps.xml rename to tests/components/roku/fixtures/apps.xml diff --git a/tests/fixtures/roku/media-player-close.xml b/tests/components/roku/fixtures/media-player-close.xml similarity index 100% rename from tests/fixtures/roku/media-player-close.xml rename to tests/components/roku/fixtures/media-player-close.xml diff --git a/tests/fixtures/roku/media-player-live.xml b/tests/components/roku/fixtures/media-player-live.xml similarity index 100% rename from tests/fixtures/roku/media-player-live.xml rename to tests/components/roku/fixtures/media-player-live.xml diff --git a/tests/fixtures/roku/media-player-pause.xml b/tests/components/roku/fixtures/media-player-pause.xml similarity index 100% rename from tests/fixtures/roku/media-player-pause.xml rename to tests/components/roku/fixtures/media-player-pause.xml diff --git a/tests/fixtures/roku/media-player-play.xml b/tests/components/roku/fixtures/media-player-play.xml similarity index 100% rename from tests/fixtures/roku/media-player-play.xml rename to tests/components/roku/fixtures/media-player-play.xml diff --git a/tests/fixtures/roku/roku3-device-info-power-off.xml b/tests/components/roku/fixtures/roku3-device-info-power-off.xml similarity index 100% rename from tests/fixtures/roku/roku3-device-info-power-off.xml rename to tests/components/roku/fixtures/roku3-device-info-power-off.xml diff --git a/tests/fixtures/roku/roku3-device-info.xml b/tests/components/roku/fixtures/roku3-device-info.xml similarity index 100% rename from tests/fixtures/roku/roku3-device-info.xml rename to tests/components/roku/fixtures/roku3-device-info.xml diff --git a/tests/fixtures/roku/rokutv-device-info-power-off.xml b/tests/components/roku/fixtures/rokutv-device-info-power-off.xml similarity index 100% rename from tests/fixtures/roku/rokutv-device-info-power-off.xml rename to tests/components/roku/fixtures/rokutv-device-info-power-off.xml diff --git a/tests/fixtures/roku/rokutv-device-info.xml b/tests/components/roku/fixtures/rokutv-device-info.xml similarity index 100% rename from tests/fixtures/roku/rokutv-device-info.xml rename to tests/components/roku/fixtures/rokutv-device-info.xml diff --git a/tests/fixtures/roku/rokutv-tv-active-channel.xml b/tests/components/roku/fixtures/rokutv-tv-active-channel.xml similarity index 100% rename from tests/fixtures/roku/rokutv-tv-active-channel.xml rename to tests/components/roku/fixtures/rokutv-tv-active-channel.xml diff --git a/tests/fixtures/roku/rokutv-tv-channels.xml b/tests/components/roku/fixtures/rokutv-tv-channels.xml similarity index 100% rename from tests/fixtures/roku/rokutv-tv-channels.xml rename to tests/components/roku/fixtures/rokutv-tv-channels.xml diff --git a/tests/components/smart_meter_texas/conftest.py b/tests/components/smart_meter_texas/conftest.py index 0d474503582..b5193b59d08 100644 --- a/tests/components/smart_meter_texas/conftest.py +++ b/tests/components/smart_meter_texas/conftest.py @@ -2,7 +2,6 @@ import asyncio from http import HTTPStatus import json -from pathlib import Path import pytest from smart_meter_texas.const import ( @@ -29,7 +28,7 @@ TEST_ENTITY_ID = "sensor.electric_meter_123456789" def load_smt_fixture(name): """Return a dict of the json fixture.""" - json_fixture = load_fixture(Path() / DOMAIN / f"{name}.json") + json_fixture = load_fixture(f"{name}.json", DOMAIN) return json.loads(json_fixture) diff --git a/tests/fixtures/smart_meter_texas/latestodrread.json b/tests/components/smart_meter_texas/fixtures/latestodrread.json similarity index 100% rename from tests/fixtures/smart_meter_texas/latestodrread.json rename to tests/components/smart_meter_texas/fixtures/latestodrread.json diff --git a/tests/fixtures/smart_meter_texas/meter.json b/tests/components/smart_meter_texas/fixtures/meter.json similarity index 100% rename from tests/fixtures/smart_meter_texas/meter.json rename to tests/components/smart_meter_texas/fixtures/meter.json diff --git a/tests/fixtures/smtp/configuration.yaml b/tests/components/smtp/fixtures/configuration.yaml similarity index 100% rename from tests/fixtures/smtp/configuration.yaml rename to tests/components/smtp/fixtures/configuration.yaml diff --git a/tests/components/smtp/test_notify.py b/tests/components/smtp/test_notify.py index 5af1e5fcdbc..38f48c169ac 100644 --- a/tests/components/smtp/test_notify.py +++ b/tests/components/smtp/test_notify.py @@ -1,5 +1,4 @@ """The tests for the notify smtp platform.""" -from os import path import re from unittest.mock import patch @@ -12,6 +11,8 @@ from homeassistant.components.smtp.notify import MailNotificationService from homeassistant.const import SERVICE_RELOAD from homeassistant.setup import async_setup_component +from tests.common import get_fixture_path + class MockSMTP(MailNotificationService): """Test SMTP object that doesn't need a working server.""" @@ -45,11 +46,7 @@ async def test_reload_notify(hass): assert hass.services.has_service(notify.DOMAIN, DOMAIN) - yaml_path = path.join( - _get_fixtures_base_path(), - "fixtures", - "smtp/configuration.yaml", - ) + yaml_path = get_fixture_path("configuration.yaml", "smtp") with patch.object(hass_config, "YAML_CONFIG_FILE", yaml_path), patch( "homeassistant.components.smtp.notify.MailNotificationService.connection_is_valid" ): @@ -65,10 +62,6 @@ async def test_reload_notify(hass): assert hass.services.has_service(notify.DOMAIN, "smtp_reloaded") -def _get_fixtures_base_path(): - return path.dirname(path.dirname(path.dirname(__file__))) - - @pytest.fixture def message(): """Return MockSMTP object with test data.""" diff --git a/tests/fixtures/sonarr/calendar.json b/tests/components/sonarr/fixtures/calendar.json similarity index 100% rename from tests/fixtures/sonarr/calendar.json rename to tests/components/sonarr/fixtures/calendar.json diff --git a/tests/fixtures/sonarr/command.json b/tests/components/sonarr/fixtures/command.json similarity index 100% rename from tests/fixtures/sonarr/command.json rename to tests/components/sonarr/fixtures/command.json diff --git a/tests/fixtures/sonarr/diskspace.json b/tests/components/sonarr/fixtures/diskspace.json similarity index 100% rename from tests/fixtures/sonarr/diskspace.json rename to tests/components/sonarr/fixtures/diskspace.json diff --git a/tests/fixtures/sonarr/queue.json b/tests/components/sonarr/fixtures/queue.json similarity index 100% rename from tests/fixtures/sonarr/queue.json rename to tests/components/sonarr/fixtures/queue.json diff --git a/tests/fixtures/sonarr/series.json b/tests/components/sonarr/fixtures/series.json similarity index 100% rename from tests/fixtures/sonarr/series.json rename to tests/components/sonarr/fixtures/series.json diff --git a/tests/fixtures/sonarr/system-status.json b/tests/components/sonarr/fixtures/system-status.json similarity index 100% rename from tests/fixtures/sonarr/system-status.json rename to tests/components/sonarr/fixtures/system-status.json diff --git a/tests/fixtures/sonarr/wanted-missing.json b/tests/components/sonarr/fixtures/wanted-missing.json similarity index 100% rename from tests/fixtures/sonarr/wanted-missing.json rename to tests/components/sonarr/fixtures/wanted-missing.json diff --git a/tests/fixtures/statistics/configuration.yaml b/tests/components/statistics/fixtures/configuration.yaml similarity index 100% rename from tests/fixtures/statistics/configuration.yaml rename to tests/components/statistics/fixtures/configuration.yaml diff --git a/tests/components/statistics/test_sensor.py b/tests/components/statistics/test_sensor.py index 6cb53c9b93f..41ec88deaec 100644 --- a/tests/components/statistics/test_sensor.py +++ b/tests/components/statistics/test_sensor.py @@ -1,6 +1,5 @@ """The test for the statistics sensor platform.""" from datetime import datetime, timedelta -from os import path import statistics import unittest from unittest.mock import patch @@ -21,6 +20,7 @@ from homeassistant.util import dt as dt_util from tests.common import ( fire_time_changed, + get_fixture_path, get_test_home_assistant, init_recorder_component, ) @@ -496,11 +496,7 @@ async def test_reload(hass): assert hass.states.get("sensor.test") - yaml_path = path.join( - _get_fixtures_base_path(), - "fixtures", - "statistics/configuration.yaml", - ) + yaml_path = get_fixture_path("configuration.yaml", "statistics") with patch.object(hass_config, "YAML_CONFIG_FILE", yaml_path): await hass.services.async_call( DOMAIN, @@ -514,7 +510,3 @@ async def test_reload(hass): assert hass.states.get("sensor.test") is None assert hass.states.get("sensor.cputest") - - -def _get_fixtures_base_path(): - return path.dirname(path.dirname(path.dirname(__file__))) diff --git a/tests/fixtures/tado/ac_issue_32294.heat_mode.json b/tests/components/tado/fixtures/ac_issue_32294.heat_mode.json similarity index 100% rename from tests/fixtures/tado/ac_issue_32294.heat_mode.json rename to tests/components/tado/fixtures/ac_issue_32294.heat_mode.json diff --git a/tests/fixtures/tado/device_temp_offset.json b/tests/components/tado/fixtures/device_temp_offset.json similarity index 100% rename from tests/fixtures/tado/device_temp_offset.json rename to tests/components/tado/fixtures/device_temp_offset.json diff --git a/tests/fixtures/tado/device_wr1.json b/tests/components/tado/fixtures/device_wr1.json similarity index 100% rename from tests/fixtures/tado/device_wr1.json rename to tests/components/tado/fixtures/device_wr1.json diff --git a/tests/fixtures/tado/devices.json b/tests/components/tado/fixtures/devices.json similarity index 100% rename from tests/fixtures/tado/devices.json rename to tests/components/tado/fixtures/devices.json diff --git a/tests/fixtures/tado/hvac_action_heat.json b/tests/components/tado/fixtures/hvac_action_heat.json similarity index 100% rename from tests/fixtures/tado/hvac_action_heat.json rename to tests/components/tado/fixtures/hvac_action_heat.json diff --git a/tests/fixtures/tado/me.json b/tests/components/tado/fixtures/me.json similarity index 100% rename from tests/fixtures/tado/me.json rename to tests/components/tado/fixtures/me.json diff --git a/tests/fixtures/tado/smartac3.auto_mode.json b/tests/components/tado/fixtures/smartac3.auto_mode.json similarity index 100% rename from tests/fixtures/tado/smartac3.auto_mode.json rename to tests/components/tado/fixtures/smartac3.auto_mode.json diff --git a/tests/fixtures/tado/smartac3.cool_mode.json b/tests/components/tado/fixtures/smartac3.cool_mode.json similarity index 100% rename from tests/fixtures/tado/smartac3.cool_mode.json rename to tests/components/tado/fixtures/smartac3.cool_mode.json diff --git a/tests/fixtures/tado/smartac3.dry_mode.json b/tests/components/tado/fixtures/smartac3.dry_mode.json similarity index 100% rename from tests/fixtures/tado/smartac3.dry_mode.json rename to tests/components/tado/fixtures/smartac3.dry_mode.json diff --git a/tests/fixtures/tado/smartac3.fan_mode.json b/tests/components/tado/fixtures/smartac3.fan_mode.json similarity index 100% rename from tests/fixtures/tado/smartac3.fan_mode.json rename to tests/components/tado/fixtures/smartac3.fan_mode.json diff --git a/tests/fixtures/tado/smartac3.heat_mode.json b/tests/components/tado/fixtures/smartac3.heat_mode.json similarity index 100% rename from tests/fixtures/tado/smartac3.heat_mode.json rename to tests/components/tado/fixtures/smartac3.heat_mode.json diff --git a/tests/fixtures/tado/smartac3.hvac_off.json b/tests/components/tado/fixtures/smartac3.hvac_off.json similarity index 100% rename from tests/fixtures/tado/smartac3.hvac_off.json rename to tests/components/tado/fixtures/smartac3.hvac_off.json diff --git a/tests/fixtures/tado/smartac3.manual_off.json b/tests/components/tado/fixtures/smartac3.manual_off.json similarity index 100% rename from tests/fixtures/tado/smartac3.manual_off.json rename to tests/components/tado/fixtures/smartac3.manual_off.json diff --git a/tests/fixtures/tado/smartac3.offline.json b/tests/components/tado/fixtures/smartac3.offline.json similarity index 100% rename from tests/fixtures/tado/smartac3.offline.json rename to tests/components/tado/fixtures/smartac3.offline.json diff --git a/tests/fixtures/tado/smartac3.smart_mode.json b/tests/components/tado/fixtures/smartac3.smart_mode.json similarity index 100% rename from tests/fixtures/tado/smartac3.smart_mode.json rename to tests/components/tado/fixtures/smartac3.smart_mode.json diff --git a/tests/fixtures/tado/smartac3.turning_off.json b/tests/components/tado/fixtures/smartac3.turning_off.json similarity index 100% rename from tests/fixtures/tado/smartac3.turning_off.json rename to tests/components/tado/fixtures/smartac3.turning_off.json diff --git a/tests/fixtures/tado/smartac3.with_swing.json b/tests/components/tado/fixtures/smartac3.with_swing.json similarity index 100% rename from tests/fixtures/tado/smartac3.with_swing.json rename to tests/components/tado/fixtures/smartac3.with_swing.json diff --git a/tests/fixtures/tado/tadov2.heating.auto_mode.json b/tests/components/tado/fixtures/tadov2.heating.auto_mode.json similarity index 100% rename from tests/fixtures/tado/tadov2.heating.auto_mode.json rename to tests/components/tado/fixtures/tadov2.heating.auto_mode.json diff --git a/tests/fixtures/tado/tadov2.heating.manual_mode.json b/tests/components/tado/fixtures/tadov2.heating.manual_mode.json similarity index 100% rename from tests/fixtures/tado/tadov2.heating.manual_mode.json rename to tests/components/tado/fixtures/tadov2.heating.manual_mode.json diff --git a/tests/fixtures/tado/tadov2.heating.off_mode.json b/tests/components/tado/fixtures/tadov2.heating.off_mode.json similarity index 100% rename from tests/fixtures/tado/tadov2.heating.off_mode.json rename to tests/components/tado/fixtures/tadov2.heating.off_mode.json diff --git a/tests/fixtures/tado/tadov2.water_heater.auto_mode.json b/tests/components/tado/fixtures/tadov2.water_heater.auto_mode.json similarity index 100% rename from tests/fixtures/tado/tadov2.water_heater.auto_mode.json rename to tests/components/tado/fixtures/tadov2.water_heater.auto_mode.json diff --git a/tests/fixtures/tado/tadov2.water_heater.heating.json b/tests/components/tado/fixtures/tadov2.water_heater.heating.json similarity index 100% rename from tests/fixtures/tado/tadov2.water_heater.heating.json rename to tests/components/tado/fixtures/tadov2.water_heater.heating.json diff --git a/tests/fixtures/tado/tadov2.water_heater.manual_mode.json b/tests/components/tado/fixtures/tadov2.water_heater.manual_mode.json similarity index 100% rename from tests/fixtures/tado/tadov2.water_heater.manual_mode.json rename to tests/components/tado/fixtures/tadov2.water_heater.manual_mode.json diff --git a/tests/fixtures/tado/tadov2.water_heater.off_mode.json b/tests/components/tado/fixtures/tadov2.water_heater.off_mode.json similarity index 100% rename from tests/fixtures/tado/tadov2.water_heater.off_mode.json rename to tests/components/tado/fixtures/tadov2.water_heater.off_mode.json diff --git a/tests/fixtures/tado/tadov2.zone_capabilities.json b/tests/components/tado/fixtures/tadov2.zone_capabilities.json similarity index 100% rename from tests/fixtures/tado/tadov2.zone_capabilities.json rename to tests/components/tado/fixtures/tadov2.zone_capabilities.json diff --git a/tests/fixtures/tado/token.json b/tests/components/tado/fixtures/token.json similarity index 100% rename from tests/fixtures/tado/token.json rename to tests/components/tado/fixtures/token.json diff --git a/tests/fixtures/tado/water_heater_zone_capabilities.json b/tests/components/tado/fixtures/water_heater_zone_capabilities.json similarity index 100% rename from tests/fixtures/tado/water_heater_zone_capabilities.json rename to tests/components/tado/fixtures/water_heater_zone_capabilities.json diff --git a/tests/fixtures/tado/weather.json b/tests/components/tado/fixtures/weather.json similarity index 100% rename from tests/fixtures/tado/weather.json rename to tests/components/tado/fixtures/weather.json diff --git a/tests/fixtures/tado/zone_capabilities.json b/tests/components/tado/fixtures/zone_capabilities.json similarity index 100% rename from tests/fixtures/tado/zone_capabilities.json rename to tests/components/tado/fixtures/zone_capabilities.json diff --git a/tests/fixtures/tado/zone_default_overlay.json b/tests/components/tado/fixtures/zone_default_overlay.json similarity index 100% rename from tests/fixtures/tado/zone_default_overlay.json rename to tests/components/tado/fixtures/zone_default_overlay.json diff --git a/tests/fixtures/tado/zone_state.json b/tests/components/tado/fixtures/zone_state.json similarity index 100% rename from tests/fixtures/tado/zone_state.json rename to tests/components/tado/fixtures/zone_state.json diff --git a/tests/fixtures/tado/zone_states.json b/tests/components/tado/fixtures/zone_states.json similarity index 100% rename from tests/fixtures/tado/zone_states.json rename to tests/components/tado/fixtures/zone_states.json diff --git a/tests/fixtures/tado/zone_with_swing_capabilities.json b/tests/components/tado/fixtures/zone_with_swing_capabilities.json similarity index 100% rename from tests/fixtures/tado/zone_with_swing_capabilities.json rename to tests/components/tado/fixtures/zone_with_swing_capabilities.json diff --git a/tests/fixtures/tado/zones.json b/tests/components/tado/fixtures/zones.json similarity index 100% rename from tests/fixtures/tado/zones.json rename to tests/components/tado/fixtures/zones.json diff --git a/tests/fixtures/telegram/configuration.yaml b/tests/components/telegram/fixtures/configuration.yaml similarity index 100% rename from tests/fixtures/telegram/configuration.yaml rename to tests/components/telegram/fixtures/configuration.yaml diff --git a/tests/components/telegram/test_notify.py b/tests/components/telegram/test_notify.py index 6f8d1f989f9..8c67c5af3a2 100644 --- a/tests/components/telegram/test_notify.py +++ b/tests/components/telegram/test_notify.py @@ -1,5 +1,4 @@ """The tests for the telegram.notify platform.""" -from os import path from unittest.mock import patch from homeassistant import config as hass_config @@ -8,6 +7,8 @@ from homeassistant.components.telegram import DOMAIN from homeassistant.const import SERVICE_RELOAD from homeassistant.setup import async_setup_component +from tests.common import get_fixture_path + async def test_reload_notify(hass): """Verify we can reload the notify service.""" @@ -30,11 +31,7 @@ async def test_reload_notify(hass): assert hass.services.has_service(notify.DOMAIN, DOMAIN) - yaml_path = path.join( - _get_fixtures_base_path(), - "fixtures", - "telegram/configuration.yaml", - ) + yaml_path = get_fixture_path("configuration.yaml", "telegram") with patch.object(hass_config, "YAML_CONFIG_FILE", yaml_path): await hass.services.async_call( DOMAIN, @@ -46,7 +43,3 @@ async def test_reload_notify(hass): assert not hass.services.has_service(notify.DOMAIN, DOMAIN) assert hass.services.has_service(notify.DOMAIN, "telegram_reloaded") - - -def _get_fixtures_base_path(): - return path.dirname(path.dirname(path.dirname(__file__))) diff --git a/tests/fixtures/template/broken_configuration.yaml b/tests/components/template/fixtures/broken_configuration.yaml similarity index 100% rename from tests/fixtures/template/broken_configuration.yaml rename to tests/components/template/fixtures/broken_configuration.yaml diff --git a/tests/fixtures/template/configuration.yaml.corrupt b/tests/components/template/fixtures/configuration.yaml.corrupt similarity index 100% rename from tests/fixtures/template/configuration.yaml.corrupt rename to tests/components/template/fixtures/configuration.yaml.corrupt diff --git a/tests/fixtures/template/empty_configuration.yaml b/tests/components/template/fixtures/empty_configuration.yaml similarity index 100% rename from tests/fixtures/template/empty_configuration.yaml rename to tests/components/template/fixtures/empty_configuration.yaml diff --git a/tests/fixtures/template/ref_configuration.yaml b/tests/components/template/fixtures/ref_configuration.yaml similarity index 100% rename from tests/fixtures/template/ref_configuration.yaml rename to tests/components/template/fixtures/ref_configuration.yaml diff --git a/tests/fixtures/template/sensor_configuration.yaml b/tests/components/template/fixtures/sensor_configuration.yaml similarity index 100% rename from tests/fixtures/template/sensor_configuration.yaml rename to tests/components/template/fixtures/sensor_configuration.yaml diff --git a/tests/components/template/test_init.py b/tests/components/template/test_init.py index 28caf673d01..08ffdbf6cb0 100644 --- a/tests/components/template/test_init.py +++ b/tests/components/template/test_init.py @@ -1,6 +1,5 @@ """The test for the Template sensor platform.""" from datetime import timedelta -from os import path from unittest.mock import patch import pytest @@ -11,7 +10,7 @@ from homeassistant.helpers.reload import SERVICE_RELOAD from homeassistant.setup import async_setup_component from homeassistant.util import dt as dt_util -from tests.common import async_fire_time_changed +from tests.common import async_fire_time_changed, get_fixture_path @pytest.mark.parametrize("count,domain", [(1, "sensor")]) @@ -250,17 +249,9 @@ async def test_reload_sensors_that_reference_other_template_sensors(hass, start_ assert hass.states.get("sensor.test3").state == "2" -def _get_fixtures_base_path(): - return path.dirname(path.dirname(path.dirname(__file__))) - - async def async_yaml_patch_helper(hass, filename): """Help update configuration.yaml.""" - yaml_path = path.join( - _get_fixtures_base_path(), - "fixtures", - f"template/{filename}", - ) + yaml_path = get_fixture_path(filename, "template") with patch.object(config, "YAML_CONFIG_FILE", yaml_path): await hass.services.async_call( DOMAIN, diff --git a/tests/fixtures/trace/automation_saved_traces.json b/tests/components/trace/fixtures/automation_saved_traces.json similarity index 100% rename from tests/fixtures/trace/automation_saved_traces.json rename to tests/components/trace/fixtures/automation_saved_traces.json diff --git a/tests/fixtures/trace/script_saved_traces.json b/tests/components/trace/fixtures/script_saved_traces.json similarity index 100% rename from tests/fixtures/trace/script_saved_traces.json rename to tests/components/trace/fixtures/script_saved_traces.json diff --git a/tests/fixtures/trend/configuration.yaml b/tests/components/trend/fixtures/configuration.yaml similarity index 100% rename from tests/fixtures/trend/configuration.yaml rename to tests/components/trend/fixtures/configuration.yaml diff --git a/tests/components/trend/test_binary_sensor.py b/tests/components/trend/test_binary_sensor.py index be414b73042..4716762d2e7 100644 --- a/tests/components/trend/test_binary_sensor.py +++ b/tests/components/trend/test_binary_sensor.py @@ -1,6 +1,5 @@ """The test for the Trend sensor platform.""" from datetime import timedelta -from os import path from unittest.mock import patch from homeassistant import config as hass_config, setup @@ -8,7 +7,11 @@ from homeassistant.components.trend import DOMAIN from homeassistant.const import SERVICE_RELOAD import homeassistant.util.dt as dt_util -from tests.common import assert_setup_component, get_test_home_assistant +from tests.common import ( + assert_setup_component, + get_fixture_path, + get_test_home_assistant, +) class TestTrendBinarySensor: @@ -395,11 +398,7 @@ async def test_reload(hass): assert hass.states.get("binary_sensor.test_trend_sensor") - yaml_path = path.join( - _get_fixtures_base_path(), - "fixtures", - "trend/configuration.yaml", - ) + yaml_path = get_fixture_path("configuration.yaml", "trend") with patch.object(hass_config, "YAML_CONFIG_FILE", yaml_path): await hass.services.async_call( DOMAIN, @@ -413,7 +412,3 @@ async def test_reload(hass): assert hass.states.get("binary_sensor.test_trend_sensor") is None assert hass.states.get("binary_sensor.second_test_trend_sensor") - - -def _get_fixtures_base_path(): - return path.dirname(path.dirname(path.dirname(__file__))) diff --git a/tests/fixtures/unifi_direct.txt b/tests/components/unifi_direct/fixtures/data.txt similarity index 100% rename from tests/fixtures/unifi_direct.txt rename to tests/components/unifi_direct/fixtures/data.txt diff --git a/tests/components/unifi_direct/test_device_tracker.py b/tests/components/unifi_direct/test_device_tracker.py index 9f594901e94..700f490bba5 100644 --- a/tests/components/unifi_direct/test_device_tracker.py +++ b/tests/components/unifi_direct/test_device_tracker.py @@ -74,7 +74,7 @@ async def test_get_device_name(mock_ssh, hass): CONF_CONSIDER_HOME: timedelta(seconds=180), } } - mock_ssh.return_value.before = load_fixture("unifi_direct.txt") + mock_ssh.return_value.before = load_fixture("data.txt", "unifi_direct") scanner = get_scanner(hass, conf_dict) devices = scanner.scan_devices() assert len(devices) == 23 @@ -132,7 +132,7 @@ async def test_to_get_update(mock_sendline, mock_prompt, mock_login, mock_logout def test_good_response_parses(hass): """Test that the response form the AP parses to JSON correctly.""" - response = _response_to_json(load_fixture("unifi_direct.txt")) + response = _response_to_json(load_fixture("data.txt", "unifi_direct")) assert response != {} diff --git a/tests/fixtures/universal/configuration.yaml b/tests/components/universal/fixtures/configuration.yaml similarity index 100% rename from tests/fixtures/universal/configuration.yaml rename to tests/components/universal/fixtures/configuration.yaml diff --git a/tests/components/universal/test_media_player.py b/tests/components/universal/test_media_player.py index 737d37052c2..4c8b125cbce 100644 --- a/tests/components/universal/test_media_player.py +++ b/tests/components/universal/test_media_player.py @@ -1,7 +1,6 @@ """The tests for the Universal Media player platform.""" import asyncio from copy import copy -from os import path import unittest from unittest.mock import patch @@ -24,7 +23,7 @@ from homeassistant.const import ( from homeassistant.core import Context, callback from homeassistant.setup import async_setup_component, setup_component -from tests.common import get_test_home_assistant, mock_service +from tests.common import get_fixture_path, get_test_home_assistant, mock_service def validate_config(config): @@ -1177,11 +1176,7 @@ async def test_reload(hass): {"activity_list": ["act1", "act2"], "current_activity": "act2"}, ) - yaml_path = path.join( - _get_fixtures_base_path(), - "fixtures", - "universal/configuration.yaml", - ) + yaml_path = get_fixture_path("configuration.yaml", "universal") with patch.object(hass_config, "YAML_CONFIG_FILE", yaml_path): await hass.services.async_call( "universal", @@ -1199,7 +1194,3 @@ async def test_reload(hass): assert ( "device_class" not in hass.states.get("media_player.master_bed_tv").attributes ) - - -def _get_fixtures_base_path(): - return path.dirname(path.dirname(path.dirname(__file__))) diff --git a/tests/fixtures/venstar/colortouch_info.json b/tests/components/venstar/fixtures/colortouch_info.json similarity index 100% rename from tests/fixtures/venstar/colortouch_info.json rename to tests/components/venstar/fixtures/colortouch_info.json diff --git a/tests/fixtures/venstar/colortouch_root.json b/tests/components/venstar/fixtures/colortouch_root.json similarity index 100% rename from tests/fixtures/venstar/colortouch_root.json rename to tests/components/venstar/fixtures/colortouch_root.json diff --git a/tests/fixtures/venstar/colortouch_sensors.json b/tests/components/venstar/fixtures/colortouch_sensors.json similarity index 100% rename from tests/fixtures/venstar/colortouch_sensors.json rename to tests/components/venstar/fixtures/colortouch_sensors.json diff --git a/tests/fixtures/venstar/t2k_info.json b/tests/components/venstar/fixtures/t2k_info.json similarity index 100% rename from tests/fixtures/venstar/t2k_info.json rename to tests/components/venstar/fixtures/t2k_info.json diff --git a/tests/fixtures/venstar/t2k_root.json b/tests/components/venstar/fixtures/t2k_root.json similarity index 100% rename from tests/fixtures/venstar/t2k_root.json rename to tests/components/venstar/fixtures/t2k_root.json diff --git a/tests/fixtures/venstar/t2k_sensors.json b/tests/components/venstar/fixtures/t2k_sensors.json similarity index 100% rename from tests/fixtures/venstar/t2k_sensors.json rename to tests/components/venstar/fixtures/t2k_sensors.json diff --git a/tests/fixtures/vultr_account_info.json b/tests/components/vultr/fixtures/account_info.json similarity index 100% rename from tests/fixtures/vultr_account_info.json rename to tests/components/vultr/fixtures/account_info.json diff --git a/tests/fixtures/vultr_server_list.json b/tests/components/vultr/fixtures/server_list.json similarity index 100% rename from tests/fixtures/vultr_server_list.json rename to tests/components/vultr/fixtures/server_list.json diff --git a/tests/components/vultr/test_binary_sensor.py b/tests/components/vultr/test_binary_sensor.py index e0d71bf20a8..1b84ddff291 100644 --- a/tests/components/vultr/test_binary_sensor.py +++ b/tests/components/vultr/test_binary_sensor.py @@ -53,12 +53,12 @@ class TestVultrBinarySensorSetup(unittest.TestCase): """Test successful instance.""" mock.get( "https://api.vultr.com/v1/account/info?api_key=ABCDEFG1234567", - text=load_fixture("vultr_account_info.json"), + text=load_fixture("account_info.json", "vultr"), ) with patch( "vultr.Vultr.server_list", - return_value=json.loads(load_fixture("vultr_server_list.json")), + return_value=json.loads(load_fixture("server_list.json", "vultr")), ): # Setup hub base_vultr.setup(self.hass, VALID_CONFIG) @@ -113,12 +113,12 @@ class TestVultrBinarySensorSetup(unittest.TestCase): """Test the VultrBinarySensor fails.""" mock.get( "https://api.vultr.com/v1/account/info?api_key=ABCDEFG1234567", - text=load_fixture("vultr_account_info.json"), + text=load_fixture("account_info.json", "vultr"), ) with patch( "vultr.Vultr.server_list", - return_value=json.loads(load_fixture("vultr_server_list.json")), + return_value=json.loads(load_fixture("server_list.json", "vultr")), ): # Setup hub base_vultr.setup(self.hass, VALID_CONFIG) diff --git a/tests/components/vultr/test_init.py b/tests/components/vultr/test_init.py index 80480a2cec2..040eac1a674 100644 --- a/tests/components/vultr/test_init.py +++ b/tests/components/vultr/test_init.py @@ -32,7 +32,7 @@ class TestVultr(unittest.TestCase): """Test successful setup.""" with patch( "vultr.Vultr.server_list", - return_value=json.loads(load_fixture("vultr_server_list.json")), + return_value=json.loads(load_fixture("server_list.json", "vultr")), ): response = vultr.setup(self.hass, self.config) assert response diff --git a/tests/components/vultr/test_sensor.py b/tests/components/vultr/test_sensor.py index bacffe8e6af..ac7008d066b 100644 --- a/tests/components/vultr/test_sensor.py +++ b/tests/components/vultr/test_sensor.py @@ -59,12 +59,12 @@ class TestVultrSensorSetup(unittest.TestCase): """Test the Vultr sensor class and methods.""" mock.get( "https://api.vultr.com/v1/account/info?api_key=ABCDEFG1234567", - text=load_fixture("vultr_account_info.json"), + text=load_fixture("account_info.json", "vultr"), ) with patch( "vultr.Vultr.server_list", - return_value=json.loads(load_fixture("vultr_server_list.json")), + return_value=json.loads(load_fixture("server_list.json", "vultr")), ): # Setup hub base_vultr.setup(self.hass, VALID_CONFIG) @@ -143,12 +143,12 @@ class TestVultrSensorSetup(unittest.TestCase): """Test the VultrSensor fails.""" mock.get( "https://api.vultr.com/v1/account/info?api_key=ABCDEFG1234567", - text=load_fixture("vultr_account_info.json"), + text=load_fixture("account_info.json", "vultr"), ) with patch( "vultr.Vultr.server_list", - return_value=json.loads(load_fixture("vultr_server_list.json")), + return_value=json.loads(load_fixture("server_list.json", "vultr")), ): # Setup hub base_vultr.setup(self.hass, VALID_CONFIG) diff --git a/tests/components/vultr/test_switch.py b/tests/components/vultr/test_switch.py index d6b7392ca9c..ab3698b48f4 100644 --- a/tests/components/vultr/test_switch.py +++ b/tests/components/vultr/test_switch.py @@ -53,12 +53,12 @@ class TestVultrSwitchSetup(unittest.TestCase): """Test successful instance.""" mock.get( "https://api.vultr.com/v1/account/info?api_key=ABCDEFG1234567", - text=load_fixture("vultr_account_info.json"), + text=load_fixture("account_info.json", "vultr"), ) with patch( "vultr.Vultr.server_list", - return_value=json.loads(load_fixture("vultr_server_list.json")), + return_value=json.loads(load_fixture("server_list.json", "vultr")), ): # Setup hub base_vultr.setup(self.hass, VALID_CONFIG) @@ -114,7 +114,7 @@ class TestVultrSwitchSetup(unittest.TestCase): """Test turning a subscription on.""" with patch( "vultr.Vultr.server_list", - return_value=json.loads(load_fixture("vultr_server_list.json")), + return_value=json.loads(load_fixture("server_list.json", "vultr")), ), patch("vultr.Vultr.server_start") as mock_start: for device in self.DEVICES: if device.name == "Failed Server": @@ -128,7 +128,7 @@ class TestVultrSwitchSetup(unittest.TestCase): """Test turning a subscription off.""" with patch( "vultr.Vultr.server_list", - return_value=json.loads(load_fixture("vultr_server_list.json")), + return_value=json.loads(load_fixture("server_list.json", "vultr")), ), patch("vultr.Vultr.server_halt") as mock_halt: for device in self.DEVICES: if device.name == "A Server": @@ -147,12 +147,12 @@ class TestVultrSwitchSetup(unittest.TestCase): """Test the VultrSwitch fails.""" mock.get( "https://api.vultr.com/v1/account/info?api_key=ABCDEFG1234567", - text=load_fixture("vultr_account_info.json"), + text=load_fixture("account_info.json", "vultr"), ) with patch( "vultr.Vultr.server_list", - return_value=json.loads(load_fixture("vultr_server_list.json")), + return_value=json.loads(load_fixture("server_list.json", "vultr")), ): # Setup hub base_vultr.setup(self.hass, VALID_CONFIG) diff --git a/tests/fixtures/wled/rgb.json b/tests/components/wled/fixtures/rgb.json similarity index 100% rename from tests/fixtures/wled/rgb.json rename to tests/components/wled/fixtures/rgb.json diff --git a/tests/fixtures/wled/rgb_single_segment.json b/tests/components/wled/fixtures/rgb_single_segment.json similarity index 100% rename from tests/fixtures/wled/rgb_single_segment.json rename to tests/components/wled/fixtures/rgb_single_segment.json diff --git a/tests/fixtures/wled/rgb_websocket.json b/tests/components/wled/fixtures/rgb_websocket.json similarity index 100% rename from tests/fixtures/wled/rgb_websocket.json rename to tests/components/wled/fixtures/rgb_websocket.json diff --git a/tests/fixtures/wled/rgbw.json b/tests/components/wled/fixtures/rgbw.json similarity index 100% rename from tests/fixtures/wled/rgbw.json rename to tests/components/wled/fixtures/rgbw.json diff --git a/tests/fixtures/zwave_js/aeon_smart_switch_6_state.json b/tests/components/zwave_js/fixtures/aeon_smart_switch_6_state.json similarity index 100% rename from tests/fixtures/zwave_js/aeon_smart_switch_6_state.json rename to tests/components/zwave_js/fixtures/aeon_smart_switch_6_state.json diff --git a/tests/fixtures/zwave_js/aeotec_radiator_thermostat_state.json b/tests/components/zwave_js/fixtures/aeotec_radiator_thermostat_state.json similarity index 100% rename from tests/fixtures/zwave_js/aeotec_radiator_thermostat_state.json rename to tests/components/zwave_js/fixtures/aeotec_radiator_thermostat_state.json diff --git a/tests/fixtures/zwave_js/aeotec_zw164_siren_state.json b/tests/components/zwave_js/fixtures/aeotec_zw164_siren_state.json similarity index 100% rename from tests/fixtures/zwave_js/aeotec_zw164_siren_state.json rename to tests/components/zwave_js/fixtures/aeotec_zw164_siren_state.json diff --git a/tests/fixtures/zwave_js/bulb_6_multi_color_state.json b/tests/components/zwave_js/fixtures/bulb_6_multi_color_state.json similarity index 100% rename from tests/fixtures/zwave_js/bulb_6_multi_color_state.json rename to tests/components/zwave_js/fixtures/bulb_6_multi_color_state.json diff --git a/tests/fixtures/zwave_js/chain_actuator_zws12_state.json b/tests/components/zwave_js/fixtures/chain_actuator_zws12_state.json similarity index 100% rename from tests/fixtures/zwave_js/chain_actuator_zws12_state.json rename to tests/components/zwave_js/fixtures/chain_actuator_zws12_state.json diff --git a/tests/fixtures/zwave_js/climate_danfoss_lc_13_state.json b/tests/components/zwave_js/fixtures/climate_danfoss_lc_13_state.json similarity index 100% rename from tests/fixtures/zwave_js/climate_danfoss_lc_13_state.json rename to tests/components/zwave_js/fixtures/climate_danfoss_lc_13_state.json diff --git a/tests/fixtures/zwave_js/climate_eurotronic_spirit_z_state.json b/tests/components/zwave_js/fixtures/climate_eurotronic_spirit_z_state.json similarity index 100% rename from tests/fixtures/zwave_js/climate_eurotronic_spirit_z_state.json rename to tests/components/zwave_js/fixtures/climate_eurotronic_spirit_z_state.json diff --git a/tests/fixtures/zwave_js/climate_heatit_z_trm2fx_state.json b/tests/components/zwave_js/fixtures/climate_heatit_z_trm2fx_state.json similarity index 100% rename from tests/fixtures/zwave_js/climate_heatit_z_trm2fx_state.json rename to tests/components/zwave_js/fixtures/climate_heatit_z_trm2fx_state.json diff --git a/tests/fixtures/zwave_js/climate_heatit_z_trm3_no_value_state.json b/tests/components/zwave_js/fixtures/climate_heatit_z_trm3_no_value_state.json similarity index 100% rename from tests/fixtures/zwave_js/climate_heatit_z_trm3_no_value_state.json rename to tests/components/zwave_js/fixtures/climate_heatit_z_trm3_no_value_state.json diff --git a/tests/fixtures/zwave_js/climate_heatit_z_trm3_state.json b/tests/components/zwave_js/fixtures/climate_heatit_z_trm3_state.json similarity index 100% rename from tests/fixtures/zwave_js/climate_heatit_z_trm3_state.json rename to tests/components/zwave_js/fixtures/climate_heatit_z_trm3_state.json diff --git a/tests/fixtures/zwave_js/climate_radio_thermostat_ct100_mode_and_setpoint_on_different_endpoints_state.json b/tests/components/zwave_js/fixtures/climate_radio_thermostat_ct100_mode_and_setpoint_on_different_endpoints_state.json similarity index 100% rename from tests/fixtures/zwave_js/climate_radio_thermostat_ct100_mode_and_setpoint_on_different_endpoints_state.json rename to tests/components/zwave_js/fixtures/climate_radio_thermostat_ct100_mode_and_setpoint_on_different_endpoints_state.json diff --git a/tests/fixtures/zwave_js/climate_radio_thermostat_ct100_plus_different_endpoints_state.json b/tests/components/zwave_js/fixtures/climate_radio_thermostat_ct100_plus_different_endpoints_state.json similarity index 100% rename from tests/fixtures/zwave_js/climate_radio_thermostat_ct100_plus_different_endpoints_state.json rename to tests/components/zwave_js/fixtures/climate_radio_thermostat_ct100_plus_different_endpoints_state.json diff --git a/tests/fixtures/zwave_js/climate_radio_thermostat_ct100_plus_state.json b/tests/components/zwave_js/fixtures/climate_radio_thermostat_ct100_plus_state.json similarity index 100% rename from tests/fixtures/zwave_js/climate_radio_thermostat_ct100_plus_state.json rename to tests/components/zwave_js/fixtures/climate_radio_thermostat_ct100_plus_state.json diff --git a/tests/fixtures/zwave_js/climate_radio_thermostat_ct101_multiple_temp_units_state.json b/tests/components/zwave_js/fixtures/climate_radio_thermostat_ct101_multiple_temp_units_state.json similarity index 100% rename from tests/fixtures/zwave_js/climate_radio_thermostat_ct101_multiple_temp_units_state.json rename to tests/components/zwave_js/fixtures/climate_radio_thermostat_ct101_multiple_temp_units_state.json diff --git a/tests/fixtures/zwave_js/controller_state.json b/tests/components/zwave_js/fixtures/controller_state.json similarity index 100% rename from tests/fixtures/zwave_js/controller_state.json rename to tests/components/zwave_js/fixtures/controller_state.json diff --git a/tests/fixtures/zwave_js/cover_aeotec_nano_shutter_state.json b/tests/components/zwave_js/fixtures/cover_aeotec_nano_shutter_state.json similarity index 100% rename from tests/fixtures/zwave_js/cover_aeotec_nano_shutter_state.json rename to tests/components/zwave_js/fixtures/cover_aeotec_nano_shutter_state.json diff --git a/tests/fixtures/zwave_js/cover_fibaro_fgr222_state.json b/tests/components/zwave_js/fixtures/cover_fibaro_fgr222_state.json similarity index 100% rename from tests/fixtures/zwave_js/cover_fibaro_fgr222_state.json rename to tests/components/zwave_js/fixtures/cover_fibaro_fgr222_state.json diff --git a/tests/fixtures/zwave_js/cover_iblinds_v2_state.json b/tests/components/zwave_js/fixtures/cover_iblinds_v2_state.json similarity index 100% rename from tests/fixtures/zwave_js/cover_iblinds_v2_state.json rename to tests/components/zwave_js/fixtures/cover_iblinds_v2_state.json diff --git a/tests/fixtures/zwave_js/cover_qubino_shutter_state.json b/tests/components/zwave_js/fixtures/cover_qubino_shutter_state.json similarity index 100% rename from tests/fixtures/zwave_js/cover_qubino_shutter_state.json rename to tests/components/zwave_js/fixtures/cover_qubino_shutter_state.json diff --git a/tests/fixtures/zwave_js/cover_zw062_state.json b/tests/components/zwave_js/fixtures/cover_zw062_state.json similarity index 100% rename from tests/fixtures/zwave_js/cover_zw062_state.json rename to tests/components/zwave_js/fixtures/cover_zw062_state.json diff --git a/tests/fixtures/zwave_js/eaton_rf9640_dimmer_state.json b/tests/components/zwave_js/fixtures/eaton_rf9640_dimmer_state.json similarity index 100% rename from tests/fixtures/zwave_js/eaton_rf9640_dimmer_state.json rename to tests/components/zwave_js/fixtures/eaton_rf9640_dimmer_state.json diff --git a/tests/fixtures/zwave_js/ecolink_door_sensor_state.json b/tests/components/zwave_js/fixtures/ecolink_door_sensor_state.json similarity index 100% rename from tests/fixtures/zwave_js/ecolink_door_sensor_state.json rename to tests/components/zwave_js/fixtures/ecolink_door_sensor_state.json diff --git a/tests/fixtures/zwave_js/fan_ge_12730_state.json b/tests/components/zwave_js/fixtures/fan_ge_12730_state.json similarity index 100% rename from tests/fixtures/zwave_js/fan_ge_12730_state.json rename to tests/components/zwave_js/fixtures/fan_ge_12730_state.json diff --git a/tests/fixtures/zwave_js/fortrezz_ssa1_siren_state.json b/tests/components/zwave_js/fixtures/fortrezz_ssa1_siren_state.json similarity index 100% rename from tests/fixtures/zwave_js/fortrezz_ssa1_siren_state.json rename to tests/components/zwave_js/fixtures/fortrezz_ssa1_siren_state.json diff --git a/tests/fixtures/zwave_js/ge_in_wall_dimmer_switch_state.json b/tests/components/zwave_js/fixtures/ge_in_wall_dimmer_switch_state.json similarity index 100% rename from tests/fixtures/zwave_js/ge_in_wall_dimmer_switch_state.json rename to tests/components/zwave_js/fixtures/ge_in_wall_dimmer_switch_state.json diff --git a/tests/fixtures/zwave_js/hank_binary_switch_state.json b/tests/components/zwave_js/fixtures/hank_binary_switch_state.json similarity index 100% rename from tests/fixtures/zwave_js/hank_binary_switch_state.json rename to tests/components/zwave_js/fixtures/hank_binary_switch_state.json diff --git a/tests/fixtures/zwave_js/in_wall_smart_fan_control_state.json b/tests/components/zwave_js/fixtures/in_wall_smart_fan_control_state.json similarity index 100% rename from tests/fixtures/zwave_js/in_wall_smart_fan_control_state.json rename to tests/components/zwave_js/fixtures/in_wall_smart_fan_control_state.json diff --git a/tests/fixtures/zwave_js/inovelli_lzw36_state.json b/tests/components/zwave_js/fixtures/inovelli_lzw36_state.json similarity index 100% rename from tests/fixtures/zwave_js/inovelli_lzw36_state.json rename to tests/components/zwave_js/fixtures/inovelli_lzw36_state.json diff --git a/tests/fixtures/zwave_js/light_color_null_values_state.json b/tests/components/zwave_js/fixtures/light_color_null_values_state.json similarity index 100% rename from tests/fixtures/zwave_js/light_color_null_values_state.json rename to tests/components/zwave_js/fixtures/light_color_null_values_state.json diff --git a/tests/fixtures/zwave_js/lock_august_asl03_state.json b/tests/components/zwave_js/fixtures/lock_august_asl03_state.json similarity index 100% rename from tests/fixtures/zwave_js/lock_august_asl03_state.json rename to tests/components/zwave_js/fixtures/lock_august_asl03_state.json diff --git a/tests/fixtures/zwave_js/lock_id_lock_as_id150_state.json b/tests/components/zwave_js/fixtures/lock_id_lock_as_id150_state.json similarity index 100% rename from tests/fixtures/zwave_js/lock_id_lock_as_id150_state.json rename to tests/components/zwave_js/fixtures/lock_id_lock_as_id150_state.json diff --git a/tests/fixtures/zwave_js/lock_popp_electric_strike_lock_control_state.json b/tests/components/zwave_js/fixtures/lock_popp_electric_strike_lock_control_state.json similarity index 100% rename from tests/fixtures/zwave_js/lock_popp_electric_strike_lock_control_state.json rename to tests/components/zwave_js/fixtures/lock_popp_electric_strike_lock_control_state.json diff --git a/tests/fixtures/zwave_js/lock_schlage_be469_state.json b/tests/components/zwave_js/fixtures/lock_schlage_be469_state.json similarity index 100% rename from tests/fixtures/zwave_js/lock_schlage_be469_state.json rename to tests/components/zwave_js/fixtures/lock_schlage_be469_state.json diff --git a/tests/fixtures/zwave_js/multisensor_6_state.json b/tests/components/zwave_js/fixtures/multisensor_6_state.json similarity index 100% rename from tests/fixtures/zwave_js/multisensor_6_state.json rename to tests/components/zwave_js/fixtures/multisensor_6_state.json diff --git a/tests/fixtures/zwave_js/nortek_thermostat_added_event.json b/tests/components/zwave_js/fixtures/nortek_thermostat_added_event.json similarity index 100% rename from tests/fixtures/zwave_js/nortek_thermostat_added_event.json rename to tests/components/zwave_js/fixtures/nortek_thermostat_added_event.json diff --git a/tests/fixtures/zwave_js/nortek_thermostat_removed_event.json b/tests/components/zwave_js/fixtures/nortek_thermostat_removed_event.json similarity index 100% rename from tests/fixtures/zwave_js/nortek_thermostat_removed_event.json rename to tests/components/zwave_js/fixtures/nortek_thermostat_removed_event.json diff --git a/tests/fixtures/zwave_js/nortek_thermostat_state.json b/tests/components/zwave_js/fixtures/nortek_thermostat_state.json similarity index 100% rename from tests/fixtures/zwave_js/nortek_thermostat_state.json rename to tests/components/zwave_js/fixtures/nortek_thermostat_state.json diff --git a/tests/fixtures/zwave_js/null_name_check_state.json b/tests/components/zwave_js/fixtures/null_name_check_state.json similarity index 100% rename from tests/fixtures/zwave_js/null_name_check_state.json rename to tests/components/zwave_js/fixtures/null_name_check_state.json diff --git a/tests/fixtures/zwave_js/srt321_hrt4_zw_state.json b/tests/components/zwave_js/fixtures/srt321_hrt4_zw_state.json similarity index 100% rename from tests/fixtures/zwave_js/srt321_hrt4_zw_state.json rename to tests/components/zwave_js/fixtures/srt321_hrt4_zw_state.json diff --git a/tests/fixtures/zwave_js/vision_security_zl7432_state.json b/tests/components/zwave_js/fixtures/vision_security_zl7432_state.json similarity index 100% rename from tests/fixtures/zwave_js/vision_security_zl7432_state.json rename to tests/components/zwave_js/fixtures/vision_security_zl7432_state.json diff --git a/tests/fixtures/zwave_js/wallmote_central_scene_state.json b/tests/components/zwave_js/fixtures/wallmote_central_scene_state.json similarity index 100% rename from tests/fixtures/zwave_js/wallmote_central_scene_state.json rename to tests/components/zwave_js/fixtures/wallmote_central_scene_state.json diff --git a/tests/fixtures/zwave_js/zen_31_state.json b/tests/components/zwave_js/fixtures/zen_31_state.json similarity index 100% rename from tests/fixtures/zwave_js/zen_31_state.json rename to tests/components/zwave_js/fixtures/zen_31_state.json diff --git a/tests/fixtures/griddy/getnow.json b/tests/fixtures/griddy/getnow.json deleted file mode 100644 index 2bf685dac44..00000000000 --- a/tests/fixtures/griddy/getnow.json +++ /dev/null @@ -1,600 +0,0 @@ -{ - "now": { - "date": "2020-03-08T18:10:16Z", - "hour_num": "18", - "min_num": "10", - "settlement_point": "LZ_HOUSTON", - "price_type": "lmp", - "price_ckwh": "1.26900000000000000000", - "value_score": "11", - "mean_price_ckwh": "1.429706", - "diff_mean_ckwh": "-0.160706", - "high_ckwh": "3.200000", - "low_ckwh": "0.700000", - "std_dev_ckwh": "0.544065", - "price_display": "1.3", - "price_display_sign": "¢", - "date_local_tz": "2020-03-08T13:10:16-05:00" - }, - "forecast": [ - { - "date": "2020-03-08T19:00:00Z", - "hour_num": "19", - "min_num": "0", - "settlement_point": "LZ_HOUSTON", - "price_type": "dam", - "price_ckwh": "1.32000000", - "value_score": "12", - "mean_price_ckwh": "1.433030", - "diff_mean_ckwh": "-0.113030", - "high_ckwh": "3.200000", - "low_ckwh": "0.700000", - "std_dev_ckwh": "0.552149", - "price_display": "1.3", - "price_display_sign": "¢", - "date_local_tz": "2020-03-08T14:00:00-05:00" - }, - { - "date": "2020-03-08T20:00:00Z", - "hour_num": "20", - "min_num": "0", - "settlement_point": "LZ_HOUSTON", - "price_type": "dam", - "price_ckwh": "1.37400000", - "value_score": "12", - "mean_price_ckwh": "1.433030", - "diff_mean_ckwh": "-0.059030", - "high_ckwh": "3.200000", - "low_ckwh": "0.700000", - "std_dev_ckwh": "0.552149", - "price_display": "1.4", - "price_display_sign": "¢", - "date_local_tz": "2020-03-08T15:00:00-05:00" - }, - { - "date": "2020-03-08T21:00:00Z", - "hour_num": "21", - "min_num": "0", - "settlement_point": "LZ_HOUSTON", - "price_type": "dam", - "price_ckwh": "1.44700000", - "value_score": "13", - "mean_price_ckwh": "1.433030", - "diff_mean_ckwh": "0.013970", - "high_ckwh": "3.200000", - "low_ckwh": "0.700000", - "std_dev_ckwh": "0.552149", - "price_display": "1.4", - "price_display_sign": "¢", - "date_local_tz": "2020-03-08T16:00:00-05:00" - }, - { - "date": "2020-03-08T22:00:00Z", - "hour_num": "22", - "min_num": "0", - "settlement_point": "LZ_HOUSTON", - "price_type": "dam", - "price_ckwh": "1.52600000", - "value_score": "13", - "mean_price_ckwh": "1.433030", - "diff_mean_ckwh": "0.092970", - "high_ckwh": "3.200000", - "low_ckwh": "0.700000", - "std_dev_ckwh": "0.552149", - "price_display": "1.5", - "price_display_sign": "¢", - "date_local_tz": "2020-03-08T17:00:00-05:00" - }, - { - "date": "2020-03-08T23:00:00Z", - "hour_num": "23", - "min_num": "0", - "settlement_point": "LZ_HOUSTON", - "price_type": "dam", - "price_ckwh": "2.05100000", - "value_score": "17", - "mean_price_ckwh": "1.433030", - "diff_mean_ckwh": "0.617970", - "high_ckwh": "3.200000", - "low_ckwh": "0.700000", - "std_dev_ckwh": "0.552149", - "price_display": "2.1", - "price_display_sign": "¢", - "date_local_tz": "2020-03-08T18:00:00-05:00" - }, - { - "date": "2020-03-09T00:00:00Z", - "hour_num": "0", - "min_num": "0", - "settlement_point": "LZ_HOUSTON", - "price_type": "dam", - "price_ckwh": "2.07400000", - "value_score": "17", - "mean_price_ckwh": "1.433030", - "diff_mean_ckwh": "0.640970", - "high_ckwh": "3.200000", - "low_ckwh": "0.700000", - "std_dev_ckwh": "0.552149", - "price_display": "2.1", - "price_display_sign": "¢", - "date_local_tz": "2020-03-08T19:00:00-05:00" - }, - { - "date": "2020-03-09T01:00:00Z", - "hour_num": "1", - "min_num": "0", - "settlement_point": "LZ_HOUSTON", - "price_type": "dam", - "price_ckwh": "1.94400000", - "value_score": "16", - "mean_price_ckwh": "1.433030", - "diff_mean_ckwh": "0.510970", - "high_ckwh": "3.200000", - "low_ckwh": "0.700000", - "std_dev_ckwh": "0.552149", - "price_display": "1.9", - "price_display_sign": "¢", - "date_local_tz": "2020-03-08T20:00:00-05:00" - }, - { - "date": "2020-03-09T02:00:00Z", - "hour_num": "2", - "min_num": "0", - "settlement_point": "LZ_HOUSTON", - "price_type": "dam", - "price_ckwh": "1.57500000", - "value_score": "14", - "mean_price_ckwh": "1.433030", - "diff_mean_ckwh": "0.141970", - "high_ckwh": "3.200000", - "low_ckwh": "0.700000", - "std_dev_ckwh": "0.552149", - "price_display": "1.6", - "price_display_sign": "¢", - "date_local_tz": "2020-03-08T21:00:00-05:00" - }, - { - "date": "2020-03-09T03:00:00Z", - "hour_num": "3", - "min_num": "0", - "settlement_point": "LZ_HOUSTON", - "price_type": "dam", - "price_ckwh": "1.23700000", - "value_score": "11", - "mean_price_ckwh": "1.433030", - "diff_mean_ckwh": "-0.196030", - "high_ckwh": "3.200000", - "low_ckwh": "0.700000", - "std_dev_ckwh": "0.552149", - "price_display": "1.2", - "price_display_sign": "¢", - "date_local_tz": "2020-03-08T22:00:00-05:00" - }, - { - "date": "2020-03-09T04:00:00Z", - "hour_num": "4", - "min_num": "0", - "settlement_point": "LZ_HOUSTON", - "price_type": "dam", - "price_ckwh": "0.96200000", - "value_score": "9", - "mean_price_ckwh": "1.433030", - "diff_mean_ckwh": "-0.471030", - "high_ckwh": "3.200000", - "low_ckwh": "0.700000", - "std_dev_ckwh": "0.552149", - "price_display": "1", - "price_display_sign": "¢", - "date_local_tz": "2020-03-08T23:00:00-05:00" - }, - { - "date": "2020-03-09T05:00:00Z", - "hour_num": "5", - "min_num": "0", - "settlement_point": "LZ_HOUSTON", - "price_type": "dam", - "price_ckwh": "0.80000000", - "value_score": "8", - "mean_price_ckwh": "1.433030", - "diff_mean_ckwh": "-0.633030", - "high_ckwh": "3.200000", - "low_ckwh": "0.700000", - "std_dev_ckwh": "0.552149", - "price_display": "0.8", - "price_display_sign": "¢", - "date_local_tz": "2020-03-09T00:00:00-05:00" - }, - { - "date": "2020-03-09T06:00:00Z", - "hour_num": "6", - "min_num": "0", - "settlement_point": "LZ_HOUSTON", - "price_type": "dam", - "price_ckwh": "0.70000000", - "value_score": "7", - "mean_price_ckwh": "1.433030", - "diff_mean_ckwh": "-0.733030", - "high_ckwh": "3.200000", - "low_ckwh": "0.700000", - "std_dev_ckwh": "0.552149", - "price_display": "0.7", - "price_display_sign": "¢", - "date_local_tz": "2020-03-09T01:00:00-05:00" - }, - { - "date": "2020-03-09T07:00:00Z", - "hour_num": "7", - "min_num": "0", - "settlement_point": "LZ_HOUSTON", - "price_type": "dam", - "price_ckwh": "0.70000000", - "value_score": "7", - "mean_price_ckwh": "1.433030", - "diff_mean_ckwh": "-0.733030", - "high_ckwh": "3.200000", - "low_ckwh": "0.700000", - "std_dev_ckwh": "0.552149", - "price_display": "0.7", - "price_display_sign": "¢", - "date_local_tz": "2020-03-09T02:00:00-05:00" - }, - { - "date": "2020-03-09T08:00:00Z", - "hour_num": "8", - "min_num": "0", - "settlement_point": "LZ_HOUSTON", - "price_type": "dam", - "price_ckwh": "0.70000000", - "value_score": "7", - "mean_price_ckwh": "1.433030", - "diff_mean_ckwh": "-0.733030", - "high_ckwh": "3.200000", - "low_ckwh": "0.700000", - "std_dev_ckwh": "0.552149", - "price_display": "0.7", - "price_display_sign": "¢", - "date_local_tz": "2020-03-09T03:00:00-05:00" - }, - { - "date": "2020-03-09T09:00:00Z", - "hour_num": "9", - "min_num": "0", - "settlement_point": "LZ_HOUSTON", - "price_type": "dam", - "price_ckwh": "0.70000000", - "value_score": "7", - "mean_price_ckwh": "1.433030", - "diff_mean_ckwh": "-0.733030", - "high_ckwh": "3.200000", - "low_ckwh": "0.700000", - "std_dev_ckwh": "0.552149", - "price_display": "0.7", - "price_display_sign": "¢", - "date_local_tz": "2020-03-09T04:00:00-05:00" - }, - { - "date": "2020-03-09T10:00:00Z", - "hour_num": "10", - "min_num": "0", - "settlement_point": "LZ_HOUSTON", - "price_type": "dam", - "price_ckwh": "0.90000000", - "value_score": "8", - "mean_price_ckwh": "1.433030", - "diff_mean_ckwh": "-0.533030", - "high_ckwh": "3.200000", - "low_ckwh": "0.700000", - "std_dev_ckwh": "0.552149", - "price_display": "0.9", - "price_display_sign": "¢", - "date_local_tz": "2020-03-09T05:00:00-05:00" - }, - { - "date": "2020-03-09T11:00:00Z", - "hour_num": "11", - "min_num": "0", - "settlement_point": "LZ_HOUSTON", - "price_type": "dam", - "price_ckwh": "1.00000000", - "value_score": "9", - "mean_price_ckwh": "1.433030", - "diff_mean_ckwh": "-0.433030", - "high_ckwh": "3.200000", - "low_ckwh": "0.700000", - "std_dev_ckwh": "0.552149", - "price_display": "1", - "price_display_sign": "¢", - "date_local_tz": "2020-03-09T06:00:00-05:00" - }, - { - "date": "2020-03-09T12:00:00Z", - "hour_num": "12", - "min_num": "0", - "settlement_point": "LZ_HOUSTON", - "price_type": "dam", - "price_ckwh": "1.10000000", - "value_score": "10", - "mean_price_ckwh": "1.433030", - "diff_mean_ckwh": "-0.333030", - "high_ckwh": "3.200000", - "low_ckwh": "0.700000", - "std_dev_ckwh": "0.552149", - "price_display": "1.1", - "price_display_sign": "¢", - "date_local_tz": "2020-03-09T07:00:00-05:00" - }, - { - "date": "2020-03-09T13:00:00Z", - "hour_num": "13", - "min_num": "0", - "settlement_point": "LZ_HOUSTON", - "price_type": "dam", - "price_ckwh": "1.10000000", - "value_score": "10", - "mean_price_ckwh": "1.433030", - "diff_mean_ckwh": "-0.333030", - "high_ckwh": "3.200000", - "low_ckwh": "0.700000", - "std_dev_ckwh": "0.552149", - "price_display": "1.1", - "price_display_sign": "¢", - "date_local_tz": "2020-03-09T08:00:00-05:00" - }, - { - "date": "2020-03-09T14:00:00Z", - "hour_num": "14", - "min_num": "0", - "settlement_point": "LZ_HOUSTON", - "price_type": "dam", - "price_ckwh": "1.20000000", - "value_score": "11", - "mean_price_ckwh": "1.433030", - "diff_mean_ckwh": "-0.233030", - "high_ckwh": "3.200000", - "low_ckwh": "0.700000", - "std_dev_ckwh": "0.552149", - "price_display": "1.2", - "price_display_sign": "¢", - "date_local_tz": "2020-03-09T09:00:00-05:00" - }, - { - "date": "2020-03-09T15:00:00Z", - "hour_num": "15", - "min_num": "0", - "settlement_point": "LZ_HOUSTON", - "price_type": "dam", - "price_ckwh": "1.20000000", - "value_score": "11", - "mean_price_ckwh": "1.433030", - "diff_mean_ckwh": "-0.233030", - "high_ckwh": "3.200000", - "low_ckwh": "0.700000", - "std_dev_ckwh": "0.552149", - "price_display": "1.2", - "price_display_sign": "¢", - "date_local_tz": "2020-03-09T10:00:00-05:00" - }, - { - "date": "2020-03-09T16:00:00Z", - "hour_num": "16", - "min_num": "0", - "settlement_point": "LZ_HOUSTON", - "price_type": "dam", - "price_ckwh": "1.30000000", - "value_score": "11", - "mean_price_ckwh": "1.433030", - "diff_mean_ckwh": "-0.133030", - "high_ckwh": "3.200000", - "low_ckwh": "0.700000", - "std_dev_ckwh": "0.552149", - "price_display": "1.3", - "price_display_sign": "¢", - "date_local_tz": "2020-03-09T11:00:00-05:00" - }, - { - "date": "2020-03-09T17:00:00Z", - "hour_num": "17", - "min_num": "0", - "settlement_point": "LZ_HOUSTON", - "price_type": "dam", - "price_ckwh": "1.40000000", - "value_score": "12", - "mean_price_ckwh": "1.433030", - "diff_mean_ckwh": "-0.033030", - "high_ckwh": "3.200000", - "low_ckwh": "0.700000", - "std_dev_ckwh": "0.552149", - "price_display": "1.4", - "price_display_sign": "¢", - "date_local_tz": "2020-03-09T12:00:00-05:00" - }, - { - "date": "2020-03-09T18:00:00Z", - "hour_num": "18", - "min_num": "0", - "settlement_point": "LZ_HOUSTON", - "price_type": "dam", - "price_ckwh": "1.50000000", - "value_score": "13", - "mean_price_ckwh": "1.433030", - "diff_mean_ckwh": "0.066970", - "high_ckwh": "3.200000", - "low_ckwh": "0.700000", - "std_dev_ckwh": "0.552149", - "price_display": "1.5", - "price_display_sign": "¢", - "date_local_tz": "2020-03-09T13:00:00-05:00" - }, - { - "date": "2020-03-09T19:00:00Z", - "hour_num": "19", - "min_num": "0", - "settlement_point": "LZ_HOUSTON", - "price_type": "dam", - "price_ckwh": "1.60000000", - "value_score": "14", - "mean_price_ckwh": "1.433030", - "diff_mean_ckwh": "0.166970", - "high_ckwh": "3.200000", - "low_ckwh": "0.700000", - "std_dev_ckwh": "0.552149", - "price_display": "1.6", - "price_display_sign": "¢", - "date_local_tz": "2020-03-09T14:00:00-05:00" - }, - { - "date": "2020-03-09T20:00:00Z", - "hour_num": "20", - "min_num": "0", - "settlement_point": "LZ_HOUSTON", - "price_type": "dam", - "price_ckwh": "1.60000000", - "value_score": "14", - "mean_price_ckwh": "1.433030", - "diff_mean_ckwh": "0.166970", - "high_ckwh": "3.200000", - "low_ckwh": "0.700000", - "std_dev_ckwh": "0.552149", - "price_display": "1.6", - "price_display_sign": "¢", - "date_local_tz": "2020-03-09T15:00:00-05:00" - }, - { - "date": "2020-03-09T21:00:00Z", - "hour_num": "21", - "min_num": "0", - "settlement_point": "LZ_HOUSTON", - "price_type": "dam", - "price_ckwh": "1.60000000", - "value_score": "14", - "mean_price_ckwh": "1.433030", - "diff_mean_ckwh": "0.166970", - "high_ckwh": "3.200000", - "low_ckwh": "0.700000", - "std_dev_ckwh": "0.552149", - "price_display": "1.6", - "price_display_sign": "¢", - "date_local_tz": "2020-03-09T16:00:00-05:00" - }, - { - "date": "2020-03-09T22:00:00Z", - "hour_num": "22", - "min_num": "0", - "settlement_point": "LZ_HOUSTON", - "price_type": "dam", - "price_ckwh": "2.10000000", - "value_score": "18", - "mean_price_ckwh": "1.433030", - "diff_mean_ckwh": "0.666970", - "high_ckwh": "3.200000", - "low_ckwh": "0.700000", - "std_dev_ckwh": "0.552149", - "price_display": "2.1", - "price_display_sign": "¢", - "date_local_tz": "2020-03-09T17:00:00-05:00" - }, - { - "date": "2020-03-09T23:00:00Z", - "hour_num": "23", - "min_num": "0", - "settlement_point": "LZ_HOUSTON", - "price_type": "dam", - "price_ckwh": "3.20000000", - "value_score": "27", - "mean_price_ckwh": "1.433030", - "diff_mean_ckwh": "1.766970", - "high_ckwh": "3.200000", - "low_ckwh": "0.700000", - "std_dev_ckwh": "0.552149", - "price_display": "3.2", - "price_display_sign": "¢", - "date_local_tz": "2020-03-09T18:00:00-05:00" - }, - { - "date": "2020-03-10T00:00:00Z", - "hour_num": "0", - "min_num": "0", - "settlement_point": "LZ_HOUSTON", - "price_type": "dam", - "price_ckwh": "2.40000000", - "value_score": "20", - "mean_price_ckwh": "1.433030", - "diff_mean_ckwh": "0.966970", - "high_ckwh": "3.200000", - "low_ckwh": "0.700000", - "std_dev_ckwh": "0.552149", - "price_display": "2.4", - "price_display_sign": "¢", - "date_local_tz": "2020-03-09T19:00:00-05:00" - }, - { - "date": "2020-03-10T01:00:00Z", - "hour_num": "1", - "min_num": "0", - "settlement_point": "LZ_HOUSTON", - "price_type": "dam", - "price_ckwh": "2.00000000", - "value_score": "17", - "mean_price_ckwh": "1.433030", - "diff_mean_ckwh": "0.566970", - "high_ckwh": "3.200000", - "low_ckwh": "0.700000", - "std_dev_ckwh": "0.552149", - "price_display": "2", - "price_display_sign": "¢", - "date_local_tz": "2020-03-09T20:00:00-05:00" - }, - { - "date": "2020-03-10T02:00:00Z", - "hour_num": "2", - "min_num": "0", - "settlement_point": "LZ_HOUSTON", - "price_type": "dam", - "price_ckwh": "1.70000000", - "value_score": "15", - "mean_price_ckwh": "1.433030", - "diff_mean_ckwh": "0.266970", - "high_ckwh": "3.200000", - "low_ckwh": "0.700000", - "std_dev_ckwh": "0.552149", - "price_display": "1.7", - "price_display_sign": "¢", - "date_local_tz": "2020-03-09T21:00:00-05:00" - }, - { - "date": "2020-03-10T03:00:00Z", - "hour_num": "3", - "min_num": "0", - "settlement_point": "LZ_HOUSTON", - "price_type": "dam", - "price_ckwh": "1.40000000", - "value_score": "12", - "mean_price_ckwh": "1.433030", - "diff_mean_ckwh": "-0.033030", - "high_ckwh": "3.200000", - "low_ckwh": "0.700000", - "std_dev_ckwh": "0.552149", - "price_display": "1.4", - "price_display_sign": "¢", - "date_local_tz": "2020-03-09T22:00:00-05:00" - }, - { - "date": "2020-03-10T04:00:00Z", - "hour_num": "4", - "min_num": "0", - "settlement_point": "LZ_HOUSTON", - "price_type": "dam", - "price_ckwh": "1.20000000", - "value_score": "11", - "mean_price_ckwh": "1.433030", - "diff_mean_ckwh": "-0.233030", - "high_ckwh": "3.200000", - "low_ckwh": "0.700000", - "std_dev_ckwh": "0.552149", - "price_display": "1.2", - "price_display_sign": "¢", - "date_local_tz": "2020-03-09T23:00:00-05:00" - } - ], - "seconds_until_refresh": "26" -} diff --git a/tests/helpers/test_reload.py b/tests/helpers/test_reload.py index b4f47fa65b1..b99951493ca 100644 --- a/tests/helpers/test_reload.py +++ b/tests/helpers/test_reload.py @@ -1,6 +1,5 @@ """Tests for the reload helper.""" import logging -from os import path from unittest.mock import AsyncMock, Mock, patch import pytest @@ -20,6 +19,7 @@ from homeassistant.loader import async_get_integration from tests.common import ( MockModule, MockPlatform, + get_fixture_path, mock_entity_platform, mock_integration, ) @@ -57,11 +57,7 @@ async def test_reload_platform(hass): assert platform.platform_name == PLATFORM assert platform.domain == DOMAIN - yaml_path = path.join( - _get_fixtures_base_path(), - "fixtures", - "helpers/reload_configuration.yaml", - ) + yaml_path = get_fixture_path("helpers/reload_configuration.yaml") with patch.object(config, "YAML_CONFIG_FILE", yaml_path): await async_reload_integration_platforms(hass, PLATFORM, [DOMAIN]) @@ -99,11 +95,7 @@ async def test_setup_reload_service(hass): await async_setup_reload_service(hass, PLATFORM, [DOMAIN]) - yaml_path = path.join( - _get_fixtures_base_path(), - "fixtures", - "helpers/reload_configuration.yaml", - ) + yaml_path = get_fixture_path("helpers/reload_configuration.yaml") with patch.object(config, "YAML_CONFIG_FILE", yaml_path): await hass.services.async_call( PLATFORM, @@ -142,11 +134,7 @@ async def test_setup_reload_service_when_async_process_component_config_fails(ha await async_setup_reload_service(hass, PLATFORM, [DOMAIN]) - yaml_path = path.join( - _get_fixtures_base_path(), - "fixtures", - "helpers/reload_configuration.yaml", - ) + yaml_path = get_fixture_path("helpers/reload_configuration.yaml") with patch.object(config, "YAML_CONFIG_FILE", yaml_path), patch.object( config, "async_process_component_config", return_value=None ): @@ -196,11 +184,7 @@ async def test_setup_reload_service_with_platform_that_provides_async_reset_plat await async_setup_reload_service(hass, PLATFORM, [DOMAIN]) - yaml_path = path.join( - _get_fixtures_base_path(), - "fixtures", - "helpers/reload_configuration.yaml", - ) + yaml_path = get_fixture_path("helpers/reload_configuration.yaml") with patch.object(config, "YAML_CONFIG_FILE", yaml_path): await hass.services.async_call( PLATFORM, @@ -218,11 +202,7 @@ async def test_async_integration_yaml_config(hass): """Test loading yaml config for an integration.""" mock_integration(hass, MockModule(DOMAIN)) - yaml_path = path.join( - _get_fixtures_base_path(), - "fixtures", - f"helpers/{DOMAIN}_configuration.yaml", - ) + yaml_path = get_fixture_path(f"helpers/{DOMAIN}_configuration.yaml") with patch.object(config, "YAML_CONFIG_FILE", yaml_path): processed_config = await async_integration_yaml_config(hass, DOMAIN) @@ -233,16 +213,8 @@ async def test_async_integration_missing_yaml_config(hass): """Test loading missing yaml config for an integration.""" mock_integration(hass, MockModule(DOMAIN)) - yaml_path = path.join( - _get_fixtures_base_path(), - "fixtures", - "helpers/does_not_exist_configuration.yaml", - ) + yaml_path = get_fixture_path("helpers/does_not_exist_configuration.yaml") with pytest.raises(FileNotFoundError), patch.object( config, "YAML_CONFIG_FILE", yaml_path ): await async_integration_yaml_config(hass, DOMAIN) - - -def _get_fixtures_base_path(): - return path.dirname(path.dirname(__file__))