Projet

Général

Profil

0001-toulouse-maelis-add-endpoint-to-create-or-update-quo.patch

Nicolas Roche, 09 décembre 2022 12:51

Télécharger (23,3 ko)

Voir les différences:

Subject: [PATCH 1/2] toulouse-maelis: add endpoint to create or update
 quotients (#71698)

 functests/toulouse_maelis/conftest.py         |  1 +
 .../data/test_update_quotient.json            | 29 ++++++
 functests/toulouse_maelis/test_family.py      | 46 +++++++++
 passerelle/contrib/toulouse_maelis/models.py  | 25 +++++
 passerelle/contrib/toulouse_maelis/schemas.py | 36 +++++++
 .../Q_create_update_quotient.xml              | 23 +++++
 .../R_create_update_quotient.xml              |  5 +
 .../R_create_update_quotient_soap_error.xml   | 13 +++
 tests/data/toulouse_maelis/R_read_family.xml  | 14 +++
 .../toulouse_maelis/R_read_family_relax.xml   | 14 +++
 .../R_read_family_reordered.xml               | 14 +++
 tests/test_toulouse_maelis.py                 | 98 ++++++++++++++++++-
 12 files changed, 317 insertions(+), 1 deletion(-)
 create mode 100644 functests/toulouse_maelis/data/test_update_quotient.json
 create mode 100644 tests/data/toulouse_maelis/Q_create_update_quotient.xml
 create mode 100644 tests/data/toulouse_maelis/R_create_update_quotient.xml
 create mode 100644 tests/data/toulouse_maelis/R_create_update_quotient_soap_error.xml
functests/toulouse_maelis/conftest.py
371 371
    assert create_result['err'] == 0
372 372
    print('\ncreate DUI: %s' % str(create_result['data']['number']))
373 373
    data = diff_family(conn, name_id, 'test_create_family.json')
374 374

  
375 375
    return {
376 376
        'name_id': name_id,  # linked
377 377
        'family_id': str(create_result['data']['number']),
378 378
        'lastname': lastname,
379
        'rl1_num': data['RL1']['num'],
379 380
        'family_payload': create_family_payload,
380 381
        'data': data,
381 382
    }
382 383

  
383 384

  
384 385
@pytest.fixture(scope='session')
385 386
def update_data(request, conn, referentials):
386 387
    name_id = request.config.getoption('--nameid')
functests/toulouse_maelis/data/test_update_quotient.json
1
[
2
  {
3
    "yearRev": 2021,
4
    "dateStart": "2022-01-02T00:00:00+01:00",
5
    "dateEnd": "2022-12-31T00:00:00+01:00",
6
    "mtt": 1500.33,
7
    "cdquo": "QS",
8
    "codeUti": null,
9
    "cdquo_text": "QUOTIENT SCOLAIRE"
10
  },
11
  {
12
    "yearRev": 2020,
13
    "dateStart": "2022-01-02T00:00:00+01:00",
14
    "dateEnd": "2022-12-31T00:00:00+01:00",
15
    "mtt": 1500.33,
16
    "cdquo": "QS",
17
    "codeUti": null,
18
    "cdquo_text": "QUOTIENT SCOLAIRE"
19
  },
20
  {
21
    "yearRev": 2021,
22
    "dateStart": "2022-01-01T00:00:00+01:00",
23
    "dateEnd": "2022-01-01T00:00:00+01:00",
24
    "mtt": 1500.33,
25
    "cdquo": "QS",
26
    "codeUti": null,
27
    "cdquo_text": "QUOTIENT SCOLAIRE"
28
  }
29
]
functests/toulouse_maelis/test_family.py
747 747
    assert diff_child(conn, update_data['name_id'], 0, 'test_child_indicator.json', key='indicatorList')
748 748

  
749 749
    # restore Bart indicators
750 750
    payload = {'indicatorList': update_data['family_payload']['childList'][0]['indicatorList']}
751 751
    resp = requests.post(url, json=payload)
752 752
    resp.raise_for_status()
753 753
    assert resp.json()['err'] == 0
754 754
    assert diff_family(conn, update_data['name_id'], 'test_update_family.json')
755

  
756

  
757
def test_update_quotient(conn, create_data):
758
    unlink(conn, create_data['name_id'])
759
    link(conn, create_data)
760

  
761
    # add quotient
762
    url = conn + '/update-quotient?NameID=%s&rl_id=%s' % (create_data['name_id'], create_data['rl1_num'])
763
    payload = {
764
        'yearRev': '2021',
765
        'dateStart': '2022-01-01',
766
        'dateEnd': '2022-12-31',
767
        'mtt': '1500.33',
768
        'cdquo': 'QS',
769
    }
770
    resp = requests.post(url, json=payload)
771
    resp.raise_for_status()
772
    assert resp.json()['err'] == 0
773
    data = read_family(conn, create_data['name_id'])
774
    assert data['RL1']['quotientList'] == [
775
        {
776
            'yearRev': 2021,
777
            'dateStart': '2022-01-01T00:00:00+01:00',
778
            'dateEnd': '2022-12-31T00:00:00+01:00',
779
            'mtt': 1500.33,
780
            'cdquo': 'QS',
781
            'codeUti': None,
782
            'cdquo_text': 'QUOTIENT SCOLAIRE',
783
        }
784
    ]
785

  
786
    # add quotient
787
    payload['dateStart'] = '2022-01-02'
788
    resp = requests.post(url, json=payload)
789
    resp.raise_for_status()
790
    assert resp.json()['err'] == 0
791
    data = read_family(conn, create_data['name_id'])
792
    assert len(data['RL1']['quotientList']) == 2
793

  
794
    # add quotient on another income year
795
    payload['yearRev'] = '2020'
796
    resp = requests.post(url, json=payload)
797
    resp.raise_for_status()
798
    assert resp.json()['err'] == 0
799
    data = diff_rlg(conn, create_data['name_id'], 1, 'test_update_quotient.json', 'quotientList')
800
    assert len(data['RL1']['quotientList']) == 3
passerelle/contrib/toulouse_maelis/models.py
270 270
        self.add_text_value('Civility', data, ['civility'])
271 271
        self.add_text_value('Quality', data, ['quality'])
272 272
        self.add_text_value('Complement', data, ['adresse', 'numComp'])
273 273
        self.add_text_value('Street', data, ['adresse', 'idStreet'])
274 274
        self.add_text_value('CSP', data, ['profession', 'codeCSP'])
275 275
        self.add_text_value('Organ', data, ['CAFInfo', 'organ'])
276 276
        for indicator in data['indicatorList']:
277 277
            self.add_text_value_to_rl_indicator(indicator)
278
        for quotient in data['quotientList']:
279
            self.add_text_value('Quotient', quotient, ['cdquo'])
278 280

  
279 281
        # sort indicators
280 282
        if data['indicatorList']:
281 283
            data['indicatorList'].sort(key=lambda x: x['code'])
282 284

  
283 285
    def add_text_value_to_family(self, data):
284 286
        self.add_text_value('Category', data, ['category'])
285 287
        self.add_text_value('Situation', data, ['situation'])
......
1081 1083
    )
