Add Internet Printing Protocol (IPP) integration (#32859)
* Create __init__.py * Create manifest.json * Update zeroconf.py * more work on integration * more work on integration. * add more sensor tests. * Update const.py * Update sensor.py * more work on ipp. * Update test_config_flow.py * more work on ipp. * Update config_flow.py * Update config_flow.py
This commit is contained in:
parent
0e3c1dc031
commit
98f68f4798
17 changed files with 1165 additions and 0 deletions
42
tests/components/ipp/test_init.py
Normal file
42
tests/components/ipp/test_init.py
Normal file
|
@ -0,0 +1,42 @@
|
|||
"""Tests for the IPP integration."""
|
||||
import aiohttp
|
||||
|
||||
from homeassistant.components.ipp.const import DOMAIN
|
||||
from homeassistant.config_entries import (
|
||||
ENTRY_STATE_LOADED,
|
||||
ENTRY_STATE_NOT_LOADED,
|
||||
ENTRY_STATE_SETUP_RETRY,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from tests.components.ipp import init_integration
|
||||
from tests.test_util.aiohttp import AiohttpClientMocker
|
||||
|
||||
|
||||
async def test_config_entry_not_ready(
|
||||
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
|
||||
) -> None:
|
||||
"""Test the IPP configuration entry not ready."""
|
||||
aioclient_mock.post(
|
||||
"http://EPSON123456.local:631/ipp/print", exc=aiohttp.ClientError
|
||||
)
|
||||
|
||||
entry = await init_integration(hass, aioclient_mock)
|
||||
assert entry.state == ENTRY_STATE_SETUP_RETRY
|
||||
|
||||
|
||||
async def test_unload_config_entry(
|
||||
hass: HomeAssistant, aioclient_mock: AiohttpClientMocker
|
||||
) -> None:
|
||||
"""Test the IPP configuration entry unloading."""
|
||||
entry = await init_integration(hass, aioclient_mock)
|
||||
|
||||
assert hass.data[DOMAIN]
|
||||
assert entry.entry_id in hass.data[DOMAIN]
|
||||
assert entry.state == ENTRY_STATE_LOADED
|
||||
|
||||
await hass.config_entries.async_unload(entry.entry_id)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
assert entry.entry_id not in hass.data[DOMAIN]
|
||||
assert entry.state == ENTRY_STATE_NOT_LOADED
|
Loading…
Add table
Add a link
Reference in a new issue