mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-27 17:17:40 +03:00
Fix tests
This commit is contained in:
parent
e6aa27113d
commit
abd73434c6
@ -48,8 +48,9 @@ class TestHttpReview(BaseTestHttp):
|
|||||||
################################### GET /review Endpoint ########################################################
|
################################### GET /review Endpoint ########################################################
|
||||||
####################################################################################################################
|
####################################################################################################################
|
||||||
|
|
||||||
# Does not return any data point since the end time (before parameter) is not passed and the review segment end_time is 2 seconds from now
|
def test_get_review_that_overlaps_default_period(self):
|
||||||
def test_get_review_no_filters_no_matches(self):
|
"""Test that a review item that starts during the default period
|
||||||
|
but ends after is included in the results."""
|
||||||
now = datetime.now().timestamp()
|
now = datetime.now().timestamp()
|
||||||
|
|
||||||
with TestClient(self.app) as client:
|
with TestClient(self.app) as client:
|
||||||
@ -57,7 +58,7 @@ class TestHttpReview(BaseTestHttp):
|
|||||||
response = client.get("/review")
|
response = client.get("/review")
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
response_json = response.json()
|
response_json = response.json()
|
||||||
assert len(response_json) == 0
|
assert len(response_json) == 1
|
||||||
|
|
||||||
def test_get_review_no_filters(self):
|
def test_get_review_no_filters(self):
|
||||||
now = datetime.now().timestamp()
|
now = datetime.now().timestamp()
|
||||||
@ -73,11 +74,13 @@ class TestHttpReview(BaseTestHttp):
|
|||||||
assert response_json[0]["has_been_reviewed"] == False
|
assert response_json[0]["has_been_reviewed"] == False
|
||||||
|
|
||||||
def test_get_review_with_time_filter_no_matches(self):
|
def test_get_review_with_time_filter_no_matches(self):
|
||||||
|
"""Test that review items outside the range are not returned."""
|
||||||
now = datetime.now().timestamp()
|
now = datetime.now().timestamp()
|
||||||
|
|
||||||
with TestClient(self.app) as client:
|
with TestClient(self.app) as client:
|
||||||
id = "123456.random"
|
id = "123456.random"
|
||||||
super().insert_mock_review_segment(id, now, now + 2)
|
super().insert_mock_review_segment(id, now - 2, now - 1)
|
||||||
|
super().insert_mock_review_segment(f"{id}2", now + 4, now + 5)
|
||||||
params = {
|
params = {
|
||||||
"after": now,
|
"after": now,
|
||||||
"before": now + 3,
|
"before": now + 3,
|
||||||
@ -85,7 +88,7 @@ class TestHttpReview(BaseTestHttp):
|
|||||||
response = client.get("/review", params=params)
|
response = client.get("/review", params=params)
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
response_json = response.json()
|
response_json = response.json()
|
||||||
assert len(response_json) == 0
|
assert len(response_json) == 1
|
||||||
|
|
||||||
def test_get_review_with_time_filter(self):
|
def test_get_review_with_time_filter(self):
|
||||||
now = datetime.now().timestamp()
|
now = datetime.now().timestamp()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user