From df00954bccad99d648e1345eb880088bda5ffb22 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Wed, 27 Sep 2023 23:14:45 +0200 Subject: [PATCH] Fix APi unit tests --- tests/api/setup_test_api.py | 2 +- tests/api/test_api_assiduites.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/api/setup_test_api.py b/tests/api/setup_test_api.py index 63df403b5a..adcd2e0a36 100644 --- a/tests/api/setup_test_api.py +++ b/tests/api/setup_test_api.py @@ -129,7 +129,7 @@ def check_fields(data: dict, fields: dict = None): """ assert set(data.keys()) == set(fields.keys()) for key in data: - if key in ("moduleimpl_id", "desc", "user_id", "external_data"): + if key in ("moduleimpl_id", "desc", "external_data"): assert ( isinstance(data[key], fields[key]) or data[key] is None ), f"error [{key}:{type(data[key])}, {data[key]}, {fields[key]}]" diff --git a/tests/api/test_api_assiduites.py b/tests/api/test_api_assiduites.py index 1333047182..1a7fb653df 100644 --- a/tests/api/test_api_assiduites.py +++ b/tests/api/test_api_assiduites.py @@ -6,6 +6,7 @@ Ecrit par HARTMANN Matthias """ from random import randint +from types import NoneType from tests.api.setup_test_api import ( GET, @@ -34,7 +35,8 @@ ASSIDUITES_FIELDS = { "etat": str, "desc": str, "entry_date": str, - "user_id": str, + "user_id": (int, NoneType), + "user_name": (str, NoneType), "est_just": bool, "external_data": dict, }