From d3dc6ef6fe2dc1a777688424237f473285b54e42 Mon Sep 17 00:00:00 2001
From: Nicolas ROCHE <nroche@entrouvert.com>
Date: Tue, 20 Dec 2022 15:46:24 +0100
Subject: [PATCH 2/3] toulouse-maelis: add document referential (#72532)

---
 .../data/test_read_document_list.json         | 359 ++++++++++++++++++
 functests/toulouse_maelis/test_data.py        |   1 +
 passerelle/contrib/toulouse_maelis/models.py  |  18 +-
 .../toulouse_maelis/R_read_document_list.xml  | 261 +++++++++++++
 tests/test_toulouse_maelis.py                 |  37 +-
 5 files changed, 674 insertions(+), 2 deletions(-)
 create mode 100644 functests/toulouse_maelis/data/test_read_document_list.json
 create mode 100644 tests/data/toulouse_maelis/R_read_document_list.xml

diff --git a/functests/toulouse_maelis/data/test_read_document_list.json b/functests/toulouse_maelis/data/test_read_document_list.json
new file mode 100644
index 00000000..70ee2409
--- /dev/null
+++ b/functests/toulouse_maelis/data/test_read_document_list.json
@@ -0,0 +1,359 @@
+[
+  {
+    "id": "43",
+    "code": "43",
+    "rang": "FAMILY",
+    "text": "Acte notari\u00e9 de divorce",
+    "label": "Acte notari\u00e9 de divorce"
+  },
+  {
+    "id": "44",
+    "code": "44",
+    "rang": "PERSON",
+    "text": "Attestation aide m\u00e9dicale de l'\u00e9tat CPAM",
+    "label": "Attestation aide m\u00e9dicale de l'\u00e9tat CPAM"
+  },
+  {
+    "id": "45",
+    "code": "45",
+    "rang": "FAMILY",
+    "text": "Attestation CAF",
+    "label": "Attestation CAF"
+  },
+  {
+    "id": "46",
+    "code": "46",
+    "rang": "FAMILY",
+    "text": "Attestation CD31",
+    "label": "Attestation CD31"
+  },
+  {
+    "id": "47",
+    "code": "47",
+    "rang": "FAMILY",
+    "text": "Attestation d'attribution ou non de bourse",
+    "label": "Attestation d'attribution ou non de bourse"
+  },
+  {
+    "id": "49",
+    "code": "49",
+    "rang": "FAMILY",
+    "text": "Attestation de paiement Office fran\u00e7ais de l'immigration et int\u00e9gration",
+    "label": "Attestation de paiement Office fran\u00e7ais de l'immigration et int\u00e9gration"
+  },
+  {
+    "id": "50",
+    "code": "50",
+    "rang": "FAMILY",
+    "text": "Attestation de paiement P\u00f4le emploi",
+    "label": "Attestation de paiement P\u00f4le emploi"
+  },
+  {
+    "id": "81",
+    "code": "81",
+    "rang": "FAMILY",
+    "text": "Attestation d'h\u00e9bergement d'une personne physique",
+    "label": "Attestation d'h\u00e9bergement d'une personne physique"
+  },
+  {
+    "id": "55",
+    "code": "55",
+    "rang": "FAMILY",
+    "text": "Attestation d'inscription au registre du Commerce et des M\u00e9tiers - Kbis",
+    "label": "Attestation d'inscription au registre du Commerce et des M\u00e9tiers - Kbis"
+  },
+  {
+    "id": "52",
+    "code": "52",
+    "rang": "FAMILY",
+    "text": "Attestation h\u00e9bergement organismes tiers",
+    "label": "Attestation h\u00e9bergement organismes tiers"
+  },
+  {
+    "id": "53",
+    "code": "53",
+    "rang": "FAMILY",
+    "text": "Attestation indemn. arr\u00eat maladie CPAM",
+    "label": "Attestation indemn. arr\u00eat maladie CPAM"
+  },
+  {
+    "id": "54",
+    "code": "54",
+    "rang": "FAMILY",
+    "text": "Attestation indemn. P\u00f4le emploi",
+    "label": "Attestation indemn. P\u00f4le emploi"
+  },
+  {
+    "id": "56",
+    "code": "56",
+    "rang": "FAMILY",
+    "text": "Attestation organismes associatifs",
+    "label": "Attestation organismes associatifs"
+  },
+  {
+    "id": "48",
+    "code": "48",
+    "rang": "FAMILY",
+    "text": "Attestation paiement CPAM",
+    "label": "Attestation paiement CPAM"
+  },
+  {
+    "id": "51",
+    "code": "51",
+    "rang": "FAMILY",
+    "text": "Attestation prise en charge Maison d'enfants",
+    "label": "Attestation prise en charge Maison d'enfants"
+  },
+  {
+    "id": "83",
+    "code": "83",
+    "rang": "PERSON",
+    "text": "Attestation responsabilit\u00e9 civile",
+    "label": "Attestation responsabilit\u00e9 civile"
+  },
+  {
+    "id": "57",
+    "code": "57",
+    "rang": "FAMILY",
+    "text": "Attestation travailleur social",
+    "label": "Attestation travailleur social"
+  },
+  {
+    "id": "69",
+    "code": "69",
+    "rang": "PERSON",
+    "text": "Autorisation de sortie du territoire",
+    "label": "Autorisation de sortie du territoire"
+  },
+  {
+    "id": "42",
+    "code": "42",
+    "rang": "PERSON",
+    "text": "Autre document utile \u00e0 la d\u00e9rogation",
+    "label": "Autre document utile \u00e0 la d\u00e9rogation"
+  },
+  {
+    "id": "58",
+    "code": "58",
+    "rang": "FAMILY",
+    "text": "Avis d'imposition / non imposition",
+    "label": "Avis d'imposition / non imposition"
+  },
+  {
+    "id": "59",
+    "code": "59",
+    "rang": "FAMILY",
+    "text": "Bilan comptable",
+    "label": "Bilan comptable"
+  },
+  {
+    "id": "60",
+    "code": "60",
+    "rang": "FAMILY",
+    "text": "Bulletin de salaire",
+    "label": "Bulletin de salaire"
+  },
+  {
+    "id": "61",
+    "code": "61",
+    "rang": "FAMILY",
+    "text": "Carte \u00e9tudiant",
+    "label": "Carte \u00e9tudiant"
+  },
+  {
+    "id": "68",
+    "code": "68",
+    "rang": "PERSON",
+    "text": "Carte mutuelle ou CMU",
+    "label": "Carte mutuelle ou CMU"
+  },
+  {
+    "id": "70",
+    "code": "70",
+    "rang": "PERSON",
+    "text": "Carte nationnale d'identit\u00e9",
+    "label": "Carte nationnale d'identit\u00e9"
+  },
+  {
+    "id": "71",
+    "code": "71",
+    "rang": "FAMILY",
+    "text": "Certificat de PACS",
+    "label": "Certificat de PACS"
+  },
+  {
+    "id": "73",
+    "code": "73",
+    "rang": "PERSON",
+    "text": "Certificat de scolarit\u00e9",
+    "label": "Certificat de scolarit\u00e9"
+  },
+  {
+    "id": "74",
+    "code": "74",
+    "rang": "PERSON",
+    "text": "Copie carte de s\u00e9jour",
+    "label": "Copie carte de s\u00e9jour"
+  },
+  {
+    "id": "38",
+    "code": "38",
+    "rang": "PERSON",
+    "text": "Copie pages de vaccination",
+    "label": "Copie pages de vaccination"
+  },
+  {
+    "id": "62",
+    "code": "62",
+    "rang": "PERSON",
+    "text": "Copie passeport",
+    "label": "Copie passeport"
+  },
+  {
+    "id": "75",
+    "code": "75",
+    "rang": "PERSON",
+    "text": "Courrier ou mail famille re\u00e7u",
+    "label": "Courrier ou mail famille re\u00e7u"
+  },
+  {
+    "id": "37",
+    "code": "37",
+    "rang": "FAMILY",
+    "text": "D\u00e9claration conjointe sign\u00e9e des parents",
+    "label": "D\u00e9claration conjointe sign\u00e9e des parents"
+  },
+  {
+    "id": "63",
+    "code": "63",
+    "rang": "FAMILY",
+    "text": "Document donn\u00e9es allocataire",
+    "label": "Document donn\u00e9es allocataire"
+  },
+  {
+    "id": "72",
+    "code": "72",
+    "rang": "FAMILY",
+    "text": "Extrait d'acte de mariage",
+    "label": "Extrait d'acte de mariage"
+  },
+  {
+    "id": "76",
+    "code": "76",
+    "rang": "PERSON",
+    "text": "Extrait de naissance",
+    "label": "Extrait de naissance"
+  },
+  {
+    "id": "77",
+    "code": "77",
+    "rang": "PERSON",
+    "text": "Fiche individuelle enfant version papier num\u00e9ris\u00e9",
+    "label": "Fiche individuelle enfant version papier num\u00e9ris\u00e9"
+  },
+  {
+    "id": "78",
+    "code": "78",
+    "rang": "PERSON",
+    "text": "Formulaire DUI version papier num\u00e9ris\u00e9",
+    "label": "Formulaire DUI version papier num\u00e9ris\u00e9"
+  },
+  {
+    "id": "64",
+    "code": "64",
+    "rang": "FAMILY",
+    "text": "Jugement des affaires familiales",
+    "label": "Jugement des affaires familiales"
+  },
+  {
+    "id": "65",
+    "code": "65",
+    "rang": "FAMILY",
+    "text": "Jugement mise sous tutelle",
+    "label": "Jugement mise sous tutelle"
+  },
+  {
+    "id": "35",
+    "code": "35",
+    "rang": "FAMILY",
+    "text": "Justificatif de domicile",
+    "label": "Justificatif de domicile"
+  },
+  {
+    "id": "82",
+    "code": "82",
+    "rang": "PERSON",
+    "text": "Justificatif officiel pr\u00e9cisant l'adresse de l'h\u00e9berg\u00e9",
+    "label": "Justificatif officiel pr\u00e9cisant l'adresse de l'h\u00e9berg\u00e9"
+  },
+  {
+    "id": "41",
+    "code": "41",
+    "rang": "PERSON",
+    "text": "Lettre justificative de la d\u00e9rogation",
+    "label": "Lettre justificative de la d\u00e9rogation"
+  },
+  {
+    "id": "36",
+    "code": "36",
+    "rang": "FAMILY",
+    "text": "Livret de famille",
+    "label": "Livret de famille"
+  },
+  {
+    "id": "84",
+    "code": "84",
+    "rang": "PERSON",
+    "text": "Notification MDPH",
+    "label": "Notification MDPH"
+  },
+  {
+    "id": "66",
+    "code": "66",
+    "rang": "PERSON",
+    "text": "Ordonnance",
+    "label": "Ordonnance"
+  },
+  {
+    "id": "86",
+    "code": "86",
+    "rang": "PERSON",
+    "text": "PAI",
+    "label": "PAI"
+  },
+  {
+    "id": "40",
+    "code": "40",
+    "rang": "PERSON",
+    "text": "PERI - Carte nationale d'identit\u00e9",
+    "label": "PERI - Carte nationale d'identit\u00e9"
+  },
+  {
+    "id": "67",
+    "code": "67",
+    "rang": "PERSON",
+    "text": "Photocopie attestation CPAM / CMU",
+    "label": "Photocopie attestation CPAM / CMU"
+  },
+  {
+    "id": "85",
+    "code": "85",
+    "rang": "PERSON",
+    "text": "Preuve carte s\u00e9nior",
+    "label": "Preuve carte s\u00e9nior"
+  },
+  {
+    "id": "80",
+    "code": "80",
+    "rang": "PERSON",
+    "text": "R\u00e9capitulatif donn\u00e9es sant\u00e9 autorisations enfant",
+    "label": "R\u00e9capitulatif donn\u00e9es sant\u00e9 autorisations enfant"
+  },
+  {
+    "id": "79",
+    "code": "79",
+    "rang": "PERSON",
+    "text": "R\u00e9capitulatif toutes d\u00e9marches li\u00e9e au DUI",
+    "label": "R\u00e9capitulatif toutes d\u00e9marches li\u00e9e au DUI"
+  }
+]
diff --git a/functests/toulouse_maelis/test_data.py b/functests/toulouse_maelis/test_data.py
index d6c757ff..ffabe34d 100644
--- a/functests/toulouse_maelis/test_data.py
+++ b/functests/toulouse_maelis/test_data.py
@@ -8,16 +8,17 @@ from .conftest import diff
     "ref",
     [
         'category',
         'child-indicator',
         'civility',
         'country',
         'csp',
         'dietcode',
+        'document',
         'organ',
         'pai',
         'quality',
         'quotient',
         'rl-indicator',
         'situation',
         'street',
         'vaccin',
diff --git a/passerelle/contrib/toulouse_maelis/models.py b/passerelle/contrib/toulouse_maelis/models.py
index 3de1db84..d6147fb3 100644
--- a/passerelle/contrib/toulouse_maelis/models.py
+++ b/passerelle/contrib/toulouse_maelis/models.py
@@ -98,17 +98,17 @@ class ToulouseMaelis(BaseResource, HTTPResource):
                 response = self.call('Family', 'read' + referential_name + 'List')
                 response = serialize_object(response)
             except Exception as e:
                 raise UpdateError('Service indisponible : %s' % str(e))
             if referential_name == 'Organ':
                 id_key, text_key = 'id', 'code'
             elif referential_name == 'Street':
                 id_key, text_key = 'idStreet', 'libelleStreet'
-            elif 'Indicator' in referential_name:
+            elif referential_name in ('RLIndicator', 'ChildIndicator', 'Document'):
                 id_key, text_key = 'code', 'label'
             else:
                 id_key, text_key = 'code', 'libelle'
 
         last_update = now()
         for item in response:
             text = item[text_key].strip()
             self.referential.update_or_create(
@@ -128,16 +128,17 @@ class ToulouseMaelis(BaseResource, HTTPResource):
         for name in (
             'Category',
             'ChildIndicator',
             'Civility',
             'Complement',
             'Country',
             'CSP',
             'DietCode',
+            'Document',
             'Organ',
             'PAI',
             'Quality',
             'Quotient',
             'RLIndicator',
             'Sex',
             'Situation',
             'Street',
@@ -576,16 +577,31 @@ class ToulouseMaelis(BaseResource, HTTPResource):
             'q': {'description': 'Recherche en texte intégral'},
             'limit': {'description': 'Nombre maximal de résultats; doit être inférieur à 20.'},
             'distinct': {'description': 'Supression des doublons'},
         },
     )
     def read_dietcode_list(self, request, id=None, q=None, limit=None, distinct=True):
         return {'data': self.get_referential('DietCode', id, q, limit, distinct)}
 
+    @endpoint(
+        display_category='Famille',
+        description='Liste des pièces jointes',
+        name='read-document-list',
+        perm='can_access',
+        parameters={
+            'id': {'description': 'Identifiant de l’enregistrement'},
+            'q': {'description': 'Recherche en texte intégral'},
+            'limit': {'description': 'Nombre maximal de résultats; doit être inférieur à 20.'},
+            'distinct': {'description': 'Supression des doublons'},
+        },
+    )
+    def read_document_list(self, request, id=None, q=None, limit=None, distinct=True):
+        return {'data': self.get_referential('Document', id, q, limit, distinct)}
+
     @endpoint(
         display_category='Famille',
         description='Liste des organismes (CAF)',
         name='read-organ-list',
         perm='can_access',
         parameters={
             'id': {'description': 'Identifiant de l’enregistrement'},
             'q': {'description': 'Recherche en texte intégral'},
diff --git a/tests/data/toulouse_maelis/R_read_document_list.xml b/tests/data/toulouse_maelis/R_read_document_list.xml
new file mode 100644
index 00000000..7078b984
--- /dev/null
+++ b/tests/data/toulouse_maelis/R_read_document_list.xml
@@ -0,0 +1,261 @@
+<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
+  <soap:Body>
+    <ns2:readDocumentListResponse xmlns:ns2="family.ws.maelis.sigec.com">
+      <documentList>
+        <code>69</code>
+        <label>Autorisation de sortie du territoire</label>
+        <rang>PERSON</rang>
+      </documentList>
+      <documentList>
+        <code>42</code>
+        <label>Autre document utile &#224; la d&#233;rogation</label>
+        <rang>PERSON</rang>
+      </documentList>
+      <documentList>
+        <code>38</code>
+        <label>Copie pages de vaccination</label>
+        <rang>PERSON</rang>
+      </documentList>
+      <documentList>
+        <code>41</code>
+        <label>Lettre justificative de la d&#233;rogation</label>
+        <rang>PERSON</rang>
+      </documentList>
+      <documentList>
+        <code>40</code>
+        <label>PERI - Carte nationale d'identit&#233;</label>
+        <rang>PERSON</rang>
+      </documentList>
+      <documentList>
+        <code>43</code>
+        <label>Acte notari&#233; de divorce</label>
+        <rang>FAMILY</rang>
+      </documentList>
+      <documentList>
+        <code>45</code>
+        <label>Attestation CAF</label>
+        <rang>FAMILY</rang>
+      </documentList>
+      <documentList>
+        <code>46</code>
+        <label>Attestation CD31</label>
+        <rang>FAMILY</rang>
+      </documentList>
+      <documentList>
+        <code>47</code>
+        <label>Attestation d'attribution ou non de bourse</label>
+        <rang>FAMILY</rang>
+      </documentList>
+      <documentList>
+        <code>49</code>
+        <label>Attestation de paiement Office fran&#231;ais de l'immigration et int&#233;gration</label>
+        <rang>FAMILY</rang>
+      </documentList>
+      <documentList>
+        <code>50</code>
+        <label>Attestation de paiement P&#244;le emploi</label>
+        <rang>FAMILY</rang>
+      </documentList>
+      <documentList>
+        <code>55</code>
+        <label>Attestation d'inscription au registre du Commerce et des M&#233;tiers - Kbis</label>
+        <rang>FAMILY</rang>
+      </documentList>
+      <documentList>
+        <code>52</code>
+        <label>Attestation h&#233;bergement organismes tiers</label>
+        <rang>FAMILY</rang>
+      </documentList>
+      <documentList>
+        <code>53</code>
+        <label>Attestation indemn. arr&#234;t maladie CPAM</label>
+        <rang>FAMILY</rang>
+      </documentList>
+      <documentList>
+        <code>54</code>
+        <label>Attestation indemn. P&#244;le emploi</label>
+        <rang>FAMILY</rang>
+      </documentList>
+      <documentList>
+        <code>56</code>
+        <label>Attestation organismes associatifs</label>
+        <rang>FAMILY</rang>
+      </documentList>
+      <documentList>
+        <code>48</code>
+        <label>Attestation paiement CPAM</label>
+        <rang>FAMILY</rang>
+      </documentList>
+      <documentList>
+        <code>51</code>
+        <label>Attestation prise en charge Maison d'enfants</label>
+        <rang>FAMILY</rang>
+      </documentList>
+      <documentList>
+        <code>57</code>
+        <label>Attestation travailleur social</label>
+        <rang>FAMILY</rang>
+      </documentList>
+      <documentList>
+        <code>58</code>
+        <label>Avis d'imposition / non imposition</label>
+        <rang>FAMILY</rang>
+      </documentList>
+      <documentList>
+        <code>59</code>
+        <label>Bilan comptable</label>
+        <rang>FAMILY</rang>
+      </documentList>
+      <documentList>
+        <code>60</code>
+        <label>Bulletin de salaire</label>
+        <rang>FAMILY</rang>
+      </documentList>
+      <documentList>
+        <code>61</code>
+        <label>Carte &#233;tudiant</label>
+        <rang>FAMILY</rang>
+      </documentList>
+      <documentList>
+        <code>37</code>
+        <label>D&#233;claration conjointe sign&#233;e des parents</label>
+        <rang>FAMILY</rang>
+      </documentList>
+      <documentList>
+        <code>63</code>
+        <label>Document donn&#233;es allocataire</label>
+        <rang>FAMILY</rang>
+      </documentList>
+      <documentList>
+        <code>64</code>
+        <label>Jugement des affaires familiales</label>
+        <rang>FAMILY</rang>
+      </documentList>
+      <documentList>
+        <code>65</code>
+        <label>Jugement mise sous tutelle</label>
+        <rang>FAMILY</rang>
+      </documentList>
+      <documentList>
+        <code>35</code>
+        <label>Justificatif de domicile</label>
+        <rang>FAMILY</rang>
+      </documentList>
+      <documentList>
+        <code>36</code>
+        <label>Livret de famille</label>
+        <rang>FAMILY</rang>
+      </documentList>
+      <documentList>
+        <code>44</code>
+        <label>Attestation aide m&#233;dicale de l'&#233;tat CPAM</label>
+        <rang>PERSON</rang>
+      </documentList>
+      <documentList>
+        <code>68</code>
+        <label>Carte mutuelle ou CMU</label>
+        <rang>PERSON</rang>
+      </documentList>
+      <documentList>
+        <code>62</code>
+        <label>Copie passeport</label>
+        <rang>PERSON</rang>
+      </documentList>
+      <documentList>
+        <code>66</code>
+        <label>Ordonnance</label>
+        <rang>PERSON</rang>
+      </documentList>
+      <documentList>
+        <code>67</code>
+        <label>Photocopie attestation CPAM / CMU</label>
+        <rang>PERSON</rang>
+      </documentList>
+      <documentList>
+        <code>81</code>
+        <label>Attestation d'h&#233;bergement d'une personne physique</label>
+        <rang>FAMILY</rang>
+      </documentList>
+      <documentList>
+        <code>83</code>
+        <label>Attestation responsabilit&#233; civile</label>
+        <rang>PERSON</rang>
+      </documentList>
+      <documentList>
+        <code>70</code>
+        <label>Carte nationnale d'identit&#233;</label>
+        <rang>PERSON</rang>
+      </documentList>
+      <documentList>
+        <code>71</code>
+        <label>Certificat de PACS</label>
+        <rang>FAMILY</rang>
+      </documentList>
+      <documentList>
+        <code>73</code>
+        <label>Certificat de scolarit&#233;</label>
+        <rang>PERSON</rang>
+      </documentList>
+      <documentList>
+        <code>74</code>
+        <label>Copie carte de s&#233;jour</label>
+        <rang>PERSON</rang>
+      </documentList>
+      <documentList>
+        <code>75</code>
+        <label>Courrier ou mail famille re&#231;u</label>
+        <rang>PERSON</rang>
+      </documentList>
+      <documentList>
+        <code>72</code>
+        <label>Extrait d'acte de mariage</label>
+        <rang>FAMILY</rang>
+      </documentList>
+      <documentList>
+        <code>76</code>
+        <label>Extrait de naissance</label>
+        <rang>PERSON</rang>
+      </documentList>
+      <documentList>
+        <code>77</code>
+        <label>Fiche individuelle enfant version papier num&#233;ris&#233;</label>
+        <rang>PERSON</rang>
+      </documentList>
+      <documentList>
+        <code>78</code>
+        <label>Formulaire DUI version papier num&#233;ris&#233;</label>
+        <rang>PERSON</rang>
+      </documentList>
+      <documentList>
+        <code>82</code>
+        <label>Justificatif officiel pr&#233;cisant l'adresse de l'h&#233;berg&#233;</label>
+        <rang>PERSON</rang>
+      </documentList>
+      <documentList>
+        <code>84</code>
+        <label>Notification MDPH</label>
+        <rang>PERSON</rang>
+      </documentList>
+      <documentList>
+        <code>86</code>
+        <label>PAI</label>
+        <rang>PERSON</rang>
+      </documentList>
+      <documentList>
+        <code>85</code>
+        <label>Preuve carte s&#233;nior</label>
+        <rang>PERSON</rang>
+      </documentList>
+      <documentList>
+        <code>80</code>
+        <label>R&#233;capitulatif donn&#233;es sant&#233; autorisations enfant</label>
+        <rang>PERSON</rang>
+      </documentList>
+      <documentList>
+        <code>79</code>
+        <label>R&#233;capitulatif toutes d&#233;marches li&#233;e au DUI</label>
+        <rang>PERSON</rang>
+      </documentList>
+    </ns2:readDocumentListResponse>
+  </soap:Body>
+</soap:Envelope>
diff --git a/tests/test_toulouse_maelis.py b/tests/test_toulouse_maelis.py
index 29872a6b..c83b686b 100644
--- a/tests/test_toulouse_maelis.py
+++ b/tests/test_toulouse_maelis.py
@@ -105,16 +105,19 @@ def django_db_setup(django_db_setup, django_db_blocker):
             family_service.add_soap_response(
                 mock, 'readChildIndicatorList', get_xml_file('R_read_child_indicator_list.xml')
             )
             family_service.add_soap_response(
                 mock, 'readCivilityList', get_xml_file('R_read_civility_list.xml')
             )
             family_service.add_soap_response(mock, 'readCountryList', get_xml_file('R_read_country_list.xml'))
             family_service.add_soap_response(mock, 'readCSPList', get_xml_file('R_read_csp_list.xml'))
+            family_service.add_soap_response(
+                mock, 'readDocumentList', get_xml_file('R_read_document_list.xml')
+            )
             family_service.add_soap_response(
                 mock, 'readDietCodeList', get_xml_file('R_read_dietcode_list.xml')
             )
             family_service.add_soap_response(mock, 'readOrganList', get_xml_file('R_read_organ_list.xml'))
             family_service.add_soap_response(mock, 'readPAIList', get_xml_file('R_read_pai_list.xml'))
             family_service.add_soap_response(mock, 'readQualityList', get_xml_file('R_read_quality_list.xml'))
             family_service.add_soap_response(
                 mock, 'readQuotientList', get_xml_file('R_read_quotient_list.xml')
@@ -280,27 +283,28 @@ def test_cron(db):
     assert sorted(list({x.referential_name for x in Referential.objects.all()})) == [
         'CSP',
         'Category',
         'ChildIndicator',
         'Civility',
         'Complement',
         'Country',
         'DietCode',
+        'Document',
         'Organ',
         'PAI',
         'Quality',
         'Quotient',
         'RLIndicator',
         'Sex',
         'Situation',
         'Street',
         'Vaccin',
     ]
-    assert Referential.objects.count() == 230
+    assert Referential.objects.count() == 281
 
 
 def test_link(family_service, con, app):
     def request_check(request):
         assert request.dossierNumber == 1312
 
     family_service.add_soap_response(
         'readFamily', get_xml_file('R_read_family.xml'), request_check=request_check
@@ -485,16 +489,47 @@ def test_read_dietcode_list(con, app):
         },
         {'id': 'BB', 'code': 'BB', 'text': 'REPAS BEBE', 'libelle': 'REPAS BEBE'},
         {'id': 'MSP', 'code': 'MSP', 'text': 'REPAS MOYEN SANS PORC', 'libelle': 'REPAS MOYEN SANS PORC'},
         {'id': 'MSV', 'code': 'MSV', 'text': 'REPAS MOYEN SANS VIANDE', 'libelle': 'REPAS MOYEN SANS VIANDE'},
         {'id': 'MST', 'code': 'MST', 'text': 'REPAS MOYEN STANDARD', 'libelle': 'REPAS MOYEN STANDARD'},
     ]
 
 
+def test_read_document_list(con, app):
+    url = get_endpoint('read-document-list')
+    resp = app.get(url)
+    assert resp.json['err'] == 0
+    assert resp.json['data'][:5] == [
+        {
+            'id': '43',
+            'code': '43',
+            'rang': 'FAMILY',
+            'text': 'Acte notarié de divorce',
+            'label': 'Acte notarié de divorce',
+        },
+        {
+            'id': '44',
+            'code': '44',
+            'rang': 'PERSON',
+            'text': "Attestation aide médicale de l'état CPAM",
+            'label': "Attestation aide médicale de l'état CPAM",
+        },
+        {'id': '45', 'code': '45', 'rang': 'FAMILY', 'text': 'Attestation CAF', 'label': 'Attestation CAF'},
+        {'id': '46', 'code': '46', 'rang': 'FAMILY', 'text': 'Attestation CD31', 'label': 'Attestation CD31'},
+        {
+            'id': '47',
+            'code': '47',
+            'rang': 'FAMILY',
+            'text': "Attestation d'attribution ou non de bourse",
+            'label': "Attestation d'attribution ou non de bourse",
+        },
+    ]
+
+
 def test_read_organ_list(con, app):
     url = get_endpoint('read-organ-list')
     resp = app.get(url)
     assert resp.json['err'] == 0
     assert len(resp.json['data']) == 92
     assert resp.json['data'][:5] == [
         {'id': 'A10000979374', 'code': 'ALC L OLIVIER', 'text': 'ALC L OLIVIER', 'libelle': None},
         {'id': 'A10000979372', 'code': 'ALVA 06', 'text': 'ALVA 06', 'libelle': None},
-- 
2.30.2

