toulouse-maelis: relax soap response check (#70075)

This commit is contained in:
Nicolas Roche 2022-10-13 12:56:06 +02:00
parent c797629421
commit ab75346711
4 changed files with 453 additions and 6 deletions

View File

@ -54,7 +54,8 @@ class ToulouseMaelis(BaseResource, HTTPResource):
wsse = UsernameToken(self.zeep_wsse_username, self.zeep_wsse_password)
wsdl_name = wsdl_short_name + 'Service?wsdl'
wsdl_url = urljoin(self.base_wsdl_url, wsdl_name)
return self.soap_client(wsdl_url=wsdl_url, wsse=wsse)
settings = zeep.Settings(strict=False, xsd_ignore_sequence_order=True)
return self.soap_client(wsdl_url=wsdl_url, wsse=wsse, settings=settings)
def call(self, wsdl_short_name, service, **kwargs):
client = self.get_client(wsdl_short_name)

View File

@ -0,0 +1,216 @@
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:readFamilyResponse xmlns:ns2="family.ws.maelis.sigec.com">
<familyResult>
<number>1312</number>
<category>BI</category>
<situation>M</situation>
<flagCom>true</flagCom>
<nbChild>2</nbChild>
<RL1>
<num>613878</num>
<lastname>DOE</lastname>
<firstname>JHON</firstname>
<quality>PERE</quality>
<civility>M.</civility>
<dateBirth>1938-07-26T00:00:00+01:00</dateBirth>
<adresse>
<idStreet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<num>170</num>
<street1>Chateau d'eau</street1>
<town>Paris</town>
<zipcode>75014</zipcode>
</adresse>
<contact>
<phone>non</phone>
<mobile>0777777777</mobile>
<mail>djhon@example.org</mail>
<isContactMail>true</isContactMail>
<isContactSms>true</isContactSms>
<isInvoicePdf>true</isInvoicePdf>
</contact>
<profession>
<addressPro/>
</profession>
</RL1>
<RL2>
<num>613879</num>
<lastname>DOE</lastname>
<firstname>JANE</firstname>
<civility>MME</civility>
<dateBirth>1940-06-22T00:00:00+02:00</dateBirth>
<adresse>
<idStreet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<num>170</num>
<street1>Chateau d'eau</street1>
<town>Paris</town>
<zipcode>75014</zipcode>
</adresse>
<contact>
<isContactMail>false</isContactMail>
<isContactSms>false</isContactSms>
<isInvoicePdf>false</isInvoicePdf>
</contact>
<profession>
<codeCSP>ART</codeCSP>
<profession>informaticien</profession>
<employerName>EO</employerName>
<phone>0123456789</phone>
<addressPro>
<town>Orl&#233;ans</town>
</addressPro>
</profession>
<CAFInfo>
<number>789</number>
<organ>ma caf</organ>
</CAFInfo>
</RL2>
<emergencyPersonList>
<numPerson>614059</numPerson>
<civility>MME</civility>
<firstname>KENY</firstname>
<lastname>ARKANA</lastname>
<dateBirth>1982-12-20T00:00:00+01:00</dateBirth>
<quality>T</quality>
<contact>
<phone>0123456789</phone>
<mail>pueblo@example.org</mail>
</contact>
</emergencyPersonList>
<authorizedPersonList>
<numPerson>614121</numPerson>
<firstname>CATHY</firstname>
<lastname>PALENNE</lastname>
<dateBirth>1975-06-28T00:00:00+01:00</dateBirth>
<quality>O</quality>
<contact>
<mobile>0623456789</mobile>
</contact>
</authorizedPersonList>
<childList>
<num>613880</num>
<lastname>DOE</lastname>
<firstname>JANNIS</firstname>
<sexe>F</sexe>
<birth>
<dateBirth>1943-01-19T00:00:00+01:00</dateBirth>
</birth>
<dietcode>RSV</dietcode>
<fsl>
<dateDeb>2022-01-01T00:00:00+01:00</dateDeb>
<dateFin>2022-12-31T00:00:00+01:00</dateFin>
<allergieAlimentaire>O</allergieAlimentaire>
<allergieRespiratoire>O</allergieRespiratoire>
<allergieAutre>O</allergieAutre>
<allergieMedicament>O</allergieMedicament>
<asthme>N</asthme>
<flPAI>N</flPAI>
<flImage>N</flImage>
<dtcPrap1>2022-02-22T00:00:00+01:00</dtcPrap1>
<obsMed1>some obsMed1 text</obsMed1>
<obsMed2>some obsMed2 text</obsMed2>
<obsMed3>some obsMed3 text</obsMed3>
<obsDir1>some obsDir1 text</obsDir1>
<obsDir2>some obsDir2 text</obsDir2>
<obsDir3>some obsDir3 text</obsDir3>
<obsAssist1>some obsAssist1 text</obsAssist1>
<obsAssist2>some obsAssist2 text</obsAssist2>
<obsAssist3>some obsAssist3 text</obsAssist3>
<cons1Med>some cons1Med text</cons1Med>
<cons2Med>some cons2Med text</cons2Med>
</fsl>
<bPhoto>true</bPhoto>
<bLeaveAlone>false</bLeaveAlone>
<authorizedPersonList>
<personInfo>
<num>614719</num>
<lastname>BENT</lastname>
<firstname>AMEL</firstname>
<dateBirth>1985-06-21T00:00:00+02:00</dateBirth>
<civility>MME</civility>
<sexe>F</sexe>
<contact>
<phone>0123456789</phone>
<mobile>0623456789</mobile>
<mail>abent@example.org</mail>
</contact>
</personInfo>
<personQuality>
<code>T</code>
<libelle>TANTE</libelle>
</personQuality>
</authorizedPersonList>
<medicalRecord>
<familyDoctor>
<name>DRE</name>
<phone>0612341234</phone>
<address>
<street1>Alameda</street1>
<zipcode>90220</zipcode>
<town>Compton</town>
</address>
</familyDoctor>
<vaccinList>
<code>ROR</code>
<label>ROUGEOLE-OREILLONS-RUBEOLE</label>
<vaccinationDate>2012-02-22T00:00:00+01:00</vaccinationDate>
</vaccinList>
<vaccinList>
<code>DTC</code>
<label>DIPHTERIE TETANOS COQUELUCHE</label>
<vaccinationDate>2011-01-11T00:00:00+01:00</vaccinationDate>
</vaccinList>
<vaccinList>
<code>ROR</code>
<label>ROUGEOLE-OREILLONS-RUBEOLE</label>
<vaccinationDate>1970-01-11T00:00:00+01:00</vaccinationDate>
</vaccinList>
</medicalRecord>
<mother>
<num>613963</num>
<civility>MME</civility>
<firstname>JANE</firstname>
<lastname>DOE</lastname>
</mother>
<father>
<num>613878</num>
<civility>M.</civility>
<firstname>JHON</firstname>
<lastname>DOE</lastname>
</father>
<paiInfoBean>
<dateDeb>2022-01-01T00:00:00+01:00</dateDeb>
<dateFin>2022-12-31T00:00:00+01:00</dateFin>
<description>bla bla PAI</description>
</paiInfoBean>
</childList>
<childList>
<num>613987</num>
<lastname>DOE</lastname>
<firstname>JOHNNY ALLEN</firstname>
<sexe>M</sexe>
<birth>
<dateBirth>1942-11-27T00:00:00+01:00</dateBirth>
<place>Seattle</place>
</birth>
<bPhoto>false</bPhoto>
<bLeaveAlone>false</bLeaveAlone>
<paiInfoBean/>
</childList>
<childList>
<num>614051</num>
<lastname>DOE</lastname>
<firstname>ROBERT</firstname>
<sexe>M</sexe>
<birth>
<dateBirth>1941-05-24T00:00:00+02:00</dateBirth>
<place>Duluth</place>
</birth>
<bPhoto>true</bPhoto>
<bLeaveAlone>false</bLeaveAlone>
<paiInfoBean/>
</childList>
</familyResult>
</ns2:readFamilyResponse>
</soap:Body>
</soap:Envelope>

View File

@ -0,0 +1,218 @@
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:readFamilyResponse xmlns:ns2="family.ws.maelis.sigec.com">
<familyResult>
<number>1312</number>
<category>BI</category>
<situation>M</situation>
<flagCom>true</flagCom>
<nbChild>2</nbChild>
<RL1>
<num>613878</num>
<lastname>DOE</lastname>
<firstname>JHON</firstname>
<quality>PERE</quality>
<civility>M.</civility>
<dateBirth>1938-07-26T00:00:00+01:00</dateBirth>
<adresse>
<idStreet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<num>170</num>
<street1>Chateau d'eau</street1>
<town>Paris</town>
<zipcode>75014</zipcode>
</adresse>
<contact>
<phone>non</phone>
<mobile>0777777777</mobile>
<mail>djhon@example.org</mail>
<isContactMail>true</isContactMail>
<isContactSms>true</isContactSms>
<isInvoicePdf>true</isInvoicePdf>
</contact>
<profession>
<addressPro/>
</profession>
</RL1>
<RL2>
<num>613879</num>
<lastname>DOE</lastname>
<firstname>JANE</firstname>
<quality>MERE</quality>
<civility>MME</civility>
<dateBirth>1940-06-22T00:00:00+02:00</dateBirth>
<adresse>
<idStreet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
<num>170</num>
<street1>Chateau d'eau</street1>
<town>Paris</town>
<zipcode>75014</zipcode>
</adresse>
<contact>
<isContactMail>false</isContactMail>
<isContactSms>false</isContactSms>
<isInvoicePdf>false</isInvoicePdf>
</contact>
<profession>
<codeCSP>ART</codeCSP>
<profession>informaticien</profession>
<employerName>EO</employerName>
<phone>0123456789</phone>
<addressPro>
<town>Orl&#233;ans</town>
</addressPro>
</profession>
<CAFInfo>
<number>789</number>
<organ>ma caf</organ>
</CAFInfo>
</RL2>
<emergencyPersonList>
<numPerson>614059</numPerson>
<firstname>KENY</firstname>
<lastname>ARKANA</lastname>
<dateBirth>1982-12-20T00:00:00+01:00</dateBirth>
<quality>T</quality>
<civility>MME</civility>
<contact>
<phone>0123456789</phone>
<mail>pueblo@example.org</mail>
</contact>
</emergencyPersonList>
<authorizedPersonList>
<numPerson>614121</numPerson>
<firstname>CATHY</firstname>
<lastname>PALENNE</lastname>
<dateBirth>1975-06-28T00:00:00+01:00</dateBirth>
<quality>O</quality>
<contact>
<mobile>0623456789</mobile>
</contact>
</authorizedPersonList>
<childList>
<num>613880</num>
<lastname>DOE</lastname>
<firstname>JANNIS</firstname>
<sexe>F</sexe>
<birth>
<dateBirth>1943-01-19T00:00:00+01:00</dateBirth>
</birth>
<dietcode>RSV</dietcode>
<fsl>
<dateDeb>2022-01-01T00:00:00+01:00</dateDeb>
<dateFin>2022-12-31T00:00:00+01:00</dateFin>
<allergieAlimentaire>O</allergieAlimentaire>
<allergieRespiratoire>O</allergieRespiratoire>
<allergieAutre>O</allergieAutre>
<allergieMedicament>O</allergieMedicament>
<asthme>N</asthme>
<flPAI>N</flPAI>
<flImage>N</flImage>
<dtcPrap1>2022-02-22T00:00:00+01:00</dtcPrap1>
<obsMed1>some obsMed1 text</obsMed1>
<obsMed2>some obsMed2 text</obsMed2>
<obsMed3>some obsMed3 text</obsMed3>
<obsDir1>some obsDir1 text</obsDir1>
<obsDir2>some obsDir2 text</obsDir2>
<obsDir3>some obsDir3 text</obsDir3>
<obsAssist1>some obsAssist1 text</obsAssist1>
<obsAssist2>some obsAssist2 text</obsAssist2>
<obsAssist3>some obsAssist3 text</obsAssist3>
<cons1Med>some cons1Med text</cons1Med>
<cons2Med>some cons2Med text</cons2Med>
</fsl>
<bPhoto>true</bPhoto>
<bLeaveAlone>false</bLeaveAlone>
<authorizedPersonList>
<personInfo>
<num>614719</num>
<lastname>BENT</lastname>
<firstname>AMEL</firstname>
<dateBirth>1985-06-21T00:00:00+02:00</dateBirth>
<civility>MME</civility>
<sexe>F</sexe>
<contact>
<phone>0123456789</phone>
<mobile>0623456789</mobile>
<mail>abent@example.org</mail>
</contact>
</personInfo>
<personQuality>
<code>T</code>
<libelle>TANTE</libelle>
</personQuality>
</authorizedPersonList>
<medicalRecord>
<familyDoctor>
<name>DRE</name>
<phone>0612341234</phone>
<address>
<street1>Alameda</street1>
<zipcode>90220</zipcode>
<town>Compton</town>
</address>
</familyDoctor>
<vaccinList>
<code>ROR</code>
<label>ROUGEOLE-OREILLONS-RUBEOLE</label>
<vaccinationDate>2012-02-22T00:00:00+01:00</vaccinationDate>
</vaccinList>
<vaccinList>
<code>DTC</code>
<label>DIPHTERIE TETANOS COQUELUCHE</label>
<vaccinationDate>2011-01-11T00:00:00+01:00</vaccinationDate>
</vaccinList>
<vaccinList>
<code>ROR</code>
<label>ROUGEOLE-OREILLONS-RUBEOLE</label>
<vaccinationDate>1970-01-11T00:00:00+01:00</vaccinationDate>
</vaccinList>
</medicalRecord>
<mother>
<num>613963</num>
<civility>MME</civility>
<firstname>JANE</firstname>
<lastname>DOE</lastname>
</mother>
<father>
<num>613878</num>
<civility>M.</civility>
<firstname>JHON</firstname>
<lastname>DOE</lastname>
</father>
<paiInfoBean>
<code>PAIALI</code>
<dateDeb>2022-01-01T00:00:00+01:00</dateDeb>
<dateFin>2022-12-31T00:00:00+01:00</dateFin>
<description>bla bla PAI</description>
</paiInfoBean>
</childList>
<childList>
<num>613987</num>
<lastname>DOE</lastname>
<firstname>JOHNNY ALLEN</firstname>
<sexe>M</sexe>
<birth>
<dateBirth>1942-11-27T00:00:00+01:00</dateBirth>
<place>Seattle</place>
</birth>
<bPhoto>false</bPhoto>
<bLeaveAlone>false</bLeaveAlone>
<paiInfoBean/>
</childList>
<childList>
<num>614051</num>
<lastname>DOE</lastname>
<firstname>ROBERT</firstname>
<sexe>M</sexe>
<birth>
<dateBirth>1941-05-24T00:00:00+02:00</dateBirth>
<place>Duluth</place>
</birth>
<bPhoto>true</bPhoto>
<bLeaveAlone>false</bLeaveAlone>
<paiInfoBean/>
</childList>
</familyResult>
</ns2:readFamilyResponse>
</soap:Body>
</soap:Envelope>

View File

@ -42,6 +42,8 @@ FAILED_AUTH = FakedResponse(content=get_xml_file('R_failed_authentication.xml'),
ISWSRUNNING_TRUE = FakedResponse(content=get_xml_file('R_is_ws_running.xml') % b'true', status_code=200)
ISWSRUNNING_FALSE = FakedResponse(content=get_xml_file('R_is_ws_running.xml') % b'false', status_code=200)
READ_FAMILY = FakedResponse(content=get_xml_file('R_read_family.xml'), status_code=200)
READ_FAMILY_LAX = FakedResponse(content=get_xml_file('R_read_family_relax.xml'), status_code=200)
READ_FAMILY_ORD = FakedResponse(content=get_xml_file('R_read_family_reordered.xml'), status_code=200)
READ_RL1_FAMILY = FakedResponse(content=get_xml_file('R_read_family_with_only_rl1.xml'), status_code=200)
READ_CATEGORIES = FakedResponse(content=get_xml_file('R_read_category_list.xml'), status_code=200)
READ_CIVILITIES = FakedResponse(content=get_xml_file('R_read_civility_list.xml'), status_code=200)
@ -538,12 +540,13 @@ def test_read_vaccin_list(mocked_post, mocked_get, con, app):
]
@pytest.mark.parametrize("read_family", [READ_FAMILY, READ_FAMILY_LAX, READ_FAMILY_ORD])
@mock.patch('passerelle.utils.Request.get')
@mock.patch('passerelle.utils.Request.post')
def test_read_family(mocked_post, mocked_get, con, app):
def test_read_family(mocked_post, mocked_get, read_family, con, app):
mocked_get.return_value = FAMILY_SERVICE_WSDL
mocked_post.side_effect = [
READ_FAMILY,
read_family,
READ_CATEGORIES,
READ_SITUATIONS,
READ_CIVILITIES,
@ -612,6 +615,7 @@ def test_read_family(mocked_post, mocked_get, con, app):
del data['fsl']
del data['medicalRecord']
del data['authorizedPersonList']
del data['paiInfoBean']
assert data == {
'num': '613880',
'lastname': 'DOE',
@ -629,14 +633,22 @@ def test_read_family(mocked_post, mocked_get, con, app):
'father': {'num': 613878, 'civility': 'M.', 'firstname': 'JHON', 'lastname': 'DOE'},
'rl': None,
'subscribeActivityList': [],
'paiInfoBean': {
}
if read_family != READ_FAMILY_LAX:
assert resp.json['data']['childList'][0]['paiInfoBean'] == {
'code': 'PAIALI',
'code_text': 'ALIMENTAIRE',
'dateDeb': '2022-01-01T00:00:00+01:00',
'dateFin': '2022-12-31T00:00:00+01:00',
'description': 'bla bla PAI',
},
}
}
else:
assert resp.json['data']['childList'][0]['paiInfoBean'] == {
'code': None,
'dateDeb': '2022-01-01T00:00:00+01:00',
'dateFin': '2022-12-31T00:00:00+01:00',
'description': 'bla bla PAI',
}
assert resp.json['data']['childList'][0]['fsl'] == {
'dateDeb': '2022-01-01T00:00:00+01:00',
'dateFin': '2022-12-31T00:00:00+01:00',