mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-03 01:35:22 +03:00
Test getting list of sub labels
This commit is contained in:
parent
93b3eab1a1
commit
9afb6e763f
@ -241,6 +241,23 @@ class TestHttp(unittest.TestCase):
|
|||||||
assert event["id"] == id
|
assert event["id"] == id
|
||||||
assert event["sub_label"] == ""
|
assert event["sub_label"] == ""
|
||||||
|
|
||||||
|
def test_sub_label_list(self):
|
||||||
|
app = create_app(
|
||||||
|
FrigateConfig(**self.minimal_config), self.db, None, None, None
|
||||||
|
)
|
||||||
|
id = "123456.random"
|
||||||
|
sub_label = "sub"
|
||||||
|
|
||||||
|
with app.test_client() as client:
|
||||||
|
_insert_mock_event(id)
|
||||||
|
client.post(
|
||||||
|
f"/events/{id}/sub_label",
|
||||||
|
data=json.dumps({"subLabel": sub_label}),
|
||||||
|
content_type="application/json",
|
||||||
|
)
|
||||||
|
sub_labels = client.get("/sub_labels").json
|
||||||
|
assert sub_labels
|
||||||
|
assert sub_labels == [sub_label]
|
||||||
|
|
||||||
def _insert_mock_event(id: str) -> Event:
|
def _insert_mock_event(id: str) -> Event:
|
||||||
"""Inserts a basic event model with a given id."""
|
"""Inserts a basic event model with a given id."""
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user