From be51032b8afc7408eb3ba36cbc3385895df5e39c Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Thu, 5 May 2022 19:12:03 +0200 Subject: [PATCH] =?UTF-8?q?API=20tests:=20fix=20verify=5Ffields=20qui=20te?= =?UTF-8?q?stait=20=C3=A0=20l'envers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/api/tools_test_api.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/api/tools_test_api.py b/tests/api/tools_test_api.py index d0a224c50..7be43a891 100644 --- a/tests/api/tools_test_api.py +++ b/tests/api/tools_test_api.py @@ -2,16 +2,13 @@ """ -def verify_fields(json_response: dict, fields: set) -> bool: +def verify_fields(json_response: dict, expected_fields: set) -> bool: """ Vérifie si les champs attendu de la réponse json sont présents json_response : la réponse de la requête - fields : ensemble des champs à vérifier + expected_fields : ensemble des champs à vérifier Retourne True ou False """ - for field in json_response: - if field not in fields: - return False - return True + return all(field in json_response for field in expected_fields)