1082 1084
    def update_rl_indicator(self, request, NameID, rl_id, post_data):
1083 1085
        self.get_link(NameID)
1084 1086
        self.assert_update_indicator_payload_in_referential('RLIndicator', post_data)
1085 1087

  
1086 1088
        self.call('Family', 'updatePersonIndicatorList', numPerson=rl_id, **post_data)
1087 1089
        return {'data': 'ok'}
1088 1090

  
1091
    @endpoint(
1092
        display_category='Famille',
1093
        description="Créer ou mettre à jour un quotient d'un responsable légal",
1094
        name='update-quotient',
1095
        perm='can_access',
1096
        parameters={
1097
            'NameID': {'description': 'Publik NameID'},
1098
            'rl_id': {'description': "Numéro du responsable légal"},
1099
        },
1100
        post={'request_body': {'schema': {'application/json': schemas.UPDATE_QUOTIENT_SCHEMA}}},
1101
    )
1102
    def update_quotient(self, request, NameID, rl_id, post_data):
1103
        family_id = self.get_link(NameID).family_id
1104
        self.assert_post_data_in_referential('Quotient', post_data, ['cdquo'])
1105

  
1106
        payload = {
1107
            'dossierNumber': family_id,
1108
            'personNumber': rl_id,
1109
            'quotient': post_data,
1110
        }
1111
        self.call('Family', 'createUpdateQuotient', **payload)
1112
        return {'data': 'ok'}
