From cd1429236d5be2db1ea8320eaa64ddb528614d19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Jes=C3=BAs=20Pe=C3=B1a=20Rodr=C3=ADguez?= Date: Thu, 9 Jan 2025 12:24:53 +0100 Subject: [PATCH 1/2] fix(api): change the inserted_at.lte unittest --- api/src/backend/api/tests/test_views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/src/backend/api/tests/test_views.py b/api/src/backend/api/tests/test_views.py index c3d16b32fd3..a4f4bb5811d 100644 --- a/api/src/backend/api/tests/test_views.py +++ b/api/src/backend/api/tests/test_views.py @@ -2427,7 +2427,7 @@ def test_findings_list_include( ("inserted_at", "2024-01-01", 0), ("inserted_at.date", "2024-01-01", 0), ("inserted_at.gte", "2024-01-01", 2), - ("inserted_at.lte", "2024-12-31", 2), + ("inserted_at.lte", "2028-12-31", 2), ("updated_at.lte", "2024-01-01", 0), ("resource_type.icontains", "prowler", 2), # full text search on finding From 35be4ce45d4d2277d9f3a053f62795f861d6b2a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adri=C3=A1n=20Jes=C3=BAs=20Pe=C3=B1a=20Rodr=C3=ADguez?= Date: Thu, 9 Jan 2025 13:07:05 +0100 Subject: [PATCH 2/2] chore(api): add todo for inserted_at unittest --- api/src/backend/api/tests/test_views.py | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/api/src/backend/api/tests/test_views.py b/api/src/backend/api/tests/test_views.py index a4f4bb5811d..73677da6a61 100644 --- a/api/src/backend/api/tests/test_views.py +++ b/api/src/backend/api/tests/test_views.py @@ -1447,12 +1447,8 @@ def test_provider_group_clear_relationships( "id": str(group.id), "type": "provider-groups", "relationships": { - "providers": { - "data": [] # Removing all providers - }, - "roles": { - "data": [] # Removing all roles - }, + "providers": {"data": []}, # Removing all providers + "roles": {"data": []}, # Removing all roles }, } } @@ -2427,7 +2423,11 @@ def test_findings_list_include( ("inserted_at", "2024-01-01", 0), ("inserted_at.date", "2024-01-01", 0), ("inserted_at.gte", "2024-01-01", 2), - ("inserted_at.lte", "2028-12-31", 2), + ( + "inserted_at.lte", + "2028-12-31", + 2, + ), # TODO: To avoid having to modify this value and to ensure that the tests always work, we should set the time before the fixtures are inserted ("updated_at.lte", "2024-01-01", 0), ("resource_type.icontains", "prowler", 2), # full text search on finding @@ -3564,12 +3564,8 @@ def test_role_clear_relationships(self, authenticated_client, roles_fixture): "id": str(role.id), "type": "roles", "relationships": { - "users": { - "data": [] # Clearing all users - }, - "provider_groups": { - "data": [] # Clearing all provider groups - }, + "users": {"data": []}, # Clearing all users + "provider_groups": {"data": []}, # Clearing all provider groups }, } }