From c06572e914d26ede4f7f55891df20b11ebc7472f Mon Sep 17 00:00:00 2001
From: Nicolas ROCHE <nroche@entrouvert.com>
Date: Thu, 17 Nov 2022 08:13:04 +0100
Subject: [PATCH] toulouse-maelis: auth persons no more managed on family
 (#71388)

---
 passerelle/contrib/toulouse_maelis/schemas.py | 10 ---
 tests/data/toulouse_maelis/FamilyService.wsdl | 63 -------------------
 tests/data/toulouse_maelis/R_read_family.xml  | 10 ---
 .../toulouse_maelis/R_read_family_relax.xml   | 10 ---
 .../R_read_family_reordered.xml               | 10 ---
 tests/test_toulouse_maelis.py                 |  1 -
 6 files changed, 104 deletions(-)

diff --git a/passerelle/contrib/toulouse_maelis/schemas.py b/passerelle/contrib/toulouse_maelis/schemas.py
index a75332e2..75bc8288 100644
--- a/passerelle/contrib/toulouse_maelis/schemas.py
+++ b/passerelle/contrib/toulouse_maelis/schemas.py
@@ -495,25 +495,16 @@ UPDATE_FAMILY_SCHEMA = {
             'oneOf': [{'type': 'string'}, {'type': 'null'}],
         },
         'nbAES': {
             'description': "Nombre d'AES",
             'oneOf': [{'type': 'string'}, {'type': 'null'}],
         },
         'rl1': RLINFO_SCHEMA,
         'rl2': RLINFO_SCHEMA,
-        'authorizedPersonList': {
-            'oneOf': [
-                {
-                    'type': 'array',
-                    'items': AUTHORIZEDPERSON_SCHEMA,
-                },
-                {'type': 'null'},
-            ],
-        },
         'emergencyPersonList': {
             'oneOf': [
                 {
                     'type': 'array',
                     'items': AUTHORIZEDPERSON_SCHEMA,
                 },
                 {'type': 'null'},
             ],
@@ -536,17 +527,16 @@ CREATE_FAMILY_SCHEMA = copy.deepcopy(UPDATE_FAMILY_SCHEMA)
 CREATE_FAMILY_SCHEMA['required'] = ['rl1', 'categorie', 'situation']
 create_family_child_schema = CREATE_FAMILY_SCHEMA['properties']['childList']['oneOf'][0]['items']
 del create_family_child_schema['properties']['bPhoto']
 del create_family_child_schema['properties']['bLeaveAlone']
 del create_family_child_schema['properties']['paiInfoBean']
 
 CREATE_RL1_SCHEMA = copy.deepcopy(CREATE_FAMILY_SCHEMA)
 del CREATE_RL1_SCHEMA['properties']['rl2']
-del CREATE_RL1_SCHEMA['properties']['authorizedPersonList']
 del CREATE_RL1_SCHEMA['properties']['emergencyPersonList']
 del CREATE_RL1_SCHEMA['properties']['childList']
 del CREATE_RL1_SCHEMA['properties']['rl1']['properties']['contact']
 del CREATE_RL1_SCHEMA['properties']['rl1']['properties']['profession']
 del CREATE_RL1_SCHEMA['properties']['rl1']['properties']['CAFInfo']
 
 UPDATE_RL1_SCHEMA = copy.deepcopy(RLINFO_SCHEMA)
 UPDATE_RL1_SCHEMA['required'] = ['firstname', 'lastname', 'civility', 'quality', 'dateBirth']
diff --git a/tests/data/toulouse_maelis/FamilyService.wsdl b/tests/data/toulouse_maelis/FamilyService.wsdl
index e44374b8..4e9d5a75 100644
--- a/tests/data/toulouse_maelis/FamilyService.wsdl
+++ b/tests/data/toulouse_maelis/FamilyService.wsdl
@@ -64,18 +64,16 @@
   <xs:element name="updateChildIndicatorsResponse" type="tns:updateChildIndicatorsResponse"/>
   <xs:element name="updateChildMedicalRecord" type="tns:updateChildMedicalRecord"/>
   <xs:element name="updateChildMedicalRecordResponse" type="tns:updateChildMedicalRecordResponse"/>
   <xs:element name="updateChildPAI" type="tns:updateChildPAI"/>
   <xs:element name="updateChildPAIResponse" type="tns:updateChildPAIResponse"/>
   <xs:element name="updateCoordinate" type="tns:updateCoordinate"/>
   <xs:element name="updateCoordinateResponse" type="tns:updateCoordinateResponse"/>
   <xs:element name="updateFamily" type="tns:updateFamily"/>
-  <xs:element name="updateFamilyAuthorizedPersonList" type="tns:updateFamilyAuthorizedPersonList"/>
-  <xs:element name="updateFamilyAuthorizedPersonListResponse" type="tns:updateFamilyAuthorizedPersonListResponse"/>
   <xs:element name="updateFamilyEmergencyPersonList" type="tns:updateFamilyEmergencyPersonList"/>
   <xs:element name="updateFamilyEmergencyPersonListResponse" type="tns:updateFamilyEmergencyPersonListResponse"/>
   <xs:element name="updateFamilyResponse" type="tns:updateFamilyResponse"/>
   <xs:element name="updateFamilySituation" type="tns:updateFamilySituation"/>
   <xs:element name="updateFamilySituationResponse" type="tns:updateFamilySituationResponse"/>
   <xs:complexType name="deletesubscribe">
     <xs:sequence>
       <xs:element name="numPerson" type="xs:int"/>
@@ -151,17 +149,16 @@
       <xs:element minOccurs="0" name="flagCom" type="xs:boolean"/>
       <xs:element minOccurs="0" name="nbChild" type="xs:int"/>
       <xs:element minOccurs="0" name="nbTotalChild" type="xs:int"/>
       <xs:element minOccurs="0" name="nbAES" type="xs:string"/>
       <xs:element minOccurs="0" name="RL1" type="tns:rlInfoBean"/>
       <xs:element minOccurs="0" name="RL2" type="tns:rlInfoBean"/>
       <xs:element maxOccurs="unbounded" minOccurs="0" name="quotientList" nillable="true" type="ns1:familyQuotientBean"/>
       <xs:element maxOccurs="unbounded" minOccurs="0" name="emergencyPersonList" nillable="true" type="ns1:emergencyPersonBean"/>
-      <xs:element maxOccurs="unbounded" minOccurs="0" name="authorizedPersonList" nillable="true" type="ns1:familyPersonBean"/>
       <xs:element maxOccurs="unbounded" minOccurs="0" name="childList" nillable="true" type="ns1:childInfoBean"/>
       <xs:element maxOccurs="unbounded" minOccurs="0" name="indicatorList" nillable="true" type="ns1:indicatorValueBean"/>
       <xs:element maxOccurs="unbounded" minOccurs="0" name="childErrorList" nillable="true" type="xs:string"/>
     </xs:sequence>
   </xs:complexType>
   <xs:complexType name="rlInfoBean">
     <xs:sequence>
       <xs:element minOccurs="0" name="num" type="xs:string"/>
@@ -366,30 +363,20 @@
       <xs:element minOccurs="0" name="flagCom" type="xs:boolean"/>
       <xs:element minOccurs="0" name="nbChild" type="xs:int"/>
       <xs:element minOccurs="0" name="nbTotalChild" type="xs:int"/>
       <xs:element minOccurs="0" name="nbAES" type="xs:int"/>
       <xs:element minOccurs="0" name="rl1" type="tns:rlInfoBean"/>
       <xs:element minOccurs="0" name="rl2" type="tns:rlInfoBean"/>
       <xs:element maxOccurs="unbounded" minOccurs="0" name="childList" type="ns1:childInfoBean"/>
       <xs:element minOccurs="0" name="isForceCreateChild" type="xs:boolean"/>
-      <xs:element minOccurs="0" name="authorizedPersonList" type="tns:authorizedPersonListBean"/>
       <xs:element maxOccurs="unbounded" minOccurs="0" name="indicatorList" type="ns1:indicatorValueUpdBean"/>
       <xs:element minOccurs="0" name="emergencyPersonList" type="ns1:emergencyPersonListBean"/>
     </xs:sequence>
   </xs:complexType>
-  <xs:complexType name="authorizedPersonListBean">
-    <xs:complexContent>
-      <xs:extension base="tns:abstractSpecRequestBean">
-        <xs:sequence>
-          <xs:element maxOccurs="unbounded" minOccurs="0" name="personList" nillable="true" type="ns1:familyPersonBean"/>
-        </xs:sequence>
-      </xs:extension>
-    </xs:complexContent>
-  </xs:complexType>
   <xs:complexType name="updateFamilyResponse">
     <xs:sequence>
       <xs:element minOccurs="0" name="familyResult" type="tns:familyBean"/>
     </xs:sequence>
   </xs:complexType>
   <xs:complexType name="createUpdateQuotient">
     <xs:sequence>
       <xs:element name="dossierNumber" type="xs:int"/>
@@ -522,17 +509,16 @@
       <xs:element minOccurs="0" name="flagCom" type="xs:boolean"/>
       <xs:element minOccurs="0" name="nbChild" type="xs:int"/>
       <xs:element minOccurs="0" name="nbTotalChild" type="xs:int"/>
       <xs:element minOccurs="0" name="nbAES" type="xs:int"/>
       <xs:element name="rl1" type="tns:rlInfoBean"/>
       <xs:element minOccurs="0" name="rl2" type="tns:rlInfoBean"/>
       <xs:element maxOccurs="unbounded" minOccurs="0" name="childList" type="ns1:childBean"/>
       <xs:element minOccurs="0" name="isForceCreateChild" type="xs:boolean"/>
-      <xs:element maxOccurs="unbounded" minOccurs="0" name="authorizedPersonList" type="ns1:familyPersonBean"/>
       <xs:element maxOccurs="unbounded" minOccurs="0" name="indicatorList" type="ns1:indicatorValueAddBean"/>
       <xs:element maxOccurs="unbounded" minOccurs="0" name="emergencyPersonList" type="ns1:emergencyPersonBean"/>
     </xs:sequence>
   </xs:complexType>
   <xs:complexType name="createFamilyResponse">
     <xs:sequence>
       <xs:element minOccurs="0" name="createFamilyResult" type="ns1:resultFamilyBean"/>
     </xs:sequence>
@@ -548,25 +534,16 @@
   <xs:complexType name="readPAIList">
     <xs:sequence/>
   </xs:complexType>
   <xs:complexType name="readPAIListResponse">
     <xs:sequence>
       <xs:element maxOccurs="unbounded" minOccurs="0" name="itemList" type="ns2:itemBean"/>
     </xs:sequence>
   </xs:complexType>
-  <xs:complexType name="updateFamilyAuthorizedPersonList">
-    <xs:sequence>
-      <xs:element name="numDossier" type="xs:int"/>
-      <xs:element name="authorizedPersonList" type="tns:authorizedPersonListBean"/>
-    </xs:sequence>
-  </xs:complexType>
-  <xs:complexType name="updateFamilyAuthorizedPersonListResponse">
-    <xs:sequence/>
-  </xs:complexType>
   <xs:complexType name="readCategoryList">
     <xs:sequence/>
   </xs:complexType>
   <xs:complexType name="readCategoryListResponse">
     <xs:sequence>
       <xs:element maxOccurs="unbounded" minOccurs="0" name="itemList" type="ns2:itemBean"/>
     </xs:sequence>
   </xs:complexType>
@@ -1289,20 +1266,16 @@
   <wsdl:message name="readStreetListResponse">
     <wsdl:part element="tns:readStreetListResponse" name="parameters">
     </wsdl:part>
   </wsdl:message>
   <wsdl:message name="readPAIList">
     <wsdl:part element="tns:readPAIList" name="parameters">
     </wsdl:part>
   </wsdl:message>
-  <wsdl:message name="updateFamilyAuthorizedPersonList">
-    <wsdl:part element="tns:updateFamilyAuthorizedPersonList" name="parameters">
-    </wsdl:part>
-  </wsdl:message>
   <wsdl:message name="updateChildIndicatorsResponse">
     <wsdl:part element="tns:updateChildIndicatorsResponse" name="parameters">
     </wsdl:part>
   </wsdl:message>
   <wsdl:message name="readPAIListResponse">
     <wsdl:part element="tns:readPAIListResponse" name="parameters">
     </wsdl:part>
   </wsdl:message>
@@ -1445,20 +1418,16 @@
   <wsdl:message name="isWSRunningResponse">
     <wsdl:part element="tns:isWSRunningResponse" name="parameters">
     </wsdl:part>
   </wsdl:message>
   <wsdl:message name="readVaccinList">
     <wsdl:part element="tns:readVaccinList" name="parameters">
     </wsdl:part>
   </wsdl:message>
-  <wsdl:message name="updateFamilyAuthorizedPersonListResponse">
-    <wsdl:part element="tns:updateFamilyAuthorizedPersonListResponse" name="parameters">
-    </wsdl:part>
-  </wsdl:message>
   <wsdl:message name="readCategoryList">
     <wsdl:part element="tns:readCategoryList" name="parameters">
     </wsdl:part>
   </wsdl:message>
   <wsdl:message name="readFamilyByPassword">
     <wsdl:part element="tns:readFamilyByPassword" name="parameters">
     </wsdl:part>
   </wsdl:message>
@@ -1773,17 +1742,16 @@ Cette méthode permet de mettre à jour les informations relatives au FSL pour u
  flagCom : code/hors commune 
  nbChild : nombre d'enfants à charge max 99
  nbTotalChild : nombre d'enfants  max 99
  nbAES : nombre d'AES max 99
  rl1 : responsable légal 1 (facultatif) 
  rl2 : résponsable légal 2 (facultatif)  
  childList : la liste des enfants (facultatif)
  isForceCreateChild : null ou false et doublon de RL1 ou d'enfant détecté
- authorizedPersonList : liste des personnes autorisées à récupérer les enfants  
  indicatorList : liste des indicateurs 
  emergencyPersonList : la liste des personnes à prévenir  
 
  ----------------------
  Traitement : 
  Le service modifie les données correspondant aux paramètres passés dans la requête :
  -	Une donnée non renseignée (paramètre non présent) n'est pas mise à jour
  -	Une donnée vide (paramètre présent mais chaine vide) efface la donnée 
@@ -2128,17 +2096,16 @@ Cette méthode permet de mettre à jour les informations relatives au PAI pour u
  flagCom : code/hors commune 
  nbChild : nombre d'enfants à charge max 99
  nbTotalChild : nombre d'enfants  max 99
  nbAES : nombre d'AES max 99
  rl1 : responsable légal 1 (obligatoire)
  rl2 : résponsable légal 2 (facultatif)  
  childList : la liste des enfants 
  isForceCreateChild : null ou false et doublon de RL1 ou d'enfant détecté
- authorizedPersonList : liste des personnes autorisées à récupérer les enfants  
  indicatorList : liste des indicateurs 
  emergencyPersonList : la liste des personnes à prévenir  
  Retourne le dossier famille
 
  -------------------------
  Traitement : 
  Un traitement de recherche de doublon est fait pour la création du RL1 et des enfants.
  Pour le RL1, lorsque la date de naissance est fournie, on recherche si on trouve une personne de type RL1 ou RL2 qui existe avec les mêmes nom, prénom et date de naissance.
@@ -2196,34 +2163,16 @@ Cette méthode permet de mettre à jour les informations relatives au PAI pour u
  Retourne la liste des code valeur pour les PAI</wsdl:documentation>
       <wsdl:input message="tns:readPAIList" name="readPAIList">
     </wsdl:input>
       <wsdl:output message="tns:readPAIListResponse" name="readPAIListResponse">
     </wsdl:output>
       <wsdl:fault message="tns:MaelisFamilyException" name="MaelisFamilyException">
     </wsdl:fault>
     </wsdl:operation>
-    <wsdl:operation name="updateFamilyAuthorizedPersonList">
-<wsdl:documentation>Méthode de mise à jour de la liste des personnes autorisées sur la famille
- La liste comporte toutes les personnes autorisées. 
- Les personnes non présentes dans cette liste sont supprimées en tant que personne autorisée.
- Déprécié : il faut utiliser la méthode updateChildAutorization car nouvelle gestion par enfant (famille recomposée)  
-
- ------------------------------
- numDossier : numéro de dossier famille  (obligatoire)
- authorizedPersonList : liste des personnes autorisées
-
- -----------------------------</wsdl:documentation>
-      <wsdl:input message="tns:updateFamilyAuthorizedPersonList" name="updateFamilyAuthorizedPersonList">
-    </wsdl:input>
-      <wsdl:output message="tns:updateFamilyAuthorizedPersonListResponse" name="updateFamilyAuthorizedPersonListResponse">
-    </wsdl:output>
-      <wsdl:fault message="tns:MaelisFamilyException" name="MaelisFamilyException">
-    </wsdl:fault>
-    </wsdl:operation>
     <wsdl:operation name="readCategoryList">
 <wsdl:documentation>Méthodes de lecture du paramétrage de référence
  La liste des catégories 
 
  -------------------------
  Retourne la liste des code valeur pour les catégories</wsdl:documentation>
       <wsdl:input message="tns:readCategoryList" name="readCategoryList">
     </wsdl:input>
@@ -2652,28 +2601,16 @@ Cette méthode permet de mettre à jour les informations relatives au PAI pour u
       </wsdl:input>
       <wsdl:output name="readPAIListResponse">
         <soap:body use="literal"/>
       </wsdl:output>
       <wsdl:fault name="MaelisFamilyException">
         <soap:fault name="MaelisFamilyException" use="literal"/>
       </wsdl:fault>
     </wsdl:operation>
-    <wsdl:operation name="updateFamilyAuthorizedPersonList">
-      <soap:operation soapAction="" style="document"/>
-      <wsdl:input name="updateFamilyAuthorizedPersonList">
-        <soap:body use="literal"/>
-      </wsdl:input>
-      <wsdl:output name="updateFamilyAuthorizedPersonListResponse">
-        <soap:body use="literal"/>
-      </wsdl:output>
-      <wsdl:fault name="MaelisFamilyException">
-        <soap:fault name="MaelisFamilyException" use="literal"/>
-      </wsdl:fault>
-    </wsdl:operation>
     <wsdl:operation name="readCategoryList">
       <soap:operation soapAction="" style="document"/>
       <wsdl:input name="readCategoryList">
         <soap:body use="literal"/>
       </wsdl:input>
       <wsdl:output name="readCategoryListResponse">
         <soap:body use="literal"/>
       </wsdl:output>
diff --git a/tests/data/toulouse_maelis/R_read_family.xml b/tests/data/toulouse_maelis/R_read_family.xml
index 20a6dd00..669d20c9 100644
--- a/tests/data/toulouse_maelis/R_read_family.xml
+++ b/tests/data/toulouse_maelis/R_read_family.xml
@@ -73,26 +73,16 @@
           <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>
diff --git a/tests/data/toulouse_maelis/R_read_family_relax.xml b/tests/data/toulouse_maelis/R_read_family_relax.xml
index 1ace41f1..91102dfa 100644
--- a/tests/data/toulouse_maelis/R_read_family_relax.xml
+++ b/tests/data/toulouse_maelis/R_read_family_relax.xml
@@ -72,26 +72,16 @@
           <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>
diff --git a/tests/data/toulouse_maelis/R_read_family_reordered.xml b/tests/data/toulouse_maelis/R_read_family_reordered.xml
index f1eb3bb3..ddcd4211 100644
--- a/tests/data/toulouse_maelis/R_read_family_reordered.xml
+++ b/tests/data/toulouse_maelis/R_read_family_reordered.xml
@@ -73,26 +73,16 @@
           <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>
diff --git a/tests/test_toulouse_maelis.py b/tests/test_toulouse_maelis.py
index f0dd39f3..6e4a54f6 100644
--- a/tests/test_toulouse_maelis.py
+++ b/tests/test_toulouse_maelis.py
@@ -558,17 +558,16 @@ def test_read_family(mocked_post, mocked_get, read_family, con, app):
     Link.objects.create(resource=con, family_id='1312', name_id='local')
 
     resp = app.get(url + '?NameID=local')
     assert resp.json['err'] == 0
     data = resp.json['data']
     del data['RL1']
     del data['RL2']
     del data['childList']
-    del data['authorizedPersonList']
     del data['emergencyPersonList']
     assert data == {
         'number': 1312,
         'category': 'BI',
         'situation': 'M',
         'flagCom': True,
         'nbChild': 2,
         'nbTotalChild': None,
-- 
2.30.2

