Fix APi unit tests

This commit is contained in:
Emmanuel Viennet 2023-09-27 23:14:45 +02:00
parent 4f07bd677c
commit df00954bcc
2 changed files with 4 additions and 2 deletions

View File

@ -129,7 +129,7 @@ def check_fields(data: dict, fields: dict = None):
""" """
assert set(data.keys()) == set(fields.keys()) assert set(data.keys()) == set(fields.keys())
for key in data: for key in data:
if key in ("moduleimpl_id", "desc", "user_id", "external_data"): if key in ("moduleimpl_id", "desc", "external_data"):
assert ( assert (
isinstance(data[key], fields[key]) or data[key] is None isinstance(data[key], fields[key]) or data[key] is None
), f"error [{key}:{type(data[key])}, {data[key]}, {fields[key]}]" ), f"error [{key}:{type(data[key])}, {data[key]}, {fields[key]}]"

View File

@ -6,6 +6,7 @@ Ecrit par HARTMANN Matthias
""" """
from random import randint from random import randint
from types import NoneType
from tests.api.setup_test_api import ( from tests.api.setup_test_api import (
GET, GET,
@ -34,7 +35,8 @@ ASSIDUITES_FIELDS = {
"etat": str, "etat": str,
"desc": str, "desc": str,
"entry_date": str, "entry_date": str,
"user_id": str, "user_id": (int, NoneType),
"user_name": (str, NoneType),
"est_just": bool, "est_just": bool,
"external_data": dict, "external_data": dict,
} }