generated from firstof9/integration_blueprint
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add mincharge sensor * adjust tests
- Loading branch information
Showing
10 changed files
with
104 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,14 @@ | ||
CONFIG_DATA = { | ||
"api_key": "fakeAPIKey", | ||
"utility": "Fake Utility Co.", | ||
"utility": "Fake Utility Co", | ||
"rate_plan": "totallyfakerateplan", | ||
"manual_plan": "manualfakerateplan", | ||
} | ||
|
||
CONFIG_DATA_WITH_SENSOR = { | ||
"api_key": "fakeAPIKey", | ||
"utility": "Fake Utility Co", | ||
"rate_plan": "totallyfakerateplan", | ||
"manual_plan": "manualfakerateplan", | ||
"sensor": "sensor.fakesensor", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"""Tests for sensors.""" | ||
|
||
from pytest_homeassistant_custom_component.common import MockConfigEntry | ||
|
||
from custom_components.openei.const import DOMAIN | ||
from tests.const import CONFIG_DATA | ||
|
||
FAKE_MINCHARGE_SENSOR = "sensor.fake_utility_co_minimum_charge" | ||
|
||
|
||
async def test_sensors(hass, mock_sensors, mock_api): | ||
"""Test settting up entities.""" | ||
entry = MockConfigEntry( | ||
domain=DOMAIN, | ||
title="Fake Utility Co", | ||
data=CONFIG_DATA, | ||
) | ||
|
||
entry.add_to_hass(hass) | ||
assert await hass.config_entries.async_setup(entry.entry_id) | ||
await hass.async_block_till_done() | ||
|
||
state = hass.states.get(FAKE_MINCHARGE_SENSOR) | ||
assert state is not None | ||
assert state.state == "10" | ||
assert state.attributes["unit_of_measurement"] == "$/month" |