1113

  
1089 1114
    @endpoint(
1090 1115
        display_category='Famille',
1091 1116
        description="Création d'une personne à prévenir en cas d'urgence",
1092 1117
        name='create-person',
1093 1118
        perm='can_access',
1094 1119
        parameters={
1095 1120
            'NameID': {'description': 'Publik NameID'},
1096 1121
        },
passerelle/contrib/toulouse_maelis/schemas.py
715 715
            'type': 'array',
716 716
            'items': INDICATOR_SCHEMA,
717 717
            'minItems': 1,
718 718
        }
719 719
    },
720 720
    'additionalProperties': False,
721 721
    'unflatten': True,
722 722
}
723

  
724
UPDATE_QUOTIENT_SCHEMA = {
725
    '$schema': 'http://json-schema.org/draft-04/schema#',
726
    'title': 'Family persons',
727
    'description': "Mise à jours des quotients sur les responsables légaux",
728
    'type': 'object',
729
    'required': ['yearRev', 'dateStart', 'dateEnd', 'mtt', 'cdquo'],
730
    'properties': {
731
        'yearRev': {
732
            'description': 'Année de revenu',
733
            'type': 'string',
734
            'pattern': '^[0-9]{4}$',
735
        },
736
        'dateStart': {
737
            'description': 'Date de début',
738
            'type': 'string',
739
            'pattern': '^[0-9]{4}-[0-9]{2}-[0-9]{2}$',
740
        },
741
        'dateEnd': {
742
            'description': 'Date de fin',
743
            'type': 'string',
744
            'pattern': '^[0-9]{4}-[0-9]{2}-[0-9]{2}$',
745
        },
746
        'mtt': {
747
            'description': 'Montant',
748
            'type': 'string',
749
            'pattern': r'^[0-9]+\.?[0-9]*$',
750
        },
751
        'cdquo': {
752
            'description': 'Code du quotient (depuis référentiel)',
753
            'type': 'string',
754
            'pattern': '.+',
755
        },
756
    },
757
    'additionalProperties': False,
758
}
tests/data/toulouse_maelis/Q_create_update_quotient.xml
1
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
2
  <soap-env:Header>
3
    <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
4
      <wsse:UsernameToken>
5
        <wsse:Username>maelis-webservice</wsse:Username>
6
        <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">maelis-password</wsse:Password>
7
      </wsse:UsernameToken>
8
    </wsse:Security>
9
  </soap-env:Header>
10
  <soap-env:Body>
11
    <ns0:createUpdateQuotient xmlns:ns0="family.ws.maelis.sigec.com">
12
      <dossierNumber>1312</dossierNumber>
13
      <personNumber>613878</personNumber>
14
      <quotient>
15
        <yearRev>2021</yearRev>
16
        <dateStart>2022-10-01</dateStart>
17
        <dateEnd>2023-01-31</dateEnd>
18
        <mtt>1500.33</mtt>
19
        <cdquo>QS</cdquo>
20
      </quotient>
21
    </ns0:createUpdateQuotient>
22
  </soap-env:Body>
23
</soap-env:Envelope>
tests/data/toulouse_maelis/R_create_update_quotient.xml
1
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
2
  <soap:Body>
3
    <ns2:createUpdateQuotientResponse xmlns:ns2="family.ws.maelis.sigec.com"/>
4
  </soap:Body>
5
</soap:Envelope>
tests/data/toulouse_maelis/R_create_update_quotient_soap_error.xml
1
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
2
  <soap:Body>
3
    <soap:Fault>
4
      <faultcode>soap:Server</faultcode>
5
      <faultstring>E07 : Il existe d&#233;j&#224; un quotient post&#233;rieur pour cette p&#233;riode</faultstring>
6
      <detail>
7
        <ns1:MaelisFamilyException xmlns:ns1="family.ws.maelis.sigec.com">
8
          <message xmlns:ns2="family.ws.maelis.sigec.com">E07 : Il existe d&#233;j&#224; un quotient post&#233;rieur pour cette p&#233;riode</message>
9
        </ns1:MaelisFamilyException>
10
      </detail>
11
    </soap:Fault>
12
  </soap:Body>
13
</soap:Envelope>
tests/data/toulouse_maelis/R_read_family.xml
40 40
            <code>ETABSPEC</code>
41 41
            <label>Etablissement sp&#233;cialis&#233;</label>
42 42
            <note>SNPP</note>
43 43
          </indicatorList>
