Compare commits

..

2 Commits

Author SHA1 Message Date
alex 349d6c6437 chore: rename integration and references in unit tests 2021-12-11 12:03:56 +00:00
ludeeus d51d010901 init
fix action

Action commit

Created package file

minor updates

Add binary_sensor

Updated package file

Updated package file

Fix BinarySensor Class name

Add more descriptions

Updated package file

Move stuff

Updated package file

add binary_sensor to resources.json

Updated package file

Add configuration

Updated package file

Remove switch

Adds CONTRIBUTING

Fix broken link

Remove refrences

Fix links

fix broken actions

Update actions

Updated package file

Updated package file

Black format

Fix config issues

Updated package file

Fix icon for binary_sensor

Add switch platform

Update README.md (#1)

* Update README.md

* Update README.md

Update CONTRIBUTING.md (#2)

Update __init__.py (#3)

* Update __init__.py

* Set enabled default to `True`

Update const.py (#4)

cleanup badges/add style (#5)

* shield that supports styling

* badge cleanup

* Change discord ID

Correct typo

Create manifest.json (#12)

Fixes https://github.com/custom-components/blueprint/issues/10

Move manifest to correct dir

Fixes #9 by renaming the file

Updates, updates, more updates, worst commit messge ever!

revert

Update main.workflow

Delete resources.json

Create example.yaml

Update README.md

Summer update 😎

Adds info about devcontainer

Adds pylint

Add translation example

remove stalebot

Adds integrationhelper

adds requirements.txt

Adds "tabnine.tabnine-vscode" to devcontainer

Add support for config_flow configuration

Add config_flow "docs"

Update README.md

use https for pip install ha@dev (#15)

Typo on README.md (#18)

Fix various typos in comments (#19)

Add hassfest action (#22)

* Add hassfest action

* Fix manifest issue

Spring cleaning ☀️ (#23)

* Spring cleaning

* Actions

* Fix branches

* Changes for config_flow

Show how to only allow one instance

Adds HACS validation action (#24)

Update postCreateCommand

Update tasks

Minor updates (#26)

* link correction in README.md and info.md

* Add READMME.md for .devcontainer

* Add automation.yaml file in the configuration

* Complete CONTRIBUTING.md

Improve README for container dev and library update. (#27)

Feature/setup cfg (#28)

* Add setup.cfg

* Run black and isort.

* Add blueprint to first party.

* Make const import consistent.

Move translation files

Fixes #32

Use CoordinatorEntity (#33)

Co-authored-by: Joakim Sørensen <hi@ludeeus.dev>

Fixed typos (#34)

Fix directory name for translations and link to the documentation (#36)

Fix info.md (#40)

Use debian based devcontainer (#44)

Remove sampleclient (#45)

Rename [blueprint|Blueprint] -> [integration_blueprint|Integration blueprint] (#47)

Change HACS action (#39)

Fix wrong path for link (#48)

For an unknown reason the link was pointing to a one of my repository.
Probably a too quick copy/paste.

Add french translation and strings improvements (#49)

Reusing work done on strings.json done in #37

Add example tests (#50)

Prepare and explain how to step by step debugging (#51)

Add version

Fix testing by bumping pytest-homeassistant-custom-component (#54)

Fix typo in api.py (#55)

passeword -> password

Fix a typo in the readme (#56)

Update .gitignore to include .idea (#57)

Update .gitignore to include .idea for those using Py Charm

Add iot_class to manifest

Use `enable_custom_integrations` fixture by default (#58)

Fix typo (#59)

retain user input after an error (#52)

Update README.md

Closes #61

remove async_timeout.timeout loop arg (#65)

Correct name "Blueprint" ->"Integration blueprint" (#64)

change entity.py to use extra_state_attributes (#66)
2021-12-11 11:43:43 +00:00
19 changed files with 20 additions and 20 deletions
+1 -1
View File
@@ -1 +1 @@
"""Tests for integration_blueprint integration.""" """Tests for octopusenergy integration."""
+3 -3
View File
@@ -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 # 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 # 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. # 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(): def bypass_get_data_fixture():
"""Skip calls to get data from API.""" """Skip calls to get data from API."""
with patch( with patch(
"custom_components.integration_blueprint.IntegrationBlueprintApiClient.async_get_data" "custom_components.octopusenergy.IntegrationBlueprintApiClient.async_get_data"
): ):
yield yield
@@ -57,7 +57,7 @@ def bypass_get_data_fixture():
def error_get_data_fixture(): def error_get_data_fixture():
"""Simulate error when retrieving data from API.""" """Simulate error when retrieving data from API."""
with patch( with patch(
"custom_components.integration_blueprint.IntegrationBlueprintApiClient.async_get_data", "custom_components.octopusenergy.IntegrationBlueprintApiClient.async_get_data",
side_effect=Exception, side_effect=Exception,
): ):
yield yield
+2 -2
View File
@@ -1,5 +1,5 @@
"""Constants for integration_blueprint tests.""" """Constants for octopusenergy tests."""
from custom_components.integration_blueprint.const import CONF_PASSWORD, CONF_USERNAME from custom_components.octopusenergy.const import CONF_PASSWORD, CONF_USERNAME
# Mock config data to be used across multiple tests # Mock config data to be used across multiple tests
MOCK_CONFIG = {CONF_USERNAME: "test_username", CONF_PASSWORD: "test_password"} MOCK_CONFIG = {CONF_USERNAME: "test_username", CONF_PASSWORD: "test_password"}
+2 -2
View File
@@ -1,10 +1,10 @@
"""Tests for integration_blueprint api.""" """Tests for octopusenergy api."""
import asyncio import asyncio
import aiohttp import aiohttp
from homeassistant.helpers.aiohttp_client import async_get_clientsession 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): async def test_api(hass, aioclient_mock, caplog):
+4 -4
View File
@@ -1,11 +1,11 @@
"""Test integration_blueprint config flow.""" """Test octopusenergy config flow."""
from unittest.mock import patch from unittest.mock import patch
from homeassistant import config_entries, data_entry_flow from homeassistant import config_entries, data_entry_flow
import pytest import pytest
from pytest_homeassistant_custom_component.common import MockConfigEntry from pytest_homeassistant_custom_component.common import MockConfigEntry
from custom_components.integration_blueprint.const import ( from custom_components.octopusenergy.const import (
BINARY_SENSOR, BINARY_SENSOR,
DOMAIN, DOMAIN,
PLATFORMS, PLATFORMS,
@@ -23,10 +23,10 @@ from .const import MOCK_CONFIG
def bypass_setup_fixture(): def bypass_setup_fixture():
"""Prevent setup.""" """Prevent setup."""
with patch( with patch(
"custom_components.integration_blueprint.async_setup", "custom_components.octopusenergy.async_setup",
return_value=True, return_value=True,
), patch( ), patch(
"custom_components.integration_blueprint.async_setup_entry", "custom_components.octopusenergy.async_setup_entry",
return_value=True, return_value=True,
): ):
yield yield
+4 -4
View File
@@ -1,15 +1,15 @@
"""Test integration_blueprint setup process.""" """Test octopusenergy setup process."""
from homeassistant.exceptions import ConfigEntryNotReady from homeassistant.exceptions import ConfigEntryNotReady
import pytest import pytest
from pytest_homeassistant_custom_component.common import MockConfigEntry from pytest_homeassistant_custom_component.common import MockConfigEntry
from custom_components.integration_blueprint import ( from custom_components.octopusenergy import (
BlueprintDataUpdateCoordinator, BlueprintDataUpdateCoordinator,
async_reload_entry, async_reload_entry,
async_setup_entry, async_setup_entry,
async_unload_entry, async_unload_entry,
) )
from custom_components.integration_blueprint.const import DOMAIN from custom_components.octopusenergy.const import DOMAIN
from .const import MOCK_CONFIG 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 # 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 # 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 await async_setup_entry(hass, config_entry)
assert DOMAIN in hass.data and config_entry.entry_id in hass.data[DOMAIN] assert DOMAIN in hass.data and config_entry.entry_id in hass.data[DOMAIN]
assert ( assert (
+4 -4
View File
@@ -1,12 +1,12 @@
"""Test integration_blueprint switch.""" """Test octopusenergy switch."""
from unittest.mock import call, patch from unittest.mock import call, patch
from homeassistant.components.switch import SERVICE_TURN_OFF, SERVICE_TURN_ON from homeassistant.components.switch import SERVICE_TURN_OFF, SERVICE_TURN_ON
from homeassistant.const import ATTR_ENTITY_ID from homeassistant.const import ATTR_ENTITY_ID
from pytest_homeassistant_custom_component.common import MockConfigEntry from pytest_homeassistant_custom_component.common import MockConfigEntry
from custom_components.integration_blueprint import async_setup_entry from custom_components.octopusenergy import async_setup_entry
from custom_components.integration_blueprint.const import DEFAULT_NAME, DOMAIN, SWITCH from custom_components.octopusenergy.const import DEFAULT_NAME, DOMAIN, SWITCH
from .const import MOCK_CONFIG 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 # 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 # additional things, like whether a function was called or what arguments it was called with
with patch( with patch(
"custom_components.integration_blueprint.IntegrationBlueprintApiClient.async_set_title" "custom_components.octopusenergy.IntegrationBlueprintApiClient.async_set_title"
) as title_func: ) as title_func:
await hass.services.async_call( await hass.services.async_call(
SWITCH, SWITCH,