1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

String formatting improvements for tests (2) (#33666)

This commit is contained in:
Franck Nijhof
2020-04-05 00:33:07 +02:00
committed by GitHub
parent 906385172a
commit d7e9959442
19 changed files with 65 additions and 76 deletions

View File

@@ -28,16 +28,16 @@ async def test_config_flow_registers_webhook(hass, aiohttp_client):
hass.bus.async_listen(ifttt.EVENT_RECEIVED, handle_event)
client = await aiohttp_client(hass.http.app)
await client.post("/api/webhook/{}".format(webhook_id), json={"hello": "ifttt"})
await client.post(f"/api/webhook/{webhook_id}", json={"hello": "ifttt"})
assert len(ifttt_events) == 1
assert ifttt_events[0].data["webhook_id"] == webhook_id
assert ifttt_events[0].data["hello"] == "ifttt"
# Invalid JSON
await client.post("/api/webhook/{}".format(webhook_id), data="not a dict")
await client.post(f"/api/webhook/{webhook_id}", data="not a dict")
assert len(ifttt_events) == 1
# Not a dict
await client.post("/api/webhook/{}".format(webhook_id), json="not a dict")
await client.post(f"/api/webhook/{webhook_id}", json="not a dict")
assert len(ifttt_events) == 1