From 8cffd06bf414c317ff51672cccc013cf22eec396 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arturo=20Filast=C3=B2?= Date: Fri, 11 Oct 2024 16:41:04 +0200 Subject: [PATCH] Add failing test for end_time returning --- ooniapi/services/oonifindings/tests/test_oonifindings.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ooniapi/services/oonifindings/tests/test_oonifindings.py b/ooniapi/services/oonifindings/tests/test_oonifindings.py index eb3eafd4..87cf43a1 100644 --- a/ooniapi/services/oonifindings/tests/test_oonifindings.py +++ b/ooniapi/services/oonifindings/tests/test_oonifindings.py @@ -11,6 +11,10 @@ "%Y-%m-%dT%H:%M:%S.%fZ" ) +sample_end_time = (utcnow_seconds() + timedelta(days=30)).strftime( + "%Y-%m-%dT%H:%M:%S.%fZ" +) + SAMPLE_EMAIL = "sample@ooni.org" SAMPLE_OONIFINDING = { @@ -449,6 +453,8 @@ def test_oonifinding_create(client, client_with_hashed_email, client_with_user_r z["slug"] = "this-is-my-slug" z["ASNs"] = [1234] z["published"] = True + z["start_time"] = sample_start_time + z["end_time"] = sample_end_time r = client_with_admin_role.post("api/v1/incidents/create", json=z) assert r.status_code == 200 @@ -463,6 +469,8 @@ def test_oonifinding_create(client, client_with_hashed_email, client_with_user_r j = r.json() print(j) assert j["incident"]["themes"] == ["social_media"] + assert j["incident"]["start_time"] == sample_start_time + assert j["incident"]["end_time"] == sample_end_time r = client.get(f"api/v1/incidents/show/this-is-my-slug") assert r.status_code == 200