tcl: update TCL to new data source URLs (#71975) #7
|
@ -182,6 +182,9 @@ FAMILY_PAYLOAD = {
|
|||
'lastname': 'Simpson',
|
||||
'birth': {'dateBirth': '1989-12-17'},
|
||||
'dietcode': 'BB',
|
||||
'paiInfoBean': {
|
||||
'code': 'PAIALI',
|
||||
},
|
||||
},
|
||||
],
|
||||
'emergencyPersonList': [
|
||||
|
@ -223,6 +226,9 @@ def pytest_addoption(parser):
|
|||
)
|
||||
parser.addoption('--nameid', help='Publik Name ID', default='functest')
|
||||
parser.addoption('--dui', help='DUI number', default='')
|
||||
parser.addoption(
|
||||
'--lastname', help='override lastname to create a new "update" family', default='Simpson'
|
||||
)
|
||||
|
||||
|
||||
def unlink(conn, name_id):
|
||||
|
@ -351,7 +357,7 @@ def referentials(conn):
|
|||
|
||||
|
||||
@pytest.fixture(scope='session')
|
||||
def create_data(request, conn, referentials):
|
||||
def create_data(request, conn):
|
||||
name_id = request.config.getoption('--nameid')
|
||||
unlink(conn, name_id)
|
||||
lastname = uuid4().hex[0:30]
|
||||
|
@ -376,23 +382,24 @@ def create_data(request, conn, referentials):
|
|||
'name_id': name_id, # linked
|
||||
'family_id': str(create_result['data']['number']),
|
||||
'lastname': lastname,
|
||||
'rl1_num': data['RL1']['num'],
|
||||
'family_payload': create_family_payload,
|
||||
'data': data,
|
||||
}
|
||||
|
||||
|
||||
@pytest.fixture(scope='session')
|
||||
def update_data(request, conn, referentials):
|
||||
def update_data(request, conn):
|
||||
name_id = request.config.getoption('--nameid')
|
||||
lastname = request.config.getoption('--lastname')
|
||||
unlink(conn, name_id)
|
||||
|
||||
debug = False # True allow to create then update a new family
|
||||
if debug:
|
||||
lastname = 'something new'
|
||||
FAMILY_PAYLOAD['rl1']['lastname'] = lastname
|
||||
FAMILY_PAYLOAD['rl2']['lastname'] = lastname
|
||||
for child in FAMILY_PAYLOAD['childList']:
|
||||
child['lastname'] = lastname
|
||||
# allow to create then update a new family if current is broken,
|
||||
# using --lastname option
|
||||
FAMILY_PAYLOAD['rl1']['lastname'] = lastname
|
||||
FAMILY_PAYLOAD['rl2']['lastname'] = lastname
|
||||
for child in FAMILY_PAYLOAD['childList']:
|
||||
child['lastname'] = lastname
|
||||
|
||||
# try to re-create test family
|
||||
url = conn + '/create-family?NameID=%s' % name_id
|
||||
|
@ -432,16 +439,13 @@ def update_data(request, conn, referentials):
|
|||
resp = requests.post(url, json=update_family_payload)
|
||||
resp.raise_for_status()
|
||||
assert resp.json()['err'] == 0
|
||||
|
||||
if debug:
|
||||
data = read_family(conn, name_id)
|
||||
else:
|
||||
data = diff_family(conn, name_id, 'test_update_family.json')
|
||||
data = diff_family(conn, name_id, 'test_update_family.json')
|
||||
|
||||
return {
|
||||
'name_id': name_id, # linked
|
||||
'family_id': family_id,
|
||||
'family_payload': update_family_payload,
|
||||
'lastname': lastname,
|
||||
'rl2_num': data['RL2']['num'],
|
||||
'bart_num': data['childList'][0]['num'],
|
||||
'lisa_num': data['childList'][1]['num'],
|
||||
|
|
|
@ -188,7 +188,13 @@
|
|||
"indicatorList": [],
|
||||
"medicalRecord": null,
|
||||
"insurance": null,
|
||||
"paiInfoBean": null,
|
||||
"paiInfoBean": {
|
||||
"code": "PAIALI",
|
||||
"dateDeb": null,
|
||||
"dateFin": null,
|
||||
"description": null,
|
||||
"code_text": "ALIMENTAIRE"
|
||||
},
|
||||
"mother": "N/A",
|
||||
"father": "N/A",
|
||||
"rl": null,
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
[
|
||||
{
|
||||
"yearRev": 2021,
|
||||
"dateStart": "2022-01-02T00:00:00+01:00",
|
||||
"dateEnd": "2022-12-31T00:00:00+01:00",
|
||||
"mtt": 1500.33,
|
||||
"cdquo": "QS",
|
||||
"codeUti": null,
|
||||
"cdquo_text": "QUOTIENT SCOLAIRE"
|
||||
},
|
||||
{
|
||||
"yearRev": 2020,
|
||||
"dateStart": "2022-01-02T00:00:00+01:00",
|
||||
"dateEnd": "2022-12-31T00:00:00+01:00",
|
||||
"mtt": 1500.33,
|
||||
"cdquo": "QS",
|
||||
"codeUti": null,
|
||||
"cdquo_text": "QUOTIENT SCOLAIRE"
|
||||
},
|
||||
{
|
||||
"yearRev": 2021,
|
||||
"dateStart": "2022-01-01T00:00:00+01:00",
|
||||
"dateEnd": "2022-01-01T00:00:00+01:00",
|
||||
"mtt": 1500.33,
|
||||
"cdquo": "QS",
|
||||
"codeUti": null,
|
||||
"cdquo_text": "QUOTIENT SCOLAIRE"
|
||||
}
|
||||
]
|
|
@ -21,7 +21,7 @@ def read_family(family_id, verbose):
|
|||
result = client.service.readFamily(
|
||||
dossierNumber=family_id,
|
||||
# schoolYear=
|
||||
# incomeYear=2020, # <-- pour avoir les quotients
|
||||
# incomeYear=2022, # <-- pour filtrer les quotients sur cette année
|
||||
# referenceYear=2020,
|
||||
)
|
||||
print(result)
|
||||
|
|
|
@ -189,6 +189,11 @@ def test_update_family(conn, update_data):
|
|||
|
||||
# reset fields
|
||||
family_reset_payload = copy.deepcopy(FAMILY_RESET_PAYLOAD)
|
||||
family_reset_payload['rl1']['lastname'] = update_data['lastname']
|
||||
family_reset_payload['rl2']['lastname'] = update_data['lastname']
|
||||
for child in family_reset_payload['childList']:
|
||||
child['lastname'] = update_data['lastname']
|
||||
|
||||
family_reset_payload['childList'][0]['num'] = update_data['family_payload']['childList'][0]['num']
|
||||
resp = requests.post(url, json=family_reset_payload)
|
||||
resp.raise_for_status()
|
||||
|
@ -323,6 +328,7 @@ def test_update_rlg(conn, update_data, rl):
|
|||
|
||||
# reset responsable legal
|
||||
payload = copy.deepcopy(FAMILY_RESET_PAYLOAD[rlg])
|
||||
payload['lastname'] = update_data['lastname']
|
||||
for key in 'adresse', 'contact', 'profession', 'CAFInfo', 'indicatorList':
|
||||
if key in payload:
|
||||
del payload[key]
|
||||
|
@ -361,7 +367,7 @@ def test_update_rlg(conn, update_data, rl):
|
|||
)
|
||||
|
||||
# update birtday is refused
|
||||
payload['lastname'] = 'Simpson'
|
||||
payload['lastname'] = update_data['lastname']
|
||||
payload['birth']['dateBirth'] = '1970-01-01'
|
||||
resp = requests.post(url, json=payload)
|
||||
resp.raise_for_status()
|
||||
|
@ -752,3 +758,57 @@ def test_update_child_indicator(conn, update_data):
|
|||
resp.raise_for_status()
|
||||
assert resp.json()['err'] == 0
|
||||
assert diff_family(conn, update_data['name_id'], 'test_update_family.json')
|
||||
|
||||
|
||||
def test_update_quotient(conn, create_data):
|
||||
unlink(conn, create_data['name_id'])
|
||||
link(conn, create_data)
|
||||
|
||||
# add quotient
|
||||
url = conn + '/update-quotient?NameID=%s&rl_id=%s' % (create_data['name_id'], create_data['rl1_num'])
|
||||
payload = {
|
||||
'yearRev': '2021',
|
||||
'dateStart': '2022-01-01',
|
||||
'dateEnd': '2022-12-31',
|
||||
'mtt': '1500.33',
|
||||
'cdquo': 'QS',
|
||||
}
|
||||
resp = requests.post(url, json=payload)
|
||||
resp.raise_for_status()
|
||||
assert resp.json()['err'] == 0
|
||||
data = read_family(conn, create_data['name_id'])
|
||||
assert data['RL1']['quotientList'] == [
|
||||
{
|
||||
'yearRev': 2021,
|
||||
'dateStart': '2022-01-01T00:00:00+01:00',
|
||||
'dateEnd': '2022-12-31T00:00:00+01:00',
|
||||
'mtt': 1500.33,
|
||||
'cdquo': 'QS',
|
||||
'codeUti': None,
|
||||
'cdquo_text': 'QUOTIENT SCOLAIRE',
|
||||
}
|
||||
]
|
||||
|
||||
# add quotient
|
||||
payload['dateStart'] = '2022-01-02'
|
||||
resp = requests.post(url, json=payload)
|
||||
resp.raise_for_status()
|
||||
assert resp.json()['err'] == 0
|
||||
data = read_family(conn, create_data['name_id'])
|
||||
assert len(data['RL1']['quotientList']) == 2
|
||||
|
||||
# add quotient on another income year
|
||||
payload['yearRev'] = '2020'
|
||||
resp = requests.post(url, json=payload)
|
||||
resp.raise_for_status()
|
||||
assert resp.json()['err'] == 0
|
||||
data = diff_rlg(conn, create_data['name_id'], 1, 'test_update_quotient.json', 'quotientList')
|
||||
assert len(data['RL1']['quotientList']) == 3
|
||||
|
||||
# test read-family with reference year
|
||||
url = conn + '/read-family?NameID=%s&income_year=%s' % (create_data['name_id'], '2020')
|
||||
resp = requests.get(url)
|
||||
resp.raise_for_status()
|
||||
res = resp.json()
|
||||
assert res['err'] == 0
|
||||
return len(res['data']['RL1']['quotientList']) == 1
|
||||
|
|
|
@ -51,9 +51,5 @@ def test_link(conn, update_data):
|
|||
resp = requests.post(url, json=payload)
|
||||
resp.raise_for_status()
|
||||
res = resp.json()
|
||||
assert res == {
|
||||
'err': 'not-found',
|
||||
'err_class': 'passerelle.utils.jsonresponse.APIError',
|
||||
'err_desc': "RL1 does not match '196947' family",
|
||||
'data': None,
|
||||
}
|
||||
assert res['err'] == 'not-found'
|
||||
assert 'RL1 does not match' in res['err_desc']
|
||||
|
|
|
@ -22,7 +22,7 @@ from django.db import models
|
|||
from django.http import HttpResponse
|
||||
from django.urls import reverse
|
||||
from django.utils.http import urlencode
|
||||
from django.utils.timezone import now
|
||||
from django.utils.timezone import localtime, now
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from passerelle.base.models import BaseResource, HTTPResource
|
||||
|
@ -665,7 +665,7 @@ class RSA13Resource(BaseResource, HTTPResource):
|
|||
if locals().get(key):
|
||||
params[key] = locals()[key]
|
||||
content = self.get('platform/%s/beneficiaire/csv/' % platform_id, email=email, ip=ip, params=params)
|
||||
date = now().strftime('%Y-%m-%d_%H:%M')
|
||||
date = localtime(now()).strftime('%Y-%m-%d_%H:%M')
|
||||
return self.csv_response('beneficiaire', data=content['data'], filename=f'beneficiaire-{date}.csv')
|
||||
|
||||
@endpoint(
|
||||
|
@ -1963,7 +1963,7 @@ class RSA13Resource(BaseResource, HTTPResource):
|
|||
):
|
||||
url = 'platform/%s/beneficiaire/sorti/csv' % platform_id
|
||||
content = self.get(url, email=email, ip=ip)
|
||||
date = now().strftime('%Y-%m-%d_%H:%M')
|
||||
date = localtime(now()).strftime('%Y-%m-%d_%H:%M')
|
||||
return self.csv_response(
|
||||
'sorti', data=content.get('data') or [], filename=f'beneficiaire-sorti-{date}.csv'
|
||||
)
|
||||
|
|
|
@ -127,7 +127,7 @@ class Tcl(BaseResource):
|
|||
|
||||
with transaction.atomic():
|
||||
for key in ('tcllignebus', 'tcllignemf', 'tcllignetram'):
|
||||
url = get_tcl_data_url(key)
|
||||
url = get_tcl_data_url(key + '_2_0_0')
|
||||
response = self.requests.get(url)
|
||||
response.raise_for_status()
|
||||
for line_data in response.json()['values']:
|
||||
|
@ -139,6 +139,7 @@ class Tcl(BaseResource):
|
|||
code_titan=line_data['code_titan'],
|
||||
defaults={'transport_key': key, 'ligne': line_data['ligne']},
|
||||
)
|
||||
line.ut = None
|
||||
line.__dict__.update(line_data)
|
||||
line.transport_key = key
|
||||
line.save()
|
||||
|
|
|
@ -187,13 +187,13 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
except Link.DoesNotExist:
|
||||
raise APIError('User not linked to family', err_code='not-linked')
|
||||
|
||||
def get_family_raw(self, family_id):
|
||||
response = self.call('Family', 'readFamily', dossierNumber=family_id)
|
||||
def get_family_raw(self, family_id, **kwargs):
|
||||
response = self.call('Family', 'readFamily', dossierNumber=family_id, **kwargs)
|
||||
data = serialize_object(response)
|
||||
return data
|
||||
|
||||
def get_rl_raw(self, family_id, rl_id):
|
||||
data = self.get_family_raw(family_id)
|
||||
def get_rl_raw(self, family_id, rl_id, **kwargs):
|
||||
data = self.get_family_raw(family_id, **kwargs)
|
||||
if data['RL1']['num'] == rl_id:
|
||||
return data['RL1']
|
||||
elif data['RL2'] and data['RL2']['num'] == rl_id:
|
||||
|
@ -275,6 +275,8 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
self.add_text_value('Organ', data, ['CAFInfo', 'organ'])
|
||||
for indicator in data['indicatorList']:
|
||||
self.add_text_value_to_rl_indicator(indicator)
|
||||
for quotient in data['quotientList']:
|
||||
self.add_text_value('Quotient', quotient, ['cdquo'])
|
||||
|
||||
# sort indicators
|
||||
if data['indicatorList']:
|
||||
|
@ -307,13 +309,13 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
self.add_text_value_to_person(data)
|
||||
return data
|
||||
|
||||
def get_rl(self, family_id, rl_id):
|
||||
data = self.get_rl_raw(family_id, rl_id)
|
||||
def get_rl(self, family_id, rl_id, **kwargs):
|
||||
data = self.get_rl_raw(family_id, rl_id, **kwargs)
|
||||
self.add_text_value_to_rl(data)
|
||||
return data
|
||||
|
||||
def get_family(self, family_id):
|
||||
data = self.get_family_raw(family_id)
|
||||
def get_family(self, family_id, **kwargs):
|
||||
data = self.get_family_raw(family_id, **kwargs)
|
||||
self.add_text_value_to_family(data)
|
||||
return data
|
||||
|
||||
|
@ -727,11 +729,14 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
description='Informations sur la famille',
|
||||
perm='can_access',
|
||||
name='read-family',
|
||||
parameters={'NameID': {'description': 'Publik NameID'}},
|
||||
parameters={
|
||||
'NameID': {'description': 'Publik NameID'},
|
||||
'income_year': {'description': 'Année de revenu pour filtrer les quotients'},
|
||||
},
|
||||
)
|
||||
def read_family(self, request, NameID):
|
||||
def read_family(self, request, NameID, income_year=None):
|
||||
family_id = self.get_link(NameID).family_id
|
||||
data = self.get_family(family_id)
|
||||
data = self.get_family(family_id, incomeYear=income_year)
|
||||
return {'data': data}
|
||||
|
||||
@endpoint(
|
||||
|
@ -742,11 +747,12 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
parameters={
|
||||
'NameID': {'description': 'Publik NameID'},
|
||||
'rl_id': {'description': 'Numéro du représentant légal'},
|
||||
'income_year': {'description': 'Année de revenu pour filtrer les quotients'},
|
||||
},
|
||||
)
|
||||
def read_rl(self, request, NameID, rl_id):
|
||||
def read_rl(self, request, NameID, rl_id, income_year=None):
|
||||
family_id = self.get_link(NameID).family_id
|
||||
data = self.get_rl(family_id, rl_id)
|
||||
data = self.get_rl(family_id, rl_id, incomeYear=income_year)
|
||||
return {'data': data}
|
||||
|
||||
@endpoint(
|
||||
|
@ -1086,6 +1092,29 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
self.call('Family', 'updatePersonIndicatorList', numPerson=rl_id, **post_data)
|
||||
return {'data': 'ok'}
|
||||
|
||||
@endpoint(
|
||||
display_category='Famille',
|
||||
description="Créer ou mettre à jour un quotient d'un responsable légal",
|
||||
name='update-quotient',
|
||||
perm='can_access',
|
||||
parameters={
|
||||
'NameID': {'description': 'Publik NameID'},
|
||||
'rl_id': {'description': "Numéro du responsable légal"},
|
||||
},
|
||||
post={'request_body': {'schema': {'application/json': schemas.UPDATE_QUOTIENT_SCHEMA}}},
|
||||
)
|
||||
def update_quotient(self, request, NameID, rl_id, post_data):
|
||||
family_id = self.get_link(NameID).family_id
|
||||
self.assert_post_data_in_referential('Quotient', post_data, ['cdquo'])
|
||||
|
||||
payload = {
|
||||
'dossierNumber': family_id,
|
||||
'personNumber': rl_id,
|
||||
'quotient': post_data,
|
||||
}
|
||||
self.call('Family', 'createUpdateQuotient', **payload)
|
||||
return {'data': 'ok'}
|
||||
|
||||
@endpoint(
|
||||
display_category='Famille',
|
||||
description="Création d'une personne à prévenir en cas d'urgence",
|
||||
|
|
|
@ -720,3 +720,39 @@ UPDATE_INDICATOR_SCHEMA = {
|
|||
'additionalProperties': False,
|
||||
'unflatten': True,
|
||||
}
|
||||
|
||||
UPDATE_QUOTIENT_SCHEMA = {
|
||||
'$schema': 'http://json-schema.org/draft-04/schema#',
|
||||
'title': 'Family persons',
|
||||
'description': "Mise à jours des quotients sur les responsables légaux",
|
||||
'type': 'object',
|
||||
'required': ['yearRev', 'dateStart', 'dateEnd', 'mtt', 'cdquo'],
|
||||
'properties': {
|
||||
'yearRev': {
|
||||
'description': 'Année de revenu',
|
||||
'type': 'string',
|
||||
'pattern': '^[0-9]{4}$',
|
||||
},
|
||||
'dateStart': {
|
||||
'description': 'Date de début',
|
||||
'type': 'string',
|
||||
'pattern': '^[0-9]{4}-[0-9]{2}-[0-9]{2}$',
|
||||
},
|
||||
'dateEnd': {
|
||||
'description': 'Date de fin',
|
||||
'type': 'string',
|
||||
'pattern': '^[0-9]{4}-[0-9]{2}-[0-9]{2}$',
|
||||
},
|
||||
'mtt': {
|
||||
'description': 'Montant',
|
||||
'type': 'string',
|
||||
'pattern': r'^[0-9]+\.?[0-9]*$',
|
||||
},
|
||||
'cdquo': {
|
||||
'description': 'Code du quotient (depuis référentiel)',
|
||||
'type': 'string',
|
||||
'pattern': '.+',
|
||||
},
|
||||
},
|
||||
'additionalProperties': False,
|
||||
}
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
<soap-env:Header>
|
||||
<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
|
||||
<wsse:UsernameToken>
|
||||
<wsse:Username>maelis-webservice</wsse:Username>
|
||||
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">maelis-password</wsse:Password>
|
||||
</wsse:UsernameToken>
|
||||
</wsse:Security>
|
||||
</soap-env:Header>
|
||||
<soap-env:Body>
|
||||
<ns0:createUpdateQuotient xmlns:ns0="family.ws.maelis.sigec.com">
|
||||
<dossierNumber>1312</dossierNumber>
|
||||
<personNumber>613878</personNumber>
|
||||
<quotient>
|
||||
<yearRev>2021</yearRev>
|
||||
<dateStart>2022-10-01</dateStart>
|
||||
<dateEnd>2023-01-31</dateEnd>
|
||||
<mtt>1500.33</mtt>
|
||||
<cdquo>QS</cdquo>
|
||||
</quotient>
|
||||
</ns0:createUpdateQuotient>
|
||||
</soap-env:Body>
|
||||
</soap-env:Envelope>
|
|
@ -0,0 +1,5 @@
|
|||
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
<soap:Body>
|
||||
<ns2:createUpdateQuotientResponse xmlns:ns2="family.ws.maelis.sigec.com"/>
|
||||
</soap:Body>
|
||||
</soap:Envelope>
|
|
@ -0,0 +1,13 @@
|
|||
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
<soap:Body>
|
||||
<soap:Fault>
|
||||
<faultcode>soap:Server</faultcode>
|
||||
<faultstring>E07 : Il existe déjà un quotient postérieur pour cette période</faultstring>
|
||||
<detail>
|
||||
<ns1:MaelisFamilyException xmlns:ns1="family.ws.maelis.sigec.com">
|
||||
<message xmlns:ns2="family.ws.maelis.sigec.com">E07 : Il existe déjà un quotient postérieur pour cette période</message>
|
||||
</ns1:MaelisFamilyException>
|
||||
</detail>
|
||||
</soap:Fault>
|
||||
</soap:Body>
|
||||
</soap:Envelope>
|
|
@ -45,6 +45,20 @@
|
|||
<code>AVL</code>
|
||||
<label>Auxiliaire de Vie loisirs</label>
|
||||
</indicatorList>
|
||||
<quotientList>
|
||||
<yearRev>2020</yearRev>
|
||||
<dateStart>2021-01-01T00:00:00+01:00</dateStart>
|
||||
<dateEnd>2021-12-31T00:00:00+01:00</dateEnd>
|
||||
<mtt>1500.33</mtt>
|
||||
<cdquo>QS</cdquo>
|
||||
</quotientList>
|
||||
<quotientList>
|
||||
<yearRev>2021</yearRev>
|
||||
<dateStart>2022-01-01T00:00:00+01:00</dateStart>
|
||||
<dateEnd>2022-12-31T00:00:00+01:00</dateEnd>
|
||||
<mtt>1500.44</mtt>
|
||||
<cdquo>MOY ECO</cdquo>
|
||||
</quotientList>
|
||||
</RL1>
|
||||
<RL2>
|
||||
<num>613879</num>
|
||||
|
|
|
@ -45,6 +45,20 @@
|
|||
<code>AVL</code>
|
||||
<label>Auxiliaire de Vie loisirs</label>
|
||||
</indicatorList>
|
||||
<quotientList>
|
||||
<yearRev>2020</yearRev>
|
||||
<dateStart>2021-01-01T00:00:00+01:00</dateStart>
|
||||
<dateEnd>2021-12-31T00:00:00+01:00</dateEnd>
|
||||
<mtt>1500.33</mtt>
|
||||
<cdquo>QS</cdquo>
|
||||
</quotientList>
|
||||
<quotientList>
|
||||
<yearRev>2021</yearRev>
|
||||
<dateStart>2022-01-01T00:00:00+01:00</dateStart>
|
||||
<dateEnd>2022-12-31T00:00:00+01:00</dateEnd>
|
||||
<mtt>1500.44</mtt>
|
||||
<cdquo>MOY ECO</cdquo>
|
||||
</quotientList>
|
||||
</RL1>
|
||||
<RL2>
|
||||
<num>613879</num>
|
||||
|
|
|
@ -45,6 +45,20 @@
|
|||
<code>AVL</code>
|
||||
<label>Auxiliaire de Vie loisirs</label>
|
||||
</indicatorList>
|
||||
<quotientList>
|
||||
<yearRev>2020</yearRev>
|
||||
<dateStart>2021-01-01T00:00:00+01:00</dateStart>
|
||||
<dateEnd>2021-12-31T00:00:00+01:00</dateEnd>
|
||||
<mtt>1500.33</mtt>
|
||||
<cdquo>QS</cdquo>
|
||||
</quotientList>
|
||||
<quotientList>
|
||||
<yearRev>2021</yearRev>
|
||||
<dateStart>2022-01-01T00:00:00+01:00</dateStart>
|
||||
<dateEnd>2022-12-31T00:00:00+01:00</dateEnd>
|
||||
<mtt>1500.44</mtt>
|
||||
<cdquo>MOY ECO</cdquo>
|
||||
</quotientList>
|
||||
</RL1>
|
||||
<RL2>
|
||||
<num>613879</num>
|
||||
|
|
|
@ -0,0 +1,211 @@
|
|||
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
<soap:Body>
|
||||
<ns2:readFamilyResponse xmlns:ns2="family.ws.maelis.sigec.com">
|
||||
<familyResult>
|
||||
<number>1312</number>
|
||||
<category>BI</category>
|
||||
<situation>M</situation>
|
||||
<flagCom>true</flagCom>
|
||||
<nbChild>2</nbChild>
|
||||
<RL1>
|
||||
<num>613878</num>
|
||||
<lastname>DOE</lastname>
|
||||
<firstname>JHON</firstname>
|
||||
<quality>PERE</quality>
|
||||
<civility>M.</civility>
|
||||
<birth>
|
||||
<dateBirth>1938-07-26T00:00:00+01:00</dateBirth>
|
||||
<place>Rabbat</place>
|
||||
<countryCode>99350</countryCode>
|
||||
</birth>
|
||||
<adresse>
|
||||
<idStreet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
|
||||
<num>170</num>
|
||||
<street1>Chateau d'eau</street1>
|
||||
<town>Paris</town>
|
||||
<zipcode>75014</zipcode>
|
||||
</adresse>
|
||||
<contact>
|
||||
<phone>non</phone>
|
||||
<mobile>0777777777</mobile>
|
||||
<mail>djhon@example.org</mail>
|
||||
<isContactMail>true</isContactMail>
|
||||
<isContactSms>true</isContactSms>
|
||||
<isInvoicePdf>true</isInvoicePdf>
|
||||
</contact>
|
||||
<profession>
|
||||
<addressPro/>
|
||||
</profession>
|
||||
<quotientList>
|
||||
<yearRev>2020</yearRev>
|
||||
<dateStart>2021-01-01T00:00:00+01:00</dateStart>
|
||||
<dateEnd>2021-12-31T00:00:00+01:00</dateEnd>
|
||||
<mtt>1500.33</mtt>
|
||||
<cdquo>QS</cdquo>
|
||||
</quotientList>
|
||||
</RL1>
|
||||
<RL2>
|
||||
<num>613879</num>
|
||||
<lastname>DOE</lastname>
|
||||
<firstname>JANE</firstname>
|
||||
<maidenName>SMITH</maidenName>
|
||||
<quality>MERE</quality>
|
||||
<civility>MME</civility>
|
||||
<birth>
|
||||
<dateBirth>1940-06-22T00:00:00+02:00</dateBirth>
|
||||
<place>Bardot</place>
|
||||
<countryCode>99351</countryCode>
|
||||
</birth>
|
||||
<adresse>
|
||||
<idStreet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
|
||||
<num>170</num>
|
||||
<street1>Chateau d'eau</street1>
|
||||
<town>Paris</town>
|
||||
<zipcode>75014</zipcode>
|
||||
</adresse>
|
||||
<contact>
|
||||
<isContactMail>false</isContactMail>
|
||||
<isContactSms>false</isContactSms>
|
||||
<isInvoicePdf>false</isInvoicePdf>
|
||||
</contact>
|
||||
<profession>
|
||||
<codeCSP>ART</codeCSP>
|
||||
<profession>informaticien</profession>
|
||||
<employerName>EO</employerName>
|
||||
<phone>0123456789</phone>
|
||||
<addressPro>
|
||||
<town>Orléans</town>
|
||||
</addressPro>
|
||||
</profession>
|
||||
<CAFInfo>
|
||||
<number>789</number>
|
||||
<organ>A10007752822</organ>
|
||||
</CAFInfo>
|
||||
</RL2>
|
||||
<emergencyPersonList>
|
||||
<numPerson>614059</numPerson>
|
||||
<civility>MME</civility>
|
||||
<firstname>KENY</firstname>
|
||||
<lastname>ARKANA</lastname>
|
||||
<dateBirth>1982-12-20T00:00:00+01:00</dateBirth>
|
||||
<quality>T</quality>
|
||||
<contact>
|
||||
<phone>0123456789</phone>
|
||||
<mail>pueblo@example.org</mail>
|
||||
</contact>
|
||||
</emergencyPersonList>
|
||||
<childList>
|
||||
<num>613880</num>
|
||||
<lastname>DOE</lastname>
|
||||
<firstname>JANNIS</firstname>
|
||||
<sexe>F</sexe>
|
||||
<birth>
|
||||
<dateBirth>1943-01-19T00:00:00+01:00</dateBirth>
|
||||
<place>Saint-louis</place>
|
||||
<communeCode>91122</communeCode>
|
||||
<countryCode>99100</countryCode>
|
||||
</birth>
|
||||
<dietcode>RSV</dietcode>
|
||||
<bPhoto>true</bPhoto>
|
||||
<bLeaveAlone>false</bLeaveAlone>
|
||||
<authorizedPersonList>
|
||||
<personInfo>
|
||||
<num>614719</num>
|
||||
<lastname>BENT</lastname>
|
||||
<firstname>AMEL</firstname>
|
||||
<dateBirth>1985-06-21T00:00:00+02:00</dateBirth>
|
||||
<civility>MME</civility>
|
||||
<sexe>F</sexe>
|
||||
<contact>
|
||||
<phone>0123456789</phone>
|
||||
<mobile>0623456789</mobile>
|
||||
<mail>abent@example.org</mail>
|
||||
</contact>
|
||||
</personInfo>
|
||||
<personQuality>
|
||||
<code>T</code>
|
||||
<libelle>TANTE</libelle>
|
||||
</personQuality>
|
||||
</authorizedPersonList>
|
||||
<medicalRecord>
|
||||
<familyDoctor>
|
||||
<name>DRE</name>
|
||||
<phone>0612341234</phone>
|
||||
<address>
|
||||
<street1>Alameda</street1>
|
||||
<zipcode>90220</zipcode>
|
||||
<town>Compton</town>
|
||||
</address>
|
||||
</familyDoctor>
|
||||
<allergy1>butterscotch, imitation butterscotch, glow-in-the-dark monster make-up</allergy1>
|
||||
<allergy2>shrimp and cauliflower</allergy2>
|
||||
<comment1>the shrimp allergy isn't fully identified</comment1>
|
||||
<observ1>Ay Caramba!</observ1>
|
||||
<observ2>Eat my shorts!</observ2>
|
||||
<isAuthHospital>true</isAuthHospital>
|
||||
<hospital>Springfield General Hospital</hospital>
|
||||
<vaccinList>
|
||||
<code>ROR</code>
|
||||
<label>ROUGEOLE-OREILLONS-RUBEOLE</label>
|
||||
<vaccinationDate>2012-02-22T00:00:00+01:00</vaccinationDate>
|
||||
</vaccinList>
|
||||
<vaccinList>
|
||||
<code>DTC</code>
|
||||
<label>DIPHTERIE TETANOS COQUELUCHE</label>
|
||||
<vaccinationDate>2011-01-11T00:00:00+01:00</vaccinationDate>
|
||||
</vaccinList>
|
||||
<vaccinList>
|
||||
<code>ROR</code>
|
||||
<label>ROUGEOLE-OREILLONS-RUBEOLE</label>
|
||||
<vaccinationDate>1970-01-11T00:00:00+01:00</vaccinationDate>
|
||||
</vaccinList>
|
||||
</medicalRecord>
|
||||
<mother>
|
||||
<num>613963</num>
|
||||
<civility>MME</civility>
|
||||
<firstname>JANE</firstname>
|
||||
<lastname>DOE</lastname>
|
||||
</mother>
|
||||
<father>
|
||||
<num>613878</num>
|
||||
<civility>M.</civility>
|
||||
<firstname>JHON</firstname>
|
||||
<lastname>DOE</lastname>
|
||||
</father>
|
||||
<paiInfoBean>
|
||||
<code>PAIALI</code>
|
||||
<dateDeb>2022-01-01T00:00:00+01:00</dateDeb>
|
||||
<dateFin>2022-12-31T00:00:00+01:00</dateFin>
|
||||
<description>bla bla PAI</description>
|
||||
</paiInfoBean>
|
||||
</childList>
|
||||
<childList>
|
||||
<num>613987</num>
|
||||
<lastname>DOE</lastname>
|
||||
<firstname>JOHNNY ALLEN</firstname>
|
||||
<sexe>M</sexe>
|
||||
<birth>
|
||||
<dateBirth>1942-11-27T00:00:00+01:00</dateBirth>
|
||||
<place>Seattle</place>
|
||||
</birth>
|
||||
<bPhoto>false</bPhoto>
|
||||
<bLeaveAlone>false</bLeaveAlone>
|
||||
<paiInfoBean/>
|
||||
</childList>
|
||||
<childList>
|
||||
<num>614051</num>
|
||||
<lastname>DOE</lastname>
|
||||
<firstname>ROBERT</firstname>
|
||||
<sexe>M</sexe>
|
||||
<birth>
|
||||
<dateBirth>1941-05-24T00:00:00+02:00</dateBirth>
|
||||
<place>Duluth</place>
|
||||
</birth>
|
||||
<bPhoto>true</bPhoto>
|
||||
<bLeaveAlone>false</bLeaveAlone>
|
||||
<paiInfoBean/>
|
||||
</childList>
|
||||
</familyResult>
|
||||
</ns2:readFamilyResponse>
|
||||
</soap:Body>
|
||||
</soap:Envelope>
|
|
@ -115,9 +115,9 @@ def connector(db):
|
|||
|
||||
def tcl_responses(url, **kwargs):
|
||||
content = {
|
||||
'/tcllignebus': LIGNE_BUS,
|
||||
'/tcllignemf': LIGNE_MF,
|
||||
'/tcllignetram': LIGNE_TRAM,
|
||||
'/tcllignebus_2_0_0': LIGNE_BUS,
|
||||
'/tcllignemf_2_0_0': LIGNE_MF,
|
||||
'/tcllignetram_2_0_0': LIGNE_TRAM,
|
||||
'/geojson/tclarret': ARRETS,
|
||||
'/tclpassagearret': PASSAGES,
|
||||
}.get(urlparse.urlparse(url).path)
|
||||
|
|
|
@ -44,6 +44,9 @@ ISWSRUNNING_FALSE = FakedResponse(content=get_xml_file('R_is_ws_running.xml') %
|
|||
READ_FAMILY = FakedResponse(content=get_xml_file('R_read_family.xml'), status_code=200)
|
||||
READ_FAMILY_LAX = FakedResponse(content=get_xml_file('R_read_family_relax.xml'), status_code=200)
|
||||
READ_FAMILY_ORD = FakedResponse(content=get_xml_file('R_read_family_reordered.xml'), status_code=200)
|
||||
READ_FAMILY_QUOTIENT = FakedResponse(
|
||||
content=get_xml_file('R_read_family_with_income_year.xml'), status_code=200
|
||||
)
|
||||
READ_RL1_FAMILY = FakedResponse(content=get_xml_file('R_read_family_with_only_rl1.xml'), status_code=200)
|
||||
IS_RL_EXISTS_TRUE = FakedResponse(content=get_xml_file('R_is_rl_exists.xml') % b'true', status_code=200)
|
||||
IS_RL_EXISTS_FALSE = FakedResponse(content=get_xml_file('R_is_rl_exists.xml') % b'false', status_code=200)
|
||||
|
@ -58,6 +61,10 @@ CREATE_CHILD_ERR = FakedResponse(content=get_xml_file('R_create_child_error.xml'
|
|||
UPDATE_FAMILY = FakedResponse(content=get_xml_file('R_update_family.xml'), status_code=200)
|
||||
UPDATE_FAMILY_ERR = FakedResponse(content=get_xml_file('R_update_family_error.xml'), status_code=200)
|
||||
UPDATE_FAMILY_500 = FakedResponse(content=get_xml_file('R_update_family_soap_error.xml'), status_code=500)
|
||||
UPDATE_QUOTIENT = FakedResponse(content=get_xml_file('R_create_update_quotient.xml'), status_code=200)
|
||||
UPDATE_QUOTIENT_500 = FakedResponse(
|
||||
content=get_xml_file('R_create_update_quotient_soap_error.xml'), status_code=500
|
||||
)
|
||||
UPDATE_DIETCODE = FakedResponse(content=get_xml_file('R_update_child_dietcode.xml'), status_code=200)
|
||||
UPDATE_PAI = FakedResponse(content=get_xml_file('R_update_child_pai.xml'), status_code=200)
|
||||
UPDATE_PAI_500 = FakedResponse(content=get_xml_file('R_update_child_pai_soap_error.xml'), status_code=500)
|
||||
|
@ -705,7 +712,6 @@ def test_read_family(mocked_post, mocked_get, read_family, con, app):
|
|||
'CAFInfo': None,
|
||||
'civility_text': 'Monsieur',
|
||||
'quality_text': 'PERE',
|
||||
'quotientList': [],
|
||||
'indicatorList': [
|
||||
{
|
||||
'choice': None,
|
||||
|
@ -722,6 +728,26 @@ def test_read_family(mocked_post, mocked_get, read_family, con, app):
|
|||
'note': 'SNPP',
|
||||
},
|
||||
],
|
||||
'quotientList': [
|
||||
{
|
||||
'cdquo': 'QS',
|
||||
'cdquo_text': 'QUOTIENT SCOLAIRE',
|
||||
'codeUti': None,
|
||||
'dateEnd': '2021-12-31T00:00:00+01:00',
|
||||
'dateStart': '2021-01-01T00:00:00+01:00',
|
||||
'mtt': 1500.33,
|
||||
'yearRev': 2020,
|
||||
},
|
||||
{
|
||||
'cdquo': 'MOY ECO',
|
||||
'cdquo_text': 'REVENU MOYEN ( MENSUEL OU ANNUEL)',
|
||||
'codeUti': None,
|
||||
'dateEnd': '2022-12-31T00:00:00+01:00',
|
||||
'dateStart': '2022-01-01T00:00:00+01:00',
|
||||
'mtt': 1500.44,
|
||||
'yearRev': 2021,
|
||||
},
|
||||
],
|
||||
'subscribeActivityList': [],
|
||||
}
|
||||
data = resp.json['data']['childList'][0]
|
||||
|
@ -862,6 +888,29 @@ def test_read_rl1(mocked_post, mocked_get, con, app):
|
|||
assert resp.json['data']['firstname'] == 'JHON'
|
||||
|
||||
|
||||
@mock.patch('passerelle.utils.Request.get')
|
||||
@mock.patch('passerelle.utils.Request.post')
|
||||
def test_read_rl1_with_income_year(mocked_post, mocked_get, con, app):
|
||||
mocked_get.return_value = FAMILY_SERVICE_WSDL
|
||||
mocked_post.return_value = READ_FAMILY_QUOTIENT
|
||||
url = get_endpoint('read-rl')
|
||||
Link.objects.create(resource=con, family_id='1312', name_id='local')
|
||||
|
||||
resp = app.get(url + '?NameID=local&rl_id=613878&income_year=2020')
|
||||
assert resp.json['err'] == 0
|
||||
assert resp.json['data']['quotientList'] == [
|
||||
{
|
||||
'yearRev': 2020,
|
||||
'dateStart': '2021-01-01T00:00:00+01:00',
|
||||
'dateEnd': '2021-12-31T00:00:00+01:00',
|
||||
'mtt': 1500.33,
|
||||
'cdquo': 'QS',
|
||||
'cdquo_text': 'QUOTIENT SCOLAIRE',
|
||||
'codeUti': None,
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
@mock.patch('passerelle.utils.Request.get')
|
||||
@mock.patch('passerelle.utils.Request.post')
|
||||
def test_read_rl2(mocked_post, mocked_get, con, app):
|
||||
|
@ -2111,6 +2160,79 @@ def test_update_coordinate_wrong_referential_key_error(mocked_post, mocked_get,
|
|||
)
|
||||
|
||||
|
||||
@mock.patch('passerelle.utils.Request.get')
|
||||
@mock.patch('passerelle.utils.Request.post')
|
||||
def test_update_quotient(mocked_post, mocked_get, con, app):
|
||||
mocked_get.return_value = FAMILY_SERVICE_WSDL
|
||||
mocked_post.return_value = UPDATE_QUOTIENT
|
||||
url = get_endpoint('update-quotient')
|
||||
params = {
|
||||
'yearRev': '2021',
|
||||
'dateStart': '2022-10-01',
|
||||
'dateEnd': '2023-01-31',
|
||||
'mtt': '1500.33',
|
||||
'cdquo': 'QS',
|
||||
}
|
||||
|
||||
Link.objects.create(resource=con, family_id='1312', name_id='local')
|
||||
resp = app.post_json(url + '?NameID=local&rl_id=613878', params=params)
|
||||
assert_sent_payload(mocked_post, 'Q_create_update_quotient.xml')
|
||||
assert resp.json['err'] == 0
|
||||
assert resp.json['data'] == 'ok'
|
||||
|
||||
|
||||
def test_update_quotient_schema_error(con, app):
|
||||
url = get_endpoint('update-quotient')
|
||||
params = {
|
||||
'yearRev': '2021',
|
||||
'dateStart': '2022-10-01',
|
||||
'dateEnd': '2023-01-31',
|
||||
'mtt': '1500,33',
|
||||
'cdquo': 'QS',
|
||||
}
|
||||
|
||||
Link.objects.create(resource=con, family_id='1312', name_id='local')
|
||||
resp = app.post_json(url + '?NameID=local&rl_id=613878', params=params, status=400)
|
||||
assert resp.json['err'] == 1
|
||||
assert resp.json['err_desc'] == "mtt: '1500,33' does not match '^[0-9]+\\\\.?[0-9]*$'"
|
||||
|
||||
|
||||
@mock.patch('passerelle.utils.Request.get')
|
||||
@mock.patch('passerelle.utils.Request.post')
|
||||
def test_update_quotient_soap_error(mocked_post, mocked_get, con, app):
|
||||
mocked_get.return_value = FAMILY_SERVICE_WSDL
|
||||
mocked_post.return_value = UPDATE_QUOTIENT_500
|
||||
url = get_endpoint('update-quotient')
|
||||
params = {
|
||||
'yearRev': '2021',
|
||||
'dateStart': '2022-10-01',
|
||||
'dateEnd': '2023-01-31',
|
||||
'mtt': '1500.33',
|
||||
'cdquo': 'QS',
|
||||
}
|
||||
|
||||
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 'E07 : Il existe déjà un quotient postérieur' in resp.json['err_desc']
|
||||
|
||||
|
||||
def test_update_quotient_wrong_referential_key_error(con, app):
|
||||
url = get_endpoint('update-quotient')
|
||||
params = {
|
||||
'yearRev': '2021',
|
||||
'dateStart': '2023-10-01',
|
||||
'dateEnd': '2023-01-31',
|
||||
'mtt': '1500.33',
|
||||
'cdquo': 'plop',
|
||||
}
|
||||
|
||||
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_desc'] == "cdquo key value 'plop' do not belong to 'Quotient' required referential"
|
||||
|
||||
|
||||
@mock.patch('passerelle.utils.Request.get')
|
||||
@mock.patch('passerelle.utils.Request.post')
|
||||
def test_create_person(mocked_post, mocked_get, con, app):
|
||||
|
|
Loading…
Reference in New Issue