toulouse-maelis: set err field value to 1 on API error (#74088) #77

Merged
nroche merged 1 commits from wip/74088-parsifal-set-integer-on-err into main 2023-02-02 19:14:02 +01:00
2 changed files with 153 additions and 176 deletions

View File

@ -78,7 +78,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
try:
return method(**kwargs)
except zeep.exceptions.Fault as e:
raise APIError(e.message, err_code='%s-%s-%s' % (wsdl_short_name, service, e.code))
raise APIError(e.message)
def check_status(self):
assert self.call('Family', 'isWSRunning')
@ -240,7 +240,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
try:
return self.link_set.get(name_id=NameID)
except Link.DoesNotExist:
raise APIError('User not linked to family', err_code='not-linked')
raise APIError('User not linked to family')
def get_family_raw(self, family_id, **kwargs):
response = self.call('Family', 'readFamily', dossierNumber=family_id, **kwargs)
@ -253,32 +253,28 @@ class ToulouseMaelis(BaseResource, HTTPResource):
return data['RL1']
elif data['RL2'] and data['RL2']['num'] == rl_id:
return data['RL2']
raise APIError("no '%s' RL on '%s' family" % (rl_id, family_id), err_code='not-found')
raise APIError("no '%s' RL on '%s' family" % (rl_id, family_id))
def get_person_raw(self, family_id, person_id):
data = self.get_family_raw(family_id)
for person in data['emergencyPersonList']:
if str(person['numPerson']) == person_id:
return person
raise APIError(
"no '%s' emergency person on '%s' family" % (person_id, family_id), err_code='not-found'
)
raise APIError("no '%s' emergency person on '%s' family" % (person_id, family_id))
def get_child_raw(self, family_id, child_id):
data = self.get_family_raw(family_id)
for child in data['childList']:
if child['num'] == child_id:
return child
raise APIError("no '%s' child on '%s' family" % (child_id, family_id), err_code='not-found')
raise APIError("no '%s' child on '%s' family" % (child_id, family_id))
def get_child_person_raw(self, family_id, child_id, person_id):
data = self.get_child_raw(family_id, child_id)
for person in data['authorizedPersonList']:
if str(person['personInfo']['num']) == person_id:
return person
raise APIError(
"no '%s' authorized person on '%s' child" % (person_id, child_id), err_code='not-found'
)
raise APIError("no '%s' authorized person on '%s' child" % (person_id, child_id))
def add_text_value(self, referential_name, data, keys):
'''add text from referentials'''
@ -381,7 +377,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
def assert_key_in_referential(self, referential_name, key_value, keys_text, required=True):
if not key_value:
if required:
raise APIError("%s is required and could not be None" % keys_text, err_code='field-required')
raise APIError("%s is required and could not be None" % keys_text)
return
try:
self.referential.get(referential_name=referential_name, item_id=key_value)
@ -390,8 +386,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
ref_text = ref_text + "referential"
raise APIError(
"%s key value '%s' do not belong to '%s' %s"
% (keys_text, key_value, referential_name, ref_text),
err_code='wrong-key',
% (keys_text, key_value, referential_name, ref_text)
)
def assert_post_data_in_referential(self, referential_name, data, keys, required=True):
@ -831,7 +826,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
and response['RL1']['lastname'] == post_data['lastname'].upper()
and response['RL1']['birth']['dateBirth'].strftime('%Y-%m-%d') == post_data['dateBirth']
):
raise APIError("RL1 does not match '%s' family" % family_id, err_code='not-found')
raise APIError("RL1 does not match '%s' family" % family_id)
Link.objects.update_or_create(resource=self, name_id=NameID, defaults={'family_id': family_id})
return {'data': 'ok'}
@ -1096,7 +1091,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
)
def create_family(self, request, post_data, NameID=None):
if self.link_set.filter(name_id=NameID).exists():
raise APIError('User already linked to family', err_code='already-linked')
raise APIError('User already linked to family')
self.assert_family_payload_in_referential(post_data)
response = self.call('Family', 'createFamily', **post_data)
@ -1104,8 +1099,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
family_id = data.get('number')
if not family_id:
errors = data.get('rl1ErrorList') + data.get('childErrorList')
err_codes = [x.split(':')[0][:4] for x in errors]
raise APIError(' ; '.join(errors), err_code=', '.join(err_codes))
raise APIError(' ; '.join(errors))
if NameID:
Link.objects.create(resource=self, name_id=NameID, family_id=family_id)
@ -1137,8 +1131,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
family_id = data.get('number')
errors = data.get('childErrorList')
if errors:
err_codes = [x.split(':')[0][:4] for x in errors]
raise APIError(' ; '.join(errors), err_code=', '.join(err_codes))
raise APIError(' ; '.join(errors))
return {'data': data}
@endpoint(
@ -1151,7 +1144,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
)
def create_rl1(self, request, post_data, NameID=None):
if self.link_set.filter(name_id=NameID).exists():
raise APIError('User already linked to family', err_code='already-linked')
raise APIError('User already linked to family')
self.assert_create_rl1_payload_in_referential(post_data)
response = self.call('Family', 'createFamily', **post_data)
@ -1159,7 +1152,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
family_id = data.get('number')
if not family_id:
errors = data.get('rl1ErrorList') or []
raise APIError(' ; '.join(errors), err_code='already-rl1')
raise APIError(' ; '.join(errors))
if NameID:
Link.objects.create(resource=self, name_id=NameID, family_id=family_id)
@ -1213,7 +1206,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
self.assert_rl_payload_in_referential(post_data)
family = self.get_family_raw(family_id)
if family['RL2']:
raise APIError('RL2 already defined on family', err_code='already-rl2')
raise APIError('RL2 already defined on family')
payload = {
'dossierNumber': family_id,
@ -1245,7 +1238,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
self.replace_null_values(post_data)
family = self.get_family_raw(family_id)
if not family['RL2']:
raise APIError('No RL2 to update on family', err_code='no-rl2')
raise APIError('No RL2 to update on family')
rl2 = post_data
rl2['adresse'] = family['RL2']['adresse']
@ -1292,7 +1285,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
child_id = data.get('number')
if not child_id:
errors = data.get('childErrorList') or []
raise APIError(' ; '.join(errors), err_code='already-child')
raise APIError(' ; '.join(errors))
return {'data': {'child_id': child_id}}
@endpoint(
@ -1320,7 +1313,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
child['authorizedPersonList'] = known_child['authorizedPersonList']
break
else:
raise APIError('No child %s to update on family' % child_id, err_code='no-child')
raise APIError('No child %s to update on family' % child_id)
payload = {
'dossierNumber': family_id,
'category': family['category'],
@ -1452,9 +1445,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
personList[i]['numPerson'] = person_id
break
else:
raise APIError(
"no '%s' authorized person on '%s' family" % (person_id, family_id), err_code='not-found'
)
raise APIError("no '%s' authorized person on '%s' family" % (person_id, family_id))
payload = {
'dossierNumber': family_id,
'category': family['category'],
@ -1490,9 +1481,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
del personList[i]
break
else:
raise APIError(
"no '%s' authorized person on '%s' family" % (person_id, family_id), err_code='not-found'
)
raise APIError("no '%s' authorized person on '%s' family" % (person_id, family_id))
payload = {
'dossierNumber': family_id,
'category': family['category'],
@ -1560,9 +1549,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
personList[i]['personInfo']['num'] = person_id
break
else:
raise APIError(
"No '%s' authorized person on '%s' child" % (person_id, child_id), err_code='not-found'
)
raise APIError("No '%s' authorized person on '%s' child" % (person_id, child_id))
req = {
'numFamily': family_id,
'numPerson': child_id,
@ -1596,9 +1583,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
del personList[i]
break
else:
raise APIError(
"No '%s' authorized person on '%s' child" % (person_id, child_id), err_code='not-found'
)
raise APIError("No '%s' authorized person on '%s' child" % (person_id, child_id))
req = {
'numFamily': family_id,
'numPerson': child_id,
@ -1733,21 +1718,16 @@ class ToulouseMaelis(BaseResource, HTTPResource):
start_date = datetime.datetime.strptime(start_date, utils.json_date_format).date()
end_date = datetime.datetime.strptime(end_date, utils.json_date_format).date()
except ValueError:
raise APIError('bad date format, should be YYYY-MM-DD', err_code='bad-request', http_status=400)
raise APIError('bad date format, should be YYYY-MM-DD', http_status=400)
if start_date > end_date:
raise APIError(
'start_date should be before end_date',
err_code='bad-request',
http_status=400,
)
raise APIError('start_date should be before end_date', http_status=400)
reference_year = utils.get_reference_year_from_date(start_date)
end_reference_year = utils.get_reference_year_from_date(end_date)
if reference_year != end_reference_year:
raise APIError(
'start_date and end_date are in different reference year (%s != %s)'
% (reference_year, end_reference_year),
err_code='bad-request',
http_status=400,
)
return start_date, end_date, reference_year
@ -1928,7 +1908,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
response = self.call('Activity', 'updatePersonSchedule', **payload)
errors = serialize_object(response)
if errors:
raise APIError(' ; '.join(errors), err_code='agenda-child-error')
raise APIError(' ; '.join(errors))
# sort changes
activity_types = ['ACCMAT', 'RESTSCOL']
@ -2359,7 +2339,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
if activity['activity']['idActivity'] == activity_id:
break
else:
raise APIError('No activity %s for person' % activity_id, err_code='no-activity')
raise APIError('No activity %s for person' % activity_id)
data = activity.pop('unitInfoList')
meta = {'person': response['person'], 'activity': activity}
for item in data:
@ -2418,12 +2398,12 @@ class ToulouseMaelis(BaseResource, HTTPResource):
if activity['activity']['idActivity'] == activity_id:
break
else:
raise APIError('No activity %s for person' % activity_id, err_code='no-activity')
raise APIError('No activity %s for person' % activity_id)
for unit in activity['unitInfoList']:
if unit['idUnit'] == unit_id:
break
else:
raise APIError('No unit %s for person' % unit_id, err_code='no-unit')
raise APIError('No unit %s for person' % unit_id)
data = unit.pop('placeInfoList')
del activity['unitInfoList']
meta = {'person': response['person'], 'activity': activity, 'unit': unit}
@ -2596,11 +2576,9 @@ class ToulouseMaelis(BaseResource, HTTPResource):
try:
ref_date = parse_date(ref_date)
except ValueError:
raise APIError('%s is not a valid date' % ref_date, err_code='bad-request', http_status=400)
raise APIError('%s is not a valid date' % ref_date, http_status=400)
if not ref_date:
raise APIError(
'bad date format, should be YYYY-MM-DD', err_code='bad-request', http_status=400
)
raise APIError('bad date format, should be YYYY-MM-DD', http_status=400)
ref_date = ref_date.strftime(utils.json_date_format)
params = {

View File

@ -230,7 +230,6 @@ def test_call_with_wrong_credentials(family_service, con):
'err': 1,
'log_error': False,
'http_status': 200,
'err_code': 'Family-isWSRunning-ns1:FailedAuthentication',
}
@ -404,7 +403,7 @@ def test_link(family_service, con, app):
params['lastname'] = 'John'
resp = app.post_json(url + '?NameID=local', params=params)
assert Link.objects.count() == 1
assert resp.json['err'] == 'not-found'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == "RL1 does not match '1312' family"
@ -433,7 +432,7 @@ def test_unlink(con, app):
assert resp.json['data'] == 'ok'
resp = app.post_json(url + '?NameID=local')
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -809,7 +808,7 @@ def test_read_rl_list_not_linked_error(con, app):
url = get_endpoint('read-rl-list')
resp = app.get(url + '?NameID=local')
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -831,7 +830,7 @@ def test_read_person_list_not_linked_error(con, app):
url = get_endpoint('read-person-list')
resp = app.get(url + '?NameID=local')
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -861,7 +860,7 @@ def test_read_child_list_not_linked_error(con, app):
url = get_endpoint('read-child-list')
resp = app.get(url + '?NameID=local')
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -885,7 +884,7 @@ def test_read_child_person_list_not_linked_error(con, app):
url = get_endpoint('read-child-person-list')
resp = app.get(url + '?NameID=local&child_id=613880')
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -895,7 +894,7 @@ def test_read_child_person_list_not_exists_error(family_service, con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.get(url + '?NameID=local&child_id=42')
assert resp.json['err'] == 'not-found'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == "no '42' child on '1312' family"
@ -1194,7 +1193,7 @@ def test_read_family_not_linked_error(con, app):
url = get_endpoint('read-family')
resp = app.get(url + '?NameID=')
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -1335,7 +1334,7 @@ def test_read_rl_not_linked_error(con, app):
url = get_endpoint('read-rl')
resp = app.get(url + '?NameID=local&rl_id=613879')
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -1345,7 +1344,7 @@ def test_read_rl_not_found(family_service, con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.get(url + '?NameID=local&rl_id=000000')
assert resp.json['err'] == 'not-found'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == "no '000000' RL on '1312' family"
@ -1366,7 +1365,7 @@ def test_read_person_not_linked_error(con, app):
url = get_endpoint('read-person')
resp = app.get(url + '?NameID=local&person_id=614059')
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -1376,7 +1375,7 @@ def test_read_person_not_found(family_service, con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.get(url + '?NameID=local&person_id=000000')
assert resp.json['err'] == 'not-found'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == "no '000000' emergency person on '1312' family"
@ -1397,7 +1396,7 @@ def test_read_child_not_linked_error(con, app):
url = get_endpoint('read-child')
resp = app.get(url + '?NameID=local&child_id=613880')
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -1407,7 +1406,7 @@ def test_read_child_not_found(family_service, con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.get(url + '?NameID=local&child_id=000000')
assert resp.json['err'] == 'not-found'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == "no '000000' child on '1312' family"
@ -1428,7 +1427,7 @@ def test_read_child_person_not_linked_error(con, app):
url = get_endpoint('read-child-person')
resp = app.get(url + '?NameID=local&child_id=613880&person_id=614719')
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -1438,7 +1437,7 @@ def test_read_child_person_no_child_error(family_service, con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.get(url + '?NameID=local&child_id=42&person_id=614719')
assert resp.json['err'] == 'not-found'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == "no '42' child on '1312' family"
@ -1448,7 +1447,7 @@ def test_read_child_person_no_person_error(family_service, con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.get(url + '?NameID=local&child_id=613880&person_id=000000')
assert resp.json['err'] == 'not-found'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == "no '000000' authorized person on '613880' child"
@ -1598,7 +1597,7 @@ def test_create_family_already_linked_error(con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local', params=params)
assert resp.json['err'] == 'already-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User already linked to family'
@ -1619,7 +1618,7 @@ def test_create_family_maelis_error(family_service, con, app):
}
resp = app.post_json(url + '?NameID=local', params=params)
assert resp.json['err'] == 'E54a, E54a'
assert resp.json['err'] == 1
assert 'Il existe déjà' in resp.json['err_desc']
@ -1655,7 +1654,7 @@ def test_create_family_wrong_referential_key_error(con, app):
}
resp = app.post_json(url + '?NameID=local', params=params)
assert resp.json['err'] == 'wrong-key'
assert resp.json['err'] == 1
assert (
resp.json['err_desc']
== "childList/0/medicalRecord/vaccinList/0/code key value 'plop' do not belong to 'Vaccin' referential"
@ -1740,7 +1739,7 @@ def test_update_family_not_linked_error(con, app):
}
resp = app.post_json(url + '?NameID=local', params=params)
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -1759,7 +1758,7 @@ def test_update_family_maelis_error(family_service, con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local', params=params)
assert resp.json['err'] == 'E65a'
assert resp.json['err'] == 1
assert "E65a : Il existe déjà un enfant" in resp.json['err_desc']
@ -1784,7 +1783,7 @@ def test_update_family_soap_error(family_service, con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local', params=params)
assert resp.json['err'] == 'Family-updateFamily-soap:Server'
assert resp.json['err'] == 1
assert 'Une erreur est survenue' in resp.json['err_desc']
@ -1826,7 +1825,7 @@ def test_update_family_wrong_referential_key_error(con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local', params=params)
assert resp.json['err'] == 'wrong-key'
assert resp.json['err'] == 1
assert (
resp.json['err_desc']
== "childList/0/medicalRecord/vaccinList/0/code key value 'plop' do not belong to 'Vaccin' referential"
@ -1896,7 +1895,7 @@ def test_create_rl1_already_linked_error(con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local', params=params)
assert resp.json['err'] == 'already-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User already linked to family'
@ -1917,7 +1916,7 @@ def test_create_rl1_wrong_referential_key_error(con, app):
}
resp = app.post_json(url + '?NameID=local', params=params)
assert resp.json['err'] == 'wrong-key'
assert resp.json['err'] == 1
assert (
resp.json['err_desc']
== "rl1/adresse/numComp key value 'plop' do not belong to 'Complement' referential"
@ -1941,7 +1940,7 @@ def test_create_rl1_maelis_error(family_service, con, app):
}
resp = app.post_json(url + '?NameID=local', params=params)
assert resp.json['err'] == 'already-rl1'
assert resp.json['err'] == 1
assert 'Il existe déjà' in resp.json['err_desc']
@ -1982,7 +1981,7 @@ def test_update_rl1_not_linked_error(con, app):
}
resp = app.post_json(url + '?NameID=local', params=params)
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -2000,7 +1999,7 @@ def test_update_rl1_connection_error(family_service, con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local', params=params, status=500)
assert resp.json['err']
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'No address associated with hostname'
@ -2016,7 +2015,7 @@ def test_update_rl1_wrong_referential_key_error(con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local', params=params)
assert resp.json['err'] == 'wrong-key'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == "quality key value 'plop' do not belong to 'Quality' required referential"
@ -2067,7 +2066,7 @@ def test_create_rl2_not_linked_error(con, app):
}
resp = app.post_json(url + '?NameID=local', params=params)
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -2090,7 +2089,7 @@ def test_create_rl2_connection_error(family_service, con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local', params=params, status=500)
assert resp.json['err']
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'No address associated with hostname'
@ -2112,7 +2111,7 @@ def test_create_rl2_already_exists_error(family_service, con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local', params=params)
assert resp.json['err'] == 'already-rl2'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'RL2 already defined on family'
@ -2133,7 +2132,7 @@ def test_create_rl2_wrong_referential_key_error(con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local', params=params)
assert resp.json['err'] == 'wrong-key'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == "quality key value 'plop' do not belong to 'Quality' required referential"
@ -2176,7 +2175,7 @@ def test_update_rl2_not_linked_error(con, app):
}
resp = app.post_json(url + '?NameID=local', params=params)
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -2195,7 +2194,7 @@ def test_update_rl2_connection_error(family_service, con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local', params=params, status=500)
assert resp.json['err']
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'No address associated with hostname'
@ -2213,7 +2212,7 @@ def test_update_rl2_not_exists_error(family_service, con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local', params=params)
assert resp.json['err'] == 'no-rl2'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'No RL2 to update on family'
@ -2230,7 +2229,7 @@ def test_update_rl2_wrong_referential_key_error(con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local', params=params)
assert resp.json['err'] == 'wrong-key'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == "quality key value 'plop' do not belong to 'Quality' required referential"
@ -2285,7 +2284,7 @@ def test_create_child_not_linked_error(con, app):
}
resp = app.post_json(url + '?NameID=local', params=params)
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -2301,7 +2300,7 @@ def test_create_child_wrong_referential_key_error(con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local', params=params)
assert resp.json['err'] == 'wrong-key'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == "sexe key value 'plop' do not belong to 'Sex' required referential"
@ -2318,7 +2317,7 @@ def test_create_child_connection_error(family_service, con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local', params=params, status=500)
assert resp.json['err']
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'No address associated with hostname'
@ -2335,7 +2334,7 @@ def test_create_child_maelis_error(family_service, con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local', params=params)
assert resp.json['err'] == 'already-child'
assert resp.json['err'] == 1
assert 'Il existe déjà' in resp.json['err_desc']
@ -2383,7 +2382,7 @@ def test_update_child_not_linked_error(con, app):
}
resp = app.post_json(url + '?NameID=local&child_id=613880', params=params)
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -2399,7 +2398,7 @@ def test_update_child_wrong_referential_key_error(con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local', params=params)
assert resp.json['err'] == 'wrong-key'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == "sexe key value 'plop' do not belong to 'Sex' required referential"
@ -2416,7 +2415,7 @@ def test_update_child_connection_error(family_service, con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local&child_id=613880', params=params, status=500)
assert resp.json['err']
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'No address associated with hostname'
@ -2433,7 +2432,7 @@ def test_update_child_not_exists_error(family_service, con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local&child_id=42', params=params)
assert resp.json['err'] == 'no-child'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'No child 42 to update on family'
@ -2501,7 +2500,7 @@ def test_update_coordinate_wrong_referential_key_error(con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local&rl_id=613878', params=params)
assert resp.json['err'] == 'wrong-key'
assert resp.json['err'] == 1
assert (
resp.json['err_desc'] == "adresse/numComp key value 'plop' do not belong to 'Complement' referential"
)
@ -2558,7 +2557,7 @@ def test_update_quotient_soap_error(family_service, con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local&rl_id=613878', params=params)
assert resp.json['err'] == 'Family-createUpdateQuotient-soap:Server'
assert resp.json['err'] == 1
assert 'E07 : Il existe déjà un quotient postérieur' in resp.json['err_desc']
@ -2574,7 +2573,7 @@ def test_update_quotient_wrong_referential_key_error(con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local&rl_id=613878', params=params)
assert resp.json['err'] == 'wrong-key'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == "cdquo key value 'plop' do not belong to 'Quotient' required referential"
@ -2664,7 +2663,7 @@ def test_create_person_not_linked_error(con, app):
}
resp = app.post_json(url + '?NameID=local', params=params)
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -2684,7 +2683,7 @@ def test_create_person_wrong_referential_key_error(con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local', params=params)
assert resp.json['err'] == 'wrong-key'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == "sexe key value 'plop' do not belong to 'Sex' referential"
@ -2735,7 +2734,7 @@ def test_update_person_not_linked_error(con, app):
}
resp = app.post_json(url + '?NameID=local&person_id=614059', params=params)
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -2755,7 +2754,7 @@ def test_update_person_not_found(family_service, con, app):
}
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local&person_id=000000', params=params)
assert resp.json['err'] == 'not-found'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == "no '000000' authorized person on '1312' family"
@ -2782,7 +2781,7 @@ def test_delete_person_not_linked_error(con, app):
url = get_endpoint('delete-person')
resp = app.post_json(url + '?NameID=local&person_id=614059')
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -2792,7 +2791,7 @@ def test_delete_person_not_found(family_service, con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local&person_id=000000')
assert resp.json['err'] == 'not-found'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == "no '000000' authorized person on '1312' family"
@ -2867,7 +2866,7 @@ def test_create_child_person_not_linked_error(con, app):
}
resp = app.post_json(url + '?NameID=local&child_id=613880', params=params)
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -2887,7 +2886,7 @@ def test_create_child_person_wrong_referential_key_error(con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local&child_id=613880', params=params)
assert resp.json['err'] == 'wrong-key'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == "personInfo/sexe key value 'plop' do not belong to 'Sex' referential"
@ -2908,7 +2907,7 @@ def test_create_child_person_no_child_error(family_service, con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local&child_id=42', params=params)
assert resp.json['err'] == 'not-found'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == "no '42' child on '1312' family"
@ -2961,7 +2960,7 @@ def test_update_child_person_not_linked_error(con, app):
}
resp = app.post_json(url + '?NameID=local&child_id=613880&person_id=614719', params=params)
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -2981,7 +2980,7 @@ def test_update_child_person_wrong_referential_key_error(con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local&child_id=613880&person_id=614719', params=params)
assert resp.json['err'] == 'wrong-key'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == "personInfo/sexe key value 'plop' do not belong to 'Sex' referential"
@ -3001,7 +3000,7 @@ def test_update_child_person_no_child_error(family_service, con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local&child_id=42&person_id=614719', params=params)
assert resp.json['err'] == 'not-found'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == "no '42' child on '1312' family"
@ -3021,7 +3020,7 @@ def test_update_child_person_not_found(family_service, con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local&child_id=613880&person_id=000000', params=params)
assert resp.json['err'] == 'not-found'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == "No '000000' authorized person on '613880' child"
@ -3051,7 +3050,7 @@ def test_delete_child_person_not_linked_error(con, app):
url = get_endpoint('delete-child-person')
resp = app.post_json(url + '?NameID=local&child_id=613880&person_id=614719')
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -3061,7 +3060,7 @@ def test_delete_child_person_no_child_error(family_service, con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local&child_id=42&person_id=614719')
assert resp.json['err'] == 'not-found'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == "no '42' child on '1312' family"
@ -3071,7 +3070,7 @@ def test_delete_child_person_no_person_error(family_service, con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local&child_id=613880&person_id=000000')
assert resp.json['err'] == 'not-found'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == "No '000000' authorized person on '613880' child"
@ -3092,7 +3091,7 @@ def test_update_child_dietcode_not_linked_error(con, app):
url = get_endpoint('update-child-dietcode')
resp = app.post_json(url + '?NameID=local&child_id=613878&dietcode=RVS')
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -3101,7 +3100,7 @@ def test_update_child_dietcode_wrong_referential_key_error(con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local&child_id=613878&dietcode=plop')
assert resp.json['err'] == 'wrong-key'
assert resp.json['err'] == 1
assert (
resp.json['err_desc'] == "dietcode parameter key value 'plop' do not belong to 'DietCode' referential"
)
@ -3171,7 +3170,7 @@ def test_update_child_pai_not_linked_error(con, app):
}
resp = app.post_json(url + '?NameID=local&child_id=613878', params=params)
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -3189,7 +3188,7 @@ def test_update_child_pai_soap_error(family_service, con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local&child_id=613878', params=params)
assert resp.json['err'] == 'Family-updateChildPAI-soap:Server'
assert resp.json['err'] == 1
assert 'Une erreur est survenue' in resp.json['err_desc']
assert 'valeur trop grande' in resp.json['err_desc']
assert 'maximum : 500' in resp.json['err_desc']
@ -3260,7 +3259,7 @@ def test_update_child_medical_record_not_linked_error(con, app):
url = get_endpoint('update-child-medical-record')
resp = app.post_json(url + '?NameID=local&child_id=613878', params={})
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -3276,7 +3275,7 @@ def test_update_child_medical_record_soap_error(family_service, con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local&child_id=613878', params=params)
assert resp.json['err'] == 'Family-updateChildMedicalRecord-soap:Client'
assert resp.json['err'] == 1
assert 'Unmarshalling Error' in resp.json['err_desc']
assert 'pas une valeur de calendrier grégorien' in resp.json['err_desc']
@ -3297,7 +3296,7 @@ def test_update_child_medical_record_wrong_referential_key_error(con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local&child_id=613878', params=params)
assert resp.json['err'] == 'wrong-key'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == "vaccinList/1/code key value 'plop' do not belong to 'Vaccin' referential"
@ -3349,7 +3348,7 @@ def test_update_rl_indicator_not_linked_error(con, app):
}
resp = app.post_json(url + '?NameID=local&rl_id=613878', params=params)
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -3408,7 +3407,7 @@ def test_update_rl_indicator_wrong_referential_key_error(con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local&rl_id=613878', params=params)
assert resp.json['err'] == 'wrong-key'
assert resp.json['err'] == 1
assert (
resp.json['err_desc']
== "indicatorList/0/code key value 'plop' do not belong to 'RLIndicator' required referential"
@ -3476,7 +3475,7 @@ def test_update_child_indicator_not_linked_error(con, app):
}
resp = app.post_json(url + '?NameID=local&child_id=613880', params=params)
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -3520,7 +3519,7 @@ def test_update_child_indicator_wrong_referential_key_error(con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local&child_id=613880', params=params)
assert resp.json['err'] == 'wrong-key'
assert resp.json['err'] == 1
assert (
resp.json['err_desc']
== "indicatorList/0/code key value 'plop' do not belong to 'ChildIndicator' required referential"
@ -3564,7 +3563,7 @@ def test_add_supplied_document_not_linked_error(con, app):
}
resp = app.post_json(url + '?NameID=local', params=params)
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -3600,7 +3599,7 @@ def test_add_supplied_document_wrong_referential_key_error(con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local', params=params)
assert resp.json['err'] == 'wrong-key'
assert resp.json['err'] == 1
assert (
resp.json['err_desc']
== "documentList/0/code key value 'plop' do not belong to 'Document' required referential"
@ -3681,7 +3680,7 @@ def test_add_rl1_direct_debit_order_not_linked_error(con, app):
}
resp = app.post_json(url + '?NameID=local', params=params)
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -3705,7 +3704,7 @@ def test_add_rl1_direct_debit_order_soap_error(family_service, invoice_service,
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local', params=params)
assert resp.json['err'] == 'Invoice-addDirectDebitOrder-soap:Server'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == "E520 : La REGIE CS [{0}] n''existe pas dans la base Maelis"
@ -3764,7 +3763,7 @@ def test_get_rl1_direct_debit_order_not_linked_error(con, app):
}
resp = app.get(url + '?NameID=local', params=params)
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -3781,7 +3780,7 @@ def test_get_rl1_direct_debit_order_soap_error(family_service, invoice_service,
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.get(url + '?NameID=local', params=params)
assert resp.json['err'] == 'Invoice-getDirectDebitOrder-soap:Server'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == "E520 : La REGIE CS [{0}] n''existe pas dans la base Maelis"
@ -4353,7 +4352,7 @@ def test_read_child_agenda_not_linked_error(con, app):
url = get_endpoint('read-child-agenda')
resp = app.get(url + '?NameID=local&child_id=613880&start_date=2022-09-01&end_date=2023-08-31')
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -4362,23 +4361,23 @@ def test_read_child_agenda_date_error(con, app):
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.get(url + '?NameID=local&child_id=613880&start_date=bad&end_date=2023-08-31', status=400)
assert resp.json['err'] == 'bad-request'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'bad date format, should be YYYY-MM-DD'
resp = app.get(url + '?NameID=local&child_id=613880&start_date=2022-09-01&end_date=bad', status=400)
assert resp.json['err'] == 'bad-request'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'bad date format, should be YYYY-MM-DD'
resp = app.get(
url + '?NameID=local&child_id=613880&start_date=2023-09-01&end_date=2023-08-31', status=400
)
assert resp.json['err'] == 'bad-request'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'start_date should be before end_date'
resp = app.get(
url + '?NameID=local&child_id=613880&start_date=2022-09-01&end_date=2024-08-31', status=400
)
assert resp.json['err'] == 'bad-request'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'start_date and end_date are in different reference year (2022 != 2023)'
@ -4517,7 +4516,7 @@ def test_update_child_agenda_maelis_error(activity_service, con, app):
],
}
resp = app.post_json(url + '?NameID=local', params=params)
assert resp.json['err'] == 'agenda-child-error'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'Foo ; Bar'
@ -4531,7 +4530,7 @@ def test_update_child_agenda_not_linked_error(con, app):
'booking_list': [],
}
resp = app.post_json(url + '?NameID=local', params=params)
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -4566,7 +4565,7 @@ def test_update_child_agenda_date_error(con, app):
'booking_list': [],
}
resp = app.post_json(url + '?NameID=local', params=params, status=400)
assert resp.json['err'] == 'bad-request'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'start_date should be before end_date'
params = {
@ -4576,7 +4575,7 @@ def test_update_child_agenda_date_error(con, app):
'booking_list': [],
}
resp = app.post_json(url + '?NameID=local', params=params, status=400)
assert resp.json['err'] == 'bad-request'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'start_date and end_date are in different reference year (2022 != 2023)'
@ -4886,7 +4885,7 @@ def test_get_person_activity_list_not_linked_error(con, app):
'text_template': '',
}
resp = app.get(url, params=params)
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -4903,25 +4902,25 @@ def test_get_person_activity_list_date_error(con, app):
'text_template': '',
}
resp = app.get(url, params=params, status=400)
assert resp.json['err'] == 'bad-request'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'bad date format, should be YYYY-MM-DD'
params['start_date'] = '2022-09-01'
params['end_date'] = 'bad'
resp = app.get(url, params=params, status=400)
assert resp.json['err'] == 'bad-request'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'bad date format, should be YYYY-MM-DD'
params['start_date'] = '2023-09-01'
params['end_date'] = '2023-08-31'
resp = app.get(url, params=params, status=400)
assert resp.json['err'] == 'bad-request'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'start_date should be before end_date'
params['start_date'] = '2022-09-01'
params['end_date'] = '2024-08-31'
resp = app.get(url, params=params, status=400)
assert resp.json['err'] == 'bad-request'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'start_date and end_date are in different reference year (2022 != 2023)'
@ -5009,7 +5008,7 @@ def test_get_person_unit_list_not_linked_error(con, app):
'text_template': '',
}
resp = app.get(url, params=params)
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -5026,25 +5025,25 @@ def test_get_person_unit_list_date_error(con, app):
'text_template': '',
}
resp = app.get(url, params=params, status=400)
assert resp.json['err'] == 'bad-request'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'bad date format, should be YYYY-MM-DD'
params['start_date'] = '2022-09-01'
params['end_date'] = 'bad'
resp = app.get(url, params=params, status=400)
assert resp.json['err'] == 'bad-request'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'bad date format, should be YYYY-MM-DD'
params['start_date'] = '2023-09-01'
params['end_date'] = '2023-08-31'
resp = app.get(url, params=params, status=400)
assert resp.json['err'] == 'bad-request'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'start_date should be before end_date'
params['start_date'] = '2022-09-01'
params['end_date'] = '2024-08-31'
resp = app.get(url, params=params, status=400)
assert resp.json['err'] == 'bad-request'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'start_date and end_date are in different reference year (2022 != 2023)'
@ -5065,7 +5064,7 @@ def test_get_person_unit_list_no_activity_error(activity_service, con, app):
'text_template': '',
}
resp = app.get(url, params=params)
assert resp.json['err'] == 'no-activity'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'No activity plop for person'
@ -5143,7 +5142,7 @@ def test_get_person_place_list_not_linked_error(con, app):
'text_template': '',
}
resp = app.get(url, params=params)
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -5161,25 +5160,25 @@ def test_get_person_place_list_date_error(con, app):
'text_template': '',
}
resp = app.get(url, params=params, status=400)
assert resp.json['err'] == 'bad-request'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'bad date format, should be YYYY-MM-DD'
params['start_date'] = '2022-09-01'
params['end_date'] = 'bad'
resp = app.get(url, params=params, status=400)
assert resp.json['err'] == 'bad-request'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'bad date format, should be YYYY-MM-DD'
params['start_date'] = '2023-09-01'
params['end_date'] = '2023-08-31'
resp = app.get(url, params=params, status=400)
assert resp.json['err'] == 'bad-request'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'start_date should be before end_date'
params['start_date'] = '2022-09-01'
params['end_date'] = '2024-08-31'
resp = app.get(url, params=params, status=400)
assert resp.json['err'] == 'bad-request'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'start_date and end_date are in different reference year (2022 != 2023)'
@ -5201,12 +5200,12 @@ def test_get_person_place_list_no_unit_error(activity_service, con, app):
'text_template': '',
}
resp = app.get(url, params=params)
assert resp.json['err'] == 'no-activity'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'No activity plop for person'
params['activity_id'] = 'A10053187087'
resp = app.get(url, params=params)
assert resp.json['err'] == 'no-unit'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'No unit plop for person'
@ -5338,7 +5337,7 @@ def test_get_person_catalog_geojson_not_linked_error(con, app):
'person_id': '246423',
}
resp = app.get(url, params=params)
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -5353,25 +5352,25 @@ def test_get_person_catalog_geojson_date_error(con, app):
'end_date': '2023-08-31',
}
resp = app.get(url, params=params, status=400)
assert resp.json['err'] == 'bad-request'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'bad date format, should be YYYY-MM-DD'
params['start_date'] = '2022-09-01'
params['end_date'] = 'bad'
resp = app.get(url, params=params, status=400)
assert resp.json['err'] == 'bad-request'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'bad date format, should be YYYY-MM-DD'
params['start_date'] = '2023-09-01'
params['end_date'] = '2023-08-31'
resp = app.get(url, params=params, status=400)
assert resp.json['err'] == 'bad-request'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'start_date should be before end_date'
params['start_date'] = '2022-09-01'
params['end_date'] = '2024-08-31'
resp = app.get(url, params=params, status=400)
assert resp.json['err'] == 'bad-request'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'start_date and end_date are in different reference year (2022 != 2023)'
@ -5705,7 +5704,7 @@ def test_get_person_subscription_info_loisir_not_linked_error(con, app):
'ref_date': '2023-01-22',
}
resp = app.get(url, params=params)
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -5722,12 +5721,12 @@ def test_get_person_subscription_info_loisir_date_error(con, app):
'ref_date': '22/01/2023',
}
resp = app.get(url, params=params, status=400)
assert resp.json['err'] == 'bad-request'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'bad date format, should be YYYY-MM-DD'
params['ref_date'] = '2023-02-29'
resp = app.get(url, params=params, status=400)
assert resp.json['err'] == 'bad-request'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == '2023-02-29 is not a valid date'
@ -5828,7 +5827,7 @@ def test_add_person_basket_subscription_not_linked_error(con, app):
'end_date': '2023-08-31',
}
resp = app.post_json(url + '?NameID=local', params=params)
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -5891,7 +5890,7 @@ def test_get_basket(activity_service, con, app):
def test_get_basket_not_linked_error(con, app):
url = get_endpoint('get-basket')
resp = app.get(url + '?NameID=local')
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -5912,7 +5911,7 @@ def test_update_basket_time(activity_service, con, app):
def test_update_basket_time_not_linked_error(con, app):
url = get_endpoint('update-basket-time')
resp = app.post(url + '?NameID=local')
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -5944,7 +5943,7 @@ def test_delete_basket_line(activity_service, con, app):
def test_delete_basket_line_not_linked_error(con, app):
url = get_endpoint('delete-basket-line')
resp = app.post(url + '?NameID=local&line_id=S10053203120')
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -5988,7 +5987,7 @@ def test_delete_basket(activity_service, con, app):
def test_delete_basket_not_linked_error(con, app):
url = get_endpoint('delete-basket')
resp = app.post(url + '?NameID=local')
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'
@ -6022,7 +6021,7 @@ def test_validate_basket(activity_service, con, app):
def test_validate_basket_not_linked_error(con, app):
url = get_endpoint('validate-basket')
resp = app.post(url + '?NameID=local')
assert resp.json['err'] == 'not-linked'
assert resp.json['err'] == 1
assert resp.json['err_desc'] == 'User not linked to family'