-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
tests/snapshots/api-usage/tests/test_sensor_cleanuptest-sensor-cleanup.json
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,17 @@ | ||
{ | ||
"tests/test_sensor_cleanup.py::test_sensor_cleanup": { | ||
"https://api.github.com/repos/hacs/integration": 1, | ||
"https://api.github.com/repos/hacs/integration/contents/custom_components/hacs/manifest.json": 1, | ||
"https://api.github.com/repos/hacs/integration/contents/hacs.json": 1, | ||
"https://api.github.com/repos/hacs/integration/git/trees/main": 1, | ||
"https://api.github.com/repos/hacs/integration/releases": 1, | ||
"https://data-v2.hacs.xyz/appdaemon/data.json": 1, | ||
"https://data-v2.hacs.xyz/critical/data.json": 1, | ||
"https://data-v2.hacs.xyz/integration/data.json": 1, | ||
"https://data-v2.hacs.xyz/plugin/data.json": 1, | ||
"https://data-v2.hacs.xyz/python_script/data.json": 1, | ||
"https://data-v2.hacs.xyz/removed/data.json": 1, | ||
"https://data-v2.hacs.xyz/template/data.json": 1, | ||
"https://data-v2.hacs.xyz/theme/data.json": 1 | ||
} | ||
} |
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,32 @@ | ||
"""Test the sensor cleanup.""" | ||
|
||
from homeassistant.core import HomeAssistant | ||
from homeassistant.helpers import entity_registry as er | ||
|
||
from custom_components.hacs.const import DOMAIN, HACS_SYSTEM_ID | ||
|
||
from tests.common import create_config_entry, setup_integration | ||
|
||
|
||
async def test_sensor_cleanup(hass: HomeAssistant) -> None: | ||
"""Test the sensor cleanup.""" | ||
entity_registry = er.async_get(hass) | ||
assert len(entity_registry.entities) == 0 | ||
entry = entity_registry.async_get_or_create( | ||
domain="sensor", | ||
platform=DOMAIN, | ||
unique_id=HACS_SYSTEM_ID, | ||
) | ||
|
||
assert entity_registry.async_get(entry.entity_id) is not None | ||
|
||
await setup_integration( | ||
hass, | ||
create_config_entry( | ||
options={ | ||
"appdaemon": True, | ||
}, | ||
), | ||
) | ||
|
||
assert entity_registry.async_get(entry.entity_id) is None |