hass-core/tests/components/rainbird/test_init.py
Allen Porter 490d2cfb71
Move Rainbird to async client library (#84417)
* Bump pyrainbird to 0.7.0 and move to async library

* Share updates across sensors

* Fix test version and delete dead code

* Add test coverage for yaml configuration

* Address PR feedback
2022-12-22 13:00:17 -08:00

34 lines
904 B
Python

"""Tests for rainbird initialization."""
from http import HTTPStatus
from homeassistant.core import HomeAssistant
from .conftest import URL, ComponentSetup
from tests.test_util.aiohttp import AiohttpClientMocker, AiohttpClientMockResponse
async def test_setup_success(
hass: HomeAssistant,
setup_integration: ComponentSetup,
) -> None:
"""Test successful setup and unload."""
assert await setup_integration()
async def test_setup_communication_failure(
hass: HomeAssistant,
setup_integration: ComponentSetup,
responses: list[AiohttpClientMockResponse],
aioclient_mock: AiohttpClientMocker,
) -> None:
"""Test unable to talk to server on startup, which permanently fails setup."""
responses.clear()
responses.append(
AiohttpClientMockResponse("POST", URL, status=HTTPStatus.SERVICE_UNAVAILABLE)
)
assert not await setup_integration()