From d6a840ec7a8ea5becdc95aba9adc4fe0a2d52a09 Mon Sep 17 00:00:00 2001
From: Nicolas ROCHE <nroche@entrouvert.com>
Date: Wed, 27 Jul 2022 11:23:56 +0200
Subject: [PATCH] toulouse_maelis: check status on invoices webservices too
 (#67789)

---
 passerelle/contrib/toulouse_maelis/models.py  |   1 +
 .../data/toulouse_maelis/InvoiceService.wsdl  | 388 ++++++++++++++++++
 tests/test_toulouse_maelis.py                 |  25 +-
 3 files changed, 410 insertions(+), 4 deletions(-)
 create mode 100644 tests/data/toulouse_maelis/InvoiceService.wsdl

diff --git a/passerelle/contrib/toulouse_maelis/models.py b/passerelle/contrib/toulouse_maelis/models.py
index 32eb31a7..14f23a23 100644
--- a/passerelle/contrib/toulouse_maelis/models.py
+++ b/passerelle/contrib/toulouse_maelis/models.py
@@ -61,16 +61,17 @@ class ToulouseMaelis(BaseResource, HTTPResource):
         try:
             return method(**kwargs)
         except zeep.exceptions.Fault as e:
             raise APIError(e.message, err_code='%s-%s-%s' % (wsdl_short_name, service, e.code))
 
     def check_status(self):
         assert self.call('Family', 'isWSRunning')
         assert self.call('Activity', 'isWSRunning')
+        assert self.call('Invoice', 'isWSRunning')
 
     def get_referential(self, referential_name):
 
         # local referentials
         if referential_name == 'Complement':
             response = [
                 {'id': 'B', 'text': 'bis'},
                 {'id': 'T', 'text': 'ter'},
diff --git a/tests/data/toulouse_maelis/InvoiceService.wsdl b/tests/data/toulouse_maelis/InvoiceService.wsdl
new file mode 100644
index 00000000..ea17348e
--- /dev/null
+++ b/tests/data/toulouse_maelis/InvoiceService.wsdl
@@ -0,0 +1,388 @@
+<?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="ws.maelis.sigec.com" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="InvoiceService" targetNamespace="ws.maelis.sigec.com">
+  <wsdl:types>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="ws.maelis.sigec.com" xmlns:ns1="bean.persistence.ws.maelis.sigec.com" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="ws.maelis.sigec.com">
+  <xs:import namespace="bean.persistence.ws.maelis.sigec.com"/>
+  <xs:element name="addDirectDebitOrder" type="tns:addDirectDebitOrder"/>
+  <xs:element name="addDirectDebitOrderResponse" type="tns:addDirectDebitOrderResponse"/>
+  <xs:element name="getDirectDebitOrder" type="tns:getDirectDebitOrder"/>
+  <xs:element name="getDirectDebitOrderResponse" type="tns:getDirectDebitOrderResponse"/>
+  <xs:element name="isWSRunning" type="tns:isWSRunning"/>
+  <xs:element name="isWSRunningResponse" type="tns:isWSRunningResponse"/>
+  <xs:element name="payInvoices" type="tns:payInvoices"/>
+  <xs:element name="payInvoicesResponse" type="tns:payInvoicesResponse"/>
+  <xs:element name="readInvoices" type="tns:readInvoices"/>
+  <xs:element name="readInvoicesResponse" type="tns:readInvoicesResponse"/>
+  <xs:complexType name="payInvoices">
+    <xs:sequence>
+      <xs:element name="numFamily" type="xs:int"/>
+      <xs:element minOccurs="0" name="numPerson" type="xs:int"/>
+      <xs:element minOccurs="0" name="lastName" type="xs:string"/>
+      <xs:element minOccurs="0" name="firstName" type="xs:string"/>
+      <xs:element name="codeRegie" type="xs:int"/>
+      <xs:element name="amount" type="xs:double"/>
+      <xs:element name="datePaiement" type="xs:dateTime"/>
+      <xs:element name="refTransaction" type="xs:string"/>
+      <xs:element maxOccurs="unbounded" name="numInvoices" type="xs:int"/>
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType name="payInvoicesResponse">
+    <xs:sequence>
+      <xs:element minOccurs="0" name="numReglement" type="xs:int"/>
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType name="getDirectDebitOrder">
+    <xs:sequence>
+      <xs:element name="dossierNumber" type="xs:int"/>
+      <xs:element name="numPerson" type="xs:int"/>
+      <xs:element name="codeRegie" type="xs:int"/>
+      <xs:element name="dateRef" type="xs:dateTime"/>
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType name="getDirectDebitOrderResponse">
+    <xs:sequence>
+      <xs:element minOccurs="0" name="return" type="ns1:personBankBean"/>
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType abstract="true" name="abstractSpecBean">
+    <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:complexType name="addDirectDebitOrder">
+    <xs:sequence>
+      <xs:element name="dossierNumber" type="xs:int"/>
+      <xs:element name="numPerson" type="xs:int"/>
+      <xs:element name="bank" type="ns1:personBankBean"/>
+      <xs:element name="codeRegie" type="xs:int"/>
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType name="addDirectDebitOrderResponse">
+    <xs:sequence/>
+  </xs:complexType>
+  <xs:complexType name="readInvoices">
+    <xs:sequence>
+      <xs:element name="numDossier" type="xs:int"/>
+      <xs:element name="codeRegie" type="xs:int"/>
+      <xs:element name="dateStart" type="xs:dateTime"/>
+      <xs:element name="dateEnd" type="xs:dateTime"/>
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType name="readInvoicesResponse">
+    <xs:sequence>
+      <xs:element maxOccurs="unbounded" minOccurs="0" name="invoiceList" type="ns1:invoiceBean"/>
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType name="ttfKernelBean">
+    <xs:sequence>
+      <xs:element minOccurs="0" name="footerLine1" type="xs:string"/>
+      <xs:element minOccurs="0" name="footerLine2" type="xs:string"/>
+      <xs:element minOccurs="0" name="footerLine3" type="xs:string"/>
+      <xs:element minOccurs="0" name="footerLine4" type="xs:string"/>
+      <xs:element minOccurs="0" name="footerLine5" type="xs:string"/>
+      <xs:element minOccurs="0" name="headerLine1" type="xs:string"/>
+      <xs:element minOccurs="0" name="headerLine2" type="xs:string"/>
+      <xs:element minOccurs="0" name="headerLine3" type="xs:string"/>
+      <xs:element minOccurs="0" name="headerLine4" type="xs:string"/>
+      <xs:element minOccurs="0" name="headerLine5" type="xs:string"/>
+      <xs:element minOccurs="0" name="libelle" type="xs:string"/>
+    </xs:sequence>
+  </xs:complexType>
+  <xs:element name="MaelisAccountException" type="tns:MaelisAccountException"/>
+  <xs:complexType name="MaelisAccountException">
+    <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>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="bean.persistence.ws.maelis.sigec.com" xmlns:ns1="ws.maelis.sigec.com" targetNamespace="bean.persistence.ws.maelis.sigec.com" version="1.0">
+
+  <xs:import namespace="ws.maelis.sigec.com"/>
+
+  <xs:complexType name="personBankBean">
+    <xs:complexContent>
+      <xs:extension base="ns1:abstractSpecBean">
+        <xs:sequence>
+          <xs:element name="bankBIC" type="xs:string"/>
+          <xs:element name="bankIBAN" type="xs:string"/>
+          <xs:element name="bankRUM" type="xs:string"/>
+          <xs:element name="dateStart" type="xs:dateTime"/>
+          <xs:element name="bankAddress" type="xs:string"/>
+          <xs:element minOccurs="0" name="civility" type="xs:string"/>
+          <xs:element name="lastName" type="xs:string"/>
+          <xs:element name="firstName" type="xs:string"/>
+        </xs:sequence>
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+
+  <xs:complexType name="invoiceBean">
+    <xs:sequence>
+      <xs:element minOccurs="0" name="numInvoice" type="xs:string"/>
+      <xs:element minOccurs="0" name="libelleTTF" type="xs:string"/>
+      <xs:element minOccurs="0" name="regie" type="tns:regieBean"/>
+      <xs:element minOccurs="0" name="numFamily" type="xs:int"/>
+      <xs:element minOccurs="0" name="name" type="xs:string"/>
+      <xs:element minOccurs="0" name="refTIPI" type="xs:string"/>
+      <xs:element minOccurs="0" name="amountInvoice" type="xs:decimal"/>
+      <xs:element minOccurs="0" name="amountPaid" type="xs:decimal"/>
+      <xs:element minOccurs="0" name="amountPaidTG" type="xs:decimal"/>
+      <xs:element minOccurs="0" name="dateInvoice" type="xs:dateTime"/>
+      <xs:element minOccurs="0" name="dateStartPayment" type="xs:dateTime"/>
+      <xs:element minOccurs="0" name="dateDeadline" type="xs:dateTime"/>
+      <xs:element minOccurs="0" name="dateDeadlinePayment" type="xs:dateTime"/>
+      <xs:element minOccurs="0" name="dateTIPI" type="xs:dateTime"/>
+      <xs:element minOccurs="0" name="authTIPI" type="xs:string"/>
+      <xs:element minOccurs="0" name="pdfName" type="xs:string"/>
+      <xs:element maxOccurs="unbounded" minOccurs="0" name="lineInvoiceList" nillable="true" type="tns:lineInvoiceBean"/>
+    </xs:sequence>
+  </xs:complexType>
+
+  <xs:complexType name="regieBean">
+    <xs:sequence>
+      <xs:element minOccurs="0" name="code" type="xs:int"/>
+      <xs:element minOccurs="0" name="libelle" type="xs:string"/>
+    </xs:sequence>
+  </xs:complexType>
+
+  <xs:complexType name="lineInvoiceBean">
+    <xs:sequence>
+      <xs:element name="numLine" type="xs:int"/>
+      <xs:element minOccurs="0" name="numPers" type="xs:string"/>
+      <xs:element minOccurs="0" name="idActivity" type="xs:string"/>
+      <xs:element minOccurs="0" name="idUnit" type="xs:string"/>
+      <xs:element minOccurs="0" name="libelleLine" type="xs:string"/>
+      <xs:element minOccurs="0" name="name" type="xs:string"/>
+      <xs:element minOccurs="0" name="dateStart" type="xs:dateTime"/>
+      <xs:element minOccurs="0" name="dateEnd" type="xs:dateTime"/>
+      <xs:element minOccurs="0" name="quantity" type="xs:double"/>
+      <xs:element minOccurs="0" name="unitPrice" type="xs:double"/>
+      <xs:element minOccurs="0" name="amountLine" type="xs:decimal"/>
+    </xs:sequence>
+  </xs:complexType>
+
+</xs:schema>
+  </wsdl:types>
+  <wsdl:message name="payInvoices">
+    <wsdl:part element="tns:payInvoices" name="parameters">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="getDirectDebitOrder">
+    <wsdl:part element="tns:getDirectDebitOrder" name="parameters">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="isWSRunning">
+    <wsdl:part element="tns:isWSRunning" name="parameters">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="getDirectDebitOrderResponse">
+    <wsdl:part element="tns:getDirectDebitOrderResponse" name="parameters">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="addDirectDebitOrder">
+    <wsdl:part element="tns:addDirectDebitOrder" name="parameters">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="readInvoices">
+    <wsdl:part element="tns:readInvoices" name="parameters">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="payInvoicesResponse">
+    <wsdl:part element="tns:payInvoicesResponse" name="parameters">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="MaelisAccountException">
+    <wsdl:part element="tns:MaelisAccountException" name="MaelisAccountException">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="readInvoicesResponse">
+    <wsdl:part element="tns:readInvoicesResponse" name="parameters">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="isWSRunningResponse">
+    <wsdl:part element="tns:isWSRunningResponse" name="parameters">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="addDirectDebitOrderResponse">
+    <wsdl:part element="tns:addDirectDebitOrderResponse" name="parameters">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:portType name="InvoiceService">
+<wsdl:documentation>Attention : Il est nécessaire de paramétrer un code pour la régie qui doit être passé en paramètre lors de l'invocation de la méthode.</wsdl:documentation>
+    <wsdl:operation name="payInvoices">
+<wsdl:documentation>Service d'enregistrement des paiements effectués par une famille 
+ La personne qui effectue le règlement de la facture doit être Rl1 ou Rl2 de la famille
+ Solde de la liste des factures passées en paramètre
+ Enregistrement du règlement 
+ Mise à jour de la balance familiale 
+
+ ----------------------------------- 
+ numFamily : numéro de la famille 
+ numPerson : numéro de la personne qui effectue le règlement 
+ lastName : nom de la personne qui effectue le règlement 
+ firstName : prénom de la personne qui effectue le règlement 
+ codeRegie : code de la régie 
+ amount : montant du règlement 
+ datePaiement : date du règlement 
+ refTransaction : référence de la transaction 
+ numInvoices : liste des numéros de factures réglées 
+ Retourne le numéro du règlement 
+
+ ----------------------------------- 
+ Attention : Le numéro ou le nom/prénom de la personne doivent être fournis </wsdl:documentation>
+      <wsdl:input message="tns:payInvoices" name="payInvoices">
+    </wsdl:input>
+      <wsdl:output message="tns:payInvoicesResponse" name="payInvoicesResponse">
+    </wsdl:output>
+      <wsdl:fault message="tns:MaelisAccountException" name="MaelisAccountException">
+    </wsdl:fault>
+    </wsdl:operation>
+    <wsdl:operation name="getDirectDebitOrder">
+<wsdl:documentation> Lecture des informations relatives à l'autorisation de prélèvement en cours à la date de référence 
+ 
+
+ ------------------------
+ dossierNumber: numéro de dossier
+ numPerson: numéro MAELIS de la personne 
+ codeRegie : code de la régie 
+ dateRef: date de référence 
+
+ ---------------------------</wsdl:documentation>
+      <wsdl:input message="tns:getDirectDebitOrder" name="getDirectDebitOrder">
+    </wsdl:input>
+      <wsdl:output message="tns:getDirectDebitOrderResponse" name="getDirectDebitOrderResponse">
+    </wsdl:output>
+      <wsdl:fault message="tns:MaelisAccountException" name="MaelisAccountException">
+    </wsdl:fault>
+    </wsdl:operation>
+    <wsdl:operation name="isWSRunning">
+<wsdl:documentation>Méthode pour vérifier 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:MaelisAccountException" name="MaelisAccountException">
+    </wsdl:fault>
+    </wsdl:operation>
+    <wsdl:operation name="addDirectDebitOrder">
+<wsdl:documentation> Service d'ajout d'autorisation de prélèvement
+ 
+
+ ------------------------
+ dossierNumber : Numéro de dossier (numéro famille).
+ numPerson : numéro de la personne titulaire
+ bank : personBankBean coordonnées du compte à débiter (coordonnées bancaires)
+ codeRegie : code de la régie 
+
+ ---------------------------
+ Plusieurs cas peuvent se produire :
+ _	S'il les références bancaires correspondant à la demande n'existent pas, création de références bancaires avec le top de prélèvement dont la date de début correspond à la date d'effet. 
+ _	S'il existe des références bancaires différentes de celles de la demande pour la personne ou pour l'autre responsable de la famille, elles sont clôturées à la date d'effet - 1 jour
+ _	S'il existe des références bancaires correspondant à la demande 
+	*	Si le top de prélèvement automatique est déjà positionné, aucun traitement n'est effectué.
+	*	Si le top de prélèvement automatique n'est pas positionné :
+		-	Si la RUM n'est pas fournie : Création de nouvelles références bancaires avec le top de prélèvement positionné dont la date de début correspond à la date d'effet avec génération de la RUM. La date de signature du mandat est la date d'effet. Si la RUM est fournie : L'enregistrer
+		-	Clôture des références « sans prélèvement » à la date d'effet - 1 jour 
+		</wsdl:documentation>
+      <wsdl:input message="tns:addDirectDebitOrder" name="addDirectDebitOrder">
+    </wsdl:input>
+      <wsdl:output message="tns:addDirectDebitOrderResponse" name="addDirectDebitOrderResponse">
+    </wsdl:output>
+      <wsdl:fault message="tns:MaelisAccountException" name="MaelisAccountException">
+    </wsdl:fault>
+    </wsdl:operation>
+    <wsdl:operation name="readInvoices">
+<wsdl:documentation>Récupération de toutes les factures de la famille, pour la régie et la plage de dates. 
+
+ ----------------------------------- 
+ numDossier : numéro de la famille
+ codeRegie : code de la régie
+ dateStart : date de début des factures à récupérer
+ dateEnd : date de fin des factures à récupérer
+ Retourne la liste des factures</wsdl:documentation>
+      <wsdl:input message="tns:readInvoices" name="readInvoices">
+    </wsdl:input>
+      <wsdl:output message="tns:readInvoicesResponse" name="readInvoicesResponse">
+    </wsdl:output>
+      <wsdl:fault message="tns:MaelisAccountException" name="MaelisAccountException">
+    </wsdl:fault>
+    </wsdl:operation>
+  </wsdl:portType>
+  <wsdl:binding name="InvoiceServiceSoapBinding" type="tns:InvoiceService">
+    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+    <wsdl:operation name="payInvoices">
+      <soap:operation soapAction="" style="document"/>
+      <wsdl:input name="payInvoices">
+        <soap:body use="literal"/>
+      </wsdl:input>
+      <wsdl:output name="payInvoicesResponse">
+        <soap:body use="literal"/>
+      </wsdl:output>
+      <wsdl:fault name="MaelisAccountException">
+        <soap:fault name="MaelisAccountException" use="literal"/>
+      </wsdl:fault>
+    </wsdl:operation>
+    <wsdl:operation name="getDirectDebitOrder">
+      <soap:operation soapAction="" style="document"/>
+      <wsdl:input name="getDirectDebitOrder">
+        <soap:body use="literal"/>
+      </wsdl:input>
+      <wsdl:output name="getDirectDebitOrderResponse">
+        <soap:body use="literal"/>
+      </wsdl:output>
+      <wsdl:fault name="MaelisAccountException">
+        <soap:fault name="MaelisAccountException" 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="MaelisAccountException">
+        <soap:fault name="MaelisAccountException" use="literal"/>
+      </wsdl:fault>
+    </wsdl:operation>
+    <wsdl:operation name="addDirectDebitOrder">
+      <soap:operation soapAction="" style="document"/>
+      <wsdl:input name="addDirectDebitOrder">
+        <soap:body use="literal"/>
+      </wsdl:input>
+      <wsdl:output name="addDirectDebitOrderResponse">
+        <soap:body use="literal"/>
+      </wsdl:output>
+      <wsdl:fault name="MaelisAccountException">
+        <soap:fault name="MaelisAccountException" use="literal"/>
+      </wsdl:fault>
+    </wsdl:operation>
+    <wsdl:operation name="readInvoices">
+      <soap:operation soapAction="" style="document"/>
+      <wsdl:input name="readInvoices">
+        <soap:body use="literal"/>
+      </wsdl:input>
+      <wsdl:output name="readInvoicesResponse">
+        <soap:body use="literal"/>
+      </wsdl:output>
+      <wsdl:fault name="MaelisAccountException">
+        <soap:fault name="MaelisAccountException" use="literal"/>
+      </wsdl:fault>
+    </wsdl:operation>
+  </wsdl:binding>
+  <wsdl:service name="InvoiceService">
+    <wsdl:port binding="tns:InvoiceServiceSoapBinding" name="InvoiceServiceImplPort">
+      <soap:address location="https://demo-toulouse.sigec.fr/maelisws-toulouse/services/InvoiceService"/>
+    </wsdl:port>
+  </wsdl:service>
+</wsdl:definitions>
\ No newline at end of file
diff --git a/tests/test_toulouse_maelis.py b/tests/test_toulouse_maelis.py
index c7afee71..63baa9ff 100644
--- a/tests/test_toulouse_maelis.py
+++ b/tests/test_toulouse_maelis.py
@@ -33,16 +33,17 @@ TEST_BASE_DIR = os.path.join(os.path.dirname(__file__), 'data', 'toulouse_maelis
 def get_xml_file(filename):
     with open(os.path.join(TEST_BASE_DIR, filename), 'rb') as desc:
         return desc.read()
 
 
 CONNECTION_ERROR = ConnectionError('No address associated with hostname')
 FAMILY_SERVICE_WSDL = FakedResponse(content=get_xml_file('FamilyService.wsdl'), status_code=200)
 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)
 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)
 READ_FAMILY = FakedResponse(content=get_xml_file('R_read_family.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)
 READ_CSP = FakedResponse(content=get_xml_file('R_read_csp_list.xml'), status_code=200)
 READ_DIETCODE = FakedResponse(content=get_xml_file('R_read_dietcode_list.xml'), status_code=200)
@@ -126,20 +127,36 @@ def test_call(mocked_post, mocked_get, con):
     mocked_post.side_effect = [ISWSRUNNING_TRUE]
     resp = con.call('Family', 'isWSRunning')
     assert resp is True
 
 
 @pytest.mark.parametrize(
     'get_responses, post_responses, exception',
     [
-        ([FAMILY_SERVICE_WSDL, ACTIVITY_SERVICE_WSDL], [ISWSRUNNING_TRUE, ISWSRUNNING_TRUE], None),
-        ([FAMILY_SERVICE_WSDL, CONNECTION_ERROR], [ISWSRUNNING_TRUE, ISWSRUNNING_TRUE], SOAPError),
-        ([FAMILY_SERVICE_WSDL, ACTIVITY_SERVICE_WSDL], [ISWSRUNNING_TRUE, FAILED_AUTH], APIError),
-        ([FAMILY_SERVICE_WSDL, ACTIVITY_SERVICE_WSDL], [ISWSRUNNING_TRUE, ISWSRUNNING_FALSE], AssertionError),
+        (
+            [FAMILY_SERVICE_WSDL, ACTIVITY_SERVICE_WSDL, INVOICE_SERVICE_WSDL],
+            [ISWSRUNNING_TRUE, ISWSRUNNING_TRUE, ISWSRUNNING_TRUE],
+            None,
+        ),
+        (
+            [FAMILY_SERVICE_WSDL, ACTIVITY_SERVICE_WSDL, CONNECTION_ERROR],
+            [ISWSRUNNING_TRUE, ISWSRUNNING_TRUE, ISWSRUNNING_TRUE],
+            SOAPError,
+        ),
+        (
+            [FAMILY_SERVICE_WSDL, ACTIVITY_SERVICE_WSDL, INVOICE_SERVICE_WSDL],
+            [ISWSRUNNING_TRUE, ISWSRUNNING_TRUE, FAILED_AUTH],
+            APIError,
+        ),
+        (
+            [FAMILY_SERVICE_WSDL, ACTIVITY_SERVICE_WSDL, INVOICE_SERVICE_WSDL],
+            [ISWSRUNNING_TRUE, ISWSRUNNING_TRUE, ISWSRUNNING_FALSE],
+            AssertionError,
+        ),
     ],
 )
 @mock.patch('passerelle.utils.Request.get')
 @mock.patch('passerelle.utils.Request.post')
 def test_check_status(mocked_post, mocked_get, get_responses, post_responses, exception, con):
     mocked_get.side_effect = get_responses
     mocked_post.side_effect = post_responses
     if exception:
-- 
2.30.2

