Projet

Général

Profil

0006-toulouse-maelis-manage-birth-bean-on-RL-71641.patch

Nicolas Roche, 24 novembre 2022 11:14

Télécharger (50,1 ko)

Voir les différences:

Subject: [PATCH 6/6] toulouse-maelis: manage birth bean on RL (#71641)

 passerelle/contrib/toulouse_maelis/models.py  |  2 +-
 passerelle/contrib/toulouse_maelis/schemas.py | 79 +++++++++------
 .../data/toulouse_maelis/Q_create_family.xml  | 13 ++-
 tests/data/toulouse_maelis/Q_create_rl1.xml   |  4 +-
 tests/data/toulouse_maelis/Q_create_rl2.xml   |  4 +-
 .../data/toulouse_maelis/Q_update_family.xml  |  7 +-
 tests/data/toulouse_maelis/Q_update_rl1.xml   |  4 +-
 tests/data/toulouse_maelis/Q_update_rl2.xml   |  4 +-
 tests/data/toulouse_maelis/R_read_family.xml  | 15 ++-
 .../toulouse_maelis/R_read_family_relax.xml   | 15 ++-
 .../R_read_family_reordered.xml               | 15 ++-
 .../R_read_family_with_only_rl1.xml           |  6 +-
 .../data/toulouse_maelis/R_update_family.xml  | 12 ++-
 tests/test_toulouse_maelis.py                 | 99 ++++++++++++-------
 14 files changed, 198 insertions(+), 81 deletions(-)
passerelle/contrib/toulouse_maelis/models.py
471 471
        post={'request_body': {'schema': {'application/json': schemas.LINK_SCHEMA}}},
472 472
    )
473 473
    def link(self, request, NameID, post_data):
474 474
        family_id = post_data['family_id']
475 475
        response = self.call('Family', 'readFamily', dossierNumber=family_id)
476 476
        if not (
477 477
            response['RL1']['firstname'] == post_data['firstname'].upper()
478 478
            and response['RL1']['lastname'] == post_data['lastname'].upper()
479
            and response['RL1']['dateBirth'].strftime('%Y-%m-%d') == post_data['dateBirth']
479
            and response['RL1']['birth']['dateBirth'].strftime('%Y-%m-%d') == post_data['dateBirth']
480 480
        ):
481 481
            raise APIError("RL1 does not match '%s' family" % family_id, err_code='not-found')
482 482
        Link.objects.update_or_create(resource=self, name_id=NameID, defaults={'family_id': family_id})
483 483
        return {'data': 'ok'}