44 44
          <indicatorList>
45 45
            <code>AVL</code>
46 46
            <label>Auxiliaire de Vie loisirs</label>
47 47
          </indicatorList>
48
          <quotientList>
49
            <yearRev>2020</yearRev>
50
            <dateStart>2021-01-01T00:00:00+01:00</dateStart>
51
            <dateEnd>2021-12-31T00:00:00+01:00</dateEnd>
52
            <mtt>1500.33</mtt>
53
            <cdquo>QS</cdquo>
54
          </quotientList>
55
          <quotientList>
56
            <yearRev>2021</yearRev>
57
            <dateStart>2022-01-01T00:00:00+01:00</dateStart>
58
            <dateEnd>2022-12-31T00:00:00+01:00</dateEnd>
59
            <mtt>1500.44</mtt>
60
            <cdquo>MOY ECO</cdquo>
61
          </quotientList>
48 62
        </RL1>
49 63
        <RL2>
50 64
          <num>613879</num>
51 65
          <lastname>DOE</lastname>
52 66
          <firstname>JANE</firstname>
53 67
          <maidenName>SMITH</maidenName>
54 68
          <quality>MERE</quality>
55 69
          <civility>MME</civility>
tests/data/toulouse_maelis/R_read_family_relax.xml
40 40
            <code>ETABSPEC</code>
41 41
            <label>Etablissement sp&#233;cialis&#233;</label>
42 42
            <note>SNPP</note>
43 43
          </indicatorList>
44 44
          <indicatorList>
45 45
            <code>AVL</code>
46 46
            <label>Auxiliaire de Vie loisirs</label>
47 47
          </indicatorList>
48
          <quotientList>
49
            <yearRev>2020</yearRev>
50
            <dateStart>2021-01-01T00:00:00+01:00</dateStart>
51
            <dateEnd>2021-12-31T00:00:00+01:00</dateEnd>
52
            <mtt>1500.33</mtt>
53
            <cdquo>QS</cdquo>
54
          </quotientList>
55
          <quotientList>
56
            <yearRev>2021</yearRev>
57
            <dateStart>2022-01-01T00:00:00+01:00</dateStart>
58
            <dateEnd>2022-12-31T00:00:00+01:00</dateEnd>
59
            <mtt>1500.44</mtt>
60
            <cdquo>MOY ECO</cdquo>
61
          </quotientList>
48 62
        </RL1>
49 63
        <RL2>
50 64
          <num>613879</num>
51 65
          <lastname>DOE</lastname>
52 66
          <firstname>JANE</firstname>
53 67
          <maidenName>SMITH</maidenName>
54 68
          <quality>MERE</quality>
55 69
          <civility>MME</civility>
tests/data/toulouse_maelis/R_read_family_reordered.xml
40 40
            <code>ETABSPEC</code>
41 41
            <label>Etablissement sp&#233;cialis&#233;</label>
42 42
            <note>SNPP</note>
43 43
          </indicatorList>
44 44
          <indicatorList>
45 45
            <code>AVL</code>
46 46
            <label>Auxiliaire de Vie loisirs</label>
47 47
          </indicatorList>
48
          <quotientList>
49
            <yearRev>2020</yearRev>
50
            <dateStart>2021-01-01T00:00:00+01:00</dateStart>
51
            <dateEnd>2021-12-31T00:00:00+01:00</dateEnd>
52
            <mtt>1500.33</mtt>
53
            <cdquo>QS</cdquo>
54
          </quotientList>
55
          <quotientList>
56
            <yearRev>2021</yearRev>
57
            <dateStart>2022-01-01T00:00:00+01:00</dateStart>
58
            <dateEnd>2022-12-31T00:00:00+01:00</dateEnd>
59
            <mtt>1500.44</mtt>
60
            <cdquo>MOY ECO</cdquo>
61
          </quotientList>
48 62
        </RL1>
49 63
        <RL2>
50 64
          <num>613879</num>
51 65
          <lastname>DOE</lastname>
52 66
          <firstname>JANE</firstname>
53 67
          <maidenName>SMITH</maidenName>
54 68
          <quality>MERE</quality>
55 69
          <civility>MME</civility>
