From 349d6c6437b7f9ccb46b8b6d5e6844c4282fb4b0 Mon Sep 17 00:00:00 2001 From: Alex Berry Date: Sat, 11 Dec 2021 12:03:56 +0000 Subject: [PATCH] chore: rename integration and references in unit tests --- .../{integration_blueprint => octopusenergy}/__init__.py | 0 .../{integration_blueprint => octopusenergy}/api.py | 0 .../binary_sensor.py | 0 .../config_flow.py | 0 .../{integration_blueprint => octopusenergy}/const.py | 0 .../{integration_blueprint => octopusenergy}/entity.py | 0 .../manifest.json | 0 .../{integration_blueprint => octopusenergy}/sensor.py | 0 .../{integration_blueprint => octopusenergy}/switch.py | 0 .../translations/en.json | 0 .../translations/fr.json | 0 .../translations/nb.json | 0 tests/__init__.py | 2 +- tests/conftest.py | 6 +++--- tests/const.py | 4 ++-- tests/test_api.py | 4 ++-- tests/test_config_flow.py | 8 ++++---- tests/test_init.py | 8 ++++---- tests/test_switch.py | 8 ++++---- 19 files changed, 20 insertions(+), 20 deletions(-) rename custom_components/{integration_blueprint => octopusenergy}/__init__.py (100%) rename custom_components/{integration_blueprint => octopusenergy}/api.py (100%) rename custom_components/{integration_blueprint => octopusenergy}/binary_sensor.py (100%) rename custom_components/{integration_blueprint => octopusenergy}/config_flow.py (100%) rename custom_components/{integration_blueprint => octopusenergy}/const.py (100%) rename custom_components/{integration_blueprint => octopusenergy}/entity.py (100%) rename custom_components/{integration_blueprint => octopusenergy}/manifest.json (100%) rename custom_components/{integration_blueprint => octopusenergy}/sensor.py (100%) rename custom_components/{integration_blueprint => octopusenergy}/switch.py (100%) rename custom_components/{integration_blueprint => octopusenergy}/translations/en.json (100%) rename custom_components/{integration_blueprint => octopusenergy}/translations/fr.json (100%) rename custom_components/{integration_blueprint => octopusenergy}/translations/nb.json (100%) diff --git a/custom_components/integration_blueprint/__init__.py b/custom_components/octopusenergy/__init__.py similarity index 100% rename from custom_components/integration_blueprint/__init__.py rename to custom_components/octopusenergy/__init__.py diff --git a/custom_components/integration_blueprint/api.py b/custom_components/octopusenergy/api.py similarity index 100% rename from custom_components/integration_blueprint/api.py rename to custom_components/octopusenergy/api.py diff --git a/custom_components/integration_blueprint/binary_sensor.py b/custom_components/octopusenergy/binary_sensor.py similarity index 100% rename from custom_components/integration_blueprint/binary_sensor.py rename to custom_components/octopusenergy/binary_sensor.py diff --git a/custom_components/integration_blueprint/config_flow.py b/custom_components/octopusenergy/config_flow.py similarity index 100% rename from custom_components/integration_blueprint/config_flow.py rename to custom_components/octopusenergy/config_flow.py diff --git a/custom_components/integration_blueprint/const.py b/custom_components/octopusenergy/const.py similarity index 100% rename from custom_components/integration_blueprint/const.py rename to custom_components/octopusenergy/const.py diff --git a/custom_components/integration_blueprint/entity.py b/custom_components/octopusenergy/entity.py similarity index 100% rename from custom_components/integration_blueprint/entity.py rename to custom_components/octopusenergy/entity.py diff --git a/custom_components/integration_blueprint/manifest.json b/custom_components/octopusenergy/manifest.json similarity index 100% rename from custom_components/integration_blueprint/manifest.json rename to custom_components/octopusenergy/manifest.json diff --git a/custom_components/integration_blueprint/sensor.py b/custom_components/octopusenergy/sensor.py similarity index 100% rename from custom_components/integration_blueprint/sensor.py rename to custom_components/octopusenergy/sensor.py diff --git a/custom_components/integration_blueprint/switch.py b/custom_components/octopusenergy/switch.py similarity index 100% rename from custom_components/integration_blueprint/switch.py rename to custom_components/octopusenergy/switch.py diff --git a/custom_components/integration_blueprint/translations/en.json b/custom_components/octopusenergy/translations/en.json similarity index 100% rename from custom_components/integration_blueprint/translations/en.json rename to custom_components/octopusenergy/translations/en.json diff --git a/custom_components/integration_blueprint/translations/fr.json b/custom_components/octopusenergy/translations/fr.json similarity index 100% rename from custom_components/integration_blueprint/translations/fr.json rename to custom_components/octopusenergy/translations/fr.json diff --git a/custom_components/integration_blueprint/translations/nb.json b/custom_components/octopusenergy/translations/nb.json similarity index 100% rename from custom_components/integration_blueprint/translations/nb.json rename to custom_components/octopusenergy/translations/nb.json diff --git a/tests/__init__.py b/tests/__init__.py index 0ba5e33..c241543 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1 +1 @@ -"""Tests for integration_blueprint integration.""" +"""Tests for octopusenergy integration.""" diff --git a/tests/conftest.py b/tests/conftest.py index f7835f6..15360be 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,4 @@ -"""Global fixtures for integration_blueprint integration.""" +"""Global fixtures for octopusenergy integration.""" # Fixtures allow you to replace functions with a Mock object. You can perform # many options via the Mock to reflect a particular behavior from the original # function that you want to see without going through the function's actual logic. @@ -46,7 +46,7 @@ def skip_notifications_fixture(): def bypass_get_data_fixture(): """Skip calls to get data from API.""" with patch( - "custom_components.integration_blueprint.IntegrationBlueprintApiClient.async_get_data" + "custom_components.octopusenergy.IntegrationBlueprintApiClient.async_get_data" ): yield @@ -57,7 +57,7 @@ def bypass_get_data_fixture(): def error_get_data_fixture(): """Simulate error when retrieving data from API.""" with patch( - "custom_components.integration_blueprint.IntegrationBlueprintApiClient.async_get_data", + "custom_components.octopusenergy.IntegrationBlueprintApiClient.async_get_data", side_effect=Exception, ): yield diff --git a/tests/const.py b/tests/const.py index 83c523f..2288c31 100644 --- a/tests/const.py +++ b/tests/const.py @@ -1,5 +1,5 @@ -"""Constants for integration_blueprint tests.""" -from custom_components.integration_blueprint.const import CONF_PASSWORD, CONF_USERNAME +"""Constants for octopusenergy tests.""" +from custom_components.octopusenergy.const import CONF_PASSWORD, CONF_USERNAME # Mock config data to be used across multiple tests MOCK_CONFIG = {CONF_USERNAME: "test_username", CONF_PASSWORD: "test_password"} diff --git a/tests/test_api.py b/tests/test_api.py index 65ab7f3..e6b1c73 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -1,10 +1,10 @@ -"""Tests for integration_blueprint api.""" +"""Tests for octopusenergy api.""" import asyncio import aiohttp from homeassistant.helpers.aiohttp_client import async_get_clientsession -from custom_components.integration_blueprint.api import IntegrationBlueprintApiClient +from custom_components.octopusenergy.api import IntegrationBlueprintApiClient async def test_api(hass, aioclient_mock, caplog): diff --git a/tests/test_config_flow.py b/tests/test_config_flow.py index 326eb16..954f6ec 100644 --- a/tests/test_config_flow.py +++ b/tests/test_config_flow.py @@ -1,11 +1,11 @@ -"""Test integration_blueprint config flow.""" +"""Test octopusenergy config flow.""" from unittest.mock import patch from homeassistant import config_entries, data_entry_flow import pytest from pytest_homeassistant_custom_component.common import MockConfigEntry -from custom_components.integration_blueprint.const import ( +from custom_components.octopusenergy.const import ( BINARY_SENSOR, DOMAIN, PLATFORMS, @@ -23,10 +23,10 @@ from .const import MOCK_CONFIG def bypass_setup_fixture(): """Prevent setup.""" with patch( - "custom_components.integration_blueprint.async_setup", + "custom_components.octopusenergy.async_setup", return_value=True, ), patch( - "custom_components.integration_blueprint.async_setup_entry", + "custom_components.octopusenergy.async_setup_entry", return_value=True, ): yield diff --git a/tests/test_init.py b/tests/test_init.py index 4d46ec4..b8a2254 100644 --- a/tests/test_init.py +++ b/tests/test_init.py @@ -1,15 +1,15 @@ -"""Test integration_blueprint setup process.""" +"""Test octopusenergy setup process.""" from homeassistant.exceptions import ConfigEntryNotReady import pytest from pytest_homeassistant_custom_component.common import MockConfigEntry -from custom_components.integration_blueprint import ( +from custom_components.octopusenergy import ( BlueprintDataUpdateCoordinator, async_reload_entry, async_setup_entry, async_unload_entry, ) -from custom_components.integration_blueprint.const import DOMAIN +from custom_components.octopusenergy.const import DOMAIN from .const import MOCK_CONFIG @@ -26,7 +26,7 @@ async def test_setup_unload_and_reload_entry(hass, bypass_get_data): # Set up the entry and assert that the values set during setup are where we expect # them to be. Because we have patched the BlueprintDataUpdateCoordinator.async_get_data - # call, no code from custom_components/integration_blueprint/api.py actually runs. + # call, no code from custom_components/octopusenergy/api.py actually runs. assert await async_setup_entry(hass, config_entry) assert DOMAIN in hass.data and config_entry.entry_id in hass.data[DOMAIN] assert ( diff --git a/tests/test_switch.py b/tests/test_switch.py index a48d58e..fbcc929 100644 --- a/tests/test_switch.py +++ b/tests/test_switch.py @@ -1,12 +1,12 @@ -"""Test integration_blueprint switch.""" +"""Test octopusenergy switch.""" from unittest.mock import call, patch from homeassistant.components.switch import SERVICE_TURN_OFF, SERVICE_TURN_ON from homeassistant.const import ATTR_ENTITY_ID from pytest_homeassistant_custom_component.common import MockConfigEntry -from custom_components.integration_blueprint import async_setup_entry -from custom_components.integration_blueprint.const import DEFAULT_NAME, DOMAIN, SWITCH +from custom_components.octopusenergy import async_setup_entry +from custom_components.octopusenergy.const import DEFAULT_NAME, DOMAIN, SWITCH from .const import MOCK_CONFIG @@ -21,7 +21,7 @@ async def test_switch_services(hass): # Functions/objects can be patched directly in test code as well and can be used to test # additional things, like whether a function was called or what arguments it was called with with patch( - "custom_components.integration_blueprint.IntegrationBlueprintApiClient.async_set_title" + "custom_components.octopusenergy.IntegrationBlueprintApiClient.async_set_title" ) as title_func: await hass.services.async_call( SWITCH,