0007-toulouse-maelis-update-functests-for-subscritions-72.patch
functests/toulouse_maelis/conftest.py | ||
---|---|---|
79 | 79 |
}, |
80 | 80 |
], |
81 | 81 |
}, |
82 | 82 |
'childList': [ |
83 | 83 |
{ |
84 | 84 |
'sexe': 'M', |
85 | 85 |
'firstname': 'Bart', |
86 | 86 |
'lastname': 'Simpson', |
87 |
'birth': {'dateBirth': '1978-04-01'},
|
|
87 |
'birth': {'dateBirth': '2014-04-01'},
|
|
88 | 88 |
'bPhoto': True, |
89 | 89 |
'bLeaveAlone': True, |
90 | 90 |
'dietcode': 'MENU_AV', |
91 | 91 |
'paiInfoBean': { |
92 | 92 |
'code': 'PAI_01', |
93 | 93 |
'dateDeb': '2022-09-01', |
94 | 94 |
'dateFin': '2023-07-01', |
95 | 95 |
'description': 'mischievous, rebellious, misunderstood, disruptive', |
... | ... | |
170 | 170 |
}, |
171 | 171 |
}, |
172 | 172 |
], |
173 | 173 |
}, |
174 | 174 |
{ |
175 | 175 |
'sexe': 'F', |
176 | 176 |
'firstname': 'Lisa', |
177 | 177 |
'lastname': 'Simpson', |
178 |
'birth': {'dateBirth': '1980-05-09'},
|
|
178 |
'birth': {'dateBirth': '2016-05-09'},
|
|
179 | 179 |
'dietcode': 'MENU_SV', |
180 | 180 |
'paiInfoBean': { |
181 | 181 |
'code': 'PAI_02', |
182 | 182 |
}, |
183 | 183 |
}, |
184 | 184 |
{ |
185 | 185 |
'sexe': 'F', |
186 | 186 |
'firstname': 'Maggie', |
187 | 187 |
'lastname': 'Simpson', |
188 |
'birth': {'dateBirth': '1989-12-17'},
|
|
188 |
'birth': {'dateBirth': '2018-12-17'},
|
|
189 | 189 |
'dietcode': 'MENU_PAI', |
190 | 190 |
'paiInfoBean': { |
191 | 191 |
'code': 'PAI_02', |
192 | 192 |
}, |
193 | 193 |
}, |
194 |
{ |
|
195 |
'sexe': 'M', |
|
196 |
'firstname': 'Hugo', |
|
197 |
'lastname': 'Simpson', |
|
198 |
'birth': {'dateBirth': '2018-04-01'}, |
|
199 |
'dietcode': 'MENU_AV', |
|
200 |
'paiInfoBean': { |
|
201 |
'code': 'PAI_01', |
|
202 |
}, |
|
203 |
}, |
|
194 | 204 |
], |
195 | 205 |
'emergencyPersonList': [ |
196 | 206 |
{ |
197 | 207 |
'civility': 'MME', |
198 | 208 |
'firstname': 'Patty', |
199 | 209 |
'lastname': 'Bouvier', |
200 | 210 |
'dateBirth': '1948-08-30', |
201 | 211 |
'sexe': 'F', |
functests/toulouse_maelis/data/test_create_child.json | ||
---|---|---|
1 | 1 |
{ |
2 | 2 |
"num": "N/A", |
3 | 3 |
"lastname": "N/A", |
4 | 4 |
"firstname": "LISA", |
5 | 5 |
"sexe": "M", |
6 | 6 |
"birth": { |
7 |
"dateBirth": "1980-05-09T00:00:00+02:00",
|
|
7 |
"dateBirth": "2016-05-09T00:00:00+02:00",
|
|
8 | 8 |
"place": null, |
9 | 9 |
"communeCode": null, |
10 | 10 |
"countryCode": null |
11 | 11 |
}, |
12 | 12 |
"dietcode": null, |
13 | 13 |
"bPhoto": false, |
14 | 14 |
"bLeaveAlone": false, |
15 | 15 |
"authorizedPersonList": [], |
functests/toulouse_maelis/data/test_create_family.json | ||
---|---|---|
49 | 49 |
"quotientList": [], |
50 | 50 |
"childList": [ |
51 | 51 |
{ |
52 | 52 |
"num": "N/A", |
53 | 53 |
"lastname": "N/A", |
54 | 54 |
"firstname": "BART", |
55 | 55 |
"sexe": "M", |
56 | 56 |
"birth": { |
57 |
"dateBirth": "1978-04-01T00:00:00+01:00",
|
|
57 |
"dateBirth": "2014-04-01T00:00:00+02:00",
|
|
58 | 58 |
"place": null, |
59 | 59 |
"communeCode": null, |
60 | 60 |
"countryCode": null |
61 | 61 |
}, |
62 | 62 |
"dietcode": "MENU_AV", |
63 | 63 |
"bPhoto": true, |
64 | 64 |
"bLeaveAlone": true, |
65 | 65 |
"authorizedPersonList": [ |
... | ... | |
172 | 172 |
"dietcode_text": "Avec viande" |
173 | 173 |
}, |
174 | 174 |
{ |
175 | 175 |
"num": "N/A", |
176 | 176 |
"lastname": "N/A", |
177 | 177 |
"firstname": "MAGGIE", |
178 | 178 |
"sexe": "F", |
179 | 179 |
"birth": { |
180 |
"dateBirth": "1989-12-17T00:00:00+01:00",
|
|
180 |
"dateBirth": "2018-12-17T00:00:00+01:00",
|
|
181 | 181 |
"place": null, |
182 | 182 |
"communeCode": null, |
183 | 183 |
"countryCode": null |
184 | 184 |
}, |
185 | 185 |
"dietcode": "MENU_PAI", |
186 | 186 |
"bPhoto": false, |
187 | 187 |
"bLeaveAlone": false, |
188 | 188 |
"authorizedPersonList": [], |
... | ... | |
198 | 198 |
}, |
199 | 199 |
"mother": "N/A", |
200 | 200 |
"father": "N/A", |
201 | 201 |
"rl": null, |
202 | 202 |
"subscribeSchoolList": [], |
203 | 203 |
"subscribeActivityList": [], |
204 | 204 |
"sexe_text": "F\u00e9minin", |
205 | 205 |
"dietcode_text": "Panier" |
206 |
}, |
|
207 |
{ |
|
208 |
"num": "N/A", |
|
209 |
"lastname": "N/A", |
|
210 |
"firstname": "HUGO", |
|
211 |
"sexe": "M", |
|
212 |
"birth": { |
|
213 |
"dateBirth": "2018-04-01T00:00:00+02:00", |
|
214 |
"place": null, |
|
215 |
"communeCode": null, |
|
216 |
"countryCode": null |
|
217 |
}, |
|
218 |
"dietcode": "MENU_AV", |
|
219 |
"bPhoto": false, |
|
220 |
"bLeaveAlone": false, |
|
221 |
"authorizedPersonList": [], |
|
222 |
"indicatorList": [], |
|
223 |
"medicalRecord": null, |
|
224 |
"insurance": null, |
|
225 |
"paiInfoBean": { |
|
226 |
"code": "PAI_01", |
|
227 |
"dateDeb": null, |
|
228 |
"dateFin": null, |
|
229 |
"description": null, |
|
230 |
"code_text": "PAI M\u00e9dical" |
|
231 |
}, |
|
232 |
"mother": "N/A", |
|
233 |
"father": "N/A", |
|
234 |
"rl": null, |
|
235 |
"subscribeSchoolList": [], |
|
236 |
"subscribeActivityList": [], |
|
237 |
"sexe_text": "Masculin", |
|
238 |
"dietcode_text": "Avec viande" |
|
206 | 239 |
} |
207 | 240 |
], |
208 | 241 |
"emergencyPersonList": [ |
209 | 242 |
{ |
210 | 243 |
"numPerson": "N/A", |
211 | 244 |
"civility": "MME", |
212 | 245 |
"firstname": "PATTY", |
213 | 246 |
"lastname": "BOUVIER", |
functests/toulouse_maelis/data/test_update_family.json | ||
---|---|---|
117 | 117 |
"quotientList": [], |
118 | 118 |
"childList": [ |
119 | 119 |
{ |
120 | 120 |
"num": "N/A", |
121 | 121 |
"lastname": "N/A", |
122 | 122 |
"firstname": "BART", |
123 | 123 |
"sexe": "M", |
124 | 124 |
"birth": { |
125 |
"dateBirth": "1978-04-01T00:00:00+01:00",
|
|
125 |
"dateBirth": "2014-04-01T00:00:00+02:00",
|
|
126 | 126 |
"place": null, |
127 | 127 |
"communeCode": null, |
128 | 128 |
"countryCode": null |
129 | 129 |
}, |
130 | 130 |
"dietcode": "MENU_AV", |
131 | 131 |
"bPhoto": true, |
132 | 132 |
"bLeaveAlone": true, |
133 | 133 |
"authorizedPersonList": [ |
... | ... | |
240 | 240 |
"dietcode_text": "Avec viande" |
241 | 241 |
}, |
242 | 242 |
{ |
243 | 243 |
"num": "N/A", |
244 | 244 |
"lastname": "N/A", |
245 | 245 |
"firstname": "LISA", |
246 | 246 |
"sexe": "F", |
247 | 247 |
"birth": { |
248 |
"dateBirth": "1980-05-09T00:00:00+02:00",
|
|
248 |
"dateBirth": "2016-05-09T00:00:00+02:00",
|
|
249 | 249 |
"place": null, |
250 | 250 |
"communeCode": null, |
251 | 251 |
"countryCode": null |
252 | 252 |
}, |
253 | 253 |
"dietcode": "MENU_SV", |
254 | 254 |
"bPhoto": false, |
255 | 255 |
"bLeaveAlone": false, |
256 | 256 |
"authorizedPersonList": [], |
... | ... | |
273 | 273 |
"dietcode_text": "Sans viande" |
274 | 274 |
}, |
275 | 275 |
{ |
276 | 276 |
"num": "N/A", |
277 | 277 |
"lastname": "N/A", |
278 | 278 |
"firstname": "MAGGIE", |
279 | 279 |
"sexe": "F", |
280 | 280 |
"birth": { |
281 |
"dateBirth": "1989-12-17T00:00:00+01:00",
|
|
281 |
"dateBirth": "2018-12-17T00:00:00+01:00",
|
|
282 | 282 |
"place": null, |
283 | 283 |
"communeCode": null, |
284 | 284 |
"countryCode": null |
285 | 285 |
}, |
286 | 286 |
"dietcode": "MENU_PAI", |
287 | 287 |
"bPhoto": false, |
288 | 288 |
"bLeaveAlone": false, |
289 | 289 |
"authorizedPersonList": [], |
... | ... | |
299 | 299 |
}, |
300 | 300 |
"mother": "N/A", |
301 | 301 |
"father": "N/A", |
302 | 302 |
"rl": null, |
303 | 303 |
"subscribeSchoolList": [], |
304 | 304 |
"subscribeActivityList": [], |
305 | 305 |
"sexe_text": "F\u00e9minin", |
306 | 306 |
"dietcode_text": "Panier" |
307 |
}, |
|
308 |
{ |
|
309 |
"num": "N/A", |
|
310 |
"lastname": "N/A", |
|
311 |
"firstname": "HUGO", |
|
312 |
"sexe": "M", |
|
313 |
"birth": { |
|
314 |
"dateBirth": "2018-04-01T00:00:00+02:00", |
|
315 |
"place": null, |
|
316 |
"communeCode": null, |
|
317 |
"countryCode": null |
|
318 |
}, |
|
319 |
"dietcode": "MENU_AV", |
|
320 |
"bPhoto": false, |
|
321 |
"bLeaveAlone": false, |
|
322 |
"authorizedPersonList": [], |
|
323 |
"indicatorList": [], |
|
324 |
"medicalRecord": null, |
|
325 |
"insurance": null, |
|
326 |
"paiInfoBean": { |
|
327 |
"code": "PAI_01", |
|
328 |
"dateDeb": null, |
|
329 |
"dateFin": null, |
|
330 |
"description": null, |
|
331 |
"code_text": "PAI M\u00e9dical" |
|
332 |
}, |
|
333 |
"mother": "N/A", |
|
334 |
"father": "N/A", |
|
335 |
"rl": null, |
|
336 |
"subscribeSchoolList": [], |
|
337 |
"subscribeActivityList": [], |
|
338 |
"sexe_text": "Masculin", |
|
339 |
"dietcode_text": "Avec viande" |
|
307 | 340 |
} |
308 | 341 |
], |
309 | 342 |
"emergencyPersonList": [ |
310 | 343 |
{ |
311 | 344 |
"numPerson": "N/A", |
312 | 345 |
"civility": "MME", |
313 | 346 |
"firstname": "PATTY", |
314 | 347 |
"lastname": "BOUVIER", |
functests/toulouse_maelis/data/test_update_family_ras.json | ||
---|---|---|
173 | 173 |
"sexe_text": "F\u00e9minin" |
174 | 174 |
}, |
175 | 175 |
{ |
176 | 176 |
"num": "N/A", |
177 | 177 |
"lastname": "N/A", |
178 | 178 |
"firstname": "LISA", |
179 | 179 |
"sexe": "F", |
180 | 180 |
"birth": { |
181 |
"dateBirth": "1980-05-09T00:00:00+02:00",
|
|
181 |
"dateBirth": "2016-05-09T00:00:00+02:00",
|
|
182 | 182 |
"place": null, |
183 | 183 |
"communeCode": null, |
184 | 184 |
"countryCode": null |
185 | 185 |
}, |
186 | 186 |
"dietcode": "MENU_SV", |
187 | 187 |
"bPhoto": false, |
188 | 188 |
"bLeaveAlone": false, |
189 | 189 |
"authorizedPersonList": [], |
... | ... | |
206 | 206 |
"dietcode_text": "Sans viande" |
207 | 207 |
}, |
208 | 208 |
{ |
209 | 209 |
"num": "N/A", |
210 | 210 |
"lastname": "N/A", |
211 | 211 |
"firstname": "MAGGIE", |
212 | 212 |
"sexe": "F", |
213 | 213 |
"birth": { |
214 |
"dateBirth": "1989-12-17T00:00:00+01:00",
|
|
214 |
"dateBirth": "2018-12-17T00:00:00+01:00",
|
|
215 | 215 |
"place": null, |
216 | 216 |
"communeCode": null, |
217 | 217 |
"countryCode": null |
218 | 218 |
}, |
219 | 219 |
"dietcode": "MENU_PAI", |
220 | 220 |
"bPhoto": false, |
221 | 221 |
"bLeaveAlone": false, |
222 | 222 |
"authorizedPersonList": [], |
... | ... | |
232 | 232 |
}, |
233 | 233 |
"mother": "N/A", |
234 | 234 |
"father": "N/A", |
235 | 235 |
"rl": null, |
236 | 236 |
"subscribeSchoolList": [], |
237 | 237 |
"subscribeActivityList": [], |
238 | 238 |
"sexe_text": "F\u00e9minin", |
239 | 239 |
"dietcode_text": "Panier" |
240 |
}, |
|
241 |
{ |
|
242 |
"num": "N/A", |
|
243 |
"lastname": "N/A", |
|
244 |
"firstname": "HUGO", |
|
245 |
"sexe": "M", |
|
246 |
"birth": { |
|
247 |
"dateBirth": "2018-04-01T00:00:00+02:00", |
|
248 |
"place": null, |
|
249 |
"communeCode": null, |
|
250 |
"countryCode": null |
|
251 |
}, |
|
252 |
"dietcode": "MENU_AV", |
|
253 |
"bPhoto": false, |
|
254 |
"bLeaveAlone": false, |
|
255 |
"authorizedPersonList": [], |
|
256 |
"indicatorList": [], |
|
257 |
"medicalRecord": null, |
|
258 |
"insurance": null, |
|
259 |
"paiInfoBean": { |
|
260 |
"code": "PAI_01", |
|
261 |
"dateDeb": null, |
|
262 |
"dateFin": null, |
|
263 |
"description": null, |
|
264 |
"code_text": "PAI M\u00e9dical" |
|
265 |
}, |
|
266 |
"mother": "N/A", |
|
267 |
"father": "N/A", |
|
268 |
"rl": null, |
|
269 |
"subscribeSchoolList": [], |
|
270 |
"subscribeActivityList": [], |
|
271 |
"sexe_text": "Masculin", |
|
272 |
"dietcode_text": "Avec viande" |
|
240 | 273 |
} |
241 | 274 |
], |
242 | 275 |
"emergencyPersonList": [ |
243 | 276 |
{ |
244 | 277 |
"numPerson": "N/A", |
245 | 278 |
"civility": null, |
246 | 279 |
"firstname": "RESET", |
247 | 280 |
"lastname": "RESET", |
functests/toulouse_maelis/test_family.py | ||
---|---|---|
384 | 384 |
assert diff_family(conn, update_data['name_id'], 'test_update_family.json') |
385 | 385 | |
386 | 386 | |
387 | 387 |
def test_is_child_exists(conn, create_data): |
388 | 388 |
url = conn + '/is-child-exists' |
389 | 389 |
payload = { |
390 | 390 |
'firstname': 'Maggie', |
391 | 391 |
'lastname': create_data['lastname'], |
392 |
'dateBirth': '1989-12-17',
|
|
392 |
'dateBirth': create_data['family_payload']['childList'][1]['birth']['dateBirth'],
|
|
393 | 393 |
} |
394 | 394 |
resp = requests.post(url, json=payload) |
395 | 395 |
resp.raise_for_status() |
396 | 396 |
assert resp.json() == {'err': 0, 'data': True} |
397 | 397 | |
398 | 398 |
payload['firstname'] = payload['firstname'].upper() |
399 | 399 |
payload['lastname'] = payload['lastname'].lower() |
400 | 400 |
resp = requests.post(url, json=payload) |
... | ... | |
407 | 407 |
assert resp.json() == {'err': 0, 'data': False} |
408 | 408 | |
409 | 409 | |
410 | 410 |
def test_create_child(conn, create_data, update_data): |
411 | 411 |
unlink(conn, create_data['name_id']) |
412 | 412 |
link(conn, create_data) |
413 | 413 | |
414 | 414 |
data = read_family(conn, create_data['name_id']) |
415 |
assert len(data['childList']) == 2
|
|
415 |
assert len(data['childList']) == 3
|
|
416 | 416 | |
417 | 417 |
url = conn + '/create-child?NameID=%s' % create_data['name_id'] |
418 | 418 |
payload = { |
419 | 419 |
'sexe': 'M', |
420 | 420 |
'firstname': 'Lisa', |
421 | 421 |
'lastname': create_data['lastname'], |
422 |
'birth': {'dateBirth': '1980-05-09'},
|
|
422 |
'birth': {'dateBirth': update_data['family_payload']['childList'][1]['birth']['dateBirth']},
|
|
423 | 423 |
} |
424 | 424 |
resp = requests.post(url, json=payload) |
425 | 425 |
resp.raise_for_status() |
426 | 426 |
assert resp.json()['err'] == 0 |
427 |
assert diff_child(conn, create_data['name_id'], 2, 'test_create_child.json')
|
|
427 |
assert diff_child(conn, create_data['name_id'], 3, 'test_create_child.json')
|
|
428 | 428 | |
429 | 429 |
# child already exists error (Lisa form same family) |
430 | 430 |
resp = requests.post(url, json=payload) |
431 | 431 |
resp.raise_for_status() |
432 | 432 |
res = resp.json() |
433 | 433 |
assert 'Il existe déjà un enfant correspondant' in res['err_desc'] |
434 | 434 |
res['err_desc'] = 'N/A' |
435 | 435 |
assert res == { |
436 |
- |