tests/test_toulouse_maelis.py
53 53
)
54 54
CREATE_FAMILY = FakedResponse(content=get_xml_file('R_create_family.xml'), status_code=200)
55 55
CREATE_FAMILY_ERR = FakedResponse(content=get_xml_file('R_create_family_error.xml'), status_code=200)
56 56
CREATE_CHILD = FakedResponse(content=get_xml_file('R_create_child.xml'), status_code=200)
57 57
CREATE_CHILD_ERR = FakedResponse(content=get_xml_file('R_create_child_error.xml'), status_code=200)
58 58
UPDATE_FAMILY = FakedResponse(content=get_xml_file('R_update_family.xml'), status_code=200)
59 59
UPDATE_FAMILY_ERR = FakedResponse(content=get_xml_file('R_update_family_error.xml'), status_code=200)
60 60
UPDATE_FAMILY_500 = FakedResponse(content=get_xml_file('R_update_family_soap_error.xml'), status_code=500)
61
UPDATE_QUOTIENT = FakedResponse(content=get_xml_file('R_create_update_quotient.xml'), status_code=200)
62
UPDATE_QUOTIENT_500 = FakedResponse(
63
    content=get_xml_file('R_create_update_quotient_soap_error.xml'), status_code=500
64
)
61 65
UPDATE_DIETCODE = FakedResponse(content=get_xml_file('R_update_child_dietcode.xml'), status_code=200)
62 66
UPDATE_PAI = FakedResponse(content=get_xml_file('R_update_child_pai.xml'), status_code=200)
63 67
UPDATE_PAI_500 = FakedResponse(content=get_xml_file('R_update_child_pai_soap_error.xml'), status_code=500)
64 68
UPDATE_MEDICAL = FakedResponse(content=get_xml_file('R_update_child_medical_record.xml'), status_code=200)
65 69
UPDATE_MEDICAL_500 = FakedResponse(
66 70
    content=get_xml_file('R_update_child_medical_record_soap_error.xml'), status_code=500
67 71
)
68 72
UPDATE_CHILD_AUTO = FakedResponse(content=get_xml_file('R_update_child_authorization.xml'), status_code=200)
......
700 704
            'mail': 'djhon@example.org',
701 705
            'isContactMail': True,
702 706
            'isContactSms': True,
703 707
            'isInvoicePdf': True,
704 708
        },
705 709
        'CAFInfo': None,
706 710
        'civility_text': 'Monsieur',
707 711
        'quality_text': 'PERE',
708
        'quotientList': [],
709 712
        'indicatorList': [
710 713
            {
711 714
                'choice': None,
712 715
                'code': 'AVL',
713 716
                'code_text': 'Auxiliaire de Vie loisirs',
714 717
                'label': 'Auxiliaire de Vie loisirs',
715 718
                'note': None,
716 719
            },
717 720
            {
718 721
                'choice': None,
719 722
                'code': 'ETABSPEC',
720 723
                'code_text': 'Etablissement spécialisé',
721 724
                'label': 'Etablissement spécialisé',
722 725
                'note': 'SNPP',
723 726
            },
724 727
        ],
728
        'quotientList': [
729
            {
730
                'cdquo': 'QS',
731
                'cdquo_text': 'QUOTIENT SCOLAIRE',
732
                'codeUti': None,
733
                'dateEnd': '2021-12-31T00:00:00+01:00',
734
                'dateStart': '2021-01-01T00:00:00+01:00',
735
                'mtt': 1500.33,
736
                'yearRev': 2020,
737
            },
738
            {
739
                'cdquo': 'MOY ECO',
740
                'cdquo_text': 'REVENU MOYEN ( MENSUEL OU ANNUEL)',
741
                'codeUti': None,
742
                'dateEnd': '2022-12-31T00:00:00+01:00',
743
                'dateStart': '2022-01-01T00:00:00+01:00',
744
                'mtt': 1500.44,
745
                'yearRev': 2021,
746
            },
747
        ],
725 748
        'subscribeActivityList': [],
726 749
    }
727 750
    data = resp.json['data']['childList'][0]
728 751
    del data['medicalRecord']
729 752
    del data['authorizedPersonList']
730 753
    del data['paiInfoBean']
731 754
    del data['indicatorList']
