Skip to content

Commit

Permalink
[ntfy] [Frigate] Tests: Verify notification was properly received
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Apr 27, 2023
1 parent c687705 commit 8adf153
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ in progress
- [ntfy] Also interpolate outbound ntfy option fields
- [ntfy] [Frigate] Improve example/tutorial about Frigate event notifications
- [ntfy] [Frigate] Synchronize JSON event and snapshot image receive order
- [ntfy] [Frigate] Tests: Verify notification was properly received by ntfy


2023-04-11 0.33.0
Expand Down
22 changes: 22 additions & 0 deletions examples/frigate/test_frigate.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,28 @@ def test_frigate_with_attachment(mosquitto, ntfy_service, caplog, capmqtt):
assert "Job queue has 0 items to process" in caplog.messages
mqttc.disconnect()

# Verify notification was properly received by ntfy.
url = "http://localhost:5555/frigate-testdrive/json?poll=1&since=5s"
response = requests.get(url)
data = response.json()
del data["id"]
del data["time"]
del data["expires"]
del data["attachment"]["url"]
del data["attachment"]["expires"]
assert data == {
"event": "message",
"topic": "frigate-testdrive",
"title": "goat entered lawn at 2023-04-06 14:31:46.638857+00:00",
"message": "goat was in barn before",
"click": "https://httpbin.org/anything?camera=cam-testdrive&label=goat&zone=lawn",
"attachment": {
"name": "mqttwarn-frigate-cam-testdrive-goat.png",
"size": 283595,
"type": "image/png",
},
}


@pytest.mark.parametrize(
"jsonfile", ["frigate-event-full.json", "frigate-event-new-good.json", "frigate-event-update-good.json"]
Expand Down

0 comments on commit 8adf153

Please sign in to comment.