Project

General

Profile

0005-toulouse-maelis-child-need-a-num-field-to-update-716.patch

Nicolas Roche, 24 November 2022 11:38 AM

Download (4.91 KB)

View differences:

Subject: [PATCH 5/5] toulouse-maelis: child need a num field to update
 (#71642)

 passerelle/contrib/toulouse_maelis/schemas.py  | 6 +++++-
 tests/data/toulouse_maelis/Q_update_family.xml | 9 +++++++++
 tests/test_toulouse_maelis.py                  | 7 ++++++-
 3 files changed, 20 insertions(+), 2 deletions(-)
passerelle/contrib/toulouse_maelis/schemas.py
112 112
ADDRESS_SCHEMA = {
113 113
    '$schema': 'http://json-schema.org/draft-04/schema#',
114 114
    'title': 'Address',
115 115
    'description': 'Informations sur une adresse',
116 116
    'type': 'object',
117 117
    'required': ['street1', 'town', 'zipcode'],
118 118
    'properties': {
119 119
        'num': {
120
            'description': 'numéro',
120
            'description': "Numéro de l'adresse",
121 121
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
122 122
        },
123 123
        'numComp': {
124 124
            'description': 'Complément du numéro (depuis référentiel)',
125 125
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
126 126
        },
127 127
        'street1': {
128 128
            'description': 'Libellé de la voie',
......
423 423

  
424 424
CHILD_SCHEMA = {
425 425
    '$schema': 'http://json-schema.org/draft-04/schema#',
426 426
    'title': 'Child',
427 427
    'description': "Informations sur la création d'un enfant",
428 428
    'type': 'object',
429 429
    'required': ['sexe', 'firstname', 'lastname', 'birth'],
430 430
    'properties': {
431
        'num': {
432
            'description': "Numéro de l'enfant",
433
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
434
        },
431 435
        'sexe': {
432 436
            'description': 'Sexe (depuis référentiel)',
433 437
            'type': 'string',
434 438
            'pattern': '.+',
435 439
        },
436 440
        'birth': BIRTH_SCHEMA,
437 441
        'dietcode': {
438 442
            'description': 'Code de régime alimentaire (depuis référentiel)',
tests/data/toulouse_maelis/Q_update_family.xml
51 51
            <code>DTC</code>
52 52
            <vaccinationDate>1940-07-26</vaccinationDate>
53 53
          </vaccinList>
54 54
        </medicalRecord>
55 55
        <paiInfoBean>
56 56
          <code>PAIALI</code>
57 57
        </paiInfoBean>
58 58
      </childList>
59
      <childList>
60
        <num>613880</num>
61
        <firstname>Brunelle</firstname>
62
        <lastname>Doe</lastname>
63
        <sexe>F</sexe>
64
        <birth>
65
          <dateBirth>1943-01-19</dateBirth>
66
        </birth>
67
      </childList>
59 68
      <emergencyPersonList>
60 69
        <personList>
61 70
          <civility>MME</civility>
62 71
          <firstname>Keny</firstname>
63 72
          <lastname>Arkana</lastname>
64 73
          <dateBirth>1982-12-20</dateBirth>
65 74
          <sexe>F</sexe>
66 75
          <quality>T</quality>
tests/test_toulouse_maelis.py
1253 1253
        'rl1/profession/codeCSP': 'ART',
1254 1254
        'rl1/CAFInfo/organ': 'A10007752822',
1255 1255
        'emergencyPersonList/0/personList/0/civility': 'MME',
1256 1256
        'emergencyPersonList/0/personList/0/firstname': 'Keny',
1257 1257
        'emergencyPersonList/0/personList/0/lastname': 'Arkana',
1258 1258
        'emergencyPersonList/0/personList/0/sexe': 'F',
1259 1259
        'emergencyPersonList/0/personList/0/dateBirth': '1982-12-20',
1260 1260
        'emergencyPersonList/0/personList/0/quality': 'T',
1261
        'childList/0/lastname': 'Zimmerman',
1261
        'childList/0/lastname': 'Zimmerman',  # add child
1262 1262
        'childList/0/firstname': 'Robert',
1263 1263
        'childList/0/sexe': 'M',
1264 1264
        'childList/0/birth/dateBirth': '1941-05-24',
1265 1265
        'childList/0/birth/place': 'Duluth',
1266 1266
        'childList/0/dietcode': 'RSV',
1267 1267
        'childList/0/paiInfoBean/code': 'PAIALI',
1268 1268
        'childList/0/medicalRecord/vaccinList/0/code': 'DTC',
1269 1269
        'childList/0/medicalRecord/vaccinList/0/vaccinationDate': '1940-07-26',
1270
        'childList/1/num': '613880',  # update child
1271
        'childList/1/firstname': 'Brunelle',
1272
        'childList/1/lastname': 'Doe',
1273
        'childList/1/birth/dateBirth': '1943-01-19',
1274
        'childList/1/sexe': 'F',
1270 1275
    }
1271 1276

  
1272 1277
    Link.objects.create(resource=con, family_id='1312', name_id='local')
1273 1278
    resp = app.post_json(url + '?NameID=local', params=params)
1274 1279
    assert_sent_payload(mocked_post, 'Q_update_family.xml')
1275 1280
    assert resp.json['err'] == 0
1276 1281
    assert resp.json['data']['number'] == 196544
1277 1282
    assert not resp.json['data']['childErrorList']
1278
-