From 9cbe29ac638624cd1181495131846096d8a3f9ed Mon Sep 17 00:00:00 2001
From: swoga <3697291+swoga@users.noreply.github.com>
Date: Thu, 10 Oct 2024 19:24:10 +0200
Subject: [PATCH] test: add test for ObjectAnalytics under Axis OS 11.11+
---
tests/event_fixtures.py | 1 +
tests/test_event.py | 24 ++++++++++++++++++++++++
2 files changed, 25 insertions(+)
diff --git a/tests/event_fixtures.py b/tests/event_fixtures.py
index fd533641..791fafad 100644
--- a/tests/event_fixtures.py
+++ b/tests/event_fixtures.py
@@ -19,6 +19,7 @@
MOTION_GUARD_INIT = b'\n\ntnsaxis:CameraApplicationPlatform/MotionGuard/Camera1ProfileANYuri://755cc9bb-cf3a-410b-bd1b-0ec97c6d6256/ProducerReference\n'
OBJECT_ANALYTICS_INIT = b'\n\ntnsaxis:CameraApplicationPlatform/ObjectAnalytics/Device1Scenario1uri://4b2daa4c-507e-482c-8ae0-2068b1c1d875/ProducerReference\n'
+OBJECT_ANALYTICS_ANY_CHANGE = b'\n\n\n\ntnsaxis:CameraApplicationPlatform/ObjectAnalytics/Device1Scenario1\n\nuri://cfbf96f2-9dc7-437f-aa12-155aacbb0b8f/ProducerReference\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n'
PIR_INIT = b'\n\ntns1:Device/tnsaxis:Sensor/PIRuri://94fbe18e-0af8-40d2-8539-67b6ea550c6e/ProducerReference\n'
PIR_CHANGE = b'\n\ntns1:Device/tnsaxis:Sensor/PIRuri://94fbe18e-0af8-40d2-8539-67b6ea550c6e/ProducerReference\n'
diff --git a/tests/test_event.py b/tests/test_event.py
index 06f2c690..b36447f6 100644
--- a/tests/test_event.py
+++ b/tests/test_event.py
@@ -18,6 +18,7 @@
LIGHT_STATUS_INIT,
LOITERING_GUARD_INIT,
MOTION_GUARD_INIT,
+ OBJECT_ANALYTICS_ANY_CHANGE,
OBJECT_ANALYTICS_INIT,
PIR_CHANGE,
PIR_INIT,
@@ -133,6 +134,18 @@
"tripped": False,
},
),
+ (
+ OBJECT_ANALYTICS_ANY_CHANGE,
+ {
+ "topic": "tnsaxis:CameraApplicationPlatform/ObjectAnalytics/Device1Scenario1",
+ "source": "",
+ "source_idx": "Device1Scenario1",
+ "group": EventGroup.MOTION,
+ "type": "Object Analytics",
+ "state": "1",
+ "tripped": True,
+ },
+ ),
(
PIR_INIT,
{
@@ -329,6 +342,17 @@ def test_create_event(input: bytes, expected: tuple) -> None:
"value": "1",
},
),
+ (
+ OBJECT_ANALYTICS_ANY_CHANGE,
+ {
+ "operation": "Changed",
+ "topic": "tnsaxis:CameraApplicationPlatform/ObjectAnalytics/Device1Scenario1",
+ "source": "",
+ "source_idx": "",
+ "type": "active",
+ "value": "1",
+ },
+ ),
],
)
def test_parse_event_xml(input: bytes, expected: dict):