0002-toulouse-maelis-adapt-functest-on-update_coordinate-.patch
functests/toulouse_maelis/conftest.py | ||
---|---|---|
283 | 283 |
remove_id_on_child(child) |
284 | 284 |
if not key: |
285 | 285 |
assert diff(child, expected_file) |
286 | 286 |
else: |
287 | 287 |
assert diff(child[key], expected_file) |
288 | 288 |
return data |
289 | 289 | |
290 | 290 | |
291 |
def diff_rlg(conn, name_id, index, expected_file): |
|
291 |
def diff_rlg(conn, name_id, index, expected_file, key=None):
|
|
292 | 292 |
data = read_family(conn, name_id) |
293 | 293 |
rlg = copy.deepcopy(data['RL%s' % index]) |
294 | 294 |
remove_id_on_rlg(rlg) |
295 |
assert diff(rlg, expected_file) |
|
295 |
if not key: |
|
296 |
assert diff(rlg, expected_file) |
|
297 |
else: |
|
298 |
assert diff(rlg[key], expected_file) |
|
296 | 299 |
return data |
297 | 300 | |
298 | 301 | |
299 | 302 |
def diff_family(conn, name_id, expected_file, key=None): |
300 | 303 |
data = read_family(conn, name_id) |
301 | 304 |
family = copy.deepcopy(data) |
302 | 305 |
remove_id_on_family(family) |
303 | 306 |
if not key: |
functests/toulouse_maelis/data/test_update_coordinate.json | ||
---|---|---|
1 |
{ |
|
2 |
"num": "N/A", |
|
3 |
"firstname": "HOMER", |
|
4 |
"lastname": "N/A", |
|
5 |
"maidenName": null, |
|
6 |
"quality": "PERE", |
|
7 |
"civility": "M.", |
|
8 |
"birth": { |
|
9 |
"dateBirth": "1956-05-12T00:00:00+01:00", |
|
10 |
"place": null, |
|
11 |
"communeCode": null, |
|
12 |
"countryCode": null |
|
13 |
}, |
|
14 |
"adresse": { |
|
15 |
"idStreet": null, |
|
16 |
"num": 42, |
|
17 |
"numComp": "Q", |
|
18 |
"street1": "reset", |
|
19 |
"street2": null, |
|
20 |
"town": "reset", |
|
21 |
"zipcode": "reset", |
|
22 |
"numComp_text": "quater" |
|
23 |
}, |
|
24 |
"contact": { |
|
25 |
"phone": null, |
|
26 |
"mobile": null, |
|
27 |
"mail": null, |
|
28 |
"isContactMail": false, |
|
29 |
"isContactSms": false, |
|
30 |
"isInvoicePdf": false |
|
31 |
}, |
|
32 |
"profession": { |
|
33 |
"codeCSP": "15", |
|
34 |
"profession": null, |
|
35 |
"employerName": null, |
|
36 |
"phone": null, |
|
37 |
"addressPro": { |
|
38 |
"num": 42, |
|
39 |
"street": null, |
|
40 |
"zipcode": null, |
|
41 |
"town": null |
|
42 |
}, |
|
43 |
"codeCSP_text": "AUTRES" |
|
44 |
}, |
|
45 |
"CAFInfo": { |
|
46 |
"number": "reset", |
|
47 |
"organ": null |
|
48 |
}, |
|
49 |
"indicatorList": [], |
|
50 |
"quotientList": [], |
|
51 |
"subscribeActivityList": [], |
|
52 |
"civility_text": "Monsieur", |
|
53 |
"quality_text": "PERE" |
|
54 |
} |
functests/toulouse_maelis/data/test_update_coordinate_CAFInfo.json | ||
---|---|---|
1 |
{ |
|
2 |
"number": "reset", |
|
3 |
"organ": null |
|
4 |
} |
functests/toulouse_maelis/data/test_update_coordinate_adresse.json | ||
---|---|---|
1 |
{ |
|
2 |
"idStreet": null, |
|
3 |
"num": 42, |
|
4 |
"numComp": "Q", |
|
5 |
"street1": "reset", |
|
6 |
"street2": null, |
|
7 |
"town": "reset", |
|
8 |
"zipcode": "reset", |
|
9 |
"numComp_text": "quater" |
|
10 |
} |
functests/toulouse_maelis/data/test_update_coordinate_contact.json | ||
---|---|---|
1 |
{ |
|
2 |
"phone": null, |
|
3 |
"mobile": null, |
|
4 |
"mail": null, |
|
5 |
"isContactMail": false, |
|
6 |
"isContactSms": false, |
|
7 |
"isInvoicePdf": false |
|
8 |
} |
functests/toulouse_maelis/data/test_update_coordinate_profession.json | ||
---|---|---|
1 |
{ |
|
2 |
"codeCSP": "15", |
|
3 |
"profession": null, |
|
4 |
"employerName": null, |
|
5 |
"phone": null, |
|
6 |
"addressPro": { |
|
7 |
"num": 42, |
|
8 |
"street": null, |
|
9 |
"zipcode": null, |
|
10 |
"town": null |
|
11 |
}, |
|
12 |
"codeCSP_text": "AUTRES" |
|
13 |
} |
functests/toulouse_maelis/test_family.py | ||
---|---|---|
372 | 372 |
# reset RL2 coordinates |
373 | 373 |
url = conn + '/update-coordinate?NameID=%s&rl_id=%s' % (update_data['name_id'], update_data['rl2_num']) |
374 | 374 |
payload = {} |
375 | 375 |
for key in 'adresse', 'contact', 'profession', 'CAFInfo': |
376 | 376 |
payload[key] = FAMILY_RESET_PAYLOAD['rl2'][key] |
377 | 377 |
resp = requests.post(url, json=payload) |
378 | 378 |
resp.raise_for_status() |
379 | 379 |
assert resp.json()['err'] == 0 |
380 |
assert diff_rlg(conn, update_data['name_id'], 2, 'test_update_coordinate.json') |
|
380 |
for key in 'adresse', 'contact', 'profession', 'CAFInfo': |
|
381 |
assert diff_rlg(conn, update_data['name_id'], 2, 'test_update_coordinate_%s.json' % key, key) |
|
381 | 382 | |
382 | 383 |
# restore RL2 coordinates |
383 | 384 |
payload = {} |
384 | 385 |
for key in 'adresse', 'contact', 'profession', 'CAFInfo': |
385 | 386 |
payload[key] = update_data['family_payload']['rl2'][key] |
386 | 387 |
resp = requests.post(url, json=payload) |
387 | 388 |
resp.raise_for_status() |
388 | 389 |
assert resp.json()['err'] == 0 |
389 |
- |