From 9afb6e763f2fd4b13827290b32c7df75aacdd1ec Mon Sep 17 00:00:00 2001 From: Nick Mowen Date: Wed, 15 Jun 2022 19:30:43 -0600 Subject: [PATCH] Test getting list of sub labels --- frigate/test/test_http.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/frigate/test/test_http.py b/frigate/test/test_http.py index 4271e60c8..7f29dbecc 100644 --- a/frigate/test/test_http.py +++ b/frigate/test/test_http.py @@ -241,6 +241,23 @@ class TestHttp(unittest.TestCase): assert event["id"] == id 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: """Inserts a basic event model with a given id."""