generated from ludeeus/integration_blueprint
-
Notifications
You must be signed in to change notification settings - Fork 6
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
5 changed files
with
32 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
[pytest] | ||
asyncio_default_fixture_loop_scope = function | ||
asyncio_mode = auto | ||
testpaths = tests | ||
python_files = test_*.py | ||
python_classes = Test* | ||
python_functions = test_* |
Empty file.
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 @@ | ||
pytest_plugins = ["pytest_homeassistant_custom_component"] |
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,25 @@ | ||
import pytest | ||
from homeassistant.setup import async_setup_component | ||
from homeassistant.const import STATE_UNKNOWN | ||
|
||
@pytest.mark.asyncio | ||
async def test_setup(hass, enable_custom_integrations): | ||
"""Test that the component can be setup and creates sensors.""" | ||
config = { | ||
'stadtreinigung_hamburg': { | ||
'name': 'Test Sensor', | ||
'street': 'Jungfernstieg', | ||
'number': '1', | ||
} | ||
} | ||
assert await async_setup_component(hass, 'stadtreinigung_hamburg', config) | ||
await hass.async_block_till_done() | ||
|
||
# Check that the component is loaded | ||
assert 'stadtreinigung_hamburg' in hass.config.components | ||
|
||
# Verify that sensors are created | ||
state = hass.states.get('sensor.test_sensor') | ||
assert state is not None | ||
assert state.state != STATE_UNKNOWN | ||
|