greco: send NULL when a param is missing (#78260)
gitea/passerelle/pipeline/head Build started... Details

This commit is contained in:
Emmanuel Cazenave 2023-06-08 10:40:52 +02:00
parent 62ed945d62
commit 16a9364750
2 changed files with 3 additions and 3 deletions

View File

@ -118,7 +118,7 @@ class FormData:
if isinstance(value, datetime):
value = value.strftime('%Y-%m-%dT%H:%M:%S')
else:
value = ''
value = None
if '_' not in fieldname:
self.json[fieldname] = value
continue

View File

@ -246,8 +246,8 @@ def test_greco_rest_create_ok(app, rest_conn):
assert json_part.headers[b'Content-Type'] == b'application/json'
demande_creation = json.loads(json_part.content)
assert demande_creation['application'] == '69999'
assert demande_creation['beneficiaire']['fax'] == ''
assert demande_creation['beneficiaire']['numerovoie'] == ''
assert demande_creation['beneficiaire']['fax'] == None
assert demande_creation['beneficiaire']['numerovoie'] == None
assert demande_creation['localisation']['xgeoloc'] == '50.89491'
assert demande_creation['localisation']['ygeoloc'] == '4.34151'
assert demande_creation['transmetteur']['nom'] == 'Vertommen'