732 755
    assert data == {
......
2106 2129
    Link.objects.create(resource=con, family_id='1312', name_id='local')
2107 2130
    resp = app.post_json(url + '?NameID=local&rl_id=613878', params=params)
2108 2131
    assert resp.json['err'] == 'wrong-key'
2109 2132
    assert (
2110 2133
        resp.json['err_desc'] == "adresse/numComp key value 'plop' do not belong to 'Complement' referential"
2111 2134
    )
2112 2135

  
2113 2136

  
2137
@mock.patch('passerelle.utils.Request.get')
2138
@mock.patch('passerelle.utils.Request.post')
2139
def test_update_quotient(mocked_post, mocked_get, con, app):
2140
    mocked_get.return_value = FAMILY_SERVICE_WSDL
2141
    mocked_post.return_value = UPDATE_QUOTIENT
2142
    url = get_endpoint('update-quotient')
2143
    params = {
2144
        'yearRev': '2021',
2145
        'dateStart': '2022-10-01',
2146
        'dateEnd': '2023-01-31',
2147
        'mtt': '1500.33',
2148
        'cdquo': 'QS',
2149
    }
2150

  
2151
    Link.objects.create(resource=con, family_id='1312', name_id='local')
2152
    resp = app.post_json(url + '?NameID=local&rl_id=613878', params=params)
2153
    assert_sent_payload(mocked_post, 'Q_create_update_quotient.xml')
2154
    assert resp.json['err'] == 0
2155
    assert resp.json['data'] == 'ok'
2156

  
2157

  
2158
def test_update_quotient_schema_error(con, app):
2159
    url = get_endpoint('update-quotient')
2160
    params = {
2161
        'yearRev': '2021',
2162
        'dateStart': '2022-10-01',
2163
        'dateEnd': '2023-01-31',
2164
        'mtt': '1500,33',
2165
        'cdquo': 'QS',
2166
    }
2167

  
2168
    Link.objects.create(resource=con, family_id='1312', name_id='local')
2169
    resp = app.post_json(url + '?NameID=local&rl_id=613878', params=params, status=400)
2170
    assert resp.json['err'] == 1
2171
    assert resp.json['err_desc'] == "mtt: '1500,33' does not match '^[0-9]+\\\\.?[0-9]*$'"
2172

  
2173

  
2174
@mock.patch('passerelle.utils.Request.get')
2175
@mock.patch('passerelle.utils.Request.post')
2176
def test_update_quotient_soap_error(mocked_post, mocked_get, con, app):
2177
    mocked_get.return_value = FAMILY_SERVICE_WSDL
2178
    mocked_post.return_value = UPDATE_QUOTIENT_500
2179
    url = get_endpoint('update-quotient')
2180
    params = {
2181
        'yearRev': '2021',
2182
        'dateStart': '2022-10-01',
2183
        'dateEnd': '2023-01-31',
2184
        'mtt': '1500.33',
2185
        'cdquo': 'QS',
2186
    }
2187

  
2188
    Link.objects.create(resource=con, family_id='1312', name_id='local')
2189
    resp = app.post_json(url + '?NameID=local&rl_id=613878', params=params)
2190
    assert resp.json['err'] == 'Family-createUpdateQuotient-soap:Server'
2191
    assert 'E07 : Il existe déjà un quotient postérieur' in resp.json['err_desc']
2192

  
2193

  
2194
def test_update_quotient_wrong_referential_key_error(con, app):
2195
    url = get_endpoint('update-quotient')
2196
    params = {
2197
        'yearRev': '2021',
2198
        'dateStart': '2023-10-01',
2199
        'dateEnd': '2023-01-31',
2200
        'mtt': '1500.33',
2201
        'cdquo': 'plop',
2202
    }
2203

  
2204
    Link.objects.create(resource=con, family_id='1312', name_id='local')
2205
    resp = app.post_json(url + '?NameID=local&rl_id=613878', params=params)
2206
    assert resp.json['err'] == 'wrong-key'
2207
    assert resp.json['err_desc'] == "cdquo key value 'plop' do not belong to 'Quotient' required referential"
2208

  
2209

  
2114 2210
@mock.patch('passerelle.utils.Request.get')
2115 2211
@mock.patch('passerelle.utils.Request.post')
2116 2212
def test_create_person(mocked_post, mocked_get, con, app):
2117 2213
    mocked_get.return_value = FAMILY_SERVICE_WSDL
2118 2214
    mocked_post.side_effect = [READ_FAMILY, UPDATE_FAMILY]
2119 2215
    url = get_endpoint('create-person')
2120 2216
    params = {
2121 2217
        'civility': None,
2122
-