greco: send an empty string when a param is missing (#77681)
gitea/passerelle/pipeline/head This commit looks good
Details
gitea/passerelle/pipeline/head This commit looks good
Details
This commit is contained in:
parent
9a4f57612e
commit
31efc19163
|
@ -117,13 +117,15 @@ class FormData:
|
|||
self.fields[fieldname] = value
|
||||
if isinstance(value, datetime):
|
||||
value = value.strftime('%Y-%m-%dT%H:%M:%S')
|
||||
if '_' not in fieldname:
|
||||
self.json[fieldname] = value
|
||||
continue
|
||||
key, subkey = fieldname.split('_')
|
||||
if key not in self.json:
|
||||
self.json[key] = {}
|
||||
self.json[key][subkey] = value
|
||||
else:
|
||||
value = ''
|
||||
if '_' not in fieldname:
|
||||
self.json[fieldname] = value
|
||||
continue
|
||||
key, subkey = fieldname.split('_')
|
||||
if key not in self.json:
|
||||
self.json[key] = {}
|
||||
self.json[key][subkey] = value
|
||||
|
||||
# https://dev.entrouvert.org/issues/75259
|
||||
danger = self.json.get('danger', '')
|
||||
|
|
|
@ -246,6 +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['localisation']['xgeoloc'] == '50.89491'
|
||||
assert demande_creation['localisation']['ygeoloc'] == '4.34151'
|
||||
assert demande_creation['transmetteur']['nom'] == 'Vertommen'
|
||||
|
|
Loading…
Reference in New Issue