toulouse-maelis: add endpoint to read ape indicators list (#73923)
gitea-wip/passerelle/pipeline/pr-main This commit looks good Details

This commit is contained in:
Serghei Mihai 2023-02-01 12:19:16 +01:00
parent 95192de819
commit 8c756cfb75
4 changed files with 536 additions and 2 deletions

View File

@ -83,6 +83,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
assert self.call('Activity', 'isWSRunning')
assert self.call('Invoice', 'isWSRunning')
assert self.call('Site', 'isWSRunning')
assert self.call('Ape', 'isWSRunning')
def update_referential(self, referential_name, data, id_key, text_key):
last_update = now()
@ -167,11 +168,18 @@ class ToulouseMaelis(BaseResource, HTTPResource):
data = self.get_referential_data('Activity', referential_name)
self.update_referential(referential_name, data, id_key, text_key)
def update_ape_referentials(self):
for referential_name in ('ApeIndicator',):
id_key, text_key = 'level', 'level'
data = self.get_referential_data('Ape', referential_name)
self.update_referential(referential_name, data, id_key, text_key)
def daily(self):
try:
self.update_family_referentials()
self.update_site_referentials()
self.update_activity_referentials()
self.update_ape_referentials()
except UpdateError as e:
self.logger.warning('Erreur sur la mise à jour: %s' % e)
@ -2416,6 +2424,15 @@ class ToulouseMaelis(BaseResource, HTTPResource):
def read_activity_nature_list(self, request):
return {'data': self.get_referential('ActivityNatureType')}
@endpoint(
display_category='Inscriptions',
description="Liste les indicateurs pour les activités petite enfance",
name='read-ape-indicators-list',
perm='can_access',
)
def read_ape_indicators_list(self, request):
return {'data': self.get_referential('ApeIndicator')}
class Link(models.Model):
resource = models.ForeignKey(ToulouseMaelis, on_delete=models.CASCADE)

View File

@ -0,0 +1,386 @@
<?xml version='1.0' encoding='UTF-8'?><wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="ape.ws.maelis.sigec.com" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="ApeService" targetNamespace="ape.ws.maelis.sigec.com">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="bean.persistence.ws.maelis.sigec.com" version="1.0">
<xs:complexType name="itemBean">
<xs:sequence>
<xs:element minOccurs="0" name="code" type="xs:string"/>
<xs:element minOccurs="0" name="libelle" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="bean.persistence.ape.ws.maelis.sigec.com" xmlns:ns2="bean.persistence.ws.maelis.sigec.com" xmlns:ns1="ape.ws.maelis.sigec.com" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="bean.persistence.ape.ws.maelis.sigec.com">
<xs:import namespace="ape.ws.maelis.sigec.com"/>
<xs:import namespace="bean.persistence.ws.maelis.sigec.com"/>
<xs:complexType name="addApeBookRequestBean">
<xs:complexContent>
<xs:extension base="ns1:abstractSpecRequestBean">
<xs:all/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="addApeBookResultBean">
<xs:complexContent>
<xs:extension base="ns1:abstractSpecResultBean">
<xs:sequence/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="readApeIndicatorListResultBean">
<xs:complexContent>
<xs:extension base="ns1:abstractSpecResultBean">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="apeIndicatorGroupList" nillable="true" type="tns:apeIndicatorGroupBean"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="apeIndicatorGroupBean">
<xs:complexContent>
<xs:extension base="ns1:abstractSpecResultBean">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="indicatorList" nillable="true" type="tns:indicatorReadBean"/>
<xs:element minOccurs="0" name="level" type="ns1:apeIndicatorLevelEnum"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="indicatorReadBean">
<xs:complexContent>
<xs:extension base="ns1:abstractSpecResultBean">
<xs:sequence>
<xs:element minOccurs="0" name="code" type="xs:string"/>
<xs:element minOccurs="0" name="libelle" type="xs:string"/>
<xs:element minOccurs="0" name="typeDesc" type="ns1:indicatorTypeDescEnum"/>
<xs:element maxOccurs="unbounded" minOccurs="0" name="choiceList" nillable="true" type="ns2:itemBean"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="readNurseryListRequestBean">
<xs:complexContent>
<xs:extension base="ns1:abstractSpecRequestBean">
<xs:sequence>
<xs:element minOccurs="0" name="activityTypeCode" type="xs:string"/>
<xs:element minOccurs="0" name="codePSU" type="ns1:nurseryTypeAccEnum"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="readNurseryListResultBean">
<xs:complexContent>
<xs:extension base="ns1:abstractSpecResultBean">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="nurseryList" nillable="true" type="tns:nurseryInfoBean"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="nurseryInfoBean">
<xs:complexContent>
<xs:extension base="ns1:abstractSpecResultBean">
<xs:sequence>
<xs:element minOccurs="0" name="activityType" type="tns:activityTypeBean"/>
<xs:element minOccurs="0" name="idActivity" type="xs:string"/>
<xs:element minOccurs="0" name="libelle" type="xs:string"/>
<xs:element minOccurs="0" name="libelle2" type="xs:string"/>
<xs:element minOccurs="0" name="manager1" type="tns:managerBean"/>
<xs:element minOccurs="0" name="manager2" type="tns:managerBean"/>
<xs:element minOccurs="0" name="obs1" type="xs:string"/>
<xs:element minOccurs="0" name="obs2" type="xs:string"/>
<xs:element maxOccurs="unbounded" minOccurs="0" name="unitList" nillable="true" type="tns:nurseryUnitInfoBean"/>
<xs:element minOccurs="0" name="place" type="tns:placeInfoBean"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="activityTypeBean">
<xs:complexContent>
<xs:extension base="ns1:abstractSpecResultBean">
<xs:sequence>
<xs:element minOccurs="0" name="code" type="xs:string"/>
<xs:element minOccurs="0" name="libelle" type="xs:string"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="managerBean">
<xs:complexContent>
<xs:extension base="ns1:abstractSpecResultBean">
<xs:sequence>
<xs:element minOccurs="0" name="lastname" type="xs:string"/>
<xs:element minOccurs="0" name="firstname" type="xs:string"/>
<xs:element minOccurs="0" name="phone" type="xs:string"/>
<xs:element minOccurs="0" name="poste" type="xs:string"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="nurseryUnitInfoBean">
<xs:complexContent>
<xs:extension base="ns1:abstractSpecResultBean">
<xs:sequence>
<xs:element minOccurs="0" name="idUnit" type="xs:string"/>
<xs:element minOccurs="0" name="libelle" type="xs:string"/>
<xs:element minOccurs="0" name="typeAcc" type="ns1:nurseryTypeAccEnum"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="placeInfoBean">
<xs:complexContent>
<xs:extension base="ns1:abstractSpecResultBean">
<xs:sequence>
<xs:element minOccurs="0" name="idPlace" type="xs:string"/>
<xs:element minOccurs="0" name="libelle" type="xs:string"/>
<xs:element minOccurs="0" name="libelle2" type="xs:string"/>
<xs:element minOccurs="0" name="address" type="tns:addressBean"/>
<xs:element minOccurs="0" name="latitude" type="xs:double"/>
<xs:element minOccurs="0" name="longitude" type="xs:double"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="addressBean">
<xs:complexContent>
<xs:extension base="ns1:abstractSpecResultBean">
<xs:sequence>
<xs:element minOccurs="0" name="num" type="xs:int"/>
<xs:element minOccurs="0" name="street1" type="xs:string"/>
<xs:element minOccurs="0" name="street2" type="xs:string"/>
<xs:element minOccurs="0" name="idStreet" type="xs:string"/>
<xs:element minOccurs="0" name="zipcode" type="xs:string"/>
<xs:element minOccurs="0" name="town" type="xs:string"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="ape.ws.maelis.sigec.com" xmlns:ns1="bean.persistence.ape.ws.maelis.sigec.com" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="ape.ws.maelis.sigec.com">
<xs:import namespace="bean.persistence.ape.ws.maelis.sigec.com"/>
<xs:import namespace="bean.persistence.ws.maelis.sigec.com"/>
<xs:element name="addApeBook" type="tns:addApeBook"/>
<xs:element name="addApeBookResponse" type="tns:addApeBookResponse"/>
<xs:element name="isWSRunning" type="tns:isWSRunning"/>
<xs:element name="isWSRunningResponse" type="tns:isWSRunningResponse"/>
<xs:element name="readApeIndicatorList" type="tns:readApeIndicatorList"/>
<xs:element name="readApeIndicatorListResponse" type="tns:readApeIndicatorListResponse"/>
<xs:element name="readNurseryList" type="tns:readNurseryList"/>
<xs:element name="readNurseryListResponse" type="tns:readNurseryListResponse"/>
<xs:complexType name="addApeBook">
<xs:sequence>
<xs:element name="request" type="ns1:addApeBookRequestBean"/>
</xs:sequence>
</xs:complexType>
<xs:complexType abstract="true" name="abstractSpecRequestBean">
<xs:complexContent>
<xs:extension base="tns:abstractSpecBean">
<xs:sequence/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType abstract="true" name="abstractSpecBean">
<xs:sequence/>
</xs:complexType>
<xs:complexType name="addApeBookResponse">
<xs:sequence>
<xs:element minOccurs="0" name="result" type="ns1:addApeBookResultBean"/>
</xs:sequence>
</xs:complexType>
<xs:complexType abstract="true" name="abstractSpecResultBean">
<xs:complexContent>
<xs:extension base="tns:abstractSpecBean">
<xs:sequence/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="readApeIndicatorList">
<xs:sequence/>
</xs:complexType>
<xs:complexType name="readApeIndicatorListResponse">
<xs:sequence>
<xs:element minOccurs="0" name="result" type="ns1:readApeIndicatorListResultBean"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="readNurseryList">
<xs:sequence>
<xs:element name="request" type="ns1:readNurseryListRequestBean"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="readNurseryListResponse">
<xs:sequence>
<xs:element minOccurs="0" name="result" type="ns1:readNurseryListResultBean"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="isWSRunning">
<xs:sequence/>
</xs:complexType>
<xs:complexType name="isWSRunningResponse">
<xs:sequence>
<xs:element name="isWSRunning" type="xs:boolean"/>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="indicatorTypeDescEnum">
<xs:restriction base="xs:string">
<xs:enumeration value="NONE"/>
<xs:enumeration value="NOTE"/>
<xs:enumeration value="CHOICE"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="apeIndicatorLevelEnum">
<xs:restriction base="xs:string">
<xs:enumeration value="INDI_APE_FAM"/>
<xs:enumeration value="INDI_APE_ENF"/>
<xs:enumeration value="INDI_APE_RES"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="nurseryTypeAccEnum">
<xs:restriction base="xs:string">
<xs:enumeration value="REGULAR"/>
<xs:enumeration value="OCCASIONAL"/>
</xs:restriction>
</xs:simpleType>
<xs:element name="MaelisApeException" type="tns:MaelisApeException"/>
<xs:complexType name="MaelisApeException">
<xs:sequence>
<xs:element minOccurs="0" name="message" type="xs:string"/>
<xs:element minOccurs="0" name="message" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="addApeBook">
<wsdl:part element="tns:addApeBook" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="addApeBookResponse">
<wsdl:part element="tns:addApeBookResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="readNurseryListResponse">
<wsdl:part element="tns:readNurseryListResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="MaelisApeException">
<wsdl:part element="tns:MaelisApeException" name="MaelisApeException">
</wsdl:part>
</wsdl:message>
<wsdl:message name="isWSRunning">
<wsdl:part element="tns:isWSRunning" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="readApeIndicatorListResponse">
<wsdl:part element="tns:readApeIndicatorListResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="readApeIndicatorList">
<wsdl:part element="tns:readApeIndicatorList" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="readNurseryList">
<wsdl:part element="tns:readNurseryList" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="isWSRunningResponse">
<wsdl:part element="tns:isWSRunningResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="ApeService">
<wsdl:operation name="addApeBook">
<wsdl:documentation>Crée une demande de place en crèche</wsdl:documentation>
<wsdl:input message="tns:addApeBook" name="addApeBook">
</wsdl:input>
<wsdl:output message="tns:addApeBookResponse" name="addApeBookResponse">
</wsdl:output>
<wsdl:fault message="tns:MaelisApeException" name="MaelisApeException">
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="readApeIndicatorList">
<wsdl:documentation>Renvoie la liste des indicateurs (groupés par niveau) qui pourront être pris en compte au moment de la création de la demande de place en crèche.</wsdl:documentation>
<wsdl:input message="tns:readApeIndicatorList" name="readApeIndicatorList">
</wsdl:input>
<wsdl:output message="tns:readApeIndicatorListResponse" name="readApeIndicatorListResponse">
</wsdl:output>
<wsdl:fault message="tns:MaelisApeException" name="MaelisApeException">
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="readNurseryList">
<wsdl:documentation>Renvoie la liste des crèches selon les critères indiqués</wsdl:documentation>
<wsdl:input message="tns:readNurseryList" name="readNurseryList">
</wsdl:input>
<wsdl:output message="tns:readNurseryListResponse" name="readNurseryListResponse">
</wsdl:output>
<wsdl:fault message="tns:MaelisApeException" name="MaelisApeException">
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="isWSRunning">
<wsdl:documentation>Vérifie si le webservice est OK
-------------------------
Retourne vrai ou faux </wsdl:documentation>
<wsdl:input message="tns:isWSRunning" name="isWSRunning">
</wsdl:input>
<wsdl:output message="tns:isWSRunningResponse" name="isWSRunningResponse">
</wsdl:output>
<wsdl:fault message="tns:MaelisApeException" name="MaelisApeException">
</wsdl:fault>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ApeServiceSoapBinding" type="tns:ApeService">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="addApeBook">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="addApeBook">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="addApeBookResponse">
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="MaelisApeException">
<soap:fault name="MaelisApeException" use="literal"/>
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="readApeIndicatorList">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="readApeIndicatorList">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="readApeIndicatorListResponse">
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="MaelisApeException">
<soap:fault name="MaelisApeException" use="literal"/>
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="readNurseryList">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="readNurseryList">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="readNurseryListResponse">
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="MaelisApeException">
<soap:fault name="MaelisApeException" use="literal"/>
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="isWSRunning">
<soap:operation soapAction="" style="document"/>
<wsdl:input name="isWSRunning">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="isWSRunningResponse">
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="MaelisApeException">
<soap:fault name="MaelisApeException" use="literal"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ApeService">
<wsdl:port binding="tns:ApeServiceSoapBinding" name="ApeServiceImplPort">
<soap:address location="https://demo-toulouse.sigec.fr/maelisws-toulouse/services/ApeService"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

View File

@ -0,0 +1,93 @@
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:readApeIndicatorListResponse xmlns:ns2="ape.ws.maelis.sigec.com">
<result>
<apeIndicatorGroupList>
<level>INDI_APE_FAM</level>
<indicatorList>
<code>APE_COMPO1</code>
<typeDesc>NONE</typeDesc>
</indicatorList>
<indicatorList>
<code>APE_COMPO2</code>
<typeDesc>NONE</typeDesc>
</indicatorList>
<indicatorList>
<code>APE_COMPO3</code>
<typeDesc>NONE</typeDesc>
</indicatorList>
<indicatorList>
<code>APE_COMPO4</code>
<typeDesc>NONE</typeDesc>
</indicatorList>
<indicatorList>
<code>APE_HFRAT</code>
<typeDesc>NONE</typeDesc>
</indicatorList>
<indicatorList>
<code>APE_MULTIACC</code>
<typeDesc>NONE</typeDesc>
</indicatorList>
<indicatorList>
<code>APE_NAIM</code>
<typeDesc>NONE</typeDesc>
</indicatorList>
<indicatorList>
<code>APE_SPLOG</code>
<typeDesc>NONE</typeDesc>
</indicatorList>
</apeIndicatorGroupList>
<apeIndicatorGroupList>
<level>INDI_APE_ENF</level>
<indicatorList>
<code>APE-MINE</code>
<typeDesc>NONE</typeDesc>
</indicatorList>
<indicatorList>
<code>APE_ALLO</code>
<typeDesc>NONE</typeDesc>
</indicatorList>
<indicatorList>
<code>APE_HBOTH</code>
<typeDesc>NONE</typeDesc>
</indicatorList>
<indicatorList>
<code>APE_HPAR</code>
<typeDesc>NONE</typeDesc>
</indicatorList>
<indicatorList>
<code>APE_SITUP</code>
<typeDesc>NONE</typeDesc>
</indicatorList>
</apeIndicatorGroupList>
<apeIndicatorGroupList>
<level>INDI_APE_RES</level>
<indicatorList>
<code>APE_FIRSTC</code>
<typeDesc>NONE</typeDesc>
</indicatorList>
<indicatorList>
<code>APE_FRAT</code>
<typeDesc>NOTE</typeDesc>
</indicatorList>
<indicatorList>
<code>APE_HAND</code>
<typeDesc>CHOICE</typeDesc>
<choiceList>
<code>H</code>
<libelle>Handicap</libelle>
</choiceList>
<choiceList>
<code>MC</code>
<libelle>Maladie Chronique</libelle>
</choiceList>
</indicatorList>
<indicatorList>
<code>APE_KOFRAT</code>
<typeDesc>NONE</typeDesc>
</indicatorList>
</apeIndicatorGroupList>
</result>
</ns2:readApeIndicatorListResponse>
</soap:Body>
</soap:Envelope>

View File

@ -47,6 +47,7 @@ FAMILY_SERVICE_WSDL = FakedResponse(content=get_xml_file('FamilyService.wsdl'),
ACTIVITY_SERVICE_WSDL = FakedResponse(content=get_xml_file('ActivityService.wsdl'), status_code=200)
INVOICE_SERVICE_WSDL = FakedResponse(content=get_xml_file('InvoiceService.wsdl'), status_code=200)
SITE_SERVICE_WSDL = FakedResponse(content=get_xml_file('SiteService.wsdl'), status_code=200)
APE_SERVICE_WSDL = FakedResponse(content=get_xml_file('ApeService.wsdl'), status_code=200)
FAILED_AUTH = FakedResponse(content=get_xml_file('R_failed_authentication.xml'), status_code=500)
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)
@ -111,6 +112,16 @@ def site_service(requests_mock):
yield soap_mock
@pytest.fixture()
def ape_service():
with ResponsesSoap(
wsdl_url='https://example.org/ApeService?wsdl',
wsdl_content=get_xml_file('ApeService.wsdl'),
settings=Settings(strict=False, xsd_ignore_sequence_order=True),
)() as mock:
yield mock
@pytest.fixture(scope='module')
def django_db_setup(django_db_setup, django_db_blocker):
with django_db_blocker.unblock():
@ -141,6 +152,12 @@ def django_db_setup(django_db_setup, django_db_blocker):
settings=Settings(strict=False, xsd_ignore_sequence_order=True),
)
ape_service = ResponsesSoap(
wsdl_url='https://example.org/ApeService?wsdl',
wsdl_content=get_xml_file('ApeService.wsdl'),
settings=Settings(strict=False, xsd_ignore_sequence_order=True),
)
with family_service() as soap_mock:
soap_mock.add_soap_response('readCategoryList', get_xml_file('R_read_category_list.xml'))
soap_mock.add_soap_response(
@ -171,6 +188,10 @@ def django_db_setup(django_db_setup, django_db_blocker):
)
con.update_activity_referentials()
with ape_service() as ape_mock:
ape_mock.add_soap_response('readApeIndicatorList', get_xml_file('R_read_ape_indicator_list.xml'))
con.update_ape_referentials()
# reset change in zeep private interface to bypass clear_cache fixture
from zeep.cache import InMemoryCache
@ -220,8 +241,14 @@ def test_call(family_service, con):
'get_responses, post_responses, exception',
[
(
[FAMILY_SERVICE_WSDL, ACTIVITY_SERVICE_WSDL, INVOICE_SERVICE_WSDL, SITE_SERVICE_WSDL],
[ISWSRUNNING_TRUE, ISWSRUNNING_TRUE, ISWSRUNNING_TRUE, ISWSRUNNING_TRUE],
[
FAMILY_SERVICE_WSDL,
ACTIVITY_SERVICE_WSDL,
INVOICE_SERVICE_WSDL,
SITE_SERVICE_WSDL,
APE_SERVICE_WSDL,
],
[ISWSRUNNING_TRUE, ISWSRUNNING_TRUE, ISWSRUNNING_TRUE, ISWSRUNNING_TRUE, ISWSRUNNING_TRUE],
None,
),
(
@ -325,6 +352,7 @@ def test_cron(db):
assert Referential.objects.filter(referential_name='Category').count() == 3
assert sorted(list({x.referential_name for x in Referential.objects.all()})) == [
'ActivityNatureType',
'ApeIndicator',
'CSP',
'Category',
'ChildIndicator',
@ -5282,3 +5310,13 @@ def test_read_activity_nature_list(con, app):
{'code': 'ACCSOIR', 'libelle': 'Accueil du soir'},
],
}
def test_read_ape_indicator_list(con, app):
url = get_endpoint('read-ape-indicators-list')
resp = app.get(url)
assert resp.json['err'] == 0
assert len(resp.json['data']) == 3
for item in resp.json['data']:
assert 'id' in item
assert 'text' in item