Restore august lock changed_by state on restart (#32340)
* Various code review items from previous PRs * Add a test for fetching the doorbell camera image * Switch to using UNIT_PERCENTAGE for battery charge unit * Add tests for changed_by
This commit is contained in:
1 parent
e9a7b66df6
commit
be14b94705
8 files changed
+112
-50
No files matched your search
@@ -1,5 +1,7 @@
|
||||
"""The camera tests for the august platform."""
|
||||
|
||||
from asynctest import mock
|
||||
|
||||
from homeassistant.const import STATE_IDLE
|
||||
|
||||
from tests.components.august.mocks import (
|
||||
@@ -8,11 +10,26 @@ from tests.components.august.mocks import (
|
||||
)
|
||||
|
||||
|
||||
async def test_create_doorbell(hass):
|
||||
async def test_create_doorbell(hass, aiohttp_client):
|
||||
"""Test creation of a doorbell."""
|
||||
doorbell_one = await _mock_doorbell_from_fixture(hass, "get_doorbell.json")
|
||||
doorbell_details = [doorbell_one]
|
||||
await _create_august_with_devices(hass, doorbell_details)
|
||||
|
||||
camera_k98gidt45gul_name_camera = hass.states.get("camera.k98gidt45gul_name_camera")
|
||||
assert camera_k98gidt45gul_name_camera.state == STATE_IDLE
|
||||
with mock.patch.object(
|
||||
doorbell_one, "get_doorbell_image", create=False, return_value="image"
|
||||
):
|
||||
await _create_august_with_devices(hass, [doorbell_one])
|
||||
|
||||
camera_k98gidt45gul_name_camera = hass.states.get(
|
||||
"camera.k98gidt45gul_name_camera"
|
||||
)
|
||||
assert camera_k98gidt45gul_name_camera.state == STATE_IDLE
|
||||
|
||||
url = hass.states.get("camera.k98gidt45gul_name_camera").attributes[
|
||||
"entity_picture"
|
||||
]
|
||||
|
||||
client = await aiohttp_client(hass.http.app)
|
||||
resp = await client.get(url)
|
||||
assert resp.status == 200
|
||||
body = await resp.text()
|
||||
assert body == "image"
|
||||
Reference in new issue
Block a user