484 484

  
485 485
    @endpoint(
486 486
        display_category='Famille',
487 487
        description='Supprimer une liaison entre un compte usager et une famille',
passerelle/contrib/toulouse_maelis/schemas.py
19 19
    {'type': 'boolean'},
20 20
    {
21 21
        'type': 'string',
22 22
        'pattern': '^([Oo][Uu][Ii]|[Nn][Oo][Nn]|[Tt][Rr][Uu][Ee]|[Ff][Aa][Ll][Ss][Ee]|1|0)$',
23 23
        'pattern_description': 'Les valeurs "0", "1", "true", "false", "oui" ou "non" sont autorisées (insensibles à la casse).',
24 24
    },
25 25
]
26 26

  
27
ID_PROPERTIES = {
27
BASIC_ID_PROPERTIES = {
28 28
    'firstname': {
29 29
        'description': 'Prénom',
30 30
        'type': 'string',
31 31
    },
32 32
    'lastname': {
33 33
        'description': 'Nom',
34 34
        'type': 'string',
35 35
    },
......
49 49
    'properties': {
50 50
        'family_id': {
51 51
            'description': 'Numéro DUI',
52 52
            'type': 'string',
53 53
        },
54 54
    },
55 55
    'additionalProperties': False,
56 56
}
57
LINK_SCHEMA['properties'].update(ID_PROPERTIES)
57
LINK_SCHEMA['properties'].update(BASIC_ID_PROPERTIES)
58 58

  
59 59
ISEXISTS_SCHEMA = {
60 60
    '$schema': 'http://json-schema.org/draft-04/schema#',
61 61
    'title': 'Exist',
62 62
    'description': "Recherche d'un responsable légal ou d'un enfant dans Maelis",
63 63
    'type': 'object',
64 64
    'required': ['firstname', 'lastname', 'dateBirth'],
65
    'properties': ID_PROPERTIES,
65
    'properties': BASIC_ID_PROPERTIES,
66 66
    'additionalProperties': False,
67 67
}
68 68

  
69
BIRTH_SCHEMA = {
70
    '$schema': 'http://json-schema.org/draft-04/schema#',
71
    'title': 'Birth info',
72
    'description': "Informations relatives à la naissance",
73
    'type': 'object',
74
    'required': ['dateBirth'],
75
    'properties': {
76
        'dateBirth': {
77
            'description': 'Date de naissance',
78
            'type': 'string',
79
            'pattern': '^[0-9]{4}-[0-9]{2}-[0-9]{2}$',
80
        },
81
        'place': {
82
            'description': 'Lieu de naissance',
83
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
84
        },
85
        'communeCode': {
86
            'description': 'Commune de naissance (depuis référentiel)',
87
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
88
        },
89
        'countryCode': {
90
            'description': 'Pays de naissance (depuis référentiel)',
91
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
92
        },
93
    },
94
}
95

  
96
ID_PROPERTIES = {
97
    'firstname': {
98
        'description': 'Prénom',
99
        'type': 'string',
100
    },
101
    'lastname': {
102
        'description': 'Nom',
103
        'type': 'string',
104
    },
105
    'birth': BIRTH_SCHEMA,
106
}
107

  
69 108
ADDRESS_SCHEMA = {
70 109
    '$schema': 'http://json-schema.org/draft-04/schema#',
71 110
    'title': 'Address',
72 111
    'description': 'Informations sur une adresse',
73 112
    'type': 'object',
74 113
    'required': ['street1', 'town', 'zipcode'],
75 114
    'properties': {
76 115
        'num': {
......
201 240
    },
202 241
}
203 242

  
204 243
RLINFO_SCHEMA = {
205 244
    '$schema': 'http://json-schema.org/draft-04/schema#',
206 245
    'title': 'RL',
207 246
    'description': "Informations sur le responsable légal",
208 247
    'type': 'object',
209
    'required': ['firstname', 'lastname', 'civility', 'quality', 'dateBirth', 'adresse'],
248
    'required': ['firstname', 'lastname', 'civility', 'quality', 'birth', 'adresse'],
210 249
    'properties': {
211 250
        'civility': {
212 251
            'description': 'civilité (depuis référentiel)',
213 252
            'type': 'string',
214 253
            'pattern': '.+',
215 254
        },
216 255
        'quality': {
217 256
            'description': 'Qualité (depuis référentiel)',
218 257
            'type': 'string',
219 258
            'pattern': '.+',
220 259
        },
221 260
        'adresse': ADDRESS_SCHEMA,
222 261
        'contact': {'oneOf': [CONTACT_SCHEMA, {'type': 'null'}]},
223 262
        'profession': {'oneOf': [PROFESSION_SCHEMA, {'type': 'null'}]},
224 263
        'CAFInfo': {'oneOf': [CAFINFO_SCHEMA, {'type': 'null'}]},
225 264
    },
265
    'unflatten': True,
226 266
    'additionalProperties': False,
227 267
}
228 268
RLINFO_SCHEMA['properties'].update(ID_PROPERTIES)
229 269

  
230
CHILDBIRTH_SCHEMA = {
231
    '$schema': 'http://json-schema.org/draft-04/schema#',
232
    'title': 'Child birth',
233
    'description': "Informations sur la naissance d'un enfant",
234
    'type': 'object',
235
    'required': ['dateBirth'],
236
    'properties': {
237
        'dateBirth': {
238
            'description': 'Date de naissance',
239
            'type': 'string',
240
            'pattern': '^[0-9]{4}-[0-9]{2}-[0-9]{2}$',
241
        },
242
        'place': {
243
            'description': 'Lieu de naissance',
244
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
245
        },
246
    },
247
}
248

  
249 270
DOCTORADDRESS_SCHEMA = {
250 271
    '$schema': 'http://json-schema.org/draft-04/schema#',
251 272
    'title': 'Doctor address',
252 273
    'description': "Informations sur l'adresse du docteur",
253 274
    'type': 'object',
254 275
    'properties': {
255 276
        'street1': {
256 277
            'description': 'Libellé de la voie',
......
364 385
    'additionalProperties': False,
365 386
}
366 387

  
367 388
CHILD_SCHEMA = {
368 389
    '$schema': 'http://json-schema.org/draft-04/schema#',
369 390
    'title': 'Child',
370 391
    'description': "Informations sur la création d'un enfant",
371 392
    'type': 'object',
372
    'required': ['sexe', 'firstname', 'lastname'],
373
    'oneOf': [
374
        {'required': ['dateBirth']},  # createFamily
375
        {'required': ['birth']},  # updateFamily
376
    ],
393
    'required': ['sexe', 'firstname', 'lastname', 'birth'],
377 394
    'properties': {
378 395
        'sexe': {
379 396
            'description': 'Sexe (depuis référentiel)',
380 397
            'type': 'string',
381 398
            'pattern': '.+',
382 399
        },
383
        'birth': CHILDBIRTH_SCHEMA,
400
        'birth': BIRTH_SCHEMA,
384 401
        'dietcode': {
385 402
            'description': 'Code de régime alimentaire (depuis référentiel)',
386 403
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
387 404
        },
388 405
        'bPhoto': {
389 406
            'description': 'Autorisation photo',
390 407
            'oneOf': BOOLEAN_TYPES,
391 408
        },
......
441 458
            'description': 'Sexe (depuis référentiel)',
442 459
            'oneOf': [{'type': 'string'}, {'type': 'null'}],
443 460
        },
444 461
        'contact': {'oneOf': [CONTACTLIGHT_SCHEMA, {'type': 'null'}]},
445 462
    },
446 463
    'unflatten': True,
447 464
    'additionalProperties': False,
448 465
}
449
FAMILYPERSON_SCHEMA['properties'].update(ID_PROPERTIES)
466
FAMILYPERSON_SCHEMA['properties'].update(BASIC_ID_PROPERTIES)
450 467

  
451 468
AUTHORIZEDPERSON_SCHEMA = {
452 469
    '$schema': 'http://json-schema.org/draft-04/schema#',
453 470
    'title': 'Family persons',
454 471
    'description': "Informations sur les personnes autorisées à venir chercher les enfants ou à prévenir en cas d'urgence",
455 472
    'type': 'object',
456 473
    'properties': {
457 474
        'personList': {
......
535 552
del CREATE_RL1_SCHEMA['properties']['rl2']
536 553
del CREATE_RL1_SCHEMA['properties']['emergencyPersonList']
537 554
del CREATE_RL1_SCHEMA['properties']['childList']
538 555
del CREATE_RL1_SCHEMA['properties']['rl1']['properties']['contact']
539 556
del CREATE_RL1_SCHEMA['properties']['rl1']['properties']['profession']
540 557
del CREATE_RL1_SCHEMA['properties']['rl1']['properties']['CAFInfo']
541 558

  
542 559
UPDATE_RL1_SCHEMA = copy.deepcopy(RLINFO_SCHEMA)
543
UPDATE_RL1_SCHEMA['required'] = ['firstname', 'lastname', 'civility', 'quality', 'dateBirth']
560
UPDATE_RL1_SCHEMA['required'] = ['firstname', 'lastname', 'civility', 'quality', 'birth']
544 561
del UPDATE_RL1_SCHEMA['properties']['adresse']
545 562
del UPDATE_RL1_SCHEMA['properties']['contact']
546 563
del UPDATE_RL1_SCHEMA['properties']['profession']
547 564
del UPDATE_RL1_SCHEMA['properties']['CAFInfo']
548 565

  
549 566
CREATE_RL2_SCHEMA = copy.deepcopy(RLINFO_SCHEMA)
550 567
CREATE_RL2_SCHEMA['unflatten'] = True
551 568
del CREATE_RL2_SCHEMA['properties']['contact']
tests/data/toulouse_maelis/Q_create_family.xml
12 12
    <ns0:createFamily xmlns:ns0="family.ws.maelis.sigec.com">
13 13
      <category>ACCEUI</category>
14 14
      <situation>C</situation>
15 15
      <rl1>
16 16
        <firstname>Jhon</firstname>
17 17
        <lastname>Doe</lastname>
18 18
        <quality>AU</quality>
19 19
        <civility>M.</civility>
20
        <dateBirth>1938-07-26</dateBirth>
20
        <birth>
21
          <dateBirth>1938-07-26</dateBirth>
22
          <place>Rabbat</place>
23
          <countryCode>99350</countryCode>
24
        </birth>
21 25
        <adresse>
22 26
          <numComp>B</numComp>
23 27
          <street1>Chateau</street1>
24 28
          <town>Paris</town>
25 29
          <zipcode>75014</zipcode>
26 30
        </adresse>
27 31
        <profession>
28 32
          <codeCSP>ART</codeCSP>
......
30 34
        <CAFInfo>
31 35
          <organ>A10007752822</organ>
32 36
        </CAFInfo>
33 37
      </rl1>
34 38
      <childList>
35 39
        <firstname>Robert</firstname>
36 40
        <lastname>Zimmerman</lastname>
37 41
        <sexe>M</sexe>
38
        <dateBirth>1941-05-24</dateBirth>
42
        <birth>
43
          <dateBirth>1941-05-24</dateBirth>
44
          <place>Saint-louis</place>
45
          <communeCode>91122</communeCode>
46
          <countryCode>99100</countryCode>
47
        </birth>
39 48
        <dietcode>RSV</dietcode>
40 49
        <medicalRecord>
41 50
          <vaccinList>
42 51
            <code>DTC</code>
43 52
            <vaccinationDate>1940-07-26</vaccinationDate>
44 53
          </vaccinList>
45 54
        </medicalRecord>
46 55
      </childList>
tests/data/toulouse_maelis/Q_create_rl1.xml
12 12
    <ns0:createFamily xmlns:ns0="family.ws.maelis.sigec.com">
13 13
      <category>ACCEUI</category>
14 14
      <situation>C</situation>
15 15
      <rl1>
16 16
        <firstname>Jhon</firstname>
17 17
        <lastname>Doe</lastname>
18 18
        <quality>AU</quality>
19 19
        <civility>M.</civility>
20
        <dateBirth>1938-07-26</dateBirth>
20
        <birth>
21
          <dateBirth>1938-07-26</dateBirth>
22
        </birth>
21 23
        <adresse>
22 24
          <street1>Chateau</street1>
23 25
          <town>Paris</town>
24 26
          <zipcode>75014</zipcode>
25 27
        </adresse>
26 28
      </rl1>
27 29
    </ns0:createFamily>
28 30
  </soap-env:Body>
tests/data/toulouse_maelis/Q_create_rl2.xml
14 14
      <situation>M</situation>
15 15
      <flagCom>true</flagCom>
16 16
      <nbChild>2</nbChild>
17 17
      <rl2>
18 18
        <firstname>JANE</firstname>
19 19
        <lastname>DOE</lastname>
20 20
        <quality>MERE</quality>
21 21
        <civility>MME</civility>
22
        <dateBirth>1940-06-22</dateBirth>
22
        <birth>
23
          <dateBirth>1940-06-22</dateBirth>
24
        </birth>
23 25
        <adresse>
24 26
          <num>170</num>
25 27
          <street1>Chateau d'eau</street1>
26 28
          <town>Paris</town>
27 29
          <zipcode>75014</zipcode>
28 30
        </adresse>
29 31
      </rl2>
30 32
    </ns0:updateFamily>
tests/data/toulouse_maelis/Q_update_family.xml
13 13
      <dossierNumber>1312</dossierNumber>
14 14
      <category>BI</category>
15 15
      <situation>C</situation>
16 16
      <rl1>
17 17
        <firstname>Jhon</firstname>
18 18
        <lastname>Doe</lastname>
19 19
        <quality>AU</quality>
20 20
        <civility>M.</civility>
21
        <dateBirth>1938-07-26</dateBirth>
21
        <birth>
22
          <dateBirth>1938-07-26</dateBirth>
23
          <place>Rabbat</place>
24
          <communeCode/>
25
          <countryCode>99350</countryCode>
26
        </birth>
22 27
        <adresse>
23 28
          <numComp>B</numComp>
24 29
          <street1>Chateau</street1>
25 30
          <town>Paris</town>
26 31
          <zipcode>75014</zipcode>
27 32
        </adresse>
28 33
        <profession>
29 34
          <codeCSP>ART</codeCSP>
tests/data/toulouse_maelis/Q_update_rl1.xml
16 16
      <flagCom>true</flagCom>
17 17
      <nbChild>2</nbChild>
18 18
      <rl1>
19 19
        <num>613878</num>
20 20
        <firstname>Jhonny</firstname>
21 21
        <lastname>Doe</lastname>
22 22
        <quality>PERE</quality>
23 23
        <civility>M.</civility>
24
        <dateBirth>1943-06-15</dateBirth>
24
        <birth>
25
          <dateBirth>1943-06-15</dateBirth>
26
        </birth>
25 27
        <adresse>
26 28
          <num>170</num>
27 29
          <street1>Chateau d'eau</street1>
28 30
          <town>Paris</town>
29 31
          <zipcode>75014</zipcode>
30 32
        </adresse>
31 33
      </rl1>
32 34
    </ns0:updateFamily>
tests/data/toulouse_maelis/Q_update_rl2.xml
15 15
      <flagCom>true</flagCom>
16 16
      <nbChild>2</nbChild>
17 17
      <rl2>
18 18
        <num>613879</num>
19 19
        <firstname>JANE</firstname>
20 20
        <lastname>DOE</lastname>
21 21
        <quality>MERE</quality>
22 22
        <civility>MME</civility>
23
        <dateBirth>1940-06-22</dateBirth>
23
        <birth>
24
          <dateBirth>1940-06-22</dateBirth>
25
        </birth>
24 26
        <adresse>
25 27
          <num>170</num>
26 28
          <street1>Chateau d'eau</street1>
27 29
          <town>Paris</town>
28 30
          <zipcode>75014</zipcode>
29 31
        </adresse>
30 32
      </rl2>
31 33
    </ns0:updateFamily>
tests/data/toulouse_maelis/R_read_family.xml
8 8
        <flagCom>true</flagCom>
9 9
        <nbChild>2</nbChild>
10 10
        <RL1>
11 11
          <num>613878</num>
12 12
          <lastname>DOE</lastname>
13 13
          <firstname>JHON</firstname>
14 14
          <quality>PERE</quality>
15 15
          <civility>M.</civility>
16
          <dateBirth>1938-07-26T00:00:00+01:00</dateBirth>
16
          <birth>
17
            <dateBirth>1938-07-26T00:00:00+01:00</dateBirth>
18
            <place>Rabbat</place>
19
            <countryCode>99350</countryCode>
20
          </birth>
17 21
          <adresse>
18 22
            <idStreet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
19 23
            <num>170</num>
20 24
            <street1>Chateau d'eau</street1>
21 25
            <town>Paris</town>
22 26
            <zipcode>75014</zipcode>
23 27
          </adresse>
24 28
          <contact>
......
34 38
          </profession>
35 39
        </RL1>
36 40
        <RL2>
37 41
          <num>613879</num>
38 42
          <lastname>DOE</lastname>
39 43
          <firstname>JANE</firstname>
40 44
          <quality>MERE</quality>
41 45
          <civility>MME</civility>
42
          <dateBirth>1940-06-22T00:00:00+02:00</dateBirth>
46
          <birth>
47
            <dateBirth>1940-06-22T00:00:00+02:00</dateBirth>
48
            <place>Bardot</place>
49
            <countryCode>99351</countryCode>
50
          </birth>
43 51
          <adresse>
44 52
            <idStreet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
45 53
            <num>170</num>
46 54
            <street1>Chateau d'eau</street1>
47 55
            <town>Paris</town>
48 56
            <zipcode>75014</zipcode>
49 57
          </adresse>
50 58
          <contact>
......
80 88
        </emergencyPersonList>
81 89
        <childList>
82 90
          <num>613880</num>
83 91
          <lastname>DOE</lastname>
84 92
          <firstname>JANNIS</firstname>
85 93
          <sexe>F</sexe>
86 94
          <birth>
87 95
            <dateBirth>1943-01-19T00:00:00+01:00</dateBirth>
96
            <place>Saint-louis</place>
97
            <communeCode>91122</communeCode>
98
            <countryCode>99100</countryCode>
88 99
          </birth>
89 100
          <dietcode>RSV</dietcode>
90 101
          <bPhoto>true</bPhoto>
91 102
          <bLeaveAlone>false</bLeaveAlone>
92 103
          <authorizedPersonList>
93 104
            <personInfo>
94 105
              <num>614719</num>
95 106
              <lastname>BENT</lastname>
tests/data/toulouse_maelis/R_read_family_relax.xml
8 8
        <flagCom>true</flagCom>
9 9
        <nbChild>2</nbChild>
10 10
        <RL1>
11 11
          <num>613878</num>
12 12
          <lastname>DOE</lastname>
13 13
          <firstname>JHON</firstname>
14 14
          <quality>PERE</quality>
15 15
          <civility>M.</civility>
16
          <dateBirth>1938-07-26T00:00:00+01:00</dateBirth>
16
          <birth>
17
            <dateBirth>1938-07-26T00:00:00+01:00</dateBirth>
18
            <place>Rabbat</place>
19
            <countryCode>99350</countryCode>
20
          </birth>
17 21
          <adresse>
18 22
            <idStreet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
19 23
            <num>170</num>
20 24
            <street1>Chateau d'eau</street1>
21 25
            <town>Paris</town>
22 26
            <zipcode>75014</zipcode>
23 27
          </adresse>
24 28
          <contact>
......
33 37
            <addressPro/>
34 38
          </profession>
35 39
        </RL1>
36 40
        <RL2>
37 41
          <num>613879</num>
38 42
          <lastname>DOE</lastname>
39 43
          <firstname>JANE</firstname>
40 44
          <civility>MME</civility>
41
          <dateBirth>1940-06-22T00:00:00+02:00</dateBirth>
45
          <birth>
46
            <dateBirth>1940-06-22T00:00:00+02:00</dateBirth>
47
            <place>Bardot</place>
48
            <countryCode>99351</countryCode>
49
          </birth>
42 50
          <adresse>
43 51
            <idStreet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
44 52
            <num>170</num>
45 53
            <street1>Chateau d'eau</street1>
46 54
            <town>Paris</town>
47 55
            <zipcode>75014</zipcode>
48 56
          </adresse>
49 57
          <contact>
......
79 87
        </emergencyPersonList>
80 88
        <childList>
81 89
          <num>613880</num>
82 90
          <lastname>DOE</lastname>
83 91
          <firstname>JANNIS</firstname>
84 92
          <sexe>F</sexe>
85 93
          <birth>
86 94
            <dateBirth>1943-01-19T00:00:00+01:00</dateBirth>
95
            <place>Saint-louis</place>
96
            <communeCode>91122</communeCode>
97
            <countryCode>99100</countryCode>
87 98
          </birth>
88 99
          <dietcode>RSV</dietcode>
89 100
          <bPhoto>true</bPhoto>
90 101
          <bLeaveAlone>false</bLeaveAlone>
91 102
          <authorizedPersonList>
92 103
            <personInfo>
93 104
              <num>614719</num>
94 105
              <lastname>BENT</lastname>
tests/data/toulouse_maelis/R_read_family_reordered.xml
8 8
        <flagCom>true</flagCom>
9 9
        <nbChild>2</nbChild>
10 10
        <RL1>
11 11
          <num>613878</num>
12 12
          <lastname>DOE</lastname>
13 13
          <firstname>JHON</firstname>
14 14
          <quality>PERE</quality>
15 15
          <civility>M.</civility>
16
          <dateBirth>1938-07-26T00:00:00+01:00</dateBirth>
16
          <birth>
17
            <dateBirth>1938-07-26T00:00:00+01:00</dateBirth>
18
            <place>Rabbat</place>
19
            <countryCode>99350</countryCode>
20
          </birth>
17 21
          <adresse>
18 22
            <idStreet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
19 23
            <num>170</num>
20 24
            <street1>Chateau d'eau</street1>
21 25
            <town>Paris</town>
22 26
            <zipcode>75014</zipcode>
23 27
          </adresse>
24 28
          <contact>
......
34 38
          </profession>
35 39
        </RL1>
36 40
        <RL2>
37 41
          <num>613879</num>
38 42
          <lastname>DOE</lastname>
39 43
          <firstname>JANE</firstname>
40 44
          <quality>MERE</quality>
41 45
          <civility>MME</civility>
42
          <dateBirth>1940-06-22T00:00:00+02:00</dateBirth>
46
          <birth>
47
            <dateBirth>1940-06-22T00:00:00+02:00</dateBirth>
48
            <place>Bardot</place>
49
            <countryCode>99351</countryCode>
50
          </birth>
43 51
          <adresse>
44 52
            <idStreet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
45 53
            <num>170</num>
46 54
            <street1>Chateau d'eau</street1>
47 55
            <town>Paris</town>
48 56
            <zipcode>75014</zipcode>
49 57
          </adresse>
50 58
          <contact>
......
80 88
        </emergencyPersonList>
81 89
        <childList>
82 90
          <num>613880</num>
83 91
          <lastname>DOE</lastname>
84 92
          <firstname>JANNIS</firstname>
85 93
          <sexe>F</sexe>
86 94
          <birth>
87 95
            <dateBirth>1943-01-19T00:00:00+01:00</dateBirth>
96
            <place>Saint-louis</place>
97
            <communeCode>91122</communeCode>
98
            <countryCode>99100</countryCode>
88 99
          </birth>
89 100
          <dietcode>RSV</dietcode>
90 101
          <bPhoto>true</bPhoto>
91 102
          <bLeaveAlone>false</bLeaveAlone>
92 103
          <authorizedPersonList>
93 104
            <personInfo>
94 105
              <num>614719</num>
95 106
              <lastname>BENT</lastname>
tests/data/toulouse_maelis/R_read_family_with_only_rl1.xml
8 8
        <flagCom>true</flagCom>
9 9
        <nbChild>2</nbChild>
10 10
        <RL1>
11 11
          <num>613878</num>
12 12
          <lastname>DOE</lastname>
13 13
          <firstname>JHON</firstname>
14 14
          <quality>PERE</quality>
15 15
          <civility>M.</civility>
16
          <dateBirth>1938-07-26T00:00:00+01:00</dateBirth>
16
          <birth>
17
            <dateBirth>1938-07-26T00:00:00+01:00</dateBirth>
18
            <place>Rabbat</place>
19
            <countryCode>99350</countryCode>
20
          </birth>
17 21
          <adresse>
18 22
            <idStreet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
19 23
            <num>170</num>
20 24
            <street1>Chateau d'eau</street1>
21 25
            <town>Paris</town>
22 26
            <zipcode>75014</zipcode>
23 27
          </adresse>
24 28
          <contact>
tests/data/toulouse_maelis/R_update_family.xml
7 7
        <category>BI</category>
8 8
        <situation>C</situation>
9 9
        <RL1>
10 10
          <num>613955</num>
11 11
          <lastname>DOE</lastname>
12 12
          <firstname>JHON</firstname>
13 13
          <quality>AU</quality>
14 14
          <civility>MR</civility>
15
          <dateBirth>1938-07-26T00:00:00+01:00</dateBirth>
15
          <birth>
16
            <dateBirth>1938-07-26T00:00:00+01:00</dateBirth>
17
            <place>Rabbat</place>
18
            <countryCode>99350</countryCode>
19
          </birth>
16 20
          <adresse>
17 21
            <idStreet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
18 22
            <num>0</num>
19 23
            <street1>Chateau</street1>
20 24
            <town>Paris</town>
21 25
            <zipcode>75014</zipcode>
22 26
          </adresse>
23 27
          <contact>
......
27 31
          </contact>
28 32
        </RL1>
29 33
        <RL2>
30 34
          <num>614062</num>
31 35
          <lastname>DOE</lastname>
32 36
          <firstname>JANNETTE</firstname>
33 37
          <quality>MERE</quality>
34 38
          <civility>MR</civility>
35
          <dateBirth>1940-06-22T00:00:00+02:00</dateBirth>
39
          <birth>
40
            <dateBirth>1940-06-22T00:00:00+02:00</dateBirth>
41
            <place>Bardot</place>
42
            <countryCode>99351</countryCode>
43
          </birth>
36 44
          <adresse>
37 45
            <idStreet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
38 46
            <num>0</num>
39 47
            <street1>Chateau</street1>
40 48
            <town>Paris</town>
41 49
            <zipcode>75014</zipcode>
42 50
          </adresse>
43 51
          <contact>
tests/test_toulouse_maelis.py
582 582
    del data['profession']
583 583
    assert data == {
584 584
        'num': '613878',
585 585
        'lastname': 'DOE',
586 586
        'firstname': 'JHON',
587 587
        'maidenName': None,
588 588
        'quality': 'PERE',
589 589
        'civility': 'M.',
590
        'dateBirth': '1938-07-26T00:00:00+01:00',
590
        'birth': {
591
            'communeCode': None,
592
            'countryCode': '99350',
593
            'dateBirth': '1938-07-26T00:00:00+01:00',
594
            'place': 'Rabbat',
595
        },
591 596
        'adresse': {
592 597
            'idStreet': None,
593 598
            'num': 170,
594 599
            'numComp': None,
595 600
            'street1': "Chateau d'eau",
596 601
            'street2': None,
597 602
            'town': 'Paris',
598 603
            'zipcode': '75014',
......
617 622
    del data['authorizedPersonList']
618 623
    del data['paiInfoBean']
619 624
    assert data == {
620 625
        'num': '613880',
621 626
        'lastname': 'DOE',
622 627
        'firstname': 'JANNIS',
623 628
        'sexe': 'F',
624 629
        'sexe_text': 'Féminin',
625
        'birth': {'dateBirth': '1943-01-19T00:00:00+01:00', 'place': None},
630
        'birth': {
631
            'dateBirth': '1943-01-19T00:00:00+01:00',
632
            'place': 'Saint-louis',
633
            'communeCode': '91122',
634
            'countryCode': '99100',
635
        },
626 636
        'dietcode': 'RSV',
627 637
        'dietcode_text': '3- RÉGIME SANS VIANDE',
628 638
        'bPhoto': True,
629 639
        'bLeaveAlone': False,
630 640
        'insurance': None,
631 641
        'indicatorList': [],
632 642
        'subscribeSchoolList': [],
633 643
        'mother': {'num': 613963, 'civility': 'MME', 'firstname': 'JANE', 'lastname': 'DOE'},
......
758 768
    assert resp.json['err'] == 0
759 769
    assert resp.json['data'] == {
760 770
        'num': '613879',
761 771
        'lastname': 'DOE',
762 772
        'firstname': 'JANE',
763 773
        'maidenName': None,
764 774
        'quality': 'MERE',
765 775
        'civility': 'MME',
766
        'dateBirth': '1940-06-22T00:00:00+02:00',
776
        'birth': {
777
            'communeCode': None,
778
            'countryCode': '99351',
779
            'dateBirth': '1940-06-22T00:00:00+02:00',
780
            'place': 'Bardot',
781
        },
767 782
        'adresse': {
768 783
            'idStreet': None,
769 784
            'num': 170,
770 785
            'numComp': None,
771 786
            'street1': "Chateau d'eau",
772 787
            'street2': None,
773 788
            'town': 'Paris',
774 789
            'zipcode': '75014',
......
1041 1056
    url = get_endpoint('create-family')
1042 1057
    params = {
1043 1058
        'category': 'ACCEUI',
1044 1059
        'situation': 'C',
1045 1060
        'rl1/civility': 'M.',
1046 1061
        'rl1/firstname': 'Jhon',
1047 1062
        'rl1/lastname': 'Doe',
1048 1063
        'rl1/quality': 'AU',
1049
        'rl1/dateBirth': '1938-07-26',
1064
        'rl1/birth/communeCode': None,
1065
        'rl1/birth/countryCode': '99350',
1066
        'rl1/birth/dateBirth': '1938-07-26',
1067
        'rl1/birth/place': 'Rabbat',
1050 1068
        'rl1/adresse/street1': 'Chateau',
1051 1069
        'rl1/adresse/town': 'Paris',
1052 1070
        'rl1/adresse/zipcode': '75014',
1053 1071
        'rl1/adresse/numComp': 'B',
1054 1072
        'rl1/profession/codeCSP': 'ART',
1055 1073
        'rl1/CAFInfo/organ': 'A10007752822',
1056 1074
        'childList/0/lastname': 'Zimmerman',
1057 1075
        'childList/0/firstname': 'Robert',
1058 1076
        'childList/0/sexe': 'M',
1059
        'childList/0/dateBirth': '1941-05-24',
1077
        'childList/0/birth/dateBirth': '1941-05-24',
1078
        'childList/0/birth/place': 'Saint-louis',
1079
        'childList/0/birth/communeCode': '91122',
1080
        'childList/0/birth/countryCode': '99100',
1060 1081
        'childList/0/dietcode': 'RSV',
1061 1082
        'childList/0/medicalRecord/vaccinList/0/code': 'DTC',
1062 1083
        'childList/0/medicalRecord/vaccinList/0/vaccinationDate': '1940-07-26',
1063 1084
    }
1064 1085

  
1065 1086
    resp = app.post_json(url + '?NameID=local', params=params)
1066 1087
    assert_sent_payload(mocked_post, 'Q_create_family.xml')
1067 1088
    assert resp.json['err'] == 0
......
1078 1099
    url = get_endpoint('create-family')
1079 1100
    params = {
1080 1101
        'category': '',
1081 1102
        'situation': 'C',
1082 1103
        'rl1/civility': 'M.',
1083 1104
        'rl1/firstname': 'Jhon',
1084 1105
        'rl1/lastname': 'Doe',
1085 1106
        'rl1/quality': 'AU',
1086
        'rl1/dateBirth': '1938-07-26',
1107
        'rl1/birth/dateBirth': '1938-07-26',
1087 1108
        'rl1/adresse/street1': 'Chateau',
1088 1109
        'rl1/adresse/town': 'Paris',
1089 1110
        'rl1/adresse/zipcode': '75014',
1090 1111
    }
1091 1112

  
1092 1113
    resp = app.post_json(url + '?NameID=local', params=params, status=400)
1093 1114
    assert resp.json['err'] == 1
1094 1115
    assert resp.json['err_desc'] == "category: '' does not match '.+'"
......
1098 1119
    url = get_endpoint('create-family')
1099 1120
    params = {
1100 1121
        'category': 'ACCEUI',
1101 1122
        'situation': 'C',
1102 1123
        'rl1/civility': 'M.',
1103 1124
        'rl1/firstname': 'Jhon',
1104 1125
        'rl1/lastname': 'Doe',
1105 1126
        'rl1/quality': 'AU',
1106
        'rl1/dateBirth': '1938-07-26',
1127
        'rl1/birth/dateBirth': '1938-07-26',
1107 1128
        'rl1/adresse/street1': 'Chateau',
1108 1129
        'rl1/adresse/town': 'Paris',
1109 1130
        'rl1/adresse/zipcode': '75014',
1110 1131
    }
1111 1132

  
1112 1133
    Link.objects.create(resource=con, family_id='1312', name_id='local')
1113 1134
    resp = app.post_json(url + '?NameID=local', params=params)
1114 1135
    assert resp.json['err'] == 'already-linked'
......
1129 1150
    url = get_endpoint('create-family')
1130 1151
    params = {
1131 1152
        'category': 'ACCEUI',
1132 1153
        'situation': 'C',
1133 1154
        'rl1/civility': 'M.',
1134 1155
        'rl1/firstname': 'Jhon',
1135 1156
        'rl1/lastname': 'Doe',
1136 1157
        'rl1/quality': 'AU',
1137
        'rl1/dateBirth': '1938-07-26',
1158
        'rl1/birth/dateBirth': '1938-07-26',
1138 1159
        'rl1/adresse/street1': 'Chateau',
1139 1160
        'rl1/adresse/town': 'Paris',
1140 1161
        'rl1/adresse/zipcode': '75014',
1141 1162
    }
1142 1163

  
1143 1164
    resp = app.post_json(url + '?NameID=local', params=params)
1144 1165
    assert resp.json['err'] == 'E54a, E54a'
1145 1166
    assert 'Il existe déjà' in resp.json['err_desc']
......
1162 1183
    url = get_endpoint('create-family')
1163 1184
    params = {
1164 1185
        'category': 'ACCEUI',
1165 1186
        'situation': 'C',
1166 1187
        'rl1/civility': 'M.',
1167 1188
        'rl1/firstname': 'Jhon',
1168 1189
        'rl1/lastname': 'Doe',
1169 1190
        'rl1/quality': 'AU',
1170
        'rl1/dateBirth': '1938-07-26',
1191
        'rl1/birth/communeCode': None,
1192
        'rl1/birth/countryCode': '99350',
1193
        'rl1/birth/dateBirth': '1938-07-26',
1194
        'rl1/birth/place': 'Rabbat',
1171 1195
        'rl1/adresse/street1': 'Chateau',
1172 1196
        'rl1/adresse/town': 'Paris',
1173 1197
        'rl1/adresse/zipcode': '75014',
1174 1198
        'rl1/adresse/numComp': 'B',
1175 1199
        'rl1/profession/codeCSP': 'ART',
1176 1200
        'rl1/CAFInfo/organ': 'A10007752822',
1177 1201
        'childList/0/lastname': 'Zimmerman',
1178 1202
        'childList/0/firstname': 'Robert',
1179 1203
        'childList/0/sexe': 'M',
1180
        'childList/0/dateBirth': '1941-05-24',
1204
        'childList/0/birth/dateBirth': '1941-05-24',
1205
        'childList/0/birth/place': 'Saint-louis',
1206
        'childList/0/birth/communeCode': '91122',
1207
        'childList/0/birth/countryCode': '99100',
1181 1208
        'childList/0/dietcode': 'RSV',
1182 1209
        'childList/0/medicalRecord/vaccinList/0/code': 'plop',
1183 1210
        'childList/0/medicalRecord/vaccinList/0/vaccinationDate': '1940-07-26',
1184 1211
    }
1185 1212

  
1186 1213
    resp = app.post_json(url + '?NameID=local', params=params)
1187 1214
    assert resp.json['err'] == 'wrong-key'
1188 1215
    assert (
......
1210 1237
    url = get_endpoint('update-family')
1211 1238
    params = {
1212 1239
        'category': 'BI',
1213 1240
        'situation': 'C',
1214 1241
        'rl1/civility': 'M.',
1215 1242
        'rl1/firstname': 'Jhon',
1216 1243
        'rl1/lastname': 'Doe',
1217 1244
        'rl1/quality': 'AU',
1218
        'rl1/dateBirth': '1938-07-26',
1245
        'rl1/birth/communeCode': None,
1246
        'rl1/birth/countryCode': '99350',
1247
        'rl1/birth/dateBirth': '1938-07-26',
1248
        'rl1/birth/place': 'Rabbat',
1219 1249
        'rl1/adresse/street1': 'Chateau',
1220 1250
        'rl1/adresse/town': 'Paris',
1221 1251
        'rl1/adresse/zipcode': '75014',
1222 1252
        'rl1/adresse/numComp': 'B',
1223 1253
        'rl1/profession/codeCSP': 'ART',
1224 1254
        'rl1/CAFInfo/organ': 'A10007752822',
1225 1255
        'emergencyPersonList/0/personList/0/civility': 'MME',
1226 1256
        'emergencyPersonList/0/personList/0/firstname': 'Keny',
......
1251 1281
    url = get_endpoint('update-family')
1252 1282
    params = {
1253 1283
        'category': 'BI',
1254 1284
        'situation': 'C',
1255 1285
        'rl1/civility': 'M.',
1256 1286
        'rl1/firstname': 'Jhon',
1257 1287
        'rl1/lastname': 'Doe',
1258 1288
        'rl1/quality': 'AU',
1259
        'rl1/dateBirth': '1938-07-26',
1289
        'rl1/birth/dateBirth': '1938-07-26',
1260 1290
        'rl1/adresse/street1': 'Chateau',
1261 1291
        'rl1/adresse/town': 'Paris',
1262 1292
        'rl1/adresse/zipcode': '75014',
1263 1293
    }
1264 1294

  
1265 1295
    resp = app.post_json(url + '?NameID=local', params=params)
1266 1296
    assert resp.json['err'] == 'not-linked'
1267 1297
    assert resp.json['err_desc'] == 'User not linked to family'
......
1302 1332
    params = {
1303 1333
        'nbChild': '100',
1304 1334
        'category': 'BI',
1305 1335
        'situation': 'C',
1306 1336
        'rl1/civility': 'M.',
1307 1337
        'rl1/firstname': 'Jhon',
1308 1338
        'rl1/lastname': 'Doe',
1309 1339
        'rl1/quality': 'AU',
1310
        'rl1/dateBirth': '1938-07-26',
1340
        'rl1/birth/dateBirth': '1938-07-26',
1311 1341
        'rl1/adresse/street1': 'Chateau',
1312 1342
        'rl1/adresse/town': 'Paris',
1313 1343
        'rl1/adresse/zipcode': '75014',
1314 1344
    }
1315 1345

  
1316 1346
    Link.objects.create(resource=con, family_id='1312', name_id='local')
1317 1347
    resp = app.post_json(url + '?NameID=local', params=params)
1318 1348
    assert resp.json['err'] == 'Family-readCategoryList-soap:Server'
......
1337 1367
    url = get_endpoint('update-family')
1338 1368
    params = {
1339 1369
        'category': 'BI',
1340 1370
        'situation': 'C',
1341 1371
        'rl1/civility': 'M.',
1342 1372
        'rl1/firstname': 'Jhon',
1343 1373
        'rl1/lastname': 'Doe',
1344 1374
        'rl1/quality': 'AU',
1345
        'rl1/dateBirth': '1938-07-26',
1375
        'rl1/birth/communeCode': None,
1376
        'rl1/birth/countryCode': '99350',
1377
        'rl1/birth/dateBirth': '1938-07-26',
1378
        'rl1/birth/place': 'Rabbat',
1346 1379
        'rl1/adresse/street1': 'Chateau',
1347 1380
        'rl1/adresse/town': 'Paris',
1348 1381
        'rl1/adresse/zipcode': '75014',
1349 1382
        'rl1/adresse/numComp': 'B',
1350 1383
        'rl1/profession/codeCSP': 'ART',
1351 1384
        'rl1/CAFInfo/organ': 'A10007752822',
1352 1385
        'emergencyPersonList/0/personList/0/civility': 'MME',
1353 1386
        'emergencyPersonList/0/personList/0/firstname': 'Keny',
......
1389 1422
    url = get_endpoint('create-rl1')
1390 1423
    params = {
1391 1424
        'category': 'ACCEUI',
1392 1425
        'situation': 'C',
1393 1426
        'rl1/civility': 'M.',
1394 1427
        'rl1/firstname': 'Jhon',
1395 1428
        'rl1/lastname': 'Doe',
1396 1429
        'rl1/quality': 'AU',
1397
        'rl1/dateBirth': '1938-07-26',
1430
        'rl1/birth/dateBirth': '1938-07-26',
1398 1431
        'rl1/adresse/street1': 'Chateau',
1399 1432
        'rl1/adresse/town': 'Paris',
1400 1433
        'rl1/adresse/zipcode': '75014',
1401 1434
    }
1402 1435

  
1403 1436
    resp = app.post_json(url + '?NameID=local', params=params)
1404 1437
    assert_sent_payload(mocked_post, 'Q_create_rl1.xml')
1405 1438
    assert resp.json['err'] == 0
......
1411 1444
    url = get_endpoint('create-rl1')
1412 1445
    params = {
1413 1446
        'category': 'ACCEUI',
1414 1447
        'situation': 'C',
1415 1448
        'rl1/civility': '',
1416 1449
        'rl1/firstname': 'Jhon',
1417 1450
        'rl1/lastname': 'Doe',
1418 1451
        'rl1/quality': '',
1419
        'rl1/dateBirth': '1938-07-26',
1452
        'rl1/birth/dateBirth': '1938-07-26',
1420 1453
        'rl1/adresse/street1': 'Chateau',
1421 1454
        'rl1/adresse/town': 'Paris',
1422 1455
        'rl1/adresse/zipcode': '75014',
1423 1456
    }
1424 1457

  
1425 1458
    resp = app.post_json(url + '?NameID=local', params=params, status=400)
1426 1459
    assert resp.json['err'] == 1
1427 1460
    assert resp.json['err_desc'] == "rl1/civility: '' does not match '.+'"
......
1431 1464
    url = get_endpoint('create-rl1')
1432 1465
    params = {
1433 1466
        'category': 'ACCEUI',
1434 1467
        'situation': 'C',
1435 1468
        'rl1/civility': 'M.',
1436 1469
        'rl1/firstname': 'Jhon',
1437 1470
        'rl1/lastname': 'Doe',
1438 1471
        'rl1/quality': 'AU',
1439
        'rl1/dateBirth': '1938-07-26',
1472
        'rl1/birth/dateBirth': '1938-07-26',
1440 1473
        'rl1/adresse/street1': 'Chateau',
1441 1474
        'rl1/adresse/town': 'Paris',
1442 1475
        'rl1/adresse/zipcode': '75014',
1443 1476
    }
1444 1477

  
1445 1478
    Link.objects.create(resource=con, family_id='1312', name_id='local')
1446 1479
    resp = app.post_json(url + '?NameID=local', params=params)
1447 1480
    assert resp.json['err'] == 'already-linked'
......
1456 1489
    url = get_endpoint('create-rl1')
1457 1490
    params = {
1458 1491
        'category': 'ACCEUI',
1459 1492
        'situation': 'C',
1460 1493
        'rl1/civility': 'M.',
1461 1494
        'rl1/firstname': 'Jhon',
1462 1495
        'rl1/lastname': 'Doe',
1463 1496
        'rl1/quality': 'AU',
1464
        'rl1/dateBirth': '1938-07-26',
1497
        'rl1/birth/dateBirth': '1938-07-26',
1465 1498
        'rl1/adresse/numComp': 'plop',
1466 1499
        'rl1/adresse/street1': 'Chateau',
1467 1500
        'rl1/adresse/town': 'Paris',
1468 1501
        'rl1/adresse/zipcode': '75014',
1469 1502
    }
1470 1503

  
1471 1504
    resp = app.post_json(url + '?NameID=local', params=params)
1472 1505
    assert resp.json['err'] == 'wrong-key'
......
1490 1523
    url = get_endpoint('create-rl1')
1491 1524
    params = {
1492 1525
        'category': 'ACCEUI',
1493 1526
        'situation': 'C',
1494 1527
        'rl1/civility': 'M.',
1495 1528
        'rl1/firstname': 'Jhon',
1496 1529
        'rl1/lastname': 'Doe',
1497 1530
        'rl1/quality': 'AU',
1498
        'rl1/dateBirth': '1938-07-26',
1531
        'rl1/birth/dateBirth': '1938-07-26',
1499 1532
        'rl1/adresse/street1': 'Chateau',
1500 1533
        'rl1/adresse/town': 'Paris',
1501 1534
        'rl1/adresse/zipcode': '75014',
1502 1535
    }
1503 1536

  
1504 1537
    resp = app.post_json(url + '?NameID=local', params=params)
1505 1538
    assert resp.json['err'] == 'already-rl1'
1506 1539
    assert 'Il existe déjà' in resp.json['err_desc']
......
1512 1545
    mocked_get.return_value = FAMILY_SERVICE_WSDL
1513 1546
    mocked_post.side_effect = [READ_RL1_FAMILY, READ_CIVILITIES, READ_QUALITIES, UPDATE_FAMILY]
1514 1547
    url = get_endpoint('update-rl1')
1515 1548
    params = {
1516 1549
        'civility': 'M.',
1517 1550
        'firstname': 'Jhonny',
1518 1551
        'lastname': 'Doe',
1519 1552
        'quality': 'PERE',
1520
        'dateBirth': '1943-06-15',
1553
        'birth/dateBirth': '1943-06-15',
1521 1554
    }
1522 1555

  
1523 1556
    Link.objects.create(resource=con, family_id='1312', name_id='local')
1524 1557
    resp = app.post_json(url + '?NameID=local', params=params)
1525 1558
    assert_sent_payload(mocked_post, 'Q_update_rl1.xml')
1526 1559
    assert resp.json['err'] == 0
1527 1560

  
1528 1561

  
1529 1562
def test_update_rl1_not_linked_error(con, app):
1530 1563
    url = get_endpoint('update-rl1')
1531 1564
    params = {
1532 1565
        'civility': 'M.',
1533 1566
        'firstname': 'Jhonny',
1534 1567
        'lastname': 'Doe',
1535 1568
        'quality': 'PERE',
1536
        'dateBirth': '1943-06-15',
1569
        'birth/dateBirth': '1943-06-15',
1537 1570
    }
1538 1571

  
1539 1572
    resp = app.post_json(url + '?NameID=local', params=params)
1540 1573
    assert resp.json['err'] == 'not-linked'
1541 1574
    assert resp.json['err_desc'] == 'User not linked to family'
1542 1575

  
1543 1576

  
1544 1577
@mock.patch('passerelle.utils.Request.get')
......
1547 1580
    mocked_get.return_value = FAMILY_SERVICE_WSDL
1548 1581
    mocked_post.side_effect = CONNECTION_ERROR
1549 1582
    url = get_endpoint('update-rl1')
1550 1583
    params = {
1551 1584
        'civility': 'M.',
1552 1585
        'firstname': 'Jhonny',
1553 1586
        'lastname': 'Doe',
1554 1587
        'quality': 'PERE',
1555
        'dateBirth': '1943-06-15',
1588
        'birth/dateBirth': '1943-06-15',
1556 1589
    }
1557 1590

  
1558 1591
    Link.objects.create(resource=con, family_id='1312', name_id='local')
1559 1592
    resp = app.post_json(url + '?NameID=local', params=params, status=500)
1560 1593
    assert resp.json['err']
1561 1594
    assert resp.json['err_desc'] == 'No address associated with hostname'
1562 1595

  
1563 1596

  
......
1567 1600
    mocked_get.return_value = FAMILY_SERVICE_WSDL
1568 1601
    mocked_post.side_effect = [READ_FAMILY, READ_CIVILITIES, READ_QUALITIES]
1569 1602
    url = get_endpoint('update-rl1')
1570 1603
    params = {
1571 1604
        'civility': 'M.',
1572 1605
        'firstname': 'Jhonny',
1573 1606
        'lastname': 'Doe',
1574 1607
        'quality': 'plop',
1575
        'dateBirth': '1943-06-15',
1608
        'birth/dateBirth': '1943-06-15',
1576 1609
    }
1577 1610

  
1578 1611
    Link.objects.create(resource=con, family_id='1312', name_id='local')
1579 1612
    resp = app.post_json(url + '?NameID=local', params=params)
1580 1613
    assert resp.json['err'] == 'wrong-key'
1581 1614
    assert resp.json['err_desc'] == "quality key value 'plop' do not belong to 'Quality' required referential"
1582 1615

  
1583 1616

  
......
1587 1620
    mocked_get.return_value = FAMILY_SERVICE_WSDL
1588 1621
    mocked_post.side_effect = [READ_RL1_FAMILY, READ_CIVILITIES, READ_QUALITIES, UPDATE_FAMILY]
1589 1622
    url = get_endpoint('create-rl2')
1590 1623
    params = {
1591 1624
        'civility': 'MME',
1592 1625
        'firstname': 'JANE',
1593 1626
        'lastname': 'DOE',
1594 1627
        'quality': 'MERE',
1595
        'dateBirth': '1940-06-22',
1628
        'birth/dateBirth': '1940-06-22',
1596 1629
        'adresse/num': '170',
1597 1630
        'adresse/street1': "Chateau d'eau",
1598 1631
        'adresse/town': 'Paris',
1599 1632
        'adresse/zipcode': '75014',
1600 1633
    }
1601 1634

  
1602 1635
    Link.objects.create(resource=con, family_id='1312', name_id='local')
1603 1636
    resp = app.post_json(url + '?NameID=local', params=params)
......
1608 1641

  
1609 1642
def test_create_rl2_not_linked_error(con, app):
1610 1643
    url = get_endpoint('create-rl2')
1611 1644
    params = {
1612 1645
        'civility': 'MME',
1613 1646
        'firstname': 'JANE',
1614 1647
        'lastname': 'DOE',
1615 1648
        'quality': 'MERE',
1616
        'dateBirth': '1940-06-22',
1649
        'birth/dateBirth': '1940-06-22',
1617 1650
        'adresse/num': '170',
1618 1651
        'adresse/street1': "Chateau d'eau",
1619 1652
        'adresse/town': 'Paris',
1620 1653
        'adresse/zipcode': '75014',
1621 1654
    }
1622 1655

  
1623 1656
    resp = app.post_json(url + '?NameID=local', params=params)
1624 1657
    assert resp.json['err'] == 'not-linked'
......
1631 1664
    mocked_get.return_value = FAMILY_SERVICE_WSDL
1632 1665
    mocked_post.side_effect = CONNECTION_ERROR
1633 1666
    url = get_endpoint('create-rl2')
1634 1667
    params = {
1635 1668
        'civility': 'MME',
1636 1669
        'firstname': 'JANE',
1637 1670
        'lastname': 'DOE',
1638 1671
        'quality': 'MERE',
1639
        'dateBirth': '1940-06-22',
1672
        'birth/dateBirth': '1940-06-22',
1640 1673
        'adresse/num': '170',
1641 1674
        'adresse/street1': "Chateau d'eau",
1642 1675
        'adresse/town': 'Paris',
1643 1676
        'adresse/zipcode': '75014',
1644 1677
    }
1645 1678

  
1646 1679
    Link.objects.create(resource=con, family_id='1312', name_id='local')
1647 1680
    resp = app.post_json(url + '?NameID=local', params=params, status=500)
......
1655 1688
    mocked_get.return_value = FAMILY_SERVICE_WSDL
1656 1689
    mocked_post.return_value = READ_FAMILY
1657 1690
    url = get_endpoint('create-rl2')
1658 1691
    params = {
1659 1692
        'civility': 'MME',
1660 1693
        'firstname': 'JANE',
1661 1694
        'lastname': 'DOE',
1662 1695
        'quality': 'MERE',
1663
        'dateBirth': '1940-06-22',
1696
        'birth/dateBirth': '1940-06-22',
1664 1697
        'adresse/num': '170',
1665 1698
        'adresse/street1': "Chateau d'eau",
1666 1699
        'adresse/town': 'Paris',
1667 1700
        'adresse/zipcode': '75014',
1668 1701
    }
1669 1702

  
1670 1703
    Link.objects.create(resource=con, family_id='1312', name_id='local')
1671 1704
    resp = app.post_json(url + '?NameID=local', params=params)
......
1679 1712
    mocked_get.return_value = FAMILY_SERVICE_WSDL
1680 1713
    mocked_post.side_effect = [READ_RL1_FAMILY, READ_CIVILITIES, READ_QUALITIES]
1681 1714
    url = get_endpoint('create-rl2')
1682 1715
    params = {
1683 1716
        'civility': 'MME',
1684 1717
        'firstname': 'JANE',
1685 1718
        'lastname': 'DOE',
1686 1719
        'quality': 'plop',
1687
        'dateBirth': '1940-06-22',
1720
        'birth/dateBirth': '1940-06-22',
1688 1721
        'adresse/num': '170',
1689 1722
        'adresse/street1': "Chateau d'eau",
1690 1723
        'adresse/town': 'Paris',
1691 1724
        'adresse/zipcode': '75014',
1692 1725
    }
1693 1726

  
1694 1727
    Link.objects.create(resource=con, family_id='1312', name_id='local')
1695 1728
    resp = app.post_json(url + '?NameID=local', params=params)
......
1703 1736
    mocked_get.return_value = FAMILY_SERVICE_WSDL
1704 1737
    mocked_post.side_effect = [READ_FAMILY, READ_CIVILITIES, READ_QUALITIES, UPDATE_FAMILY]
1705 1738
    url = get_endpoint('update-rl2')
1706 1739
    params = {
1707 1740
        'civility': 'MME',
1708 1741
        'firstname': 'JANE',
1709 1742
        'lastname': 'DOE',
1710 1743
        'quality': 'MERE',
1711
        'dateBirth': '1940-06-22',
1744
        'birth/dateBirth': '1940-06-22',
1712 1745
    }
1713 1746

  
1714 1747
    Link.objects.create(resource=con, family_id='1312', name_id='local')
1715 1748
    resp = app.post_json(url + '?NameID=local', params=params)
1716 1749
    assert_sent_payload(mocked_post, 'Q_update_rl2.xml')
1717 1750
    assert resp.json['err'] == 0
1718 1751

  
1719 1752

  
1720 1753
def test_update_rl2_not_linked_error(con, app):
1721 1754
    url = get_endpoint('update-rl2')
1722 1755
    params = {
1723 1756
        'civility': 'MME',
1724 1757
        'firstname': 'JANE',
1725 1758
        'lastname': 'DOE',
1726 1759
        'quality': 'MERE',
1727
        'dateBirth': '1940-06-22',
1760
        'birth/dateBirth': '1940-06-22',
1728 1761
    }
1729 1762

  
1730 1763
    resp = app.post_json(url + '?NameID=local', params=params)
1731 1764
    assert resp.json['err'] == 'not-linked'
1732 1765
    assert resp.json['err_desc'] == 'User not linked to family'
1733 1766

  
1734 1767

  
1735 1768
@mock.patch('passerelle.utils.Request.get')
......
1738 1771
    mocked_get.return_value = FAMILY_SERVICE_WSDL
1739 1772
    mocked_post.side_effect = CONNECTION_ERROR
1740 1773
    url = get_endpoint('update-rl2')
1741 1774
    params = {
1742 1775
        'civility': 'MME',
1743 1776
        'firstname': 'JANE',
1744 1777
        'lastname': 'DOE',
1745 1778
        'quality': 'MERE',
1746
        'dateBirth': '1940-06-22',
1779
        'birth/dateBirth': '1940-06-22',
1747 1780
    }
1748 1781

  
1749 1782
    Link.objects.create(resource=con, family_id='1312', name_id='local')
1750 1783
    resp = app.post_json(url + '?NameID=local', params=params, status=500)
1751 1784
    assert resp.json['err']
1752 1785
    assert resp.json['err_desc'] == 'No address associated with hostname'
1753 1786

  
1754 1787

  
......
1758 1791
    mocked_get.return_value = FAMILY_SERVICE_WSDL
1759 1792
    mocked_post.return_value = READ_RL1_FAMILY
1760 1793
    url = get_endpoint('update-rl2')
1761 1794
    params = {
1762 1795
        'civility': 'MME',
1763 1796
        'firstname': 'JANE',
1764 1797
        'lastname': 'DOE',
1765 1798
        'quality': 'MERE',
1766
        'dateBirth': '1940-06-22',
1799
        'birth/dateBirth': '1940-06-22',
1767 1800
    }
1768 1801

  
1769 1802
    Link.objects.create(resource=con, family_id='1312', name_id='local')
1770 1803
    resp = app.post_json(url + '?NameID=local', params=params)
1771 1804
    assert resp.json['err'] == 'no-rl2'
1772 1805
    assert resp.json['err_desc'] == 'No RL2 to update on family'
1773 1806

  
1774 1807

  
......
1778 1811
    mocked_get.return_value = FAMILY_SERVICE_WSDL
1779 1812
    mocked_post.side_effect = [READ_FAMILY, READ_CIVILITIES, READ_QUALITIES]
1780 1813
    url = get_endpoint('update-rl2')
1781 1814
    params = {
1782 1815
        'civility': 'MME',
1783 1816
        'firstname': 'JANE',
1784 1817
        'lastname': 'DOE',
1785 1818
        'quality': 'plop',
1786
        'dateBirth': '1940-06-22',
1819
        'birth/dateBirth': '1940-06-22',
1787 1820
    }
1788 1821

  
1789 1822
    Link.objects.create(resource=con, family_id='1312', name_id='local')
1790 1823
    resp = app.post_json(url + '?NameID=local', params=params)
1791 1824
    assert resp.json['err'] == 'wrong-key'
1792 1825
    assert resp.json['err_desc'] == "quality key value 'plop' do not belong to 'Quality' required referential"
1793 1826

  
1794 1827

  
1795
-