From 1d86c0ac651a78654227be513c91b10f5af3b50f Mon Sep 17 00:00:00 2001 From: Nicolas ROCHE Date: Tue, 7 Feb 2023 18:30:30 +0100 Subject: [PATCH] toulouse-maelis: update soap error in functests (#73411) --- functests/toulouse_maelis/test_family.py | 26 ++++++++---------------- functests/toulouse_maelis/test_misc.py | 9 +++----- 2 files changed, 11 insertions(+), 24 deletions(-) diff --git a/functests/toulouse_maelis/test_family.py b/functests/toulouse_maelis/test_family.py index 0f306578..b8e08eca 100644 --- a/functests/toulouse_maelis/test_family.py +++ b/functests/toulouse_maelis/test_family.py @@ -230,7 +230,7 @@ def test_create_family(conn, create_data, update_data): res = resp.json() assert res['err'] == 1 assert 'Il existe déjà un Responsable Légal correspondant' in res['err_desc'] - assert res['err_class'] == 'passerelle.utils.jsonresponse.APIError' + assert res['err_class'] == 'passerelle.utils.soap.SOAPFault' # RL1 already exists (on update_data, as RL2) error payload['rl1']['firstname'] = 'Homer' @@ -240,7 +240,7 @@ def test_create_family(conn, create_data, update_data): res = resp.json() assert res['err'] == 1 assert 'Il existe déjà un Responsable Légal correspondant' in res['err_desc'] - assert res['err_class'] == 'passerelle.utils.jsonresponse.APIError' + assert res['err_class'] == 'passerelle.utils.soap.SOAPFault' def test_is_rl_exists(conn, update_data): @@ -431,28 +431,18 @@ def test_create_child(conn, create_data, update_data): resp = requests.post(url, json=payload) resp.raise_for_status() res = resp.json() - assert 'Il existe déjà un enfant correspondant' in res['err_desc'] - res['err_desc'] = 'N/A' - assert res == { - 'err': 1, - 'err_class': 'passerelle.utils.jsonresponse.APIError', - 'err_desc': 'N/A', - 'data': None, - } + assert res['err'] == 1 + assert res['err_class'] == 'passerelle.utils.soap.SOAPFault' + assert 'E65 : Il existe déjà un enfant correspondant' in res['err_desc'] # child already exists error (Lisa form update_data) payload['lastname'] = 'Simpson' resp = requests.post(url, json=payload) resp.raise_for_status() res = resp.json() - assert 'Il existe déjà un enfant correspondant' in res['err_desc'] - res['err_desc'] = 'N/A' - assert res == { - 'err': 1, # error is return into childErrorList - 'err_class': 'passerelle.utils.jsonresponse.APIError', - 'err_desc': 'N/A', - 'data': None, - } + assert res['err'] == 1 + assert res['err_class'] == 'passerelle.utils.jsonresponse.APIError' + assert 'E65a : Il existe déjà un enfant correspondant' in res['err_desc'] def test_update_child(conn, update_data, create_data): diff --git a/functests/toulouse_maelis/test_misc.py b/functests/toulouse_maelis/test_misc.py index e8ab3ce0..c1e63eb3 100644 --- a/functests/toulouse_maelis/test_misc.py +++ b/functests/toulouse_maelis/test_misc.py @@ -34,12 +34,9 @@ def test_link(conn, update_data): resp = requests.post(url, json=payload) resp.raise_for_status() res = resp.json() - assert res == { - 'err': 1, - 'err_class': 'passerelle.utils.jsonresponse.APIError', - 'err_desc': 'E02 : Le dossier numéro [999999] ne correspond à aucune famille', - 'data': None, - } + assert res['err'] == 1 + assert res['err_class'] == 'passerelle.utils.soap.SOAPFault' + assert "E02 : Le dossier numéro [999999] ne correspond à aucune famille" in res['err_desc'] # wrong DUI firstname payload = {