mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-02 17:25:22 +03:00
Test recordings endpoint
This commit is contained in:
parent
e7e0189264
commit
6054847764
@ -313,6 +313,19 @@ class TestHttp(unittest.TestCase):
|
|||||||
assert config
|
assert config
|
||||||
assert config["cameras"]["front_door"]
|
assert config["cameras"]["front_door"]
|
||||||
|
|
||||||
|
def test_recordings(self):
|
||||||
|
app = create_app(
|
||||||
|
FrigateConfig(**self.minimal_config).runtime_config, self.db, None, None, None
|
||||||
|
)
|
||||||
|
id = "123456.random"
|
||||||
|
|
||||||
|
with app.test_client() as client:
|
||||||
|
_insert_mock_recording(id)
|
||||||
|
recording = client.get("/front_door/recordings").json
|
||||||
|
assert recording
|
||||||
|
assert recording[0]["id"] == id
|
||||||
|
|
||||||
|
|
||||||
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."""
|
||||||
return Event.insert(
|
return Event.insert(
|
||||||
@ -331,3 +344,17 @@ def _insert_mock_event(id: str) -> Event:
|
|||||||
has_clip=True,
|
has_clip=True,
|
||||||
has_snapshot=True,
|
has_snapshot=True,
|
||||||
).execute()
|
).execute()
|
||||||
|
|
||||||
|
|
||||||
|
def _insert_mock_recording(id: str) -> Event:
|
||||||
|
"""Inserts a basic recording model with a given id."""
|
||||||
|
return Recordings.insert(
|
||||||
|
id=id,
|
||||||
|
camera="front_door",
|
||||||
|
path=f"/recordings/{id}",
|
||||||
|
start_time=datetime.datetime.now().timestamp() - 50,
|
||||||
|
end_time=datetime.datetime.now().timestamp() - 60,
|
||||||
|
duration=10,
|
||||||
|
motion=True,
|
||||||
|
objects=True,
|
||||||
|
).execute()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user