Compare commits

...

30 Commits

Author SHA1 Message Date
Nicolas Roche 72e8bb0c0b toulouse-maelis: add functional tests (#71647)
gitea-wip/passerelle/pipeline/pr-main This commit looks good Details
2022-11-30 10:07:15 +01:00
Nicolas Roche a5bef170be toulouse-maelis: manage emergency person list on createFamily (#71646) 2022-11-30 07:16:32 +01:00
Nicolas Roche da77201197 toulouse-maelis: manage authorised persons on main WS (#71646) 2022-11-30 07:16:32 +01:00
Nicolas Roche 2bbee39441 toulouse-maelis: rename person schemas (#71646) 2022-11-30 07:16:32 +01:00
Nicolas Roche 62d7af4d4b toulouse-maelis: send authorized person list on update-child (#71645) 2022-11-30 07:16:32 +01:00
Nicolas Roche 1eb705e9ea toulouse-maelis: remove unused vaccin label from payload (#71643) 2022-11-30 07:16:32 +01:00
Nicolas Roche 0dedbe3b96 toulouse-maelis: allow to send an empty vaccin list (#71643) 2022-11-30 07:16:32 +01:00
Nicolas Roche adcc9adf1d toulouse-maelis: allow to send an empty dietcode (#71643) 2022-11-30 07:16:32 +01:00
Nicolas Roche af18ba7acd toulouse-maelis: correct child payload check (#71643) 2022-11-30 07:16:32 +01:00
Nicolas Roche 94f8c95bf8 toulouse-maelis: child need a num field to update (#71642) 2022-11-30 07:16:32 +01:00
Nicolas Roche d8107ea4f5 toulouse-maelis: child bean become for create and update (#71642) 2022-11-30 07:16:32 +01:00
Nicolas Roche 3aeebd8842 toulouse-maelis: RL num is no more not needed on updateFamily (#71642) 2022-11-30 07:16:32 +01:00
Nicolas Roche 6c39c8dea5 toulouse-maelis: manage new fields on medical record (#71642) 2022-11-30 07:16:32 +01:00
Nicolas Roche 47350bdc00 toulouse-maelis: add maidenName to RL json schema (#71642) 2022-11-30 07:16:32 +01:00
Nicolas Roche 50e8ec7ebe toulouse-maelis: manage birth bean on RL (#71641) 2022-11-30 07:16:32 +01:00
Nicolas Roche 5ffaaba031 toulouse-maelis: add new fields (#71641) 2022-11-30 07:16:32 +01:00
Nicolas Roche e3aee14160 toulouse-maelis: reorder name fields on test soap replies (#71641) 2022-11-30 07:16:32 +01:00
Nicolas Roche 150f96251a toulouse-maelis: vaccin code and date are required (#71641) 2022-11-30 07:16:32 +01:00
Nicolas Roche 276c760da4 toulouse-maelis: rename category field (#71641) 2022-11-30 07:16:32 +01:00
Nicolas Roche 3424d98969 toulouse-maelis: update WSDL (#71641) 2022-11-30 07:16:32 +01:00
Nicolas Roche 1f81071278 toulouse-maelis: auth persons no more managed on family (#71388) 2022-11-30 07:16:32 +01:00
Nicolas Roche 5804ed6616 toulouse-maelis: FSL removed from Parsifal project (#71387) 2022-11-30 07:16:32 +01:00
Frédéric Péters e75e5287d9 tox: add phonenumbers (new wcs dependency) (#69838) 2022-11-29 18:20:53 +01:00
Serghei Mihai b464442b6b translations update 2022-11-28 22:28:17 +01:00
Serghei Mihai 48db73f027 franceconnect_data: add field for DGFIP API base url (#71638) 2022-11-28 22:28:17 +01:00
Serghei Mihai e2df9aec5b franceconnect_data: update DGFIP API fields labels 2022-11-28 22:28:17 +01:00
Frédéric Péters d07523b3c4 grandlyon streetsections: update for new format of commune names (#71764) 2022-11-28 10:35:04 +01:00
Lauréline Guérin d0bdb9b618
franceconnect: fix data_source endpoint with bad id in param (#71456) 2022-11-26 10:01:37 +01:00
Frédéric Péters 9b889430d1 tcl: adapt to updated attributes in line data sources (#71509) 2022-11-21 13:48:11 +01:00
Agate 56b6baea78 esabora: return error content in response (#71368)
gitea-wip/passerelle/pipeline/pr-main This commit looks good Details
gitea-wip/passerelle/pipeline/pr-wip/71638-franceconnec-data-add-dgfip-api-url-field This commit looks good Details
2022-11-17 10:14:25 +01:00
66 changed files with 4870 additions and 1239 deletions

1
functests/toulouse_maelis/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.res

View File

@ -0,0 +1,22 @@
Functional tests for the Toulouse Maelis connector
Description
===========
This test suite will use the web API of a passerelle Toulouse Maelis
connector to link a Publik account and check that the connector is
behaving as expected.
Usage
=====
You will need a running passerelle instance, whith the Toulouse Maelis connector instance configured to connect to
a Maelis server.
Suppose that the Toulouse Mealis connector instance is listening here :
http://127.0.0.1:8000/toulouse-maelis/test
Then you would start the test suite with the following command:
$ py.test -sx --url=http://127.0.0.1:8000/toulouse-maelis/test test_toulouse_maelis.py

View File

View File

@ -0,0 +1,412 @@
import copy
import datetime
import json
import os
import subprocess
import time
from uuid import uuid4
import pytest
import requests
from django.core.serializers.json import DjangoJSONEncoder
from zeep.helpers import serialize_object
FAMILY_PAYLOAD = {
'category': 'BI',
'situation': 'VM',
'rl1': {
'civility': 'MME',
'firstname': 'Marge',
'lastname': 'Simpson',
'maidenName': 'Bouvier',
'quality': 'MERE',
'birth': {'dateBirth': '1950-10-01'},
'adresse': {'street1': 'Evergreen Terrace', 'town': 'Springfield', 'zipcode': '62701'},
},
'rl2': {
'civility': 'M.',
'firstname': 'Homer',
'lastname': 'Simpson',
'quality': 'PERE',
'birth': {'dateBirth': '1956-05-12'},
'adresse': {
'num': '742',
'numComp': None,
'street1': 'Evergreen Terrace',
'street2': None,
'town': 'Springfield',
'zipcode': '90701',
},
'contact': {
'isContactMail': True,
'isContactSms': True,
'isInvoicePdf': True,
'mail': 'homer.simpson@example.org.com',
'mobile': '0622222222',
'phone': '0122222222',
},
'profession': {
'addressPro': {
'num': None,
'street': None,
'town': 'Springfield',
'zipcode': '90701',
},
'codeCSP': '13',
'employerName': 'Burns',
'phone': '0133333333',
'profession': 'Inspecteur de sécurité',
},
'CAFInfo': {
'number': '123',
'organ': 'A10007752822',
},
},
'childList': [
{
'sexe': 'M',
'firstname': 'Bart',
'lastname': 'Simpson',
'birth': {'dateBirth': '1978-04-01'},
'bPhoto': True,
'bLeaveAlone': True,
'dietcode': 'STD',
'paiInfoBean': {
'code': 'PAIMED',
'dateDeb': '2022-09-01',
'dateFin': '2023-07-01',
'description': 'mischievous, rebellious, misunderstood, disruptive',
},
'medicalRecord': {
'familyDoctor': {
'name': 'MONROE',
'phone': '0612341234',
'address': {
'street1': 'Alameda',
'zipcode': '90701',
'town': 'Springfield',
},
},
'allergy1': 'butterscotch, imitation butterscotch, glow-in-the-dark monster make-up',
'allergy2': 'shrimp and cauliflower',
'comment1': "the shrimp allergy isn't fully identified",
'comment2': None,
'observ1': 'Ay Caramba!',
'observ2': 'Eat my shorts!',
'isAuthHospital': True,
'hospital': 'Springfield General Hospital',
'vaccinList': [
{
'code': 'DTC',
'vaccinationDate': '2011-01-11',
},
{
'code': 'ROR',
'vaccinationDate': '2022-02-22',
},
],
},
'authorizedPersonList': [
{
'personInfo': {
'civility': 'M.',
'firstname': 'Abraham Jebediah',
'lastname': 'Simpson',
'dateBirth': '1927-05-24',
'sexe': 'M',
'contact': {
'phone': '0312345678',
'mobile': '',
'mail': 'abe.simpson@example.org',
},
},
'personQuality': {
'code': 'GPP',
},
},
{
'personInfo': {
'civility': 'MME',
'firstname': 'Mona Penelope',
'lastname': 'Simpson',
'dateBirth': '1929-03-15',
'sexe': 'F',
'contact': {
'phone': '0412345678',
'mobile': '0612345678',
'mail': 'mona.simpson@example.org',
},
},
'personQuality': {
'code': 'GMP',
},
},
],
},
{
'sexe': 'F',
'firstname': 'Lisa',
'lastname': 'Simpson',
'birth': {'dateBirth': '1980-05-09'},
'dietcode': 'RSV',
'paiInfoBean': {
'code': 'PAIALI',
},
},
{
'sexe': 'F',
'firstname': 'Maggie',
'lastname': 'Simpson',
'birth': {'dateBirth': '1989-12-17'},
'dietcode': 'BB',
},
],
'emergencyPersonList': [
{
'civility': 'MME',
'firstname': 'Patty',
'lastname': 'Bouvier',
'dateBirth': '1948-08-30',
'sexe': 'F',
'quality': 'T',
'contact': {
'phone': '0112345678',
'mobile': '0612345678',
'mail': 'patty.bouvier@example.org',
},
},
{
'civility': 'MME',
'firstname': 'Selma',
'lastname': 'Bouvier',
'dateBirth': '1946-04-29',
'sexe': 'F',
'quality': 'OS',
'contact': {
'phone': '0112345678',
'mobile': '0612345678',
'mail': 'selma.bouvier@example.org',
},
},
],
}
def pytest_addoption(parser):
parser.addoption(
'--url',
help='Url of a passerelle Toulouse Maelis connector instance',
default='https://parsifal-passerelle.dev.publik.love/toulouse-maelis/test',
)
parser.addoption('--nameid', help='Publik Name ID', default='functest')
parser.addoption('--dui', help='DUI number', default='')
def unlink(conn, name_id):
url = conn + '/unlink?NameID=%s' % name_id
resp = requests.post(url)
resp.raise_for_status()
return resp
def link(conn, data):
url = conn + '/link?NameID=%s' % data['name_id']
payload = {
'family_id': data['family_id'],
'firstname': data['family_payload']['rl1']['firstname'],
'lastname': data['family_payload']['rl1']['lastname'],
'dateBirth': data['family_payload']['rl1']['birth']['dateBirth'],
}
resp = requests.post(url, json=payload)
resp.raise_for_status()
res = resp.json()
assert res == {'data': 'ok', 'err': 0}
def read_family(conn, name_id):
url = conn + '/read-family?NameID=%s' % name_id
resp = requests.get(url)
resp.raise_for_status()
res = resp.json()
assert res['err'] == 0
return res['data']
def diff(result, expected_file):
class JSONEncoder(DjangoJSONEncoder):
def default(self, o):
if isinstance(o, time.struct_time):
o = datetime.datetime(*tuple(o)[:6])
return super().default(o)
expected_file_path = 'data/' + expected_file
assert os.path.isfile(expected_file_path), 'please, touch %s' % expected_file_path
result_file_path = '/tmp/%s.res' % expected_file
with open(result_file_path, 'w') as json_file:
json.dump(serialize_object(result), json_file, cls=DjangoJSONEncoder, indent=2)
json_file.write('\n')
cmd = 'diff %s %s' % (result_file_path, expected_file_path)
output = subprocess.run(cmd, shell=True, check=False, stdout=None, stderr=None)
assert output.returncode == 0, 'please, %s' % cmd
return True
def remove_id_on_child(child):
child['num'] = 'N/A'
child['lastname'] = 'N/A'
child['mother'] = 'N/A' # dont care yet
child['father'] = 'N/A' # dont care yet
for person in child['authorizedPersonList']:
person['personInfo']['num'] = 'N/A'
def remove_id_on_rlg(rlg):
if rlg:
rlg['num'] = 'N/A'
rlg['lastname'] = 'N/A'
def remove_id_on_family(family):
family['number'] = 'N/A'
remove_id_on_rlg(family['RL1'])
remove_id_on_rlg(family['RL2'])
for child in family['childList']:
remove_id_on_child(child)
for person in family['emergencyPersonList']:
person['numPerson'] = 'N/A'
def diff_child(conn, name_id, index, expected_file, key=None):
data = read_family(conn, name_id)
child = copy.deepcopy(data['childList'][index])
remove_id_on_child(child)
if not key:
assert diff(child, expected_file)
else:
assert diff(child[key], expected_file)
return data
def diff_rlg(conn, name_id, index, expected_file):
data = read_family(conn, name_id)
rlg = copy.deepcopy(data['RL%s' % index])
remove_id_on_rlg(rlg)
assert diff(rlg, expected_file)
return data
def diff_family(conn, name_id, expected_file, key=None):
data = read_family(conn, name_id)
family = copy.deepcopy(data)
remove_id_on_family(family)
if not key:
assert diff(family, expected_file)
else:
assert diff(family[key], expected_file)
return data
@pytest.fixture(scope='session')
def conn(request):
return request.config.getoption('--url')
@pytest.fixture(scope='session')
def create_data(request, conn):
name_id = request.config.getoption('--nameid')
unlink(conn, name_id)
lastname = uuid4().hex[0:30]
# create family
create_family_payload = copy.deepcopy(FAMILY_PAYLOAD)
del create_family_payload['childList'][1] # without Lisa
del create_family_payload['rl2'] # without Homer
create_family_payload['rl1']['lastname'] = lastname
for child in create_family_payload['childList']:
child['lastname'] = lastname
url = conn + '/create-family?NameID=%s' % name_id
resp = requests.post(url, json=create_family_payload)
resp.raise_for_status()
create_result = resp.json()
assert create_result['err'] == 0
print('\ncreate DUI: %s' % str(create_result['data']['number']))
data = diff_family(conn, name_id, 'test_create_family.json')
return {
'name_id': name_id, # linked
'family_id': str(create_result['data']['number']),
'lastname': lastname,
'family_payload': create_family_payload,
'data': data,
}
@pytest.fixture(scope='session')
def update_data(request, conn):
name_id = request.config.getoption('--nameid')
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
# try to re-create test family
url = conn + '/create-family?NameID=%s' % name_id
resp = requests.post(url, json=FAMILY_PAYLOAD)
resp.raise_for_status()
create_result = resp.json()
if not create_result['err']:
# create DUI if it is the first time the test is run
family_id = str(create_result['data']['number'])
print('\ncreate DUI: %s' % family_id)
elif 'E54a' in create_result['err']:
# else find DUI number in the error message
family_id = str(create_result['err_desc'][-7:-1])
print('\nre-use DUI: %s' % family_id)
# and link NameID to it
url = conn + '/link?NameID=%s' % name_id
link_payload = {
'family_id': family_id,
'firstname': FAMILY_PAYLOAD['rl1']['firstname'],
'lastname': FAMILY_PAYLOAD['rl1']['lastname'],
'dateBirth': FAMILY_PAYLOAD['rl1']['birth']['dateBirth'],
}
resp = requests.post(url, json=link_payload)
resp.raise_for_status()
assert not resp.json()['err']
else:
# FAMILY_PAYLOAD looks wrong
assert False, create_result
# update DUI
data = read_family(conn, name_id)
update_family_payload = copy.deepcopy(FAMILY_PAYLOAD)
for i, child in enumerate(update_family_payload['childList']):
child['num'] = data['childList'][i]['num'] # required for update
url = conn + '/update-family?NameID=%s' % name_id
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')
return {
'name_id': name_id, # linked
'family_id': family_id,
'family_payload': update_family_payload,
'rl2_num': data['RL2']['num'],
'bart_num': data['childList'][0]['num'],
'lisa_num': data['childList'][1]['num'],
'maggie_num': data['childList'][2]['num'],
'data': data,
}

View File

@ -0,0 +1,26 @@
{
"num": "N/A",
"lastname": "N/A",
"firstname": "LISA",
"sexe": "M",
"birth": {
"dateBirth": "1980-05-09T00:00:00+02:00",
"place": null,
"communeCode": null,
"countryCode": null
},
"dietcode": null,
"bPhoto": false,
"bLeaveAlone": false,
"authorizedPersonList": [],
"indicatorList": [],
"medicalRecord": null,
"insurance": null,
"paiInfoBean": null,
"mother": "N/A",
"father": "N/A",
"rl": null,
"subscribeSchoolList": [],
"subscribeActivityList": [],
"sexe_text": "Masculin"
}

View File

@ -0,0 +1,226 @@
{
"number": "N/A",
"category": "BI",
"situation": "VM",
"flagCom": true,
"nbChild": null,
"nbTotalChild": null,
"nbAES": null,
"RL1": {
"num": "N/A",
"firstname": "MARGE",
"lastname": "N/A",
"maidenName": "BOUVIER",
"quality": "MERE",
"civility": "MME",
"birth": {
"dateBirth": "1950-10-01T00:00:00+01:00",
"place": null,
"communeCode": null,
"countryCode": null
},
"adresse": {
"idStreet": null,
"num": 0,
"numComp": null,
"street1": "Evergreen Terrace",
"street2": null,
"town": "Springfield",
"zipcode": "62701"
},
"contact": {
"phone": null,
"mobile": null,
"mail": null,
"isContactMail": false,
"isContactSms": false,
"isInvoicePdf": false
},
"profession": null,
"CAFInfo": null,
"indicatorList": [],
"quotientList": [],
"subscribeActivityList": [],
"civility_text": "Madame",
"quality_text": "MERE"
},
"RL2": null,
"quotientList": [],
"childList": [
{
"num": "N/A",
"lastname": "N/A",
"firstname": "BART",
"sexe": "M",
"birth": {
"dateBirth": "1978-04-01T00:00:00+01:00",
"place": null,
"communeCode": null,
"countryCode": null
},
"dietcode": "STD",
"bPhoto": true,
"bLeaveAlone": true,
"authorizedPersonList": [
{
"personInfo": {
"num": "N/A",
"lastname": "SIMPSON",
"firstname": "ABRAHAM JEBEDIAH",
"dateBirth": "1927-05-24T00:00:00+01:00",
"civility": "M.",
"sexe": "M",
"contact": {
"phone": "0312345678",
"mobile": null,
"mail": "abe.simpson@example.org"
},
"civility_text": "Monsieur",
"sexe_text": "Masculin"
},
"personQuality": {
"code": "GPP",
"libelle": "GRAND-PERE PATERNEL",
"code_text": "GRAND-PERE PATERNEL"
}
},
{
"personInfo": {
"num": "N/A",
"lastname": "SIMPSON",
"firstname": "MONA PENELOPE",
"dateBirth": "1929-03-15T00:00:00Z",
"civility": "MME",
"sexe": "F",
"contact": {
"phone": "0412345678",
"mobile": "0612345678",
"mail": "mona.simpson@example.org"
},
"civility_text": "Madame",
"sexe_text": "F\u00e9minin"
},
"personQuality": {
"code": "GMP",
"libelle": "GRAND-MERE PATERNELLE",
"code_text": "GRAND-MERE PATERNELLE"
}
}
],
"indicatorList": [],
"medicalRecord": {
"familyDoctor": {
"name": "MONROE",
"phone": "0612341234",
"address": {
"street1": "Alameda",
"zipcode": "90701",
"town": "Springfield"
}
},
"allergy1": "butterscotch, imitation butterscotch, glow-in-the-dark monster make-up",
"allergy2": "shrimp and cauliflower",
"comment1": "the shrimp allergy isn't fully identified",
"comment2": null,
"observ1": "Ay Caramba!",
"observ2": "Ay Caramba!",
"isAuthHospital": false,
"hospital": null,
"vaccinList": [
{
"code": "ROR",
"label": "ROUGEOLE-OREILLONS-RUBEOLE",
"vaccinationDate": "2022-02-22T00:00:00+01:00"
},
{
"code": "DTC",
"label": "DIPHTERIE TETANOS COQUELUCHE",
"vaccinationDate": "2011-01-11T00:00:00+01:00"
}
]
},
"insurance": null,
"paiInfoBean": {
"code": "PAIMED",
"dateDeb": "2022-09-01T00:00:00+02:00",
"dateFin": "2023-07-01T00:00:00+02:00",
"description": "mischievous, rebellious, misunderstood, disruptive",
"code_text": "MEDICAL"
},
"mother": "N/A",
"father": "N/A",
"rl": null,
"subscribeSchoolList": [],
"subscribeActivityList": [],
"sexe_text": "Masculin",
"dietcode_text": "1- REPAS STANDARD"
},
{
"num": "N/A",
"lastname": "N/A",
"firstname": "MAGGIE",
"sexe": "F",
"birth": {
"dateBirth": "1989-12-17T00:00:00+01:00",
"place": null,
"communeCode": null,
"countryCode": null
},
"dietcode": "BB",
"bPhoto": false,
"bLeaveAlone": false,
"authorizedPersonList": [],
"indicatorList": [],
"medicalRecord": null,
"insurance": null,
"paiInfoBean": null,
"mother": "N/A",
"father": "N/A",
"rl": null,
"subscribeSchoolList": [],
"subscribeActivityList": [],
"sexe_text": "F\u00e9minin",
"dietcode_text": "REPAS BEBE"
}
],
"emergencyPersonList": [
{
"numPerson": "N/A",
"civility": "MME",
"firstname": "PATTY",
"lastname": "BOUVIER",
"dateBirth": "1948-08-30T00:00:00+01:00",
"sexe": "F",
"quality": "T",
"contact": {
"phone": "0112345678",
"mobile": "0612345678",
"mail": "patty.bouvier@example.org"
},
"civility_text": "Madame",
"quality_text": "TANTE",
"sexe_text": "F\u00e9minin"
},
{
"numPerson": "N/A",
"civility": "MME",
"firstname": "SELMA",
"lastname": "BOUVIER",
"dateBirth": "1946-04-29T00:00:00+01:00",
"sexe": "F",
"quality": "OS",
"contact": {
"phone": "0112345678",
"mobile": "0612345678",
"mail": "selma.bouvier@example.org"
},
"civility_text": "Madame",
"quality_text": "ORGANISME SOCIAL",
"sexe_text": "F\u00e9minin"
}
],
"indicatorList": [],
"childErrorList": [],
"category_text": "BIPARENTALE",
"situation_text": "Vivant maritalement"
}

View File

@ -0,0 +1,38 @@
{
"num": "N/A",
"firstname": "HOMER",
"lastname": "N/A",
"maidenName": null,
"quality": "PERE",
"civility": "M.",
"birth": {
"dateBirth": "1956-05-12T00:00:00+01:00",
"place": null,
"communeCode": null,
"countryCode": null
},
"adresse": {
"idStreet": null,
"num": 742,
"numComp": null,
"street1": "Evergreen Terrace",
"street2": null,
"town": "Springfield",
"zipcode": "90701"
},
"contact": {
"phone": null,
"mobile": null,
"mail": null,
"isContactMail": false,
"isContactSms": false,
"isInvoicePdf": false
},
"profession": null,
"CAFInfo": null,
"indicatorList": [],
"quotientList": [],
"subscribeActivityList": [],
"civility_text": "Monsieur",
"quality_text": "PERE"
}

View File

@ -0,0 +1,14 @@
[
{
"id": "BI",
"text": "BIPARENTALE"
},
{
"id": "ACCEUI",
"text": "FAMILLE D'ACCUEIL"
},
{
"id": "MONO",
"text": "MONOPARENTALE"
}
]

View File

@ -0,0 +1,10 @@
[
{
"id": "MME",
"text": "Madame"
},
{
"id": "M.",
"text": "Monsieur"
}
]

View File

@ -0,0 +1,110 @@
[
{
"id": "14",
"text": "AGENT DE MAITRISE"
},
{
"id": "1",
"text": "AGRICULTEUR"
},
{
"id": "ART",
"text": "ARTISAN"
},
{
"id": "2",
"text": "ARTISAN-COMMERCANT"
},
{
"id": "15",
"text": "AUTRES"
},
{
"id": "CADR",
"text": "CADRE"
},
{
"id": "13",
"text": "CADRE SUPERIEUR"
},
{
"id": "3",
"text": "CHEF D'ENTREPRISE"
},
{
"id": "CHOM",
"text": "CHOMEUR"
},
{
"id": "COMM",
"text": "COMMERCANT"
},
{
"id": "10",
"text": "DEMANDEUR D'EMPLOI"
},
{
"id": "DIV",
"text": "DIVERS"
},
{
"id": "5",
"text": "EMPLOYE"
},
{
"id": "17",
"text": "ENSEIGNANT"
},
{
"id": "8",
"text": "ETUDIANT"
},
{
"id": "11",
"text": "FONCTIONNAIRE"
},
{
"id": "MAIR",
"text": "MAIRIE DE NICE"
},
{
"id": "6",
"text": "OUVRIER"
},
{
"id": "PERENS",
"text": "PERISCO ENSEIGNANT"
},
{
"id": "PEREXT",
"text": "PERISCO EXTERNE"
},
{
"id": "PERMAI",
"text": "PERISCO MAIRIE DE NICE"
},
{
"id": "PERANI",
"text": "PERISCO S.ANIMATION"
},
{
"id": "LIB",
"text": "PROFESSION LIBERALE"
},
{
"id": "12",
"text": "RETRAITE"
},
{
"id": "RMI",
"text": "REVENU MINIMUM D'INSERTION"
},
{
"id": "SANPRO",
"text": "SANS PROFESSION"
},
{
"id": "SEC",
"text": "SECRETAIRE"
}
]

View File

@ -0,0 +1,34 @@
[
{
"id": "BB",
"text": "REPAS BEBE"
},
{
"id": "MSP",
"text": "REPAS MOYEN SANS PORC"
},
{
"id": "MSV",
"text": "REPAS MOYEN SANS VIANDE"
},
{
"id": "MST",
"text": "REPAS MOYEN STANDARD"
},
{
"id": "STD",
"text": "1- REPAS STANDARD"
},
{
"id": "RSP",
"text": "2- R\u00c9GIME SANS PORC"
},
{
"id": "RSV",
"text": "3- R\u00c9GIME SANS VIANDE"
},
{
"id": "PAI",
"text": "4- PROTOCOLE D'ACCUEIL INDIVIDUALIS\u00c9"
}
]

View File

@ -0,0 +1,370 @@
[
{
"id": "A10004460232",
"text": "LEVENS"
},
{
"id": "A10007752822",
"text": "LA COLLE SUR LOUP"
},
{
"id": "A10001133770",
"text": "ASSIM"
},
{
"id": "A10007751483",
"text": "EZE"
},
{
"id": "A10008152785",
"text": "LUCERAM"
},
{
"id": "A10008170056",
"text": "SAINT ANDRE LE MANOIR"
},
{
"id": "A10008425613",
"text": "LA TRINITE ENFANTS PLACES"
},
{
"id": "A10001496896",
"text": "MONTJOYE"
},
{
"id": "A10001715627",
"text": "FOYER DE L'ENFANCE DES AM"
},
{
"id": "A10007182676",
"text": "LA TRINITE"
},
{
"id": "A10010030250",
"text": "PUGET SUR ARGENS"
},
{
"id": "A10001481849",
"text": "BEAUSOLEIL"
},
{
"id": "A10000980674",
"text": "SAINT JEAN CAP FERRAT"
},
{
"id": "A10000980692",
"text": "BERRE LES ALPES"
},
{
"id": "A10001314895",
"text": "VILLE DE NICE"
},
{
"id": "A10001474792",
"text": "PEP 06 - CORNICHE"
},
{
"id": "A10001474782",
"text": "PEP 06 MADELEINE"
},
{
"id": "A10007182941",
"text": "VALBONNE SOPHIA ANTIPOLIS"
},
{
"id": "A10007182961",
"text": "GATTIERES"
},
{
"id": "A10010601009",
"text": "FONDATION DE NICE"
},
{
"id": "A10001427675",
"text": "CANNES"
},
{
"id": "A10000802907",
"text": "VILLEFRANCHE SUR MER"
},
{
"id": "A10000802910",
"text": "SAINT ANDRE DE LA ROCHE"
},
{
"id": "A10007751693",
"text": "SAINT LAURENT DU VAR"
},
{
"id": "A10007751913",
"text": "LA TOUR"
},
{
"id": "A10001039676",
"text": "IME CORNICHE FLEURIE"
},
{
"id": "A10001612084",
"text": "VENCE"
},
{
"id": "A10000980566",
"text": "ANTIBES"
},
{
"id": "A10000980567",
"text": "ASPREMONT"
},
{
"id": "A10000980568",
"text": "CAGNES SUR MER"
},
{
"id": "A10000980569",
"text": "CASTAGNIERS"
},
{
"id": "A10000980570",
"text": "CONTES"
},
{
"id": "A10000980571",
"text": "FALICON"
},
{
"id": "A10000980572",
"text": "GILETTE"
},
{
"id": "A10000980573",
"text": "TOUET DE L ESCARENE"
},
{
"id": "A10001715572",
"text": "CAP D AIL"
},
{
"id": "A10000980575",
"text": "MENTON"
},
{
"id": "A10000980577",
"text": "ROQUEBRUNE CAP MARTIN"
},
{
"id": "A10000980584",
"text": "VALLAURIS"
},
{
"id": "A10001715581",
"text": "TOURRETTE LEVENS"
},
{
"id": "A10004071438",
"text": "ASSOCIATION LOU MERILHOUN LEVENS"
},
{
"id": "A10007179260",
"text": "BEAULIEU SUR MER"
},
{
"id": "A10000980388",
"text": "APAJH"
},
{
"id": "A10007751440",
"text": "CARROS"
},
{
"id": "A10007751441",
"text": "BLAUSASC"
},
{
"id": "A10000979354",
"text": "ATIAM"
},
{
"id": "A10000979370",
"text": "UDAF"
},
{
"id": "A10000979372",
"text": "ALVA 06"
},
{
"id": "A10000979373",
"text": "IES CLEMENT ADER"
},
{
"id": "A10000979374",
"text": "ALC L OLIVIER"
},
{
"id": "A10000979375",
"text": "IESEDA LES CHANTERELLES"
},
{
"id": "A10000979376",
"text": "IME TERRASSES"
},
{
"id": "A10007751879",
"text": "SAINT PAUL DE VENCE"
},
{
"id": "A10007753594",
"text": "VILLENEUVE LOUBET"
},
{
"id": "A10013129309",
"text": "TOURETTES-SUR-LOUP"
},
{
"id": "A10013447888",
"text": "COLOMARS"
},
{
"id": "A10015115495",
"text": "BREIL SUR ROYA"
},
{
"id": "A10015255908",
"text": "GRASSE"
},
{
"id": "A10016957436",
"text": "SAINT BLAISE"
},
{
"id": "A10013128210",
"text": "BONSON"
},
{
"id": "A10013128217",
"text": "CANTARON"
},
{
"id": "A10015126217",
"text": "MANDELIEU"
},
{
"id": "A10015528233",
"text": "THEOULE SUR MER"
},
{
"id": "A10016401771",
"text": "ASCROS"
},
{
"id": "A10016990309",
"text": "CANNES LA BOCCA"
},
{
"id": "A10012498607",
"text": "LA GAUDE"
},
{
"id": "A10013123067",
"text": "DRAP"
},
{
"id": "A10014621894",
"text": "MALAUSSENE"
},
{
"id": "A10014922597",
"text": "ROQUEFORT LES PINS"
},
{
"id": "A10014927854",
"text": "L ESCARENE"
},
{
"id": "A10014938988",
"text": "MOUGINS"
},
{
"id": "A10013129048",
"text": "SOSPEL"
},
{
"id": "A10013459160",
"text": "LE CANNET"
},
{
"id": "A10015677583",
"text": "SAINT MARTIN DU VAR"
},
{
"id": "A10017265908",
"text": "BIOT"
},
{
"id": "A10000980576",
"text": "PEILLON"
},
{
"id": "A10024933344",
"text": "LES ARCS"
},
{
"id": "A10024933368",
"text": "LA TURBIE"
},
{
"id": "A10024933442",
"text": "SAINT JULIEN"
},
{
"id": "A10021971554",
"text": "SAINT JEANNET"
},
{
"id": "A10019717953",
"text": "PEILLE"
},
{
"id": "g",
"text": "REGIME GENERAL"
},
{
"id": "a",
"text": "REGIMES AUTRES"
},
{
"id": "a11003995450",
"text": "REGIME MSA"
},
{
"id": "a11013011612",
"text": "REGIME SNCF"
},
{
"id": "a11017891473",
"text": "REGIME GENERAL MONACO"
},
{
"id": "a11015961838",
"text": "REGIME EDF/GDF - TITULAIRE"
},
{
"id": "a11015961839",
"text": "REGIME MONACO"
},
{
"id": "a11025419517",
"text": "TRIBUNAL DE GRANDE INSTANCE DE NICE"
},
{
"id": "A10026769374",
"text": "LA ROQUETTE SUR VAR"
},
{
"id": "A10027856948",
"text": "BAR-SUR-LOUP"
},
{
"id": "A10029519260",
"text": "TOUET SUR VAR"
}
]

View File

@ -0,0 +1,18 @@
[
{
"id": "PAIALI",
"text": "ALIMENTAIRE"
},
{
"id": "PAIO",
"text": "AUTRE"
},
{
"id": "PAIMED",
"text": "MEDICAL"
},
{
"id": "PAI2",
"text": "MEDICAL ET ALIMENTAIRE"
}
]

View File

@ -0,0 +1,70 @@
[
{
"id": "AU",
"text": "AUTRE"
},
{
"id": "BP",
"text": "BEAU PERE"
},
{
"id": "BM",
"text": "BELLE MERE"
},
{
"id": "CONSO",
"text": "CONSOMMATEUR"
},
{
"id": "EN",
"text": "ENFANT"
},
{
"id": "FS",
"text": "FRERES ET SOEURS"
},
{
"id": "GM",
"text": "GRAND MERE MATERNELLE"
},
{
"id": "GP",
"text": "GRAND PERE MATERNEL"
},
{
"id": "GMP",
"text": "GRAND-MERE PATERNELLE"
},
{
"id": "GPP",
"text": "GRAND-PERE PATERNEL"
},
{
"id": "MAIRIE",
"text": "MAIRIE"
},
{
"id": "MERE",
"text": "MERE"
},
{
"id": "O",
"text": "ONCLE"
},
{
"id": "OS",
"text": "ORGANISME SOCIAL"
},
{
"id": "PERE",
"text": "PERE"
},
{
"id": "T",
"text": "TANTE"
},
{
"id": "TUTEUR",
"text": "TUTEUR"
}
]

View File

@ -0,0 +1,26 @@
[
{
"id": "QF",
"text": "GRILLE DE QUOTIENT"
},
{
"id": "QCLSH",
"text": "QUOTIENT CENTRE AERE"
},
{
"id": "QJEU",
"text": "QUOTIENT JEUNESSE"
},
{
"id": "QS",
"text": "QUOTIENT SCOLAIRE"
},
{
"id": "QSPORT",
"text": "QUOTIENT SPORT"
},
{
"id": "MOY ECO",
"text": "REVENU MOYEN ( MENSUEL OU ANNUEL)"
}
]

View File

@ -0,0 +1,38 @@
[
{
"id": "C",
"text": "C\u00e9libataire"
},
{
"id": "D",
"text": "Divorc\u00e9 (e)"
},
{
"id": "CS",
"text": "EN COURS DE SEPARATION"
},
{
"id": "M",
"text": "Mari\u00e9 (e)"
},
{
"id": "P",
"text": "Pacs\u00e9 (e)"
},
{
"id": "S",
"text": "S\u00e9par\u00e9 (e)"
},
{
"id": "UL",
"text": "UNION LIBRE"
},
{
"id": "V",
"text": "Veuf (ve)"
},
{
"id": "VM",
"text": "Vivant maritalement"
}
]

View File

@ -0,0 +1,82 @@
[
{
"id": "BCG",
"text": "BCG"
},
{
"id": "CIB",
"text": "CONTRE-INDICATION TEMPORAIRE AU BCG"
},
{
"id": "MONO",
"text": "CONTROLE DU BCG (+)"
},
{
"id": "MONON",
"text": "CONTROLE DU BCG (-)"
},
{
"id": "DTC",
"text": "DIPHTERIE TETANOS COQUELUCHE"
},
{
"id": "DTCP",
"text": "DIPHTERIE-TETANOS-COQUELUCHE-POLIO"
},
{
"id": "DTP",
"text": "DIPHTERIE-TETANOS-POLIO"
},
{
"id": "HEP",
"text": "HEPATITE"
},
{
"id": "HEPA B",
"text": "HEPATITE B"
},
{
"id": "IN",
"text": "INFANRIX"
},
{
"id": "HIB",
"text": "MENINGITE"
},
{
"id": "PENT",
"text": "PENTACOQ"
},
{
"id": "PENTH",
"text": "PENT'HIBEST"
},
{
"id": "P",
"text": "POLIO"
},
{
"id": "ROR",
"text": "ROUGEOLE-OREILLONS-RUBEOLE"
},
{
"id": "ROUX",
"text": "ROUVAX"
},
{
"id": "TETANOS",
"text": "TETANOS"
},
{
"id": "TPOLIO",
"text": "TETANOS POLIO"
},
{
"id": "TETR",
"text": "TETRACOQ"
},
{
"id": "T.POLIO",
"text": "T.POLIO"
}
]

View File

@ -0,0 +1,108 @@
{
"num": "N/A",
"lastname": "N/A",
"firstname": "BARTOLOME",
"sexe": "F",
"birth": {
"dateBirth": "1970-01-01T00:00:00+01:00",
"place": null,
"communeCode": null,
"countryCode": null
},
"dietcode": "STD",
"bPhoto": false,
"bLeaveAlone": false,
"authorizedPersonList": [
{
"personInfo": {
"num": "N/A",
"lastname": "SIMPSON",
"firstname": "ABRAHAM JEBEDIAH",
"dateBirth": "1927-05-24T00:00:00+01:00",
"civility": "M.",
"sexe": "M",
"contact": {
"phone": "0312345678",
"mobile": null,
"mail": "abe.simpson@example.org"
},
"civility_text": "Monsieur",
"sexe_text": "Masculin"
},
"personQuality": {
"code": "GPP",
"libelle": "GRAND-PERE PATERNEL",
"code_text": "GRAND-PERE PATERNEL"
}
},
{
"personInfo": {
"num": "N/A",
"lastname": "SIMPSON",
"firstname": "MONA PENELOPE",
"dateBirth": "1929-03-15T00:00:00Z",
"civility": "MME",
"sexe": "F",
"contact": {
"phone": "0412345678",
"mobile": "0612345678",
"mail": "mona.simpson@example.org"
},
"civility_text": "Madame",
"sexe_text": "F\u00e9minin"
},
"personQuality": {
"code": "GMP",
"libelle": "GRAND-MERE PATERNELLE",
"code_text": "GRAND-MERE PATERNELLE"
}
}
],
"indicatorList": [],
"medicalRecord": {
"familyDoctor": {
"name": "MONROE",
"phone": "0612341234",
"address": {
"street1": "Alameda",
"zipcode": "90701",
"town": "Springfield"
}
},
"allergy1": "butterscotch, imitation butterscotch, glow-in-the-dark monster make-up",
"allergy2": "shrimp and cauliflower",
"comment1": "the shrimp allergy isn't fully identified",
"comment2": null,
"observ1": "Ay Caramba!",
"observ2": "Ay Caramba!",
"isAuthHospital": true,
"hospital": "Springfield General Hospital",
"vaccinList": [
{
"code": "ROR",
"label": "ROUGEOLE-OREILLONS-RUBEOLE",
"vaccinationDate": "2022-02-22T00:00:00+01:00"
},
{
"code": "DTC",
"label": "DIPHTERIE TETANOS COQUELUCHE",
"vaccinationDate": "2011-01-11T00:00:00+01:00"
}
]
},
"insurance": null,
"paiInfoBean": {
"code": "PAIMED",
"dateDeb": "2022-09-01T00:00:00+02:00",
"dateFin": "2023-07-01T00:00:00+02:00",
"description": "mischievous, rebellious, misunderstood, disruptive",
"code_text": "MEDICAL"
},
"mother": "N/A",
"father": "N/A",
"rl": null,
"subscribeSchoolList": [],
"subscribeActivityList": [],
"sexe_text": "F\u00e9minin",
"dietcode_text": "1- REPAS STANDARD"
}

View File

@ -0,0 +1,23 @@
{
"familyDoctor": null,
"allergy1": null,
"allergy2": null,
"comment1": null,
"comment2": null,
"observ1": null,
"observ2": null,
"isAuthHospital": false,
"hospital": null,
"vaccinList": [
{
"code": "ROR",
"label": "ROUGEOLE-OREILLONS-RUBEOLE",
"vaccinationDate": "2022-02-22T00:00:00+01:00"
},
{
"code": "DTC",
"label": "DIPHTERIE TETANOS COQUELUCHE",
"vaccinationDate": "2011-01-11T00:00:00+01:00"
}
]
}

View File

@ -0,0 +1,7 @@
{
"code": "PAIO",
"dateDeb": "1970-01-01T00:00:00+01:00",
"dateFin": "1970-01-01T00:00:00+01:00",
"description": null,
"code_text": "AUTRE"
}

View File

@ -0,0 +1,41 @@
[
{
"personInfo": {
"num": "N/A",
"lastname": "RESET",
"firstname": "RESET",
"dateBirth": "1970-01-01T00:00:00+01:00",
"civility": null,
"sexe": "M",
"contact": null,
"sexe_text": "Masculin"
},
"personQuality": {
"code": "AU",
"libelle": "AUTRE",
"code_text": "AUTRE"
}
},
{
"personInfo": {
"num": "N/A",
"lastname": "SIMPSON",
"firstname": "MONA PENELOPE",
"dateBirth": "1929-03-15T00:00:00Z",
"civility": "MME",
"sexe": "F",
"contact": {
"phone": "0412345678",
"mobile": "0612345678",
"mail": "mona.simpson@example.org"
},
"civility_text": "Madame",
"sexe_text": "F\u00e9minin"
},
"personQuality": {
"code": "GMP",
"libelle": "GRAND-MERE PATERNELLE",
"code_text": "GRAND-MERE PATERNELLE"
}
}
]

View File

@ -0,0 +1,54 @@
{
"num": "N/A",
"firstname": "HOMER",
"lastname": "N/A",
"maidenName": null,
"quality": "PERE",
"civility": "M.",
"birth": {
"dateBirth": "1956-05-12T00:00:00+01:00",
"place": null,
"communeCode": null,
"countryCode": null
},
"adresse": {
"idStreet": null,
"num": 42,
"numComp": "Q",
"street1": "reset",
"street2": null,
"town": "reset",
"zipcode": "reset",
"numComp_text": "quater"
},
"contact": {
"phone": null,
"mobile": null,
"mail": null,
"isContactMail": false,
"isContactSms": false,
"isInvoicePdf": false
},
"profession": {
"codeCSP": "15",
"profession": null,
"employerName": null,
"phone": null,
"addressPro": {
"num": 42,
"street": null,
"zipcode": null,
"town": null
},
"codeCSP_text": "AUTRES"
},
"CAFInfo": {
"number": "reset",
"organ": null
},
"indicatorList": [],
"quotientList": [],
"subscribeActivityList": [],
"civility_text": "Monsieur",
"quality_text": "PERE"
}

View File

@ -0,0 +1,318 @@
{
"number": "N/A",
"category": "BI",
"situation": "VM",
"flagCom": true,
"nbChild": null,
"nbTotalChild": null,
"nbAES": null,
"RL1": {
"num": "N/A",
"firstname": "MARGE",
"lastname": "N/A",
"maidenName": "BOUVIER",
"quality": "MERE",
"civility": "MME",
"birth": {
"dateBirth": "1950-10-01T00:00:00+01:00",
"place": null,
"communeCode": null,
"countryCode": null
},
"adresse": {
"idStreet": null,
"num": 0,
"numComp": null,
"street1": "Evergreen Terrace",
"street2": null,
"town": "Springfield",
"zipcode": "62701"
},
"contact": {
"phone": null,
"mobile": null,
"mail": null,
"isContactMail": false,
"isContactSms": false,
"isInvoicePdf": false
},
"profession": null,
"CAFInfo": null,
"indicatorList": [],
"quotientList": [],
"subscribeActivityList": [],
"civility_text": "Madame",
"quality_text": "MERE"
},
"RL2": {
"num": "N/A",
"firstname": "HOMER",
"lastname": "N/A",
"maidenName": null,
"quality": "PERE",
"civility": "M.",
"birth": {
"dateBirth": "1956-05-12T00:00:00+01:00",
"place": null,
"communeCode": null,
"countryCode": null
},
"adresse": {
"idStreet": null,
"num": 742,
"numComp": null,
"street1": "Evergreen Terrace",
"street2": null,
"town": "Springfield",
"zipcode": "90701"
},
"contact": {
"phone": "0122222222",
"mobile": "0622222222",
"mail": "homer.simpson@example.org.com",
"isContactMail": true,
"isContactSms": true,
"isInvoicePdf": true
},
"profession": {
"codeCSP": "13",
"profession": "Inspecteur de s\u00e9curit\u00e9",
"employerName": "Burns",
"phone": "0133333333",
"addressPro": {
"num": null,
"street": null,
"zipcode": "90701",
"town": "Springfield"
},
"codeCSP_text": "CADRE SUPERIEUR"
},
"CAFInfo": {
"number": "123",
"organ": "A10007752822",
"organ_text": "LA COLLE SUR LOUP"
},
"indicatorList": [],
"quotientList": [],
"subscribeActivityList": [],
"civility_text": "Monsieur",
"quality_text": "PERE"
},
"quotientList": [],
"childList": [
{
"num": "N/A",
"lastname": "N/A",
"firstname": "BART",
"sexe": "M",
"birth": {
"dateBirth": "1978-04-01T00:00:00+01:00",
"place": null,
"communeCode": null,
"countryCode": null
},
"dietcode": "STD",
"bPhoto": true,
"bLeaveAlone": true,
"authorizedPersonList": [
{
"personInfo": {
"num": "N/A",
"lastname": "SIMPSON",
"firstname": "ABRAHAM JEBEDIAH",
"dateBirth": "1927-05-24T00:00:00+01:00",
"civility": "M.",
"sexe": "M",
"contact": {
"phone": "0312345678",
"mobile": null,
"mail": "abe.simpson@example.org"
},
"civility_text": "Monsieur",
"sexe_text": "Masculin"
},
"personQuality": {
"code": "GPP",
"libelle": "GRAND-PERE PATERNEL",
"code_text": "GRAND-PERE PATERNEL"
}
},
{
"personInfo": {
"num": "N/A",
"lastname": "SIMPSON",
"firstname": "MONA PENELOPE",
"dateBirth": "1929-03-15T00:00:00Z",
"civility": "MME",
"sexe": "F",
"contact": {
"phone": "0412345678",
"mobile": "0612345678",
"mail": "mona.simpson@example.org"
},
"civility_text": "Madame",
"sexe_text": "F\u00e9minin"
},
"personQuality": {
"code": "GMP",
"libelle": "GRAND-MERE PATERNELLE",
"code_text": "GRAND-MERE PATERNELLE"
}
}
],
"indicatorList": [],
"medicalRecord": {
"familyDoctor": {
"name": "MONROE",
"phone": "0612341234",
"address": {
"street1": "Alameda",
"zipcode": "90701",
"town": "Springfield"
}
},
"allergy1": "butterscotch, imitation butterscotch, glow-in-the-dark monster make-up",
"allergy2": "shrimp and cauliflower",
"comment1": "the shrimp allergy isn't fully identified",
"comment2": null,
"observ1": "Ay Caramba!",
"observ2": "Ay Caramba!",
"isAuthHospital": true,
"hospital": "Springfield General Hospital",
"vaccinList": [
{
"code": "ROR",
"label": "ROUGEOLE-OREILLONS-RUBEOLE",
"vaccinationDate": "2022-02-22T00:00:00+01:00"
},
{
"code": "DTC",
"label": "DIPHTERIE TETANOS COQUELUCHE",
"vaccinationDate": "2011-01-11T00:00:00+01:00"
}
]
},
"insurance": null,
"paiInfoBean": {
"code": "PAIMED",
"dateDeb": "2022-09-01T00:00:00+02:00",
"dateFin": "2023-07-01T00:00:00+02:00",
"description": "mischievous, rebellious, misunderstood, disruptive",
"code_text": "MEDICAL"
},
"mother": "N/A",
"father": "N/A",
"rl": null,
"subscribeSchoolList": [],
"subscribeActivityList": [],
"sexe_text": "Masculin",
"dietcode_text": "1- REPAS STANDARD"
},
{
"num": "N/A",
"lastname": "N/A",
"firstname": "LISA",
"sexe": "F",
"birth": {
"dateBirth": "1980-05-09T00:00:00+02:00",
"place": null,
"communeCode": null,
"countryCode": null
},
"dietcode": "RSV",
"bPhoto": false,
"bLeaveAlone": false,
"authorizedPersonList": [],
"indicatorList": [],
"medicalRecord": null,
"insurance": null,
"paiInfoBean": {
"code": "PAIALI",
"dateDeb": null,
"dateFin": null,
"description": null,
"code_text": "ALIMENTAIRE"
},
"mother": "N/A",
"father": "N/A",
"rl": null,
"subscribeSchoolList": [],
"subscribeActivityList": [],
"sexe_text": "F\u00e9minin",
"dietcode_text": "3- R\u00c9GIME SANS VIANDE"
},
{
"num": "N/A",
"lastname": "N/A",
"firstname": "MAGGIE",
"sexe": "F",
"birth": {
"dateBirth": "1989-12-17T00:00:00+01:00",
"place": null,
"communeCode": null,
"countryCode": null
},
"dietcode": "BB",
"bPhoto": false,
"bLeaveAlone": false,
"authorizedPersonList": [],
"indicatorList": [],
"medicalRecord": null,
"insurance": null,
"paiInfoBean": {
"code": "PAIALI",
"dateDeb": null,
"dateFin": null,
"description": null,
"code_text": "ALIMENTAIRE"
},
"mother": "N/A",
"father": "N/A",
"rl": null,
"subscribeSchoolList": [],
"subscribeActivityList": [],
"sexe_text": "F\u00e9minin",
"dietcode_text": "REPAS BEBE"
}
],
"emergencyPersonList": [
{
"numPerson": "N/A",
"civility": "MME",
"firstname": "PATTY",
"lastname": "BOUVIER",
"dateBirth": "1948-08-30T00:00:00+01:00",
"sexe": "F",
"quality": "T",
"contact": {
"phone": "0112345678",
"mobile": "0612345678",
"mail": "patty.bouvier@example.org"
},
"civility_text": "Madame",
"quality_text": "TANTE",
"sexe_text": "F\u00e9minin"
},
{
"numPerson": "N/A",
"civility": "MME",
"firstname": "SELMA",
"lastname": "BOUVIER",
"dateBirth": "1946-04-29T00:00:00+01:00",
"sexe": "F",
"quality": "OS",
"contact": {
"phone": "0112345678",
"mobile": "0612345678",
"mail": "selma.bouvier@example.org"
},
"civility_text": "Madame",
"quality_text": "ORGANISME SOCIAL",
"sexe_text": "F\u00e9minin"
}
],
"indicatorList": [],
"childErrorList": [],
"category_text": "BIPARENTALE",
"situation_text": "Vivant maritalement"
}

View File

@ -0,0 +1,260 @@
{
"number": "N/A",
"category": "MONO",
"situation": "UL",
"flagCom": true,
"nbChild": null,
"nbTotalChild": null,
"nbAES": null,
"RL1": {
"num": "N/A",
"firstname": "MARGE",
"lastname": "N/A",
"maidenName": "BOUVIER",
"quality": "AU",
"civility": "MME",
"birth": {
"dateBirth": "1950-10-01T00:00:00+01:00",
"place": null,
"communeCode": null,
"countryCode": null
},
"adresse": {
"idStreet": null,
"num": 0,
"numComp": null,
"street1": "reset",
"street2": null,
"town": "reset",
"zipcode": "reset"
},
"contact": {
"phone": null,
"mobile": null,
"mail": null,
"isContactMail": false,
"isContactSms": false,
"isInvoicePdf": false
},
"profession": null,
"CAFInfo": null,
"indicatorList": [],
"quotientList": [],
"subscribeActivityList": [],
"civility_text": "Madame",
"quality_text": "AUTRE"
},
"RL2": {
"num": "N/A",
"firstname": "HOMER",
"lastname": "N/A",
"maidenName": null,
"quality": "AU",
"civility": "M.",
"birth": {
"dateBirth": "1956-05-12T00:00:00+01:00",
"place": null,
"communeCode": null,
"countryCode": null
},
"adresse": {
"idStreet": null,
"num": 42,
"numComp": "Q",
"street1": "reset",
"street2": null,
"town": "reset",
"zipcode": "reset",
"numComp_text": "quater"
},
"contact": {
"phone": null,
"mobile": null,
"mail": null,
"isContactMail": false,
"isContactSms": false,
"isInvoicePdf": false
},
"profession": {
"codeCSP": "15",
"profession": null,
"employerName": null,
"phone": null,
"addressPro": {
"num": 42,
"street": null,
"zipcode": null,
"town": null
},
"codeCSP_text": "AUTRES"
},
"CAFInfo": {
"number": "reset",
"organ": null
},
"indicatorList": [],
"quotientList": [],
"subscribeActivityList": [],
"civility_text": "Monsieur",
"quality_text": "AUTRE"
},
"quotientList": [],
"childList": [
{
"num": "N/A",
"lastname": "N/A",
"firstname": "BARTOLOME",
"sexe": "F",
"birth": {
"dateBirth": "1970-01-01T00:00:00+01:00",
"place": null,
"communeCode": null,
"countryCode": null
},
"dietcode": null,
"bPhoto": false,
"bLeaveAlone": false,
"authorizedPersonList": [
{
"personInfo": {
"num": "N/A",
"lastname": "RESET",
"firstname": "RESET",
"dateBirth": "1970-01-01T00:00:00+01:00",
"civility": null,
"sexe": "M",
"contact": null,
"sexe_text": "Masculin"
},
"personQuality": {
"code": "AU",
"libelle": "AUTRE",
"code_text": "AUTRE"
}
}
],
"indicatorList": [],
"medicalRecord": {
"familyDoctor": null,
"allergy1": null,
"allergy2": null,
"comment1": null,
"comment2": null,
"observ1": null,
"observ2": null,
"isAuthHospital": false,
"hospital": null,
"vaccinList": [
{
"code": "ROR",
"label": "ROUGEOLE-OREILLONS-RUBEOLE",
"vaccinationDate": "2022-02-22T00:00:00+01:00"
},
{
"code": "DTC",
"label": "DIPHTERIE TETANOS COQUELUCHE",
"vaccinationDate": "2011-01-11T00:00:00+01:00"
}
]
},
"insurance": null,
"paiInfoBean": {
"code": "PAIO",
"dateDeb": "1970-01-01T00:00:00+01:00",
"dateFin": "1970-01-01T00:00:00+01:00",
"description": null,
"code_text": "AUTRE"
},
"mother": "N/A",
"father": "N/A",
"rl": null,
"subscribeSchoolList": [],
"subscribeActivityList": [],
"sexe_text": "F\u00e9minin"
},
{
"num": "N/A",
"lastname": "N/A",
"firstname": "LISA",
"sexe": "F",
"birth": {
"dateBirth": "1980-05-09T00:00:00+02:00",
"place": null,
"communeCode": null,
"countryCode": null
},
"dietcode": "RSV",
"bPhoto": false,
"bLeaveAlone": false,
"authorizedPersonList": [],
"indicatorList": [],
"medicalRecord": null,
"insurance": null,
"paiInfoBean": {
"code": "PAIALI",
"dateDeb": null,
"dateFin": null,
"description": null,
"code_text": "ALIMENTAIRE"
},
"mother": "N/A",
"father": "N/A",
"rl": null,
"subscribeSchoolList": [],
"subscribeActivityList": [],
"sexe_text": "F\u00e9minin",
"dietcode_text": "3- R\u00c9GIME SANS VIANDE"
},
{
"num": "N/A",
"lastname": "N/A",
"firstname": "MAGGIE",
"sexe": "F",
"birth": {
"dateBirth": "1989-12-17T00:00:00+01:00",
"place": null,
"communeCode": null,
"countryCode": null
},
"dietcode": "BB",
"bPhoto": false,
"bLeaveAlone": false,
"authorizedPersonList": [],
"indicatorList": [],
"medicalRecord": null,
"insurance": null,
"paiInfoBean": {
"code": "PAIALI",
"dateDeb": null,
"dateFin": null,
"description": null,
"code_text": "ALIMENTAIRE"
},
"mother": "N/A",
"father": "N/A",
"rl": null,
"subscribeSchoolList": [],
"subscribeActivityList": [],
"sexe_text": "F\u00e9minin",
"dietcode_text": "REPAS BEBE"
}
],
"emergencyPersonList": [
{
"numPerson": "N/A",
"civility": null,
"firstname": "RESET",
"lastname": "RESET",
"dateBirth": "1970-01-01T00:00:00+01:00",
"sexe": "M",
"quality": "AU",
"contact": null,
"quality_text": "AUTRE",
"sexe_text": "Masculin"
}
],
"indicatorList": [],
"childErrorList": [],
"category_text": "MONOPARENTALE",
"situation_text": "UNION LIBRE"
}

View File

@ -0,0 +1,31 @@
[
{
"numPerson": "N/A",
"civility": "MME",
"firstname": "PATTY",
"lastname": "BOUVIER",
"dateBirth": "1948-08-30T00:00:00+01:00",
"sexe": "F",
"quality": "T",
"contact": {
"phone": "0112345678",
"mobile": "0612345678",
"mail": "patty.bouvier@example.org"
},
"civility_text": "Madame",
"quality_text": "TANTE",
"sexe_text": "F\u00e9minin"
},
{
"numPerson": "N/A",
"civility": null,
"firstname": "RESET",
"lastname": "RESET",
"dateBirth": "1970-01-01T00:00:00+01:00",
"sexe": "M",
"quality": "AU",
"contact": null,
"quality_text": "AUTRE",
"sexe_text": "Masculin"
}
]

View File

@ -0,0 +1,38 @@
{
"num": "N/A",
"firstname": "MARGE",
"lastname": "N/A",
"maidenName": "BOUVIER",
"quality": "AU",
"civility": "MME",
"birth": {
"dateBirth": "1950-10-01T00:00:00+01:00",
"place": null,
"communeCode": null,
"countryCode": null
},
"adresse": {
"idStreet": null,
"num": 0,
"numComp": null,
"street1": "Evergreen Terrace",
"street2": null,
"town": "Springfield",
"zipcode": "62701"
},
"contact": {
"phone": null,
"mobile": null,
"mail": null,
"isContactMail": false,
"isContactSms": false,
"isInvoicePdf": false
},
"profession": null,
"CAFInfo": null,
"indicatorList": [],
"quotientList": [],
"subscribeActivityList": [],
"civility_text": "Madame",
"quality_text": "AUTRE"
}

View File

@ -0,0 +1,54 @@
{
"num": "N/A",
"firstname": "HOMER",
"lastname": "N/A",
"maidenName": null,
"quality": "AU",
"civility": "M.",
"birth": {
"dateBirth": "1956-05-12T00:00:00+01:00",
"place": null,
"communeCode": null,
"countryCode": null
},
"adresse": {
"idStreet": null,
"num": 742,
"numComp": null,
"street1": "Evergreen Terrace",
"street2": null,
"town": "Springfield",
"zipcode": "90701"
},
"contact": {
"phone": "0122222222",
"mobile": "0622222222",
"mail": "homer.simpson@example.org.com",
"isContactMail": true,
"isContactSms": true,
"isInvoicePdf": true
},
"profession": {
"codeCSP": "13",
"profession": "Inspecteur de s\u00e9curit\u00e9",
"employerName": "Burns",
"phone": "0133333333",
"addressPro": {
"num": null,
"street": null,
"zipcode": "90701",
"town": "Springfield"
},
"codeCSP_text": "CADRE SUPERIEUR"
},
"CAFInfo": {
"number": "123",
"organ": "A10007752822",
"organ_text": "LA COLLE SUR LOUP"
},
"indicatorList": [],
"quotientList": [],
"subscribeActivityList": [],
"civility_text": "Monsieur",
"quality_text": "AUTRE"
}

View File

@ -0,0 +1,35 @@
#!/usr/bin/python3
import argparse
import requests
import zeep
from zeep.transports import Transport
from zeep.wsse.username import UsernameToken
WSSE = UsernameToken('maelis-webservice', 'maelis-password')
WSDL_URL = 'https://demo-toulouse.sigec.fr/maelisws-toulouse/services/FamilyService?wsdl'
def read_family(family_id, verbose):
session = requests.Session()
session.verify = False
transport = Transport(session=session)
settings = zeep.Settings(strict=False, xsd_ignore_sequence_order=True)
client = zeep.Client(WSDL_URL, transport=transport, wsse=WSSE, settings=settings)
result = client.service.readFamily(
dossierNumber=family_id,
# schoolYear=
# incomeYear=2020, # <-- pour avoir les quotients
# referenceYear=2020,
)
print(result)
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('--verbose', '-v', type=int, default=2, help='display errors')
parser.add_argument('family_id', help='196544', nargs='?', default='196544')
args = parser.parse_args()
read_family(args.family_id, verbose=args.verbose)

View File

@ -0,0 +1,693 @@
import copy
import pytest
import requests
from .conftest import diff, diff_child, diff_family, diff_rlg, link, read_family, unlink
FAMILY_RESET_PAYLOAD = {
'category': 'MONO',
'situation': 'UL',
'rl1': {
'civility': 'M.', # no effect
'firstname': 'Marge', # must be
'lastname': 'Simpson', # must be
'maidenName': 'reset', # no effect
'quality': 'AU',
'birth': {'dateBirth': '1950-10-01'}, # must be
'adresse': {'street1': 'reset', 'town': 'reset', 'zipcode': 'reset'},
},
'rl2': {
'civility': 'MME', # no effect
'firstname': 'Homer', # must be
'lastname': 'Simpson', # must be
'quality': 'AU',
'birth': {'dateBirth': '1956-05-12'}, # must be
'adresse': {
'num': '42',
'numComp': 'Q',
'street1': 'reset', # E19 : La voie est obligatoire
'street2': '',
'town': 'reset', # E17 : Le nom de la commune est obligatoire'
'zipcode': 'reset', # E16 : Le code postal est obligatoire
},
'contact': { # contact is removed (set to None) by the bellow content
'isContactMail': False,
'isContactSms': False,
'isInvoicePdf': False,
'mail': '',
'mobile': '',
'phone': '',
},
'profession': {
'addressPro': {'num': '42', 'street': '', 'town': '', 'zipcode': ''},
'codeCSP': '15',
'employerName': '',
'phone': '',
'profession': '',
},
'CAFInfo': {
'number': 'reset', # cannot be removed
'organ': '',
},
},
'childList': [
{
'num': 'place holder', # required for update
'sexe': 'F',
'firstname': 'Bartolome', # some side effects, cf test_update_child
'lastname': 'Simps',
'birth': {'dateBirth': '1970-01-01'},
'bPhoto': False,
'bLeaveAlone': False,
'dietcode': '',
'paiInfoBean': {
'code': 'PAIO',
'dateDeb': '1970-01-01',
'dateFin': '1970-01-01',
'description': '',
},
'medicalRecord': {
'familyDoctor': { # familyDoctor is removed (set to None) by the bellow content
'name': '',
'phone': '',
'address': {
'street1': '',
'zipcode': '',
'town': '',
},
},
'allergy1': '',
'allergy2': '',
'comment1': '',
'comment2': '',
'observ1': '',
'observ2': '',
'isAuthHospital': False,
'hospital': '',
'vaccinList': [],
},
# setting authorizedPersonList to None will remove the list
'authorizedPersonList': [
{
'personInfo': {
'civility': None,
'firstname': 'reset', # E704 : Le prénom de la personne est obligatoire
'lastname': 'reset', # E705 : Le nom de la personne est obligatoire
'dateBirth': '1970-01-01',
'sexe': 'M',
'contact': { # contact is removed (set to None) by the bellow content
'phone': '',
'mobile': '',
'mail': '',
},
},
'personQuality': {
'code': 'AU',
},
},
],
},
],
# setting emergencyPersonList to None will keep the list
'emergencyPersonList': [
{
'civility': None,
'firstname': 'reset', # ORA-01400: impossible d'insérer NULL dans ("MAELIS"."H_PERS"."ER_PNOM")
'lastname': 'reset', # ORA-01400: impossible d'insérer NULL dans ("MAELIS"."H_PERS"."ER_NOM")
'dateBirth': '1970-01-01',
'sexe': 'M',
'quality': 'AU',
'contact': {
'phone': '',
'mobile': '',
'mail': '',
},
},
],
}
# @pytest.mark.xfail(run=False)
@pytest.mark.parametrize(
"ref",
[
'category',
'civility', # 'country', 'county',
'csp',
'dietcode',
'organ',
'pai',
'quality',
'quotient',
'situation',
# 'street','town',
'vaccin',
],
)
def test_referentials(conn, ref):
url = conn + '/read-%s-list' % ref
resp = requests.get(url)
resp.raise_for_status()
res = resp.json()
assert res['err'] == 0
assert len(res['data']) > 1
for item in res['data']:
assert 'id' in item
assert 'text' in item
assert diff(res['data'], 'test_read_%s_list.json' % ref)
def test_update_family(conn, update_data):
unlink(conn, update_data['name_id'])
link(conn, update_data)
url = conn + '/update-family?NameID=%s' % update_data['name_id']
# reset fields
family_reset_payload = copy.deepcopy(FAMILY_RESET_PAYLOAD)
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()
assert resp.json()['err'] == 0
data = diff_family(conn, update_data['name_id'], 'test_update_family_ras.json')
# unchanged values
assert data['RL1']['civility'] != family_reset_payload['rl1']['civility']
assert data['RL2']['civility'] != family_reset_payload['rl2']['civility']
assert data['RL1']['maidenName'] != family_reset_payload['rl1']['maidenName']
# changed values
assert data['RL1']['quality'] == family_reset_payload['rl1']['quality']
assert data['RL2']['quality'] == family_reset_payload['rl2']['quality']
# without passing emergencyPersonList the list is keept
assert len(data['emergencyPersonList']) == 1
del family_reset_payload['emergencyPersonList']
resp = requests.post(url, json=family_reset_payload)
resp.raise_for_status()
assert resp.json()['err'] == 0
data = read_family(conn, update_data['name_id'])
assert len(data['emergencyPersonList']) == 1
# without passing authorizedPersonList the list is removed
assert len(data['childList'][0]['authorizedPersonList']) == 1
del family_reset_payload['childList'][0]['authorizedPersonList']
resp = requests.post(url, json=family_reset_payload)
resp.raise_for_status()
assert resp.json()['err'] == 0
data = read_family(conn, update_data['name_id'])
assert data['childList'][0]['authorizedPersonList'] == []
# update root fields
payload = {
'category': 'BI',
'situation': 'VM',
}
resp = requests.post(url, json=payload)
resp.raise_for_status()
assert resp.json()['err'] == 0
data = read_family(conn, update_data['name_id'])
assert data['category'] == 'BI'
assert data['situation'] == 'VM'
assert data['category_text'] == 'BIPARENTALE'
assert data['situation_text'] == 'Vivant maritalement'
# restore family
resp = requests.post(url, json=update_data['family_payload'])
resp.raise_for_status()
assert resp.json()['err'] == 0
assert diff_family(conn, update_data['name_id'], 'test_update_family.json')
def test_create_family(conn, create_data, update_data):
unlink(conn, create_data['name_id'])
link(conn, create_data)
url = conn + '/create-family?NameID=%s' % create_data['name_id']
# RL1 already exists (on update_data) error
unlink(conn, create_data['name_id'])
payload = copy.deepcopy(create_data['family_payload'])
payload['rl1']['lastname'] = 'Simpson'
resp = requests.post(url, json=payload)
resp.raise_for_status()
res = resp.json()
assert 'E54a' in res['err']
assert 'Il existe déjà un Responsable Légal correspondant' in res['err_desc']
assert res['err_class'] == 'passerelle.utils.jsonresponse.APIError'
# RL1 already exists (on update_data, as RL2) error
payload['rl1']['firstname'] = 'Homer'
payload['rl1']['birth']['dateBirth'] = '1956-05-12'
resp = requests.post(url, json=payload)
resp.raise_for_status()
res = resp.json()
assert 'E54a' in res['err']
assert 'Il existe déjà un Responsable Légal correspondant' in res['err_desc']
assert res['err_class'] == 'passerelle.utils.jsonresponse.APIError'
def test_is_rl_exists(conn, update_data):
url = conn + '/is-rl-exists'
payload = {'firstname': 'Marge', 'lastname': 'Simpson', 'dateBirth': '1950-10-01'}
resp = requests.post(url, json=payload)
resp.raise_for_status()
assert resp.json() == {'err': 0, 'data': True}
payload['firstname'] = payload['firstname'].upper()
payload['lastname'] = payload['lastname'].lower()
resp = requests.post(url, json=payload)
resp.raise_for_status()
assert resp.json() == {'err': 0, 'data': True}
payload['dateBirth'] = '1970-01-01'
resp = requests.post(url, json=payload)
resp.raise_for_status()
assert resp.json() == {'err': 0, 'data': False}
# test on rl2
payload = {'firstname': 'Homer', 'lastname': 'Simpson', 'dateBirth': '1956-05-12'}
resp = requests.post(url, json=payload)
resp.raise_for_status()
assert resp.json() == {'err': 0, 'data': True}
def test_create_rl2(conn, create_data, update_data):
unlink(conn, create_data['name_id'])
link(conn, create_data)
data = read_family(conn, create_data['name_id'])
assert data['RL2'] is None
# no unicity restriction on RL2 (duplicate RL2 from update_data)
url = conn + '/create-rl2?NameID=%s' % create_data['name_id']
payload = copy.deepcopy(update_data['family_payload']['rl2'])
for key in 'contact', 'profession', 'CAFInfo':
del payload[key]
resp = requests.post(url, json=payload)
resp.raise_for_status()
assert resp.json()['err'] == 0
assert diff_rlg(conn, create_data['name_id'], 2, 'test_create_rl2.json')
@pytest.mark.parametrize("rl", ['1', '2'])
def test_update_rlg(conn, update_data, rl):
rlg = 'rl' + rl
RLG = 'RL' + rl
unlink(conn, update_data['name_id'])
link(conn, update_data)
url = conn + '/update-rl%s?NameID=%s' % (rl, update_data['name_id'])
# reset responsable legal
payload = copy.deepcopy(FAMILY_RESET_PAYLOAD[rlg])
for key in 'adresse', 'contact', 'profession', 'CAFInfo':
if key in payload:
del payload[key]
resp = requests.post(url, json=payload)
resp.raise_for_status()
assert resp.json()['err'] == 0
data = diff_rlg(conn, update_data['name_id'], rl, 'test_update_rl%s.json' % rl)
# unchanged values
assert data[RLG]['civility'] != FAMILY_RESET_PAYLOAD[rlg]['civility']
if rl == 1:
assert data[RLG]['maidenName'] != FAMILY_RESET_PAYLOAD[rlg]['maidenName']
# changed values
assert data[RLG]['quality'] == FAMILY_RESET_PAYLOAD[rlg]['quality']
# update firstname is refused
payload['firstname'] = 'plop'
resp = requests.post(url, json=payload)
resp.raise_for_status()
res = resp.json()
assert res['err'] == 'Family-updateFamily-soap:Server'
assert (
"Le Responsable légal %s transmis n'est pas celui qui existe pour la famille" % rl in res['err_desc']
)
# update lastname is refused
payload['firstname'] = update_data['family_payload'][rlg]['firstname']
payload['lastname'] = 'plop'
resp = requests.post(url, json=payload)
resp.raise_for_status()
res = resp.json()
assert res['err'] == 'Family-updateFamily-soap:Server'
assert (
"Le Responsable légal %s transmis n'est pas celui qui existe pour la famille" % rl in res['err_desc']
)
# update birtday is refused
payload['lastname'] = 'Simpson'
payload['birth']['dateBirth'] = '1970-01-01'
resp = requests.post(url, json=payload)
resp.raise_for_status()
res = resp.json()
assert res['err'] == 'Family-updateFamily-soap:Server'
if rl == 1:
assert (
"Le Responsable légal %s transmis n'est pas celui qui existe pour la famille" % rl
in res['err_desc']
)
else:
assert "La date de naissance ne peut pas être modifiée" in res['err_desc']
# restore RL1
payload = copy.deepcopy(update_data['family_payload'][rlg])
for key in 'adresse', 'contact', 'profession', 'CAFInfo':
if payload.get(key):
del payload[key]
resp = requests.post(url, json=payload)
resp.raise_for_status()
assert resp.json()['err'] == 0
data = diff_family(conn, update_data['name_id'], 'test_update_family.json')
def test_update_coordinate(conn, update_data):
unlink(conn, update_data['name_id'])
link(conn, update_data)
# reset RL2 coordinates
url = conn + '/update-coordinate?NameID=%s&rl_id=%s' % (update_data['name_id'], update_data['rl2_num'])
payload = {}
for key in 'adresse', 'contact', 'profession', 'CAFInfo':
payload[key] = FAMILY_RESET_PAYLOAD['rl2'][key]
resp = requests.post(url, json=payload)
resp.raise_for_status()
assert resp.json()['err'] == 0
assert diff_rlg(conn, update_data['name_id'], 2, 'test_update_coordinate.json')
# restore RL2 coordinates
payload = {}
for key in 'adresse', 'contact', 'profession', 'CAFInfo':
payload[key] = update_data['family_payload']['rl2'][key]
resp = requests.post(url, json=payload)
resp.raise_for_status()
assert resp.json()['err'] == 0
assert diff_family(conn, update_data['name_id'], 'test_update_family.json')
def test_is_child_exists(conn, create_data):
url = conn + '/is-child-exists'
payload = {
'firstname': 'Maggie',
'lastname': create_data['lastname'],
'dateBirth': '1989-12-17',
}
resp = requests.post(url, json=payload)
resp.raise_for_status()
assert resp.json() == {'err': 0, 'data': True}
payload['firstname'] = payload['firstname'].upper()
payload['lastname'] = payload['lastname'].lower()
resp = requests.post(url, json=payload)
resp.raise_for_status()
assert resp.json() == {'err': 0, 'data': True}
payload['firstname'] = 'plop'
resp = requests.post(url, json=payload)
resp.raise_for_status()
assert resp.json() == {'err': 0, 'data': False}
def test_create_child(conn, create_data, update_data):
unlink(conn, create_data['name_id'])
link(conn, create_data)
data = read_family(conn, create_data['name_id'])
assert len(data['childList']) == 2
url = conn + '/create-child?NameID=%s' % create_data['name_id']
payload = {
'sexe': 'M',
'firstname': 'Lisa',
'lastname': create_data['lastname'],
'birth': {'dateBirth': '1980-05-09'},
}
resp = requests.post(url, json=payload)
resp.raise_for_status()
assert resp.json()['err'] == 0
assert diff_child(conn, create_data['name_id'], 2, 'test_create_child.json')
# child already exists error (Lisa form same family)
resp = requests.post(url, json=payload)
resp.raise_for_status()
res = resp.json()
assert 'Il existe déjà un enfant correspondant' in res['err_desc']
res['err_desc'] = 'N/A'
assert res == {
'err': 'Family-createChild-soap:Server',
'err_class': 'passerelle.utils.jsonresponse.APIError',
'err_desc': 'N/A',
'data': None,
}
# child already exists error (Lisa form update_data)
payload['lastname'] = 'Simpson'
resp = requests.post(url, json=payload)
resp.raise_for_status()
res = resp.json()
assert 'Il existe déjà un enfant correspondant' in res['err_desc']
res['err_desc'] = 'N/A'
assert res == {
'err': 'already-child', # error is return into childErrorList
'err_class': 'passerelle.utils.jsonresponse.APIError',
'err_desc': 'N/A',
'data': None,
}
def test_update_child(conn, update_data, create_data):
unlink(conn, update_data['name_id'])
link(conn, update_data)
# renaming using existing child names on same family will in fact target the existing child
# side effect: the authorized person list is copied by the connector (from Lisa to Maggie)
url = conn + '/update-child?NameID=%s&child_id=%s' % (update_data['name_id'], update_data['lisa_num'])
payload = copy.deepcopy(update_data['family_payload']['childList'][2]) # Maggie content
for key in 'dietcode', 'paiInfoBean', 'medicalRecord', 'authorizedPersonList':
if key in payload:
del payload[key]
assert payload['firstname'] == 'Maggie'
payload['sexe'] = 'M'
resp = requests.post(url, json=payload) # use Lisa id in url
resp.raise_for_status()
assert resp.json()['err'] == 0
data = read_family(conn, update_data['name_id'])
assert data['childList'][1]['num'] == update_data['lisa_num']
assert data['childList'][1]['firstname'] == 'LISA' # Lisa unchanged
assert data['childList'][2]['sexe'] == 'M' # Maggie updated
# restore Maggie
url = conn + '/update-child?NameID=%s&child_id=%s' % (update_data['name_id'], update_data['maggie_num'])
payload = copy.deepcopy(update_data['family_payload']['childList'][2])
for key in 'dietcode', 'paiInfoBean', 'medicalRecord', 'authorizedPersonList':
if key in payload:
del payload[key]
resp = requests.post(url, json=payload)
resp.raise_for_status()
assert resp.json()['err'] == 0
assert diff_family(conn, update_data['name_id'], 'test_update_family.json')
# rename to an existing child on other family
url = conn + '/update-child?NameID=%s&child_id=%s' % (update_data['name_id'], update_data['bart_num'])
payload = copy.deepcopy(create_data['family_payload']['childList'][1])
for key in 'dietcode', 'paiInfoBean', 'medicalRecord', 'authorizedPersonList':
if key in payload:
del payload[key]
resp = requests.post(url, json=payload)
resp.raise_for_status()
assert resp.json()['err'] == 0
data = read_family(conn, update_data['name_id'])
assert data['childList'][0]['num'] == update_data['bart_num']
assert data['childList'][0]['firstname'] == 'MAGGIE'
# reset Bart
payload = copy.deepcopy(FAMILY_RESET_PAYLOAD['childList'][0])
for key in 'dietcode', 'paiInfoBean', 'medicalRecord', 'authorizedPersonList':
if key in payload:
del payload[key]
resp = requests.post(url, json=payload)
resp.raise_for_status()
assert resp.json()['err'] == 0
assert diff_child(conn, update_data['name_id'], 0, 'test_update_child.json')
# restore Bart
payload = copy.deepcopy(update_data['family_payload']['childList'][0])
for key in 'dietcode', 'paiInfoBean', 'medicalRecord', 'authorizedPersonList':
if key in payload:
del payload[key]
resp = requests.post(url, json=payload)
resp.raise_for_status()
assert resp.json()['err'] == 0
assert diff_family(conn, update_data['name_id'], 'test_update_family.json')
def test_update_child_dietcode(conn, update_data):
unlink(conn, update_data['name_id'])
link(conn, update_data)
url = conn + '/update-child-dietcode?NameID=%s&child_id=%s&dietcode=' % (
update_data['name_id'],
update_data['bart_num'],
)
data = read_family(conn, update_data['name_id'])
assert data['childList'][0]['dietcode'] == 'STD'
assert data['childList'][0]['dietcode_text'] == '1- REPAS STANDARD'
# change dietcode
resp = requests.post(url + 'RSP')
resp.raise_for_status()
assert resp.json()['err'] == 0
data = read_family(conn, update_data['name_id'])
assert data['childList'][0]['dietcode'] == 'RSP'
assert data['childList'][0]['dietcode_text'] == '2- R\u00c9GIME SANS PORC'
# empty dietcode
resp = requests.post(url + '')
resp.raise_for_status()
assert resp.json()['err'] == 0
data = read_family(conn, update_data['name_id'])
assert data['childList'][0]['dietcode'] == None
assert 'dietcode_text' not in data['childList'][0]
# restore dietcode
resp = requests.post(url + 'STD')
resp.raise_for_status()
assert resp.json()['err'] == 0
assert diff_family(conn, update_data['name_id'], 'test_update_family.json')
def test_update_child_pai(conn, update_data):
unlink(conn, update_data['name_id'])
link(conn, update_data)
url = conn + '/update-child-pai?NameID=%s&child_id=%s' % (update_data['name_id'], update_data['bart_num'])
# reset PAI
payload = FAMILY_RESET_PAYLOAD['childList'][0]['paiInfoBean']
resp = requests.post(url, json=payload)
resp.raise_for_status()
assert resp.json()['err'] == 0
assert diff_child(conn, update_data['name_id'], 0, 'test_update_child_pai.json', key='paiInfoBean')
# restore PAI
payload = update_data['family_payload']['childList'][0]['paiInfoBean']
resp = requests.post(url, json=payload)
resp.raise_for_status()
assert resp.json()['err'] == 0
assert diff_family(conn, update_data['name_id'], 'test_update_family.json')
def test_update_child_medical_record(conn, update_data):
unlink(conn, update_data['name_id'])
link(conn, update_data)
url = conn + '/update-child-medical-record?NameID=%s&child_id=%s' % (
update_data['name_id'],
update_data['bart_num'],
)
# observation 2 is wrong
assert (
update_data['data']['childList'][0]['medicalRecord']['observ2']
!= update_data['family_payload']['childList'][0]['medicalRecord']['observ2']
)
assert (
update_data['data']['childList'][0]['medicalRecord']['observ2']
== update_data['family_payload']['childList'][0]['medicalRecord']['observ1']
)
# reset medical record
payload = FAMILY_RESET_PAYLOAD['childList'][0]['medicalRecord']
resp = requests.post(url, json=payload)
resp.raise_for_status()
assert resp.json()['err'] == 0
assert diff_child(
conn, update_data['name_id'], 0, 'test_update_child_medical_record.json', key='medicalRecord'
)
# restore medical record
payload = update_data['family_payload']['childList'][0]['medicalRecord']
resp = requests.post(url, json=payload)
resp.raise_for_status()
assert resp.json()['err'] == 0
assert diff_family(conn, update_data['name_id'], 'test_update_family.json')
def test_person(conn, update_data):
unlink(conn, update_data['name_id'])
link(conn, update_data)
data = read_family(conn, update_data['name_id'])
assert len(data['emergencyPersonList']) == 2
# delete Patty
selma_num = data['emergencyPersonList'][1]['numPerson']
url = conn + '/delete-person?NameID=%s&person_id=%s' % (update_data['name_id'], selma_num)
resp = requests.post(url)
resp.raise_for_status()
assert resp.json()['err'] == 0
data = read_family(conn, update_data['name_id'])
assert len(data['emergencyPersonList']) == 1
# re-create Selma
# last inserted person is added on the tail of the list
url = conn + '/create-person?NameID=%s' % (update_data['name_id'])
payload = FAMILY_RESET_PAYLOAD['emergencyPersonList'][0]
resp = requests.post(url, json=payload)
resp.raise_for_status()
assert resp.json()['err'] == 0
data = diff_family(conn, update_data['name_id'], 'test_update_person.json', 'emergencyPersonList')
# update Selma (and restore family person list)
selma_num = data['emergencyPersonList'][1]['numPerson']
url = conn + '/update-person?NameID=%s&person_id=%s' % (update_data['name_id'], selma_num)
payload = update_data['family_payload']['emergencyPersonList'][1]
resp = requests.post(url, json=payload)
resp.raise_for_status()
assert resp.json()['err'] == 0
assert diff_family(conn, update_data['name_id'], 'test_update_family.json')
def test_child_person(conn, update_data):
unlink(conn, update_data['name_id'])
link(conn, update_data)
data = read_family(conn, update_data['name_id'])
assert len(data['childList'][0]['authorizedPersonList']) == 2
# delete Abi
abi_num = data['childList'][0]['authorizedPersonList'][0]['personInfo']['num']
url = conn + '/delete-child-person?NameID=%s&child_id=%s&person_id=%s' % (
update_data['name_id'],
update_data['bart_num'],
abi_num,
)
resp = requests.post(url)
resp.raise_for_status()
assert resp.json()['err'] == 0
data = read_family(conn, update_data['name_id'])
assert len(data['childList'][0]['authorizedPersonList']) == 1
# re-create Abi
# last inserted person is added on the head of the list
url = conn + '/create-child-person?NameID=%s&child_id=%s' % (
update_data['name_id'],
update_data['bart_num'],
)
payload = FAMILY_RESET_PAYLOAD['childList'][0]['authorizedPersonList'][0]
resp = requests.post(url, json=payload)
resp.raise_for_status()
assert resp.json()['err'] == 0
data = diff_child(
conn, update_data['name_id'], 0, 'test_update_child_person.json', 'authorizedPersonList'
)
# update Abi (and restore child person list)
abi_num = data['childList'][0]['authorizedPersonList'][0]['personInfo']['num']
url = conn + '/update-child-person?NameID=%s&child_id=%s&person_id=%s' % (
update_data['name_id'],
update_data['bart_num'],
abi_num,
)
payload = update_data['family_payload']['childList'][0]['authorizedPersonList'][0]
resp = requests.post(url, json=payload)
resp.raise_for_status()
assert resp.json()['err'] == 0
assert diff_family(conn, update_data['name_id'], 'test_update_family.json')

View File

@ -0,0 +1,59 @@
import requests
from .conftest import link, unlink
def test_up(conn):
url = conn + '/up'
resp = requests.get(url)
resp.raise_for_status()
res = resp.json()
assert res['err'] == 0
def test_unlink(conn, update_data):
resp = unlink(conn, update_data['name_id'])
resp = unlink(conn, update_data['name_id'])
res = resp.json()
assert res['err'] == 'not-linked'
def test_link(conn, update_data):
unlink(conn, update_data['name_id'])
link(conn, update_data)
link(conn, update_data)
# wrong DUI number
url = conn + '/link?NameID=%s' % update_data['name_id']
payload = {
'family_id': '999999',
'firstname': update_data['family_payload']['rl1']['firstname'],
'lastname': update_data['family_payload']['rl1']['lastname'],
'dateBirth': update_data['family_payload']['rl1']['birth']['dateBirth'],
}
resp = requests.post(url, json=payload)
resp.raise_for_status()
res = resp.json()
assert res == {
'err': 'Family-readFamily-soap:Server',
'err_class': 'passerelle.utils.jsonresponse.APIError',
'err_desc': 'E02 : Le dossier numéro [999999] ne correspond à aucune famille',
'data': None,
}
# wrong DUI firstname
payload = {
'family_id': update_data['family_id'],
'firstname': 'plop',
'lastname': update_data['family_payload']['rl1']['lastname'],
'dateBirth': update_data['family_payload']['rl1']['birth']['dateBirth'],
}
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,
}

View File

@ -72,7 +72,7 @@ class Esabora(BaseResource, HTTPResource):
url = urllib.parse.urljoin(self.service_url, path)
headers = {'Authorization': f'Bearer {self.api_key}'}
try:
return self.requests.post(url, json=payload, headers=headers, timeout=5, **kwargs)
response = self.requests.post(url, json=payload, headers=headers, timeout=5, **kwargs)
except requests.RequestException as e:
raise APIError(
'Esabora platform "%s" connection error: %s' % (self.service_url, exception_to_text(e)),
@ -83,6 +83,26 @@ class Esabora(BaseResource, HTTPResource):
'error': str(e),
},
)
try:
data = response.json()
except requests.JSONDecodeError as e:
raise APIError(
'Esabora platform "%s" invalid JSON response: %s' % (self.service_url, exception_to_text(e)),
log_error=True,
data={
'status_code': response.status_code,
},
)
if not response.ok:
raise APIError(
'Esabora platform "%s" answered with HTTP error' % (self.service_url),
log_error=True,
data={
'status_code': response.status_code,
'content': data,
},
)
return data
@endpoint(
name='do-search',
@ -100,9 +120,7 @@ class Esabora(BaseResource, HTTPResource):
for name, value in post_data['criterions'].items()
],
}
response = self.post('mult/', payload, params={'task': 'doSearch'})
response.raise_for_status()
data = response.json()
data = self.post('mult/', payload, params={'task': 'doSearch'})
columns = {slugify(c).replace('-', '_'): c for c in data['columnList']}
keys = {slugify(c).replace('-', '_'): c for c in data['keyList']}
cleaned_data = {
@ -130,9 +148,7 @@ class Esabora(BaseResource, HTTPResource):
endpoint = post_data.pop('endpoint', None) or 'modbdd'
payload = get_treatment_payload(post_data)
response = self.post(f'{endpoint}/', payload, params={'task': 'doTreatment'})
response.raise_for_status()
data = response.json()
data = self.post(f'{endpoint}/', payload, params={'task': 'doTreatment'})
keys = [slugify(c).replace('-', '_') for c in data['keyList']]
cleaned_data = esabora_row_to_object([], keys, data)
cleaned_data['action'] = data['action']

View File

@ -60,9 +60,10 @@ def base64url_decode(input):
class FranceConnect:
def __init__(self, session, logger):
def __init__(self, session, logger, dgfip_api_base_url):
self.session = session
self.logger = logger
self.dgfip_api_base_url = dgfip_api_base_url
self.items = []
self.correlation_id = str(uuid.uuid4())
@ -135,7 +136,7 @@ class FranceConnect:
dgfip_response = self.request(
'dgfip token endpoint',
'POST',
'https://gwfc.impots.gouv.fr/token',
'token',
data=data,
auth=(dgfip_username, dgfip_password),
)
@ -162,7 +163,7 @@ class FranceConnect:
dgfip_ressource_ir_response = self.request(
'ressource IR endpoint',
'GET',
'https://gwfc.impots.gouv.fr/impotparticulier/1.0/situations/ir/assiettes/annrev/%s' % annrev,
'impotparticulier/1.0/situations/ir/assiettes/annrev/%s' % annrev,
headers=headers,
)
except FranceConnectError as e:
@ -185,8 +186,9 @@ class FranceConnect:
def add(self, key, value):
self.items.append((key, value))
def request(self, label, method, url, *args, **kwargs):
def request(self, label, method, endpoint, *args, **kwargs):
self.logger.debug('request %s %s args:%s kwargs:%s', label, method, args, kwargs)
url = urllib.parse.urljoin(self.dgfip_api_base_url, endpoint)
self.add(label.replace(' ', '_') + '_request', [method, url, args, kwargs])
try:
response = getattr(self.session, method.lower())(url, *args, **kwargs)

View File

@ -48,23 +48,19 @@ class Migration(migrations.Migration):
),
(
'dgfip_username',
models.CharField(
blank=True, max_length=64, null=True, verbose_name='api.impots.gouv.fr username'
),
models.CharField(blank=True, max_length=64, null=True, verbose_name='DGFIP API Username'),
),
(
'dgfip_password',
models.CharField(
blank=True, max_length=64, null=True, verbose_name='api.impots.gouv.fr password'
),
models.CharField(blank=True, max_length=64, null=True, verbose_name='DGFIP API Password'),
),
(
'dgfip_scopes',
models.TextField(blank=True, null=True, verbose_name='api.impots.gouv.fr scopes'),
models.TextField(blank=True, null=True, verbose_name='DGFIP API Scopes'),
),
(
'dgfip_id_teleservice',
models.TextField(blank=True, null=True, verbose_name='api.impots.gouv.fr ID_Teleservice'),
models.TextField(blank=True, null=True, verbose_name='DGFIP API ID_Teleservice'),
),
(
'users',

View File

@ -0,0 +1,22 @@
# Generated by Django 2.2.24 on 2022-11-24 10:58
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('franceconnect_data', '0002_token'),
]
operations = [
migrations.AddField(
model_name='resource',
name='dgfip_api_base_url',
field=models.URLField(
default='https://gwfc.dgfip.finances.gouv.fr/',
max_length=256,
verbose_name='DGFIP API base URL',
),
),
]

View File

@ -62,13 +62,17 @@ class Resource(BaseResource):
),
)
dgfip_username = models.CharField(_('api.impots.gouv.fr username'), max_length=64, blank=True, null=True)
dgfip_api_base_url = models.URLField(
_('DGFIP API base URL'), max_length=256, default='https://gwfc.dgfip.finances.gouv.fr/'
)
dgfip_password = models.CharField(_('api.impots.gouv.fr password'), max_length=64, blank=True, null=True)
dgfip_username = models.CharField(_('DGFIP API Username'), max_length=64, blank=True, null=True)
dgfip_scopes = models.TextField(_('api.impots.gouv.fr scopes'), blank=True, null=True)
dgfip_password = models.CharField(_('DGFIP API Password'), max_length=64, blank=True, null=True)
dgfip_id_teleservice = models.TextField(_('api.impots.gouv.fr ID_Teleservice'), blank=True, null=True)
dgfip_scopes = models.TextField(_('DGFIP API Scopes'), blank=True, null=True)
dgfip_id_teleservice = models.TextField(_('DGFIP API ID_Teleservice'), blank=True, null=True)
log_requests_errors = False
@ -121,7 +125,9 @@ class Resource(BaseResource):
return HttpResponseBadRequest('Missing or invalid origin')
redirect_uri = self.build_callback_url(request, origin=origin, mode=mode, test=test)
franceconnect = fc.FranceConnect(session=self.requests, logger=self.logger)
franceconnect = fc.FranceConnect(
session=self.requests, logger=self.logger, dgfip_api_base_url=self.dgfip_api_base_url
)
return HttpResponseRedirect(
franceconnect.authorization_request(
platform=self.fc_platform,
@ -152,7 +158,9 @@ class Resource(BaseResource):
if test and not request.user.is_superuser:
return HttpResponseBadRequest('Only admin can use test mode.')
franceconnect = fc.FranceConnect(session=self.requests, logger=self.logger)
franceconnect = fc.FranceConnect(
session=self.requests, logger=self.logger, dgfip_api_base_url=self.dgfip_api_base_url
)
redirect_uri = self.build_callback_url(request, origin=origin, mode=mode, test=test)
context = {
'origin': origin,
@ -222,11 +230,13 @@ class Resource(BaseResource):
)
def data_source(self, request, id=None, test=None, mode=None, **kwargs):
if id:
return {
'data': [
dict(self.retrieve(id), id=id),
]
}
token = self.retrieve(id)
if token:
return {
'data': [
dict(token, id=id),
]
}
url = request.build_absolute_uri(
reverse(
'generic-endpoint',
@ -262,6 +272,10 @@ class Resource(BaseResource):
return token.guid.hex
def retrieve(self, ref):
try:
ref = uuid.UUID(str(ref))
except ValueError:
return None
token = Token.objects.filter(guid=ref).first()
return token and token.content

View File

@ -131,6 +131,7 @@ class GrandLyonStreetSections(BaseResource):
)
for attribute in ('nom', 'nomcommune', 'domanialite', 'codeinsee'):
setattr(section, attribute, value.get(attribute) or '')
section.nomcommune = normalize_commune(section.nomcommune)
for attribute in ('bornemindroite', 'bornemingauche', 'bornemaxdroite', 'bornemaxgauche', 'gid'):
if value.get(attribute) in (None, 'None'):
# data.grandlyon returned 'None' as a string at a time

View File

@ -131,6 +131,10 @@ class Tcl(BaseResource):
response = self.requests.get(url)
response.raise_for_status()
for line_data in response.json()['values']:
if 'code_trace' in line_data:
line_data['code_titan'] = line_data['code_trace']
if 'nom_trace' in line_data:
line_data['libelle'] = line_data['nom_trace']
line, dummy = Line.objects.get_or_create(
code_titan=line_data['code_titan'],
defaults={'transport_key': key, 'ligne': line_data['ligne']},

View File

@ -180,19 +180,6 @@ class ToulouseMaelis(BaseResource, HTTPResource):
self.add_text_value('PAI', data, ['paiInfoBean', 'code'])
for person in data['authorizedPersonList']:
self.add_text_value_to_child_person(person)
# convert O/N string into boolean
if data.get('fsl'):
for key in (
'allergieAlimentaire',
'allergieRespiratoire',
'allergieAutre',
'allergieMedicament',
'asthme',
'flPAI',
'flImage',
):
data['fsl'][key] = bool(data['fsl'][key] == 'O')
return data
def add_text_value_to_person(self, data):
@ -276,7 +263,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
for key in keys:
data = data[key]
for i in range(0, len(data['vaccinList']) or []):
for i in range(0, len(data.get('vaccinList', []))):
self.assert_post_data_in_referential(
'Vaccin', post_data, keys + ['vaccinList', i, 'code'], required=False
)
@ -302,7 +289,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
data = data[key]
if 'dietcode' in data:
self.assert_post_data_in_referential('DietCode', post_data, keys + ['dietcode'])
self.assert_post_data_in_referential('DietCode', post_data, keys + ['dietcode'], required=False)
if 'paiInfoBean' in data:
self.assert_child_pai_payoad_in_referential(post_data, keys + ['paiInfoBean'])
if 'medicalRecord' in data:
@ -332,12 +319,12 @@ class ToulouseMaelis(BaseResource, HTTPResource):
self.assert_update_coordinate_payload_in_referential(post_data, keys)
def assert_create_rl1_payload_in_referential(self, post_data):
self.assert_post_data_in_referential('Category', post_data, ['categorie'])
self.assert_post_data_in_referential('Category', post_data, ['category'])
self.assert_post_data_in_referential('Situation', post_data, ['situation'])
self.assert_rl_payload_in_referential(post_data, ['rl1'])
def assert_family_payload_in_referential(self, post_data):
self.assert_post_data_in_referential('Category', post_data, ['categorie'])
self.assert_post_data_in_referential('Category', post_data, ['category'])
self.assert_post_data_in_referential('Situation', post_data, ['situation'])
for rlg in 'rl1', 'rl2':
if rlg in post_data:
@ -489,7 +476,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
if not (
response['RL1']['firstname'] == post_data['firstname'].upper()
and response['RL1']['lastname'] == post_data['lastname'].upper()
and response['RL1']['dateBirth'].strftime('%Y-%m-%d') == post_data['dateBirth']
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')
Link.objects.update_or_create(resource=self, name_id=NameID, defaults={'family_id': family_id})
@ -641,6 +628,11 @@ class ToulouseMaelis(BaseResource, HTTPResource):
self.assert_family_payload_in_referential(post_data)
self.replace_null_values(post_data)
# adapt payload to use same input as create_family
if len(post_data.get('emergencyPersonList', [])):
persons = post_data.pop('emergencyPersonList')
post_data['emergencyPersonList'] = [{'personList': persons}]
response = self.call('Family', 'updateFamily', dossierNumber=family_id, **post_data)
data = serialize_object(response)
family_id = data.get('number')
@ -688,11 +680,10 @@ class ToulouseMaelis(BaseResource, HTTPResource):
self.replace_null_values(post_data)
rl1 = post_data
rl1['num'] = family['RL1']['num']
rl1['adresse'] = family['RL1']['adresse']
payload = {
'dossierNumber': family_id,
'categorie': family['category'],
'category': family['category'],
'situation': family['situation'],
'flagCom': family['flagCom'],
'nbChild': family['nbChild'],
@ -720,7 +711,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
payload = {
'dossierNumber': family_id,
'categorie': family['category'],
'category': family['category'],
'situation': family['situation'],
'flagCom': family['flagCom'],
'nbChild': family['nbChild'],
@ -748,11 +739,10 @@ class ToulouseMaelis(BaseResource, HTTPResource):
self.replace_null_values(post_data)
rl2 = post_data
rl2['num'] = family['RL2']['num']
rl2['adresse'] = family['RL2']['adresse']
payload = {
'dossierNumber': family_id,
'categorie': family['category'],
'category': family['category'],
'situation': family['situation'],
'flagCom': family['flagCom'],
'nbChild': family['nbChild'],
@ -780,7 +770,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
)
def create_child(self, request, NameID, post_data, force=False):
family_id = self.get_link(NameID).family_id
self.assert_update_coordinate_payload_in_referential(post_data)
self.assert_child_payload_in_referential(post_data)
payload = {
'numDossier': family_id,
@ -809,16 +799,20 @@ class ToulouseMaelis(BaseResource, HTTPResource):
def update_child(self, request, NameID, child_id, post_data):
family_id = self.get_link(NameID).family_id
family = self.get_family_raw(family_id)
if child_id not in [x['num'] for x in family['childList']]:
raise APIError('No child %s to update on family' % child_id, err_code='no-child')
self.assert_child_payload_in_referential(post_data)
self.replace_null_values(post_data)
child = post_data
child['num'] = child_id
for known_child in family['childList']:
if str(known_child['num']) == child_id:
child['authorizedPersonList'] = known_child['authorizedPersonList']
break
else:
raise APIError('No child %s to update on family' % child_id, err_code='no-child')
payload = {
'dossierNumber': family_id,
'categorie': family['category'],
'category': family['category'],
'situation': family['situation'],
'flagCom': family['flagCom'],
'nbChild': family['nbChild'],
@ -856,7 +850,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
parameters={
'NameID': {'description': 'Publik NameID'},
},
post={'request_body': {'schema': {'application/json': schemas.FAMILYPERSON_SCHEMA}}},
post={'request_body': {'schema': {'application/json': schemas.EMERGENCY_PERSON_SCHEMA}}},
)
def create_person(self, request, NameID, post_data):
family_id = self.get_link(NameID).family_id
@ -867,7 +861,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
personList.append(post_data)
payload = {
'dossierNumber': family_id,
'categorie': family['category'],
'category': family['category'],
'situation': family['situation'],
'flagCom': family['flagCom'],
'nbChild': family['nbChild'],
@ -887,7 +881,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
'NameID': {'description': 'Publik NameID'},
'person_id': {'description': 'Numéro de la personne'},
},
post={'request_body': {'schema': {'application/json': schemas.FAMILYPERSON_SCHEMA}}},
post={'request_body': {'schema': {'application/json': schemas.EMERGENCY_PERSON_SCHEMA}}},
)
def update_person(self, request, NameID, person_id, post_data):
family_id = self.get_link(NameID).family_id
@ -906,7 +900,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
)
payload = {
'dossierNumber': family_id,
'categorie': family['category'],
'category': family['category'],
'situation': family['situation'],
'flagCom': family['flagCom'],
'nbChild': family['nbChild'],
@ -943,7 +937,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
)
payload = {
'dossierNumber': family_id,
'categorie': family['category'],
'category': family['category'],
'situation': family['situation'],
'flagCom': family['flagCom'],
'nbChild': family['nbChild'],
@ -963,7 +957,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
'NameID': {'description': 'Publik NameID'},
'child_id': {'description': "Numéro de l'enfant"},
},
post={'request_body': {'schema': {'application/json': schemas.CHILDPERSON2_SCHEMA}}},
post={'request_body': {'schema': {'application/json': schemas.AUTHORIZED_PERSON_SCHEMA}}},
)
def create_child_person(self, request, NameID, child_id, post_data):
family_id = self.get_link(NameID).family_id
@ -992,7 +986,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
'child_id': {'description': "Numéro de l'enfant"},
'person_id': {'description': 'Numéro de la personne'},
},
post={'request_body': {'schema': {'application/json': schemas.CHILDPERSON2_SCHEMA}}},
post={'request_body': {'schema': {'application/json': schemas.AUTHORIZED_PERSON_SCHEMA}}},
)
def update_child_person(self, request, NameID, child_id, person_id, post_data):
family_id = self.get_link(NameID).family_id
@ -1068,7 +1062,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
)
def update_child_dietcode(self, request, NameID, child_id, dietcode):
self.get_link(NameID)
self.assert_key_in_referential('DietCode', dietcode, 'dietcode parameter')
self.assert_key_in_referential('DietCode', dietcode, 'dietcode parameter', required=False)
self.call('Family', 'createOrUpdateChildDiet', personNumber=child_id, code=dietcode)
return {'data': 'ok'}
@ -1096,39 +1090,6 @@ class ToulouseMaelis(BaseResource, HTTPResource):
self.call('Family', 'updateChildPAI', personNumber=child_id, **post_data)
return {'data': 'ok'}
@endpoint(
display_category='Famille',
description="Créer ou mettre à jour la fiche sanitaire d'un enfant",
name='update-child-fsl',
perm='can_access',
parameters={
'NameID': {'description': 'Publik NameID'},
'child_id': {'description': "Numéro de l'enfant"},
},
post={'request_body': {'schema': {'application/json': schemas.FSL_SCHEMA}}},
)
def update_child_fsl(self, request, NameID, child_id, post_data):
self.get_link(NameID)
# maelis expect strings O/N
for key in (
'allergieAlimentaire',
'allergieRespiratoire',
'allergieAutre',
'allergieMedicament',
'asthme',
'flPAI',
'flImage',
):
post_data[key] = 'O' if post_data.get(key) else 'N'
# use None to empty optional date passed as an empty string by date filter
if post_data.get('dtcPrap1') == '':
post_data['dtcPrap1'] = None
self.call('Family', 'createOrUpdateFSL', arg0=child_id, arg1=post_data)
return {'data': 'ok'}
@endpoint(
display_category='Famille',
description="Créer ou mettre à jour les données médicales d'un enfant",

View File

@ -24,7 +24,7 @@ BOOLEAN_TYPES = [
},
]
ID_PROPERTIES = {
BASIC_ID_PROPERTIES = {
'firstname': {
'description': 'Prénom',
'type': 'string',
@ -54,7 +54,7 @@ LINK_SCHEMA = {
},
'additionalProperties': False,
}
LINK_SCHEMA['properties'].update(ID_PROPERTIES)
LINK_SCHEMA['properties'].update(BASIC_ID_PROPERTIES)
ISEXISTS_SCHEMA = {
'$schema': 'http://json-schema.org/draft-04/schema#',
@ -62,10 +62,138 @@ ISEXISTS_SCHEMA = {
'description': "Recherche d'un responsable légal ou d'un enfant dans Maelis",
'type': 'object',
'required': ['firstname', 'lastname', 'dateBirth'],
'properties': ID_PROPERTIES,
'properties': BASIC_ID_PROPERTIES,
'additionalProperties': False,
}
CONTACTLIGHT_SCHEMA = {
'$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'Contact light',
'description': "Informations de contact pour les personnes autorisées à récupérer les enfants ou à prévenir en cas d'urgence",
'type': 'object',
'properties': {
'phone': {
'description': 'Téléphone',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
'mobile': {
'description': 'Portable',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
'mail': {
'description': 'Mail',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
},
}
PERSON_PROPERTIES = {
'civility': {
'description': 'civilité (depuis référentiel)',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
'sexe': {
'description': 'Sexe (depuis référentiel)',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
'contact': {'oneOf': [CONTACTLIGHT_SCHEMA, {'type': 'null'}]},
}
PERSON_PROPERTIES.update(BASIC_ID_PROPERTIES)
EMERGENCY_PERSON_SCHEMA = {
'$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'Emergency person',
'description': "Personnes à prévenir en cas d'urgence",
'type': 'object',
'required': ['firstname', 'lastname', 'dateBirth', 'quality'],
'properties': {
'quality': {
'description': 'Qualité',
'type': 'string',
'pattern': '.+',
},
},
'unflatten': True,
'additionalProperties': False,
}
EMERGENCY_PERSON_SCHEMA['properties'].update(PERSON_PROPERTIES)
AUTHORIZED_PERSON_SCHEMA = {
'$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'Family persons',
'description': "Personnes autorisées à venir chercher l'enfant",
'type': 'object',
'required': ['personInfo', 'personQuality'],
'properties': {
'personInfo': {
'type': 'object',
'required': ['firstname', 'lastname', 'dateBirth'],
'properties': PERSON_PROPERTIES,
},
'personQuality': {
'type': 'object',
'required': ['code'],
'properties': {
'code': {
'description': 'Le code (depuis référentiel)',
'type': 'string',
'pattern': '.+',
},
},
},
},
'additionalProperties': False,
'unflatten': True,
}
BIRTH_SCHEMA = {
'$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'Birth info',
'description': "Informations relatives à la naissance",
'type': 'object',
'required': ['dateBirth'],
'properties': {
'dateBirth': {
'description': 'Date de naissance',
'type': 'string',
'pattern': '^[0-9]{4}-[0-9]{2}-[0-9]{2}$',
},
'place': {
'description': 'Lieu de naissance',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
'communeCode': {
'description': 'Commune de naissance (depuis référentiel)',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
'countryCode': {
'description': 'Pays de naissance (depuis référentiel)',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
},
}
ID_PROPERTIES = {
'firstname': {
'description': 'Prénom',
'type': 'string',
},
'lastname': {
'description': 'Nom',
'type': 'string',
},
'maidenName': {
'description': "Nom de jeune fille ",
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
'birth': BIRTH_SCHEMA,
}
ADDRESS_SCHEMA = {
'$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'Address',
@ -74,7 +202,7 @@ ADDRESS_SCHEMA = {
'required': ['street1', 'town', 'zipcode'],
'properties': {
'num': {
'description': 'numéro',
'description': "Numéro de l'adresse",
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
'numComp': {
@ -206,7 +334,7 @@ RLINFO_SCHEMA = {
'title': 'RL',
'description': "Informations sur le responsable légal",
'type': 'object',
'required': ['firstname', 'lastname', 'civility', 'quality', 'dateBirth', 'adresse'],
'required': ['firstname', 'lastname', 'civility', 'quality', 'birth', 'adresse'],
'properties': {
'civility': {
'description': 'civilité (depuis référentiel)',
@ -223,126 +351,11 @@ RLINFO_SCHEMA = {
'profession': {'oneOf': [PROFESSION_SCHEMA, {'type': 'null'}]},
'CAFInfo': {'oneOf': [CAFINFO_SCHEMA, {'type': 'null'}]},
},
'unflatten': True,
'additionalProperties': False,
}
RLINFO_SCHEMA['properties'].update(ID_PROPERTIES)
CHILDBIRTH_SCHEMA = {
'$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'Child birth',
'description': "Informations sur la naissance d'un enfant",
'type': 'object',
'required': ['dateBirth'],
'properties': {
'dateBirth': {
'description': 'Date de naissance',
'type': 'string',
'pattern': '^[0-9]{4}-[0-9]{2}-[0-9]{2}$',
},
'place': {
'description': 'Lieu de naissance',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
},
}
FSL_SCHEMA = {
'$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'FSL',
'description': 'Informations sur la fiche sanitaire',
'type': 'object',
'properties': {
'dateDeb': {
'description': 'Date de début',
'type': 'string',
'pattern': '^[0-9]{4}-[0-9]{2}-[0-9]{2}$',
},
'dateFin': {
'description': 'Date de fin',
'type': 'string',
'pattern': '^[0-9]{4}-[0-9]{2}-[0-9]{2}$',
},
'allergieAlimentaire': {
'description': 'Allergie alimentaire',
'oneOf': BOOLEAN_TYPES + [{'type': 'null'}],
},
'allergieRespiratoire': {
'description': 'Allergie respiratoire',
'oneOf': BOOLEAN_TYPES + [{'type': 'null'}],
},
'allergieAutre': {
'description': 'Allergie autre',
'oneOf': BOOLEAN_TYPES + [{'type': 'null'}],
},
'allergieMedicament': {
'description': 'Allergie médicament',
'oneOf': BOOLEAN_TYPES + [{'type': 'null'}],
},
'asthme': {
'description': 'Asthmatique',
'oneOf': BOOLEAN_TYPES + [{'type': 'null'}],
},
'flPAI': {
'description': 'PAI',
'oneOf': BOOLEAN_TYPES + [{'type': 'null'}],
},
'flImage': {
'description': 'Autorisation photo',
'oneOf': BOOLEAN_TYPES + [{'type': 'null'}],
},
'dtcPrap1': {
'description': 'Date du dernier rappel DT Polio',
'type': 'string',
'pattern': '^([0-9]{4}-[0-9]{2}-[0-9]{2}){0,1}$',
},
'obsMed1': {
'description': 'Observation médecin 1',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
'obsMed2': {
'description': 'Observation médecin 2',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
'obsMed3': {
'description': 'Observation médecin 3',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
'obsDir1': {
'description': 'Observation directeur 1',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
'obsDir2': {
'description': 'Observation directeur 2',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
'obsDir3': {
'description': 'Observation directeur 3',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
'obsAssist1': {
'description': 'Observation assistant sanitaire 1',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
'obsAssist2': {
'description': 'Observation assistant sanitaire 2',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
'obsAssist3': {
'description': 'Observation assistant sanitaire 3',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
'cons1Med': {
'description': 'Conseil médecin 1',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
'cons2Med': {
'description': 'Conseil médecin 2',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
},
'additionalProperties': False,
}
DOCTORADDRESS_SCHEMA = {
'$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'Doctor address',
@ -387,14 +400,11 @@ VACCIN_SCHEMA = {
'title': 'Vaccin',
'description': "Informations sur le vaccin",
'type': 'object',
'required': ['code', 'vaccinationDate'],
'properties': {
'code': {
'description': 'Code du vaccin (depuis référentiel)',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
'label': {
'description': 'Nom du vaccin',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
'type': 'string',
},
'vaccinationDate': {
'description': 'Date du vaccin',
@ -413,6 +423,38 @@ MEDICALRECORD_SCHEMA = {
'type': 'object',
'properties': {
'familyDoctor': FAMILYDOCTOR_SCHEMA,
'allergy1': {
'description': 'Allergie 1',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
'allergy2': {
'description': 'Allergie 2',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
'comment1': {
'description': 'Commentaire 1',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
'comment2': {
'description': 'Commentaire 2',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
'observ1': {
'description': 'Observation 1',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
'observ2': {
'description': 'Observation 2',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
'isAuthHospital': {
'description': "Autorisation d'hospitalisation",
'oneOf': BOOLEAN_TYPES,
},
'hospital': {
'description': 'Hopital',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
'vaccinList': {
'oneOf': [
{
@ -465,18 +507,18 @@ CHILD_SCHEMA = {
'title': 'Child',
'description': "Informations sur la création d'un enfant",
'type': 'object',
'required': ['sexe', 'firstname', 'lastname'],
'oneOf': [
{'required': ['dateBirth']}, # createFamily
{'required': ['birth']}, # updateFamily
],
'required': ['sexe', 'firstname', 'lastname', 'birth'],
'properties': {
'num': {
'description': "Numéro de l'enfant",
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
'sexe': {
'description': 'Sexe (depuis référentiel)',
'type': 'string',
'pattern': '.+',
},
'birth': CHILDBIRTH_SCHEMA,
'birth': BIRTH_SCHEMA,
'dietcode': {
'description': 'Code de régime alimentaire (depuis référentiel)',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
@ -489,89 +531,31 @@ CHILD_SCHEMA = {
'description': 'Autorisation à partir seul',
'oneOf': BOOLEAN_TYPES,
},
'fsl': {'oneOf': [FSL_SCHEMA, {'type': 'null'}]},
'medicalRecord': {'oneOf': [MEDICALRECORD_SCHEMA, {'type': 'null'}]},
'paiInfoBean': {'oneOf': [PAIINFO_SCHEMA, {'type': 'null'}]},
},
'additionalProperties': False,
}
CHILD_SCHEMA['properties'].update(ID_PROPERTIES)
CONTACTLIGHT_SCHEMA = {
'$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'Contact light',
'description': "Informations de contact pour les personnes autorisées à récupérer les enfants ou à prévenir en cas d'urgence",
'type': 'object',
'properties': {
'phone': {
'description': 'Téléphone',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
'mobile': {
'description': 'Portable',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
'mail': {
'description': 'Mail',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
},
}
FAMILYPERSON_SCHEMA = {
'$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'Family person',
'description': "Informations sur les personnes autorisées à venir chercher les enfants ou à prévenir en cas d'urgence",
'type': 'object',
'required': ['firstname', 'lastname', 'dateBirth', 'quality'],
'properties': {
'civility': {
'description': 'civilité (depuis référentiel)',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
'quality': {
'description': 'Qualité',
'type': 'string',
'pattern': '.+',
},
'sexe': {
'description': 'Sexe (depuis référentiel)',
'oneOf': [{'type': 'string'}, {'type': 'null'}],
},
'contact': {'oneOf': [CONTACTLIGHT_SCHEMA, {'type': 'null'}]},
},
'unflatten': True,
'additionalProperties': False,
}
FAMILYPERSON_SCHEMA['properties'].update(ID_PROPERTIES)
AUTHORIZEDPERSON_SCHEMA = {
'$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'Family persons',
'description': "Informations sur les personnes autorisées à venir chercher les enfants ou à prévenir en cas d'urgence",
'type': 'object',
'properties': {
'personList': {
'authorizedPersonList': {
'oneOf': [
{
'type': 'array',
'items': FAMILYPERSON_SCHEMA,
'items': AUTHORIZED_PERSON_SCHEMA,
},
{'type': 'null'},
],
},
},
'additionalProperties': False,
}
CHILD_SCHEMA['properties'].update(ID_PROPERTIES)
UPDATE_FAMILY_SCHEMA = {
'$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'Family',
'description': 'Informations pour créer ou mettre à jour une famille',
'type': 'object',
'required': ['categorie', 'situation'],
'required': ['category', 'situation'],
'properties': {
'categorie': {
'description': 'Categorie (depuis référentiel)',
'category': {
'description': 'Catégorie (depuis référentiel)',
'type': 'string',
'pattern': '.+',
},
@ -598,20 +582,11 @@ UPDATE_FAMILY_SCHEMA = {
},
'rl1': RLINFO_SCHEMA,
'rl2': RLINFO_SCHEMA,
'authorizedPersonList': {
'oneOf': [
{
'type': 'array',
'items': AUTHORIZEDPERSON_SCHEMA,
},
{'type': 'null'},
],
},
'emergencyPersonList': {
'oneOf': [
{
'type': 'array',
'items': AUTHORIZEDPERSON_SCHEMA,
'items': EMERGENCY_PERSON_SCHEMA,
},
{'type': 'null'},
],
@ -631,16 +606,10 @@ UPDATE_FAMILY_SCHEMA = {
}
CREATE_FAMILY_SCHEMA = copy.deepcopy(UPDATE_FAMILY_SCHEMA)
CREATE_FAMILY_SCHEMA['required'] = ['rl1', 'categorie', 'situation']
create_family_child_schema = CREATE_FAMILY_SCHEMA['properties']['childList']['oneOf'][0]['items']
del create_family_child_schema['properties']['fsl']
del create_family_child_schema['properties']['bPhoto']
del create_family_child_schema['properties']['bLeaveAlone']
del create_family_child_schema['properties']['paiInfoBean']
CREATE_FAMILY_SCHEMA['required'] = ['rl1', 'category', 'situation']
CREATE_RL1_SCHEMA = copy.deepcopy(CREATE_FAMILY_SCHEMA)
del CREATE_RL1_SCHEMA['properties']['rl2']
del CREATE_RL1_SCHEMA['properties']['authorizedPersonList']
del CREATE_RL1_SCHEMA['properties']['emergencyPersonList']
del CREATE_RL1_SCHEMA['properties']['childList']
del CREATE_RL1_SCHEMA['properties']['rl1']['properties']['contact']
@ -648,7 +617,7 @@ del CREATE_RL1_SCHEMA['properties']['rl1']['properties']['profession']
del CREATE_RL1_SCHEMA['properties']['rl1']['properties']['CAFInfo']
UPDATE_RL1_SCHEMA = copy.deepcopy(RLINFO_SCHEMA)
UPDATE_RL1_SCHEMA['required'] = ['firstname', 'lastname', 'civility', 'quality', 'dateBirth']
UPDATE_RL1_SCHEMA['required'] = ['firstname', 'lastname', 'civility', 'quality', 'birth']
del UPDATE_RL1_SCHEMA['properties']['adresse']
del UPDATE_RL1_SCHEMA['properties']['contact']
del UPDATE_RL1_SCHEMA['properties']['profession']
@ -665,9 +634,9 @@ UPDATE_RL2_SCHEMA = copy.deepcopy(UPDATE_RL1_SCHEMA)
CREATE_CHILD_SCHEMA = copy.deepcopy(CHILD_SCHEMA)
CREATE_CHILD_SCHEMA['unflatten'] = True
del CREATE_CHILD_SCHEMA['properties']['dietcode']
del CREATE_CHILD_SCHEMA['properties']['fsl']
del CREATE_CHILD_SCHEMA['properties']['medicalRecord']
del CREATE_CHILD_SCHEMA['properties']['paiInfoBean']
del CREATE_CHILD_SCHEMA['properties']['authorizedPersonList']
UPDATE_CHILD_SCHEMA = copy.deepcopy(CREATE_CHILD_SCHEMA)
@ -686,35 +655,3 @@ UPDATE_COORDINATE_SCHEMA = {
'unflatten': True,
'additionalProperties': False,
}
CHILDPERSON_SCHEMA = copy.deepcopy(FAMILYPERSON_SCHEMA)
CHILDPERSON_SCHEMA['required'] = ['firstname', 'lastname', 'dateBirth']
del CHILDPERSON_SCHEMA['properties']['quality']
PERSONQUALITY_SCHEMA = {
'$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'Child person quality',
'description': "Informations sur la qualité des personnes autorisées à venir chercher l'enfant",
'type': 'object',
'required': ['code'],
'properties': {
'code': {
'description': 'Le code (depuis référentiel)',
'type': 'string',
'pattern': '.+',
},
},
}
CHILDPERSON2_SCHEMA = {
'$schema': 'http://json-schema.org/draft-04/schema#',
'title': 'Family persons',
'description': "Informations sur les personnes autorisées à venir chercher l'enfant avec leur qualité",
'type': 'object',
'required': ['personInfo', 'personQuality'],
'properties': {
'personInfo': CHILDPERSON_SCHEMA,
'personQuality': PERSONQUALITY_SCHEMA,
},
'unflatten': True,
}

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Passerelle 0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-11-03 16:06-0500\n"
"POT-Creation-Date: 2022-11-28 15:13+0100\n"
"PO-Revision-Date: 2022-11-03 22:06+0100\n"
"Last-Translator: Frederic Peters <fpeters@entrouvert.com>\n"
"Language: fr\n"
@ -2390,20 +2390,25 @@ msgid "FranceConnect scopes"
msgstr "Domaines (« scopes ») pour FranceConnect"
#: apps/franceconnect_data/models.py
msgid "api.impots.gouv.fr username"
msgstr "identifiant pour api.impots.gouv.fr"
msgid "DGFIP API base URL"
msgstr "URL de base de lAPI"
#: apps/franceconnect_data/models.py
msgid "api.impots.gouv.fr password"
msgstr "mot de passe pour api.impots.gouv.fr"
msgid "DGFIP API Username"
msgstr "Identifiant pour lAPI DGFIP"
#: apps/franceconnect_data/models.py
msgid "api.impots.gouv.fr scopes"
msgstr "Domaines (« scopes ») pour api.impots.gouv.fr"
msgid "DGFIP API Password"
msgstr "Mot de passe pour lAPI DGFIP"
#: apps/franceconnect_data/models.py
msgid "api.impots.gouv.fr ID_Teleservice"
msgstr "ID_Teleservice pour api.impots.gouv.fr"
msgid "DGFIP API Scopes"
msgstr "Scopes de lAPI DGFIP"
#: apps/franceconnect_data/models.py
msgid "DGFIP API ID_Teleservice"
msgstr "ID_Teleservice pour lAPI DGFIP"
#: apps/franceconnect_data/models.py
msgid "Data sources through FranceConnect"

View File

@ -1051,7 +1051,7 @@
</wsdl:message>
<wsdl:portType name="ActivityService">
<wsdl:operation name="updateChildUnitBasket">
<wsdl:documentation> Méthode de mise à jour de la quantité d'une ligne du panier </wsdl:documentation>
<wsdl:documentation>Met à jour la quantité d'une ligne du panier</wsdl:documentation>
<wsdl:input message="tns:updateChildUnitBasket" name="updateChildUnitBasket">
</wsdl:input>
<wsdl:output message="tns:updateChildUnitBasketResponse" name="updateChildUnitBasketResponse">
@ -1060,7 +1060,7 @@
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="getPersonScheduleList">
<wsdl:documentation> Méthode de récuperation des calendriers d'une personne</wsdl:documentation>
<wsdl:documentation>Renvoie les calendriers d'une personne</wsdl:documentation>
<wsdl:input message="tns:getPersonScheduleList" name="getPersonScheduleList">
</wsdl:input>
<wsdl:output message="tns:getPersonScheduleListResponse" name="getPersonScheduleListResponse">
@ -1069,7 +1069,7 @@
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="getNbAvailablePlacesPortalOther">
<wsdl:documentation> Méthode qui renvoie le nombre d'inscriptions disponibles autres que PORTAL (en fonction d'une inscription à faire)
<wsdl:documentation>Renvoie le nombre d'inscriptions disponibles autres que PORTAL (en fonction d'une inscription à faire)
----------------------
idPers la personne (pour quota filles/garçons)
@ -1080,10 +1080,10 @@
date de fin période d'inscription
le total trouvé :
-1 si plus de place et l'inscription doit être refusée,
0 si plus de place et l'inscription doit être mise en attente
NA si pas de controle
NN est le nombre de places disponibles </wsdl:documentation>
-1 si plus de place et l'inscription doit être refusée,
0 si plus de place et l'inscription doit être mise en attente
NA si pas de controle
NN est le nombre de places disponibles </wsdl:documentation>
<wsdl:input message="tns:getNbAvailablePlacesPortalOther" name="getNbAvailablePlacesPortalOther">
</wsdl:input>
<wsdl:output message="tns:getNbAvailablePlacesPortalOtherResponse" name="getNbAvailablePlacesPortalOtherResponse">
@ -1092,7 +1092,7 @@
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="closeSubscribe">
<wsdl:documentation> Méthode de fermeture des calendriers d'une inscription
<wsdl:documentation>Ferme le calendrier d'une inscription
----------------------
idSubscribe : identifiant de l'inscription (obligatoire)
@ -1107,7 +1107,7 @@
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="getFamilyChilds">
<wsdl:documentation> Méthode de recherche des enfants de la famille avec leurs inscriptions
<wsdl:documentation>Renvoie les enfants de la famille avec leurs inscriptions
La liste est composée des enfants de la famille (y compris les enfants en garde alternée)
avec, pour chaque enfant, un second niveau composé de la liste de ses inscriptions existantes </wsdl:documentation>
<wsdl:input message="tns:getFamilyChilds" name="getFamilyChilds">
@ -1118,9 +1118,9 @@
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="validateBasket">
<wsdl:documentation> Méthode qui validation le panier
<wsdl:documentation>Valide le panier
Renvoi une liste d'identifiant de factures ainsi que la liste des identifiants d'inscription.
Renvoi les paramétres de l'url de paiement. </wsdl:documentation>
Renvoi les paramètres de l'URL de paiement.</wsdl:documentation>
<wsdl:input message="tns:validateBasket" name="validateBasket">
</wsdl:input>
<wsdl:output message="tns:validateBasketResponse" name="validateBasketResponse">
@ -1129,7 +1129,7 @@
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="deleteBasket">
<wsdl:documentation> Méthode qui supprime le panier </wsdl:documentation>
<wsdl:documentation>Supprime le panier</wsdl:documentation>
<wsdl:input message="tns:deleteBasket" name="deleteBasket">
</wsdl:input>
<wsdl:output message="tns:deleteBasketResponse" name="deleteBasketResponse">
@ -1138,7 +1138,7 @@
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="getFamilyBasket">
<wsdl:documentation> Méthode qui renvoie le panier de la famille pour un utilisateur </wsdl:documentation>
<wsdl:documentation>Renvoie le panier de la famille pour un utilisateur</wsdl:documentation>
<wsdl:input message="tns:getFamilyBasket" name="getFamilyBasket">
</wsdl:input>
<wsdl:output message="tns:getFamilyBasketResponse" name="getFamilyBasketResponse">
@ -1147,7 +1147,7 @@
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="addChildUnitLstWait">
<wsdl:documentation> Méthode qui permet d'ajouter au panier une inscription en liste d'attente d'un enfant à une activité du catalogue </wsdl:documentation>
<wsdl:documentation>Ajoute au panier une inscription en liste d'attente d'un enfant à une activité du catalogue</wsdl:documentation>
<wsdl:input message="tns:addChildUnitLstWait" name="addChildUnitLstWait">
</wsdl:input>
<wsdl:output message="tns:addChildUnitLstWaitResponse" name="addChildUnitLstWaitResponse">
@ -1156,7 +1156,7 @@
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="getPersonUnitInfo">
<wsdl:documentation> Méthode qui renvoie les informations d'inscription d'un enfant à une activité du catalogue </wsdl:documentation>
<wsdl:documentation>Renvoie les informations d'inscription d'un enfant à une activité du catalogue </wsdl:documentation>
<wsdl:input message="tns:getPersonUnitInfo" name="getPersonUnitInfo">
</wsdl:input>
<wsdl:output message="tns:getPersonUnitInfoResponse" name="getPersonUnitInfoResponse">
@ -1165,7 +1165,7 @@
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="updateBasketTime">
<wsdl:documentation> Méthode qui prolonge la durée de vie du panier de son délai</wsdl:documentation>
<wsdl:documentation>Prolonge la durée de vie du panier de son délai</wsdl:documentation>
<wsdl:input message="tns:updateBasketTime" name="updateBasketTime">
</wsdl:input>
<wsdl:output message="tns:updateBasketTimeResponse" name="updateBasketTimeResponse">
@ -1174,7 +1174,7 @@
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="getUnitByActivity">
<wsdl:documentation> Méthode qui renvoie les unités de l'activité indiquée </wsdl:documentation>
<wsdl:documentation>Renvoie les unités de l'activité indiquée</wsdl:documentation>
<wsdl:input message="tns:getUnitByActivity" name="getUnitByActivity">
</wsdl:input>
<wsdl:output message="tns:getUnitByActivityResponse" name="getUnitByActivityResponse">
@ -1183,7 +1183,7 @@
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="getSelectionCriteriaForFamilyList">
<wsdl:documentation> Méthode de recherche des natures d'activités pour le profil portail </wsdl:documentation>
<wsdl:documentation>Renvoie les natures d'activités pour le profil portail </wsdl:documentation>
<wsdl:input message="tns:getSelectionCriteriaForFamilyList" name="getSelectionCriteriaForFamilyList">
</wsdl:input>
<wsdl:output message="tns:getSelectionCriteriaForFamilyListResponse" name="getSelectionCriteriaForFamilyListResponse">
@ -1192,10 +1192,10 @@
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="isWSRunning">
<wsdl:documentation>Méthode pour vérifier si le webservice est OK
<wsdl:documentation>Vérifie si le webservice est OK
-------------------------
Retourne vrai ou faux </wsdl:documentation>
Retourne vrai ou faux</wsdl:documentation>
<wsdl:input message="tns:isWSRunning" name="isWSRunning">
</wsdl:input>
<wsdl:output message="tns:isWSRunningResponse" name="isWSRunningResponse">
@ -1204,7 +1204,7 @@
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="addChildUnitBasket">
<wsdl:documentation> Méthode qui permet d'ajouter au panier une inscription d'un enfant à une activité du catalogue </wsdl:documentation>
<wsdl:documentation>Ajoute au panier une inscription d'un enfant à une activité du catalogue</wsdl:documentation>
<wsdl:input message="tns:addChildUnitBasket" name="addChildUnitBasket">
</wsdl:input>
<wsdl:output message="tns:addChildUnitBasketResponse" name="addChildUnitBasketResponse">
@ -1213,7 +1213,7 @@
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="updatePersonSchedule">
<wsdl:documentation> Méthode de mise à jour du calendrier d'une personne
<wsdl:documentation>Met à jour le calendrier d'une personne
----------------------
action possible :
@ -1232,7 +1232,7 @@
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="updateWeekCalendar">
<wsdl:documentation> Méthode de mise à jour du calendrier hebdomadaire
<wsdl:documentation>Met à jour le calendrier hebdomadaire d'une personne, par rapport à une activité
----------------------
idActivity : identifiant de l'activité
@ -1257,7 +1257,7 @@
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="deleteChildUnitBasket">
<wsdl:documentation> Méthode qui supprime une ligne du panier</wsdl:documentation>
<wsdl:documentation>Supprime une ligne du panier</wsdl:documentation>
<wsdl:input message="tns:deleteChildUnitBasket" name="deleteChildUnitBasket">
</wsdl:input>
<wsdl:output message="tns:deleteChildUnitBasketResponse" name="deleteChildUnitBasketResponse">
@ -1266,7 +1266,7 @@
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="getFamilyList">
<wsdl:documentation> Méthode de recherche des familles
<wsdl:documentation>Renvoie la liste des familles correspondant aux critères indiqués
Les critères disponibles sont les suivants :
- Numéro de famille
- Nom du RL1
@ -1293,7 +1293,7 @@
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="getPersonCatalogueActivity">
<wsdl:documentation> Méthode qui renvoie le catalogue des activités d'un enfant de la famille </wsdl:documentation>
<wsdl:documentation>Renvoie le catalogue des activités d'un enfant de la famille</wsdl:documentation>
<wsdl:input message="tns:getPersonCatalogueActivity" name="getPersonCatalogueActivity">
</wsdl:input>
<wsdl:output message="tns:getPersonCatalogueActivityResponse" name="getPersonCatalogueActivityResponse">

File diff suppressed because it is too large Load Diff

View File

@ -10,14 +10,18 @@
</soap-env:Header>
<soap-env:Body>
<ns0:createFamily xmlns:ns0="family.ws.maelis.sigec.com">
<categorie>ACCEUI</categorie>
<category>ACCEUI</category>
<situation>C</situation>
<rl1>
<lastname>Doe</lastname>
<firstname>Jhon</firstname>
<lastname>Doe</lastname>
<quality>AU</quality>
<civility>M.</civility>
<dateBirth>1938-07-26</dateBirth>
<birth>
<dateBirth>1938-07-26</dateBirth>
<place>Rabbat</place>
<countryCode>99350</countryCode>
</birth>
<adresse>
<numComp>B</numComp>
<street1>Chateau</street1>
@ -32,14 +36,20 @@
</CAFInfo>
</rl1>
<childList>
<sexe>M</sexe>
<lastname>Zimmerman</lastname>
<firstname>Robert</firstname>
<dateBirth>1941-05-24</dateBirth>
<lastname>Zimmerman</lastname>
<sexe>M</sexe>
<birth>
<dateBirth>1941-05-24</dateBirth>
<place>Saint-louis</place>
<communeCode>91122</communeCode>
<countryCode>99100</countryCode>
</birth>
<dietcode>RSV</dietcode>
<medicalRecord>
<vaccinList>
<code>DTC</code>
<vaccinationDate>1940-07-26</vaccinationDate>
</vaccinList>
</medicalRecord>
</childList>

View File

@ -11,7 +11,7 @@
<soap-env:Body>
<ns0:updateFamily xmlns:ns0="family.ws.maelis.sigec.com">
<dossierNumber>1312</dossierNumber>
<categorie>BI</categorie>
<category>BI</category>
<situation>M</situation>
<flagCom>true</flagCom>
<nbChild>2</nbChild>

View File

@ -10,14 +10,16 @@
</soap-env:Header>
<soap-env:Body>
<ns0:createFamily xmlns:ns0="family.ws.maelis.sigec.com">
<categorie>ACCEUI</categorie>
<category>ACCEUI</category>
<situation>C</situation>
<rl1>
<lastname>Doe</lastname>
<firstname>Jhon</firstname>
<lastname>Doe</lastname>
<quality>AU</quality>
<civility>M.</civility>
<dateBirth>1938-07-26</dateBirth>
<birth>
<dateBirth>1938-07-26</dateBirth>
</birth>
<adresse>
<street1>Chateau</street1>
<town>Paris</town>

View File

@ -10,16 +10,19 @@
<soap-env:Body>
<ns0:updateFamily xmlns:ns0="family.ws.maelis.sigec.com">
<dossierNumber>1312</dossierNumber>
<categorie>BI</categorie>
<category>BI</category>
<situation>M</situation>
<flagCom>true</flagCom>
<nbChild>2</nbChild>
<rl2>
<lastname>DOE</lastname>
<firstname>JANE</firstname>
<lastname>DOE</lastname>
<maidenName>Smith</maidenName>
<quality>MERE</quality>
<civility>MME</civility>
<dateBirth>1940-06-22</dateBirth>
<birth>
<dateBirth>1940-06-22</dateBirth>
</birth>
<adresse>
<num>170</num>
<street1>Chateau d'eau</street1>

View File

@ -11,7 +11,7 @@
<soap-env:Body>
<ns0:updateFamily xmlns:ns0="family.ws.maelis.sigec.com">
<dossierNumber>1312</dossierNumber>
<categorie>BI</categorie>
<category>BI</category>
<situation>M</situation>
<flagCom>true</flagCom>
<nbChild>2</nbChild>

View File

@ -10,14 +10,14 @@
<soap-env:Body>
<ns0:updateFamily xmlns:ns0="family.ws.maelis.sigec.com">
<dossierNumber>1312</dossierNumber>
<categorie>BI</categorie>
<category>BI</category>
<situation>M</situation>
<flagCom>true</flagCom>
<nbChild>2</nbChild>
<childList>
<num>613880</num>
<lastname>DOE</lastname>
<firstname>JANNIS</firstname>
<lastname>DOE</lastname>
<sexe>F</sexe>
<birth>
<dateBirth>1943-01-19</dateBirth>
@ -25,6 +25,25 @@
</birth>
<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>
</childList>
</ns0:updateFamily>
</soap-env:Body>

View File

@ -1,38 +0,0 @@
<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:createOrUpdateFSL xmlns:ns0="family.ws.maelis.sigec.com">
<arg0>613878</arg0>
<arg1>
<dateDeb>2022-01-01</dateDeb>
<dateFin>2022-12-31</dateFin>
<allergieAlimentaire>O</allergieAlimentaire>
<allergieRespiratoire>O</allergieRespiratoire>
<allergieAutre>O</allergieAutre>
<allergieMedicament>O</allergieMedicament>
<asthme>N</asthme>
<flPAI>N</flPAI>
<flImage>N</flImage>
<dtcPrap1>2022-02-22</dtcPrap1>
<obsMed1>some obsMed1 text</obsMed1>
<obsMed2>some obsMed2 text</obsMed2>
<obsMed3>some obsMed3 text</obsMed3>
<obsDir1>some obsDir1 text</obsDir1>
<obsDir2>some obsDir2 text</obsDir2>
<obsDir3>some obsDir3 text</obsDir3>
<obsAssist1>some obsAssist1 text</obsAssist1>
<obsAssist2>some obsAssist2 text</obsAssist2>
<obsAssist3>some obsAssist3 text</obsAssist3>
<cons1Med>some cons1Med text</cons1Med>
<cons2Med>some cons2Med text</cons2Med>
</arg1>
</ns0:createOrUpdateFSL>
</soap-env:Body>
</soap-env:Envelope>

View File

@ -21,6 +21,14 @@
<town>Compton</town>
</address>
</familyDoctor>
<allergy1>butterscotch, imitation butterscotch, glow-in-the-dark monster make-up, and shrimp</allergy1>
<allergy2>cauliflower</allergy2>
<comment1>the shrimp allergy isn't fully identified</comment1>
<comment2/>
<observ1>Ay Caramba!</observ1>
<observ2/>
<isAuthHospital>true</isAuthHospital>
<hospital>Springfield General Hospital</hospital>
<vaccinList>
<code>DTC</code>
<vaccinationDate>2011-01-11</vaccinationDate>

View File

@ -11,14 +11,19 @@
<soap-env:Body>
<ns0:updateFamily xmlns:ns0="family.ws.maelis.sigec.com">
<dossierNumber>1312</dossierNumber>
<categorie>BI</categorie>
<category>BI</category>
<situation>C</situation>
<rl1>
<lastname>Doe</lastname>
<firstname>Jhon</firstname>
<lastname>Doe</lastname>
<quality>AU</quality>
<civility>M.</civility>
<dateBirth>1938-07-26</dateBirth>
<birth>
<dateBirth>1938-07-26</dateBirth>
<place>Rabbat</place>
<communeCode/>
<countryCode>99350</countryCode>
</birth>
<adresse>
<numComp>B</numComp>
<street1>Chateau</street1>
@ -33,8 +38,8 @@
</CAFInfo>
</rl1>
<childList>
<lastname>Zimmerman</lastname>
<firstname>Robert</firstname>
<lastname>Zimmerman</lastname>
<sexe>M</sexe>
<birth>
<dateBirth>1941-05-24</dateBirth>
@ -44,12 +49,22 @@
<medicalRecord>
<vaccinList>
<code>DTC</code>
<vaccinationDate>1940-07-26</vaccinationDate>
</vaccinList>
</medicalRecord>
<paiInfoBean>
<code>PAIALI</code>
</paiInfoBean>
</childList>
<childList>
<num>613880</num>
<firstname>Brunelle</firstname>
<lastname>Doe</lastname>
<sexe>F</sexe>
<birth>
<dateBirth>1943-01-19</dateBirth>
</birth>
</childList>
<emergencyPersonList>
<personList>
<civility>MME</civility>

View File

@ -11,7 +11,7 @@
<soap-env:Body>
<ns0:updateFamily xmlns:ns0="family.ws.maelis.sigec.com">
<dossierNumber>1312</dossierNumber>
<categorie>BI</categorie>
<category>BI</category>
<situation>M</situation>
<flagCom>true</flagCom>
<nbChild>2</nbChild>

View File

@ -11,17 +11,18 @@
<soap-env:Body>
<ns0:updateFamily xmlns:ns0="family.ws.maelis.sigec.com">
<dossierNumber>1312</dossierNumber>
<categorie>BI</categorie>
<category>BI</category>
<situation>M</situation>
<flagCom>true</flagCom>
<nbChild>2</nbChild>
<rl1>
<num>613878</num>
<lastname>Doe</lastname>
<firstname>Jhonny</firstname>
<lastname>Doe</lastname>
<quality>PERE</quality>
<civility>M.</civility>
<dateBirth>1943-06-15</dateBirth>
<birth>
<dateBirth>1943-06-15</dateBirth>
</birth>
<adresse>
<num>170</num>
<street1>Chateau d'eau</street1>

View File

@ -10,17 +10,19 @@
<soap-env:Body>
<ns0:updateFamily xmlns:ns0="family.ws.maelis.sigec.com">
<dossierNumber>1312</dossierNumber>
<categorie>BI</categorie>
<category>BI</category>
<situation>M</situation>
<flagCom>true</flagCom>
<nbChild>2</nbChild>
<rl2>
<num>613879</num>
<lastname>DOE</lastname>
<firstname>JANE</firstname>
<lastname>DOE</lastname>
<maidenName>Smith</maidenName>
<quality>MERE</quality>
<civility>MME</civility>
<dateBirth>1940-06-22</dateBirth>
<birth>
<dateBirth>1940-06-22</dateBirth>
</birth>
<adresse>
<num>170</num>
<street1>Chateau d'eau</street1>

View File

@ -13,7 +13,11 @@
<firstname>JHON</firstname>
<quality>PERE</quality>
<civility>M.</civility>
<dateBirth>1938-07-26T00:00:00+01:00</dateBirth>
<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>
@ -37,9 +41,14 @@
<num>613879</num>
<lastname>DOE</lastname>
<firstname>JANE</firstname>
<maidenName>SMITH</maidenName>
<quality>MERE</quality>
<civility>MME</civility>
<dateBirth>1940-06-22T00:00:00+02:00</dateBirth>
<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>
@ -78,16 +87,6 @@
<mail>pueblo@example.org</mail>
</contact>
</emergencyPersonList>
<authorizedPersonList>
<numPerson>614121</numPerson>
<firstname>CATHY</firstname>
<lastname>PALENNE</lastname>
<dateBirth>1975-06-28T00:00:00+01:00</dateBirth>
<quality>O</quality>
<contact>
<mobile>0623456789</mobile>
</contact>
</authorizedPersonList>
<childList>
<num>613880</num>
<lastname>DOE</lastname>
@ -95,31 +94,11 @@
<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>
<fsl>
<dateDeb>2022-01-01T00:00:00+01:00</dateDeb>
<dateFin>2022-12-31T00:00:00+01:00</dateFin>
<allergieAlimentaire>O</allergieAlimentaire>
<allergieRespiratoire>O</allergieRespiratoire>
<allergieAutre>O</allergieAutre>
<allergieMedicament>O</allergieMedicament>
<asthme>N</asthme>
<flPAI>N</flPAI>
<flImage>N</flImage>
<dtcPrap1>2022-02-22T00:00:00+01:00</dtcPrap1>
<obsMed1>some obsMed1 text</obsMed1>
<obsMed2>some obsMed2 text</obsMed2>
<obsMed3>some obsMed3 text</obsMed3>
<obsDir1>some obsDir1 text</obsDir1>
<obsDir2>some obsDir2 text</obsDir2>
<obsDir3>some obsDir3 text</obsDir3>
<obsAssist1>some obsAssist1 text</obsAssist1>
<obsAssist2>some obsAssist2 text</obsAssist2>
<obsAssist3>some obsAssist3 text</obsAssist3>
<cons1Med>some cons1Med text</cons1Med>
<cons2Med>some cons2Med text</cons2Med>
</fsl>
<bPhoto>true</bPhoto>
<bLeaveAlone>false</bLeaveAlone>
<authorizedPersonList>
@ -151,6 +130,13 @@
<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>

View File

@ -13,7 +13,11 @@
<firstname>JHON</firstname>
<quality>PERE</quality>
<civility>M.</civility>
<dateBirth>1938-07-26T00:00:00+01:00</dateBirth>
<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>
@ -38,7 +42,11 @@
<lastname>DOE</lastname>
<firstname>JANE</firstname>
<civility>MME</civility>
<dateBirth>1940-06-22T00:00:00+02:00</dateBirth>
<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>
@ -77,16 +85,6 @@
<mail>pueblo@example.org</mail>
</contact>
</emergencyPersonList>
<authorizedPersonList>
<numPerson>614121</numPerson>
<firstname>CATHY</firstname>
<lastname>PALENNE</lastname>
<dateBirth>1975-06-28T00:00:00+01:00</dateBirth>
<quality>O</quality>
<contact>
<mobile>0623456789</mobile>
</contact>
</authorizedPersonList>
<childList>
<num>613880</num>
<lastname>DOE</lastname>
@ -94,31 +92,11 @@
<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>
<fsl>
<dateDeb>2022-01-01T00:00:00+01:00</dateDeb>
<dateFin>2022-12-31T00:00:00+01:00</dateFin>
<allergieAlimentaire>O</allergieAlimentaire>
<allergieRespiratoire>O</allergieRespiratoire>
<allergieAutre>O</allergieAutre>
<allergieMedicament>O</allergieMedicament>
<asthme>N</asthme>
<flPAI>N</flPAI>
<flImage>N</flImage>
<dtcPrap1>2022-02-22T00:00:00+01:00</dtcPrap1>
<obsMed1>some obsMed1 text</obsMed1>
<obsMed2>some obsMed2 text</obsMed2>
<obsMed3>some obsMed3 text</obsMed3>
<obsDir1>some obsDir1 text</obsDir1>
<obsDir2>some obsDir2 text</obsDir2>
<obsDir3>some obsDir3 text</obsDir3>
<obsAssist1>some obsAssist1 text</obsAssist1>
<obsAssist2>some obsAssist2 text</obsAssist2>
<obsAssist3>some obsAssist3 text</obsAssist3>
<cons1Med>some cons1Med text</cons1Med>
<cons2Med>some cons2Med text</cons2Med>
</fsl>
<bPhoto>true</bPhoto>
<bLeaveAlone>false</bLeaveAlone>
<authorizedPersonList>
@ -150,6 +128,13 @@
<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>

View File

@ -13,7 +13,11 @@
<firstname>JHON</firstname>
<quality>PERE</quality>
<civility>M.</civility>
<dateBirth>1938-07-26T00:00:00+01:00</dateBirth>
<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>
@ -39,7 +43,11 @@
<firstname>JANE</firstname>
<quality>MERE</quality>
<civility>MME</civility>
<dateBirth>1940-06-22T00:00:00+02:00</dateBirth>
<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>
@ -78,16 +86,6 @@
<mail>pueblo@example.org</mail>
</contact>
</emergencyPersonList>
<authorizedPersonList>
<numPerson>614121</numPerson>
<firstname>CATHY</firstname>
<lastname>PALENNE</lastname>
<dateBirth>1975-06-28T00:00:00+01:00</dateBirth>
<quality>O</quality>
<contact>
<mobile>0623456789</mobile>
</contact>
</authorizedPersonList>
<childList>
<num>613880</num>
<lastname>DOE</lastname>
@ -95,31 +93,11 @@
<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>
<fsl>
<dateDeb>2022-01-01T00:00:00+01:00</dateDeb>
<dateFin>2022-12-31T00:00:00+01:00</dateFin>
<allergieAlimentaire>O</allergieAlimentaire>
<allergieRespiratoire>O</allergieRespiratoire>
<allergieAutre>O</allergieAutre>
<allergieMedicament>O</allergieMedicament>
<asthme>N</asthme>
<flPAI>N</flPAI>
<flImage>N</flImage>
<dtcPrap1>2022-02-22T00:00:00+01:00</dtcPrap1>
<obsMed1>some obsMed1 text</obsMed1>
<obsMed2>some obsMed2 text</obsMed2>
<obsMed3>some obsMed3 text</obsMed3>
<obsDir1>some obsDir1 text</obsDir1>
<obsDir2>some obsDir2 text</obsDir2>
<obsDir3>some obsDir3 text</obsDir3>
<obsAssist1>some obsAssist1 text</obsAssist1>
<obsAssist2>some obsAssist2 text</obsAssist2>
<obsAssist3>some obsAssist3 text</obsAssist3>
<cons1Med>some cons1Med text</cons1Med>
<cons2Med>some cons2Med text</cons2Med>
</fsl>
<bPhoto>true</bPhoto>
<bLeaveAlone>false</bLeaveAlone>
<authorizedPersonList>
@ -151,6 +129,13 @@
<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>

View File

@ -13,7 +13,11 @@
<firstname>JHON</firstname>
<quality>PERE</quality>
<civility>M.</civility>
<dateBirth>1938-07-26T00:00:00+01:00</dateBirth>
<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>

View File

@ -1,5 +0,0 @@
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<ns2:createOrUpdateFSLResponse xmlns:ns2="family.ws.maelis.sigec.com"/>
</soap:Body>
</soap:Envelope>

View File

@ -12,7 +12,11 @@
<firstname>JHON</firstname>
<quality>AU</quality>
<civility>MR</civility>
<dateBirth>1938-07-26T00:00:00+01:00</dateBirth>
<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>0</num>
@ -32,7 +36,11 @@
<firstname>JANNETTE</firstname>
<quality>MERE</quality>
<civility>MR</civility>
<dateBirth>1940-06-22T00:00:00+02:00</dateBirth>
<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>0</num>

View File

@ -245,3 +245,31 @@ def test_do_treatment_arbitrary_endpoint(app, connector):
assert responses.calls[0].request.params['task'] == 'doTreatment'
response_data = json.loads(responses.calls[0].request.body)
assert response_data == expected_payload
@responses.activate
def test_post_raises_proper_error(app, connector):
url = tests.utils.generic_endpoint_url('esabora', 'do-treatment')
responses.add(
responses.POST,
f'{connector.service_url}addevt/',
json={'foo': 'bar'},
status=400,
)
payload = {
'endpoint': 'addevt',
'treatment_name': 'Import Event',
'Adresse_Latitude': 12.3,
'Adresse_Ville': 'Marseille',
}
expected_response = {
'err': 1,
'err_class': 'passerelle.utils.jsonresponse.APIError',
'data': {'content': {'foo': 'bar'}, 'status_code': 400},
'err_desc': 'Esabora platform "http://example.esabora/ws/rest/" answered with HTTP error',
}
response = app.post_json(url, params=payload)
assert response.json == expected_response

View File

@ -18,11 +18,52 @@ import json
from urllib.parse import parse_qs, urlparse, urlunparse
import pytest
from django.utils.timezone import now
import tests.utils
from passerelle.apps.franceconnect_data.models import Resource
from tests.test_rsa13 import mock_response
CURRENT_YEAR = now().year
USER_INFO_MOCKED_RESPONSES = [
['/api/v1/token', {'access_token': 'at-1234', 'id_token': '.e30=.'}],
[
'/api/v1/userinfo',
{
'sub': 'sub-1234',
'given_name': 'John',
'family_name': 'Doe',
'birthdate': '2001-04-28',
'birthplace': '13055',
'birthcountry': '99100',
'gender': 'male',
},
],
]
DGFIP_MOCKED_RESPONSES = USER_INFO_MOCKED_RESPONSES + [
[
'/token',
{
'access_token': 'eyJ4NXQiOi',
'expires_in': 3600,
'scope': 'RessourceIRDerniere2',
'token_type': 'Bearer',
},
]
]
DGFIP_MOCKED_RESPONSES += [
[
'/impotparticulier/1.0/situations/ir/assiettes/annrev/%s' % year,
{'rfr': 0, 'revenuBrutGlobal': 0},
]
for year in range(CURRENT_YEAR - 3, CURRENT_YEAR)
]
@pytest.fixture
def fc(db):
@ -54,21 +95,7 @@ def test_init_request(app, fc):
}
@mock_response(
['/api/v1/token', {'access_token': 'at-1234', 'id_token': '.e30=.'}],
[
'/api/v1/userinfo',
{
'sub': 'sub-1234',
'given_name': 'John',
'family_name': 'Doe',
'birthdate': '2001-04-28',
'birthplace': '13055',
'birthcountry': '99100',
'gender': 'male',
},
],
)
@mock_response(*USER_INFO_MOCKED_RESPONSES)
def test_callback(app, fc):
resp = app.get(
'http://testserver/franceconnect-data/test/callback?origin=http%3A%2F%2Ftestserver&code=5678&raise=1'
@ -95,6 +122,8 @@ def test_callback(app, fc):
'text': 'John Doe né le April 28, 2001',
}
app.get('/franceconnect-data/test/data_source?id=bad') # no error
@mock_response(
['/api/v1/token', ''],
@ -119,3 +148,20 @@ def test_callback_error(app, fc):
error = json.loads(resp.pyquery('#error').text())
assert error
assert 'Error in token endpoint response' in resp
@mock_response(*DGFIP_MOCKED_RESPONSES)
def test_dgfip_mode(app, fc):
resp = app.get(
'http://testserver/franceconnect-data/test/callback?origin=http%3A%2F%2Ftestserver&code=5678&raise=1&mode=dgfip'
)
data = json.loads(resp.pyquery('#data').text())
assert data
assert 'id' in data
assert data['text'] == 'John Doe né le April 28, 2001'
resp = app.get('/franceconnect-data/test/data_source?mode=dgfip&id=' + data['id'])
data = resp.json['data'][0]
assert data['dgfip_ir']
for year in range(CURRENT_YEAR - 3, CURRENT_YEAR):
assert data['dgfip_ir'][str(year)]

View File

@ -209,6 +209,33 @@ DATA_EXAMPLE = """{
"senscircspecialise" : null,
"senscirculation" : "Double",
"typecirculation" : "générale"
},
{
"bornemaxdroite" : 10,
"bornemaxgauche" : 11,
"bornemindroite" : 2,
"bornemingauche" : 1,
"codefuv" : "21424",
"codeinsee" : "69266",
"codetroncon" : "T54753",
"datecreation" : "1995-07-17 18:43:00+02:00",
"datedomanialite" : null,
"datemajalpha" : "2022-11-14",
"datemajborne" : "2022-07-26",
"datemajgraph" : "2022-07-26",
"denomroutiere" : null,
"domanialite" : "Métropole",
"gestionnaire" : null,
"gid" : 30067,
"importance" : "Petite rue",
"nom" : "Rue de l'Avenir",
"nomcommune" : "Villeurbanne",
"observation" : null,
"particularite" : null,
"referencedomanialite" : null,
"senscircspecialise" : null,
"senscirculation" : "Inverse",
"typecirculation" : "Générale"
}
]
}
@ -238,3 +265,15 @@ def test_daily_none_bornes(app, connector):
connector.daily()
assert StreetSection.objects.get(codetroncon='T5869').bornemindroite == 0
assert StreetSection.objects.get(codetroncon='T5869').bornemaxdroite == 99999
def test_non_uppercase_communes(app, connector):
StreetSection.objects.all().delete()
with HTTMock(data_mock):
connector.daily()
response = app.get(
"/grandlyon-streetsections/gl-streetsections/section_info"
"?streetname=Rue de l'Avenir&commune=Villeurbanne&streetnumber=8"
)
assert response.json['err'] == 0
assert response.json['data']['codetroncon'] == 'T54753'

View File

@ -10,16 +10,12 @@ from passerelle.contrib.tcl.models import Line, Stop, Tcl
LIGNE_BUS = {
"values": [
{
"indice": "",
"last_update_fme": "2017-06-27 06:01:10",
"infos": "",
"couleur": "164 203 38",
"libelle": "Croix Rousse - Plateaux de St Rambert",
"nom_trace": "Croix Rousse - Plateaux de St Rambert",
"last_update": "None",
"code_titan": "2Aa1",
"code_trace": "2Aa1",
"gid": "1003",
"ligne": "2",
"ut": "UTV",
"sens": "Aller",
},
]

View File

@ -71,9 +71,7 @@ UPDATE_FAMILY_500 = FakedResponse(content=get_xml_file('R_update_family_soap_err
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)
UPDATE_FSL = FakedResponse(content=get_xml_file('R_update_child_fsl.xml'), status_code=200)
UPDATE_FSL_500 = FakedResponse(content=get_xml_file('R_update_child_fsl_soap_error.xml'), status_code=500)
UPDATE_MEDICAL = FakedResponse(content=get_xml_file('R_update_child_fsl.xml'), status_code=200)
UPDATE_MEDICAL = FakedResponse(content=get_xml_file('R_update_child_medical_record.xml'), status_code=200)
UPDATE_MEDICAL_500 = FakedResponse(
content=get_xml_file('R_update_child_medical_record_soap_error.xml'), status_code=500
)
@ -565,7 +563,6 @@ def test_read_family(mocked_post, mocked_get, read_family, con, app):
del data['RL1']
del data['RL2']
del data['childList']
del data['authorizedPersonList']
del data['emergencyPersonList']
assert data == {
'number': 1312,
@ -587,9 +584,15 @@ def test_read_family(mocked_post, mocked_get, read_family, con, app):
'num': '613878',
'lastname': 'DOE',
'firstname': 'JHON',
'maidenName': None,
'quality': 'PERE',
'civility': 'M.',
'dateBirth': '1938-07-26T00:00:00+01:00',
'birth': {
'communeCode': None,
'countryCode': '99350',
'dateBirth': '1938-07-26T00:00:00+01:00',
'place': 'Rabbat',
},
'adresse': {
'idStreet': None,
'num': 170,
@ -611,10 +614,10 @@ def test_read_family(mocked_post, mocked_get, read_family, con, app):
'civility_text': 'Monsieur',
'quality_text': 'PERE',
'quotientList': [],
'indicatorList': [],
'subscribeActivityList': [],
}
data = resp.json['data']['childList'][0]
del data['fsl']
del data['medicalRecord']
del data['authorizedPersonList']
del data['paiInfoBean']
@ -624,11 +627,17 @@ def test_read_family(mocked_post, mocked_get, read_family, con, app):
'firstname': 'JANNIS',
'sexe': 'F',
'sexe_text': 'Féminin',
'birth': {'dateBirth': '1943-01-19T00:00:00+01:00', 'place': None},
'birth': {
'dateBirth': '1943-01-19T00:00:00+01:00',
'place': 'Saint-louis',
'communeCode': '91122',
'countryCode': '99100',
},
'dietcode': 'RSV',
'dietcode_text': '3- RÉGIME SANS VIANDE',
'bPhoto': True,
'bLeaveAlone': False,
'insurance': None,
'indicatorList': [],
'subscribeSchoolList': [],
'mother': {'num': 613963, 'civility': 'MME', 'firstname': 'JANE', 'lastname': 'DOE'},
@ -651,35 +660,20 @@ def test_read_family(mocked_post, mocked_get, read_family, con, app):
'dateFin': '2022-12-31T00:00:00+01:00',
'description': 'bla bla PAI',
}
assert resp.json['data']['childList'][0]['fsl'] == {
'dateDeb': '2022-01-01T00:00:00+01:00',
'dateFin': '2022-12-31T00:00:00+01:00',
'allergieAlimentaire': True,
'allergieRespiratoire': True,
'allergieAutre': True,
'allergieMedicament': True,
'asthme': False,
'flPAI': False,
'flImage': False,
'dtcPrap1': '2022-02-22T00:00:00+01:00',
'obsMed1': 'some obsMed1 text',
'obsMed2': 'some obsMed2 text',
'obsMed3': 'some obsMed3 text',
'obsDir1': 'some obsDir1 text',
'obsDir2': 'some obsDir2 text',
'obsDir3': 'some obsDir3 text',
'obsAssist1': 'some obsAssist1 text',
'obsAssist2': 'some obsAssist2 text',
'obsAssist3': 'some obsAssist3 text',
'cons1Med': 'some cons1Med text',
'cons2Med': 'some cons2Med text',
}
assert resp.json['data']['childList'][0]['medicalRecord'] == {
"familyDoctor": {
"name": "DRE",
"phone": "0612341234",
"address": {"street1": "Alameda", "zipcode": "90220", "town": "Compton"},
},
'allergy1': 'butterscotch, imitation butterscotch, glow-in-the-dark monster make-up',
'allergy2': 'shrimp and cauliflower',
'comment1': "the shrimp allergy isn't fully identified",
'comment2': None,
'observ1': 'Ay Caramba!',
'observ2': 'Eat my shorts!',
'isAuthHospital': True,
'hospital': 'Springfield General Hospital',
"vaccinList": [
{
"code": "ROR",
@ -776,9 +770,15 @@ def test_read_rl2(mocked_post, mocked_get, con, app):
'num': '613879',
'lastname': 'DOE',
'firstname': 'JANE',
'maidenName': 'SMITH',
'quality': 'MERE',
'civility': 'MME',
'dateBirth': '1940-06-22T00:00:00+02:00',
'birth': {
'communeCode': None,
'countryCode': '99351',
'dateBirth': '1940-06-22T00:00:00+02:00',
'place': 'Bardot',
},
'adresse': {
'idStreet': None,
'num': 170,
@ -812,6 +812,7 @@ def test_read_rl2(mocked_post, mocked_get, con, app):
'civility_text': 'Madame',
'quality_text': 'MERE',
'quotientList': [],
'indicatorList': [],
'subscribeActivityList': [],
}
@ -1054,13 +1055,16 @@ def test_create_family(mocked_post, mocked_get, con, app):
]
url = get_endpoint('create-family')
params = {
'categorie': 'ACCEUI',
'category': 'ACCEUI',
'situation': 'C',
'rl1/civility': 'M.',
'rl1/firstname': 'Jhon',
'rl1/lastname': 'Doe',
'rl1/quality': 'AU',
'rl1/dateBirth': '1938-07-26',
'rl1/birth/communeCode': None,
'rl1/birth/countryCode': '99350',
'rl1/birth/dateBirth': '1938-07-26',
'rl1/birth/place': 'Rabbat',
'rl1/adresse/street1': 'Chateau',
'rl1/adresse/town': 'Paris',
'rl1/adresse/zipcode': '75014',
@ -1070,9 +1074,13 @@ def test_create_family(mocked_post, mocked_get, con, app):
'childList/0/lastname': 'Zimmerman',
'childList/0/firstname': 'Robert',
'childList/0/sexe': 'M',
'childList/0/dateBirth': '1941-05-24',
'childList/0/birth/dateBirth': '1941-05-24',
'childList/0/birth/place': 'Saint-louis',
'childList/0/birth/communeCode': '91122',
'childList/0/birth/countryCode': '99100',
'childList/0/dietcode': 'RSV',
'childList/0/medicalRecord/vaccinList/0/code': 'DTC',
'childList/0/medicalRecord/vaccinList/0/vaccinationDate': '1940-07-26',
}
resp = app.post_json(url + '?NameID=local', params=params)
@ -1090,13 +1098,13 @@ def test_create_family(mocked_post, mocked_get, con, app):
def test_create_family_empty_referential_key_error(con, app):
url = get_endpoint('create-family')
params = {
'categorie': '',
'situation': '',
'category': '',
'situation': 'C',
'rl1/civility': 'M.',
'rl1/firstname': 'Jhon',
'rl1/lastname': 'Doe',
'rl1/quality': 'AU',
'rl1/dateBirth': '1938-07-26',
'rl1/birth/dateBirth': '1938-07-26',
'rl1/adresse/street1': 'Chateau',
'rl1/adresse/town': 'Paris',
'rl1/adresse/zipcode': '75014',
@ -1104,19 +1112,19 @@ def test_create_family_empty_referential_key_error(con, app):
resp = app.post_json(url + '?NameID=local', params=params, status=400)
assert resp.json['err'] == 1
assert resp.json['err_desc'] == "categorie: '' does not match '.+'"
assert resp.json['err_desc'] == "category: '' does not match '.+'"
def test_create_family_already_linked_error(con, app):
url = get_endpoint('create-family')
params = {
'categorie': 'ACCEUI',
'category': 'ACCEUI',
'situation': 'C',
'rl1/civility': 'M.',
'rl1/firstname': 'Jhon',
'rl1/lastname': 'Doe',
'rl1/quality': 'AU',
'rl1/dateBirth': '1938-07-26',
'rl1/birth/dateBirth': '1938-07-26',
'rl1/adresse/street1': 'Chateau',
'rl1/adresse/town': 'Paris',
'rl1/adresse/zipcode': '75014',
@ -1141,13 +1149,13 @@ def test_create_family_maelis_error(mocked_post, mocked_get, con, app):
]
url = get_endpoint('create-family')
params = {
'categorie': 'ACCEUI',
'category': 'ACCEUI',
'situation': 'C',
'rl1/civility': 'M.',
'rl1/firstname': 'Jhon',
'rl1/lastname': 'Doe',
'rl1/quality': 'AU',
'rl1/dateBirth': '1938-07-26',
'rl1/birth/dateBirth': '1938-07-26',
'rl1/adresse/street1': 'Chateau',
'rl1/adresse/town': 'Paris',
'rl1/adresse/zipcode': '75014',
@ -1174,13 +1182,16 @@ def test_create_family_wrong_referential_key_error(mocked_post, mocked_get, con,
]
url = get_endpoint('create-family')
params = {
'categorie': 'ACCEUI',
'category': 'ACCEUI',
'situation': 'C',
'rl1/civility': 'M.',
'rl1/firstname': 'Jhon',
'rl1/lastname': 'Doe',
'rl1/quality': 'AU',
'rl1/dateBirth': '1938-07-26',
'rl1/birth/communeCode': None,
'rl1/birth/countryCode': '99350',
'rl1/birth/dateBirth': '1938-07-26',
'rl1/birth/place': 'Rabbat',
'rl1/adresse/street1': 'Chateau',
'rl1/adresse/town': 'Paris',
'rl1/adresse/zipcode': '75014',
@ -1190,9 +1201,13 @@ def test_create_family_wrong_referential_key_error(mocked_post, mocked_get, con,
'childList/0/lastname': 'Zimmerman',
'childList/0/firstname': 'Robert',
'childList/0/sexe': 'M',
'childList/0/dateBirth': '1941-05-24',
'childList/0/birth/dateBirth': '1941-05-24',
'childList/0/birth/place': 'Saint-louis',
'childList/0/birth/communeCode': '91122',
'childList/0/birth/countryCode': '99100',
'childList/0/dietcode': 'RSV',
'childList/0/medicalRecord/vaccinList/0/code': 'plop',
'childList/0/medicalRecord/vaccinList/0/vaccinationDate': '1940-07-26',
}
resp = app.post_json(url + '?NameID=local', params=params)
@ -1221,26 +1236,29 @@ def test_update_family(mocked_post, mocked_get, con, app):
]
url = get_endpoint('update-family')
params = {
'categorie': 'BI',
'category': 'BI',
'situation': 'C',
'rl1/civility': 'M.',
'rl1/firstname': 'Jhon',
'rl1/lastname': 'Doe',
'rl1/quality': 'AU',
'rl1/dateBirth': '1938-07-26',
'rl1/birth/communeCode': None,
'rl1/birth/countryCode': '99350',
'rl1/birth/dateBirth': '1938-07-26',
'rl1/birth/place': 'Rabbat',
'rl1/adresse/street1': 'Chateau',
'rl1/adresse/town': 'Paris',
'rl1/adresse/zipcode': '75014',
'rl1/adresse/numComp': 'B',
'rl1/profession/codeCSP': 'ART',
'rl1/CAFInfo/organ': 'A10007752822',
'emergencyPersonList/0/personList/0/civility': 'MME',
'emergencyPersonList/0/personList/0/firstname': 'Keny',
'emergencyPersonList/0/personList/0/lastname': 'Arkana',
'emergencyPersonList/0/personList/0/sexe': 'F',
'emergencyPersonList/0/personList/0/dateBirth': '1982-12-20',
'emergencyPersonList/0/personList/0/quality': 'T',
'childList/0/lastname': 'Zimmerman',
'emergencyPersonList/0/civility': 'MME',
'emergencyPersonList/0/firstname': 'Keny',
'emergencyPersonList/0/lastname': 'Arkana',
'emergencyPersonList/0/sexe': 'F',
'emergencyPersonList/0/dateBirth': '1982-12-20',
'emergencyPersonList/0/quality': 'T',
'childList/0/lastname': 'Zimmerman', # add child
'childList/0/firstname': 'Robert',
'childList/0/sexe': 'M',
'childList/0/birth/dateBirth': '1941-05-24',
@ -1248,6 +1266,12 @@ def test_update_family(mocked_post, mocked_get, con, app):
'childList/0/dietcode': 'RSV',
'childList/0/paiInfoBean/code': 'PAIALI',
'childList/0/medicalRecord/vaccinList/0/code': 'DTC',
'childList/0/medicalRecord/vaccinList/0/vaccinationDate': '1940-07-26',
'childList/1/num': '613880', # update child
'childList/1/firstname': 'Brunelle',
'childList/1/lastname': 'Doe',
'childList/1/birth/dateBirth': '1943-01-19',
'childList/1/sexe': 'F',
}
Link.objects.create(resource=con, family_id='1312', name_id='local')
@ -1261,13 +1285,13 @@ def test_update_family(mocked_post, mocked_get, con, app):
def test_update_family_not_linked_error(con, app):
url = get_endpoint('update-family')
params = {
'categorie': 'BI',
'category': 'BI',
'situation': 'C',
'rl1/civility': 'M.',
'rl1/firstname': 'Jhon',
'rl1/lastname': 'Doe',
'rl1/quality': 'AU',
'rl1/dateBirth': '1938-07-26',
'rl1/birth/dateBirth': '1938-07-26',
'rl1/adresse/street1': 'Chateau',
'rl1/adresse/town': 'Paris',
'rl1/adresse/zipcode': '75014',
@ -1289,7 +1313,7 @@ def test_update_family_maelis_error(mocked_post, mocked_get, con, app):
]
url = get_endpoint('update-family')
params = {
'categorie': 'ACCEUI',
'category': 'ACCEUI',
'situation': 'C',
'childList/0/lastname': 'Zimmerman',
'childList/0/firstname': 'Robert',
@ -1312,13 +1336,13 @@ def test_update_family_soap_error(mocked_post, mocked_get, con, app):
url = get_endpoint('update-family')
params = {
'nbChild': '100',
'categorie': 'BI',
'category': 'BI',
'situation': 'C',
'rl1/civility': 'M.',
'rl1/firstname': 'Jhon',
'rl1/lastname': 'Doe',
'rl1/quality': 'AU',
'rl1/dateBirth': '1938-07-26',
'rl1/birth/dateBirth': '1938-07-26',
'rl1/adresse/street1': 'Chateau',
'rl1/adresse/town': 'Paris',
'rl1/adresse/zipcode': '75014',
@ -1347,25 +1371,28 @@ def test_update_family_wrong_referential_key_error(mocked_post, mocked_get, con,
]
url = get_endpoint('update-family')
params = {
'categorie': 'BI',
'category': 'BI',
'situation': 'C',
'rl1/civility': 'M.',
'rl1/firstname': 'Jhon',
'rl1/lastname': 'Doe',
'rl1/quality': 'AU',
'rl1/dateBirth': '1938-07-26',
'rl1/birth/communeCode': None,
'rl1/birth/countryCode': '99350',
'rl1/birth/dateBirth': '1938-07-26',
'rl1/birth/place': 'Rabbat',
'rl1/adresse/street1': 'Chateau',
'rl1/adresse/town': 'Paris',
'rl1/adresse/zipcode': '75014',
'rl1/adresse/numComp': 'B',
'rl1/profession/codeCSP': 'ART',
'rl1/CAFInfo/organ': 'A10007752822',
'emergencyPersonList/0/personList/0/civility': 'MME',
'emergencyPersonList/0/personList/0/firstname': 'Keny',
'emergencyPersonList/0/personList/0/lastname': 'Arkana',
'emergencyPersonList/0/personList/0/sexe': 'F',
'emergencyPersonList/0/personList/0/dateBirth': '1982-12-20',
'emergencyPersonList/0/personList/0/quality': 'T',
'emergencyPersonList/0/civility': 'MME',
'emergencyPersonList/0/firstname': 'Keny',
'emergencyPersonList/0/lastname': 'Arkana',
'emergencyPersonList/0/sexe': 'F',
'emergencyPersonList/0/dateBirth': '1982-12-20',
'emergencyPersonList/0/quality': 'T',
'childList/0/lastname': 'Zimmerman',
'childList/0/firstname': 'Robert',
'childList/0/sexe': 'M',
@ -1374,6 +1401,7 @@ def test_update_family_wrong_referential_key_error(mocked_post, mocked_get, con,
'childList/0/dietcode': 'RSV',
'childList/0/paiInfoBean/code': 'PAIALI',
'childList/0/medicalRecord/vaccinList/0/code': 'plop',
'childList/0/medicalRecord/vaccinList/0/vaccinationDate': '1940-07-26',
}
Link.objects.create(resource=con, family_id='1312', name_id='local')
@ -1398,13 +1426,13 @@ def test_create_rl1(mocked_post, mocked_get, con, app):
]
url = get_endpoint('create-rl1')
params = {
'categorie': 'ACCEUI',
'category': 'ACCEUI',
'situation': 'C',
'rl1/civility': 'M.',
'rl1/firstname': 'Jhon',
'rl1/lastname': 'Doe',
'rl1/quality': 'AU',
'rl1/dateBirth': '1938-07-26',
'rl1/birth/dateBirth': '1938-07-26',
'rl1/adresse/street1': 'Chateau',
'rl1/adresse/town': 'Paris',
'rl1/adresse/zipcode': '75014',
@ -1420,13 +1448,13 @@ def test_create_rl1(mocked_post, mocked_get, con, app):
def test_create_rl1_empty_referential_key_error(con, app):
url = get_endpoint('create-rl1')
params = {
'categorie': 'ACCEUI',
'category': 'ACCEUI',
'situation': 'C',
'rl1/civility': '',
'rl1/firstname': 'Jhon',
'rl1/lastname': 'Doe',
'rl1/quality': '',
'rl1/dateBirth': '1938-07-26',
'rl1/birth/dateBirth': '1938-07-26',
'rl1/adresse/street1': 'Chateau',
'rl1/adresse/town': 'Paris',
'rl1/adresse/zipcode': '75014',
@ -1440,13 +1468,13 @@ def test_create_rl1_empty_referential_key_error(con, app):
def test_create_rl1_already_linked_error(con, app):
url = get_endpoint('create-rl1')
params = {
'categorie': 'ACCEUI',
'category': 'ACCEUI',
'situation': 'C',
'rl1/civility': 'M.',
'rl1/firstname': 'Jhon',
'rl1/lastname': 'Doe',
'rl1/quality': 'AU',
'rl1/dateBirth': '1938-07-26',
'rl1/birth/dateBirth': '1938-07-26',
'rl1/adresse/street1': 'Chateau',
'rl1/adresse/town': 'Paris',
'rl1/adresse/zipcode': '75014',
@ -1465,13 +1493,13 @@ def test_create_rl1_wrong_referential_key_error(mocked_post, mocked_get, con, ap
mocked_post.side_effect = [READ_CATEGORIES, READ_SITUATIONS, READ_CIVILITIES, READ_QUALITIES]
url = get_endpoint('create-rl1')
params = {
'categorie': 'ACCEUI',
'category': 'ACCEUI',
'situation': 'C',
'rl1/civility': 'M.',
'rl1/firstname': 'Jhon',
'rl1/lastname': 'Doe',
'rl1/quality': 'AU',
'rl1/dateBirth': '1938-07-26',
'rl1/birth/dateBirth': '1938-07-26',
'rl1/adresse/numComp': 'plop',
'rl1/adresse/street1': 'Chateau',
'rl1/adresse/town': 'Paris',
@ -1499,13 +1527,13 @@ def test_create_rl1_maelis_error(mocked_post, mocked_get, con, app):
]
url = get_endpoint('create-rl1')
params = {
'categorie': 'ACCEUI',
'category': 'ACCEUI',
'situation': 'C',
'rl1/civility': 'M.',
'rl1/firstname': 'Jhon',
'rl1/lastname': 'Doe',
'rl1/quality': 'AU',
'rl1/dateBirth': '1938-07-26',
'rl1/birth/dateBirth': '1938-07-26',
'rl1/adresse/street1': 'Chateau',
'rl1/adresse/town': 'Paris',
'rl1/adresse/zipcode': '75014',
@ -1527,7 +1555,7 @@ def test_update_rl1(mocked_post, mocked_get, con, app):
'firstname': 'Jhonny',
'lastname': 'Doe',
'quality': 'PERE',
'dateBirth': '1943-06-15',
'birth/dateBirth': '1943-06-15',
}
Link.objects.create(resource=con, family_id='1312', name_id='local')
@ -1543,7 +1571,7 @@ def test_update_rl1_not_linked_error(con, app):
'firstname': 'Jhonny',
'lastname': 'Doe',
'quality': 'PERE',
'dateBirth': '1943-06-15',
'birth/dateBirth': '1943-06-15',
}
resp = app.post_json(url + '?NameID=local', params=params)
@ -1562,7 +1590,7 @@ def test_update_rl1_connection_error(mocked_post, mocked_get, con, app):
'firstname': 'Jhonny',
'lastname': 'Doe',
'quality': 'PERE',
'dateBirth': '1943-06-15',
'birth/dateBirth': '1943-06-15',
}
Link.objects.create(resource=con, family_id='1312', name_id='local')
@ -1582,7 +1610,7 @@ def test_update_rl1_wrong_referential_key_error(mocked_post, mocked_get, con, ap
'firstname': 'Jhonny',
'lastname': 'Doe',
'quality': 'plop',
'dateBirth': '1943-06-15',
'birth/dateBirth': '1943-06-15',
}
Link.objects.create(resource=con, family_id='1312', name_id='local')
@ -1601,8 +1629,9 @@ def test_create_rl2(mocked_post, mocked_get, con, app):
'civility': 'MME',
'firstname': 'JANE',
'lastname': 'DOE',
'maidenName': 'Smith',
'quality': 'MERE',
'dateBirth': '1940-06-22',
'birth/dateBirth': '1940-06-22',
'adresse/num': '170',
'adresse/street1': "Chateau d'eau",
'adresse/town': 'Paris',
@ -1622,8 +1651,9 @@ def test_create_rl2_not_linked_error(con, app):
'civility': 'MME',
'firstname': 'JANE',
'lastname': 'DOE',
'maidenName': 'Smith',
'quality': 'MERE',
'dateBirth': '1940-06-22',
'birth/dateBirth': '1940-06-22',
'adresse/num': '170',
'adresse/street1': "Chateau d'eau",
'adresse/town': 'Paris',
@ -1645,8 +1675,9 @@ def test_create_rl2_connection_error(mocked_post, mocked_get, con, app):
'civility': 'MME',
'firstname': 'JANE',
'lastname': 'DOE',
'maidenName': 'Smith',
'quality': 'MERE',
'dateBirth': '1940-06-22',
'birth/dateBirth': '1940-06-22',
'adresse/num': '170',
'adresse/street1': "Chateau d'eau",
'adresse/town': 'Paris',
@ -1669,8 +1700,9 @@ def test_create_rl2_already_exists_error(mocked_post, mocked_get, con, app):
'civility': 'MME',
'firstname': 'JANE',
'lastname': 'DOE',
'maidenName': 'Smith',
'quality': 'MERE',
'dateBirth': '1940-06-22',
'birth/dateBirth': '1940-06-22',
'adresse/num': '170',
'adresse/street1': "Chateau d'eau",
'adresse/town': 'Paris',
@ -1693,8 +1725,9 @@ def test_create_rl2_wrong_referential_key_error(mocked_post, mocked_get, con, ap
'civility': 'MME',
'firstname': 'JANE',
'lastname': 'DOE',
'maidenName': 'Smith',
'quality': 'plop',
'dateBirth': '1940-06-22',
'birth/dateBirth': '1940-06-22',
'adresse/num': '170',
'adresse/street1': "Chateau d'eau",
'adresse/town': 'Paris',
@ -1717,8 +1750,9 @@ def test_update_rl2(mocked_post, mocked_get, con, app):
'civility': 'MME',
'firstname': 'JANE',
'lastname': 'DOE',
'maidenName': 'Smith',
'quality': 'MERE',
'dateBirth': '1940-06-22',
'birth/dateBirth': '1940-06-22',
}
Link.objects.create(resource=con, family_id='1312', name_id='local')
@ -1734,7 +1768,8 @@ def test_update_rl2_not_linked_error(con, app):
'firstname': 'JANE',
'lastname': 'DOE',
'quality': 'MERE',
'dateBirth': '1940-06-22',
'maidenName': 'Smith',
'birth/dateBirth': '1940-06-22',
}
resp = app.post_json(url + '?NameID=local', params=params)
@ -1752,8 +1787,9 @@ def test_update_rl2_connection_error(mocked_post, mocked_get, con, app):
'civility': 'MME',
'firstname': 'JANE',
'lastname': 'DOE',
'maidenName': 'Smith',
'quality': 'MERE',
'dateBirth': '1940-06-22',
'birth/dateBirth': '1940-06-22',
}
Link.objects.create(resource=con, family_id='1312', name_id='local')
@ -1772,8 +1808,9 @@ def test_update_rl2_not_exists_error(mocked_post, mocked_get, con, app):
'civility': 'MME',
'firstname': 'JANE',
'lastname': 'DOE',
'maidenName': 'Smith',
'quality': 'MERE',
'dateBirth': '1940-06-22',
'birth/dateBirth': '1940-06-22',
}
Link.objects.create(resource=con, family_id='1312', name_id='local')
@ -1792,8 +1829,9 @@ def test_update_rl2_wrong_referential_key_error(mocked_post, mocked_get, con, ap
'civility': 'MME',
'firstname': 'JANE',
'lastname': 'DOE',
'maidenName': 'Smith',
'quality': 'plop',
'dateBirth': '1940-06-22',
'birth/dateBirth': '1940-06-22',
}
Link.objects.create(resource=con, family_id='1312', name_id='local')
@ -1853,6 +1891,26 @@ def test_create_child_not_linked_error(con, app):
assert resp.json['err_desc'] == 'User not linked to family'
@mock.patch('passerelle.utils.Request.get')
@mock.patch('passerelle.utils.Request.post')
def test_create_child_wrong_referential_key_error(mocked_post, mocked_get, con, app):
mocked_get.return_value = FAMILY_SERVICE_WSDL
mocked_post.side_effect = []
url = get_endpoint('create-child')
params = {
'lastname': 'DOE',
'firstname': 'JANNIS',
'sexe': 'plop',
'birth/dateBirth': '1943-01-19',
'birth/place': 'Port Arthur',
}
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_desc'] == "sexe key value 'plop' do not belong to 'Sex' required referential"
@mock.patch('passerelle.utils.Request.get')
@mock.patch('passerelle.utils.Request.post')
def test_create_child_connection_error(mocked_post, mocked_get, con, app):
@ -1930,6 +1988,26 @@ def test_update_child_not_linked_error(con, app):
assert resp.json['err_desc'] == 'User not linked to family'
@mock.patch('passerelle.utils.Request.get')
@mock.patch('passerelle.utils.Request.post')
def test_update_child_wrong_referential_key_error(mocked_post, mocked_get, con, app):
mocked_get.return_value = FAMILY_SERVICE_WSDL
mocked_post.side_effect = []
url = get_endpoint('create-child')
params = {
'lastname': 'DOE',
'firstname': 'JANNIS',
'sexe': 'plop',
'birth/dateBirth': '1943-01-19',
'birth/place': 'Port Arthur',
}
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_desc'] == "sexe key value 'plop' do not belong to 'Sex' required referential"
@mock.patch('passerelle.utils.Request.get')
@mock.patch('passerelle.utils.Request.post')
def test_update_child_connection_error(mocked_post, mocked_get, con, app):
@ -2538,19 +2616,6 @@ def test_update_child_dietcode_not_linked_error(con, app):
assert resp.json['err_desc'] == 'User not linked to family'
@mock.patch('passerelle.utils.Request.get')
@mock.patch('passerelle.utils.Request.post')
def test_update_child_dietcode_empty_referential_key_error(mocked_post, mocked_get, con, app):
mocked_get.return_value = FAMILY_SERVICE_WSDL
mocked_post.side_effect = [READ_DIETCODE, UPDATE_DIETCODE]
url = get_endpoint('update-child-dietcode')
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local&child_id=613878&dietcode=')
assert resp.json['err'] == 'field-required'
assert resp.json['err_desc'] == "dietcode parameter is required and could not be None"
@mock.patch('passerelle.utils.Request.get')
@mock.patch('passerelle.utils.Request.post')
def test_update_child_dietcode_wrong_referential_key_error(mocked_post, mocked_get, con, app):
@ -2562,8 +2627,7 @@ def test_update_child_dietcode_wrong_referential_key_error(mocked_post, mocked_g
resp = app.post_json(url + '?NameID=local&child_id=613878&dietcode=plop')
assert resp.json['err'] == 'wrong-key'
assert (
resp.json['err_desc']
== "dietcode parameter key value 'plop' do not belong to 'DietCode' required referential"
resp.json['err_desc'] == "dietcode parameter key value 'plop' do not belong to 'DietCode' referential"
)
@ -2656,75 +2720,6 @@ def test_update_child_pai_soap_error(mocked_post, mocked_get, con, app):
assert 'maximum : 500' in resp.json['err_desc']
@mock.patch('passerelle.utils.Request.get')
@mock.patch('passerelle.utils.Request.post')
def test_update_child_fsl(mocked_post, mocked_get, con, app):
mocked_get.return_value = FAMILY_SERVICE_WSDL
mocked_post.return_value = UPDATE_FSL
url = get_endpoint('update-child-fsl')
params = {
'dateDeb': '2022-01-01',
'dateFin': '2022-12-31',
'allergieAlimentaire': True,
'allergieRespiratoire': True,
'allergieAutre': True,
'allergieMedicament': True,
'asthme': False,
'flPAI': False,
'flImage': False,
'dtcPrap1': '2022-02-22',
'obsMed1': 'some obsMed1 text',
'obsMed2': 'some obsMed2 text',
'obsMed3': 'some obsMed3 text',
'obsDir1': 'some obsDir1 text',
'obsDir2': 'some obsDir2 text',
'obsDir3': 'some obsDir3 text',
'obsAssist1': 'some obsAssist1 text',
'obsAssist2': 'some obsAssist2 text',
'obsAssist3': 'some obsAssist3 text',
'cons1Med': 'some cons1Med text',
'cons2Med': 'some cons2Med text',
}
Link.objects.create(resource=con, family_id='1312', name_id='local')
resp = app.post_json(url + '?NameID=local&child_id=613878', params=params)
assert_sent_payload(mocked_post, 'Q_update_child_fsl.xml')
assert resp.json['err'] == 0
assert resp.json['data'] == 'ok'
def test_update_child_fsl_not_linked_error(con, app):
url = get_endpoint('update-child-fsl')
params = {
'dateDeb': '2022-01-01',
'dateFin': '2022-12-31',
}
resp = app.post_json(url + '?NameID=local&child_id=613878', params=params)
assert resp.json['err'] == 'not-linked'
assert resp.json['err_desc'] == 'User not linked to family'
@mock.patch('passerelle.utils.Request.get')
@mock.patch('passerelle.utils.Request.post')
def test_update_child_fsl_soap_error(mocked_post, mocked_get, con, app):
mocked_get.return_value = FAMILY_SERVICE_WSDL
mocked_post.return_value = UPDATE_FSL_500
url = get_endpoint('update-child-fsl')
params = {
'dateDeb': '2022-01-01',
'dateFin': '2022-12-31',
'obsMed1': 'a' * 71,
}
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-createOrUpdateFSL-soap:Server'
assert 'Une erreur est survenue' in resp.json['err_desc']
assert 'valeur trop grande' in resp.json['err_desc']
assert 'maximum : 70' in resp.json['err_desc']
@mock.patch('passerelle.utils.Request.get')
@mock.patch('passerelle.utils.Request.post')
def test_update_child_medical_record(mocked_post, mocked_get, con, app):
@ -2737,6 +2732,14 @@ def test_update_child_medical_record(mocked_post, mocked_get, con, app):
'familyDoctor/address/street1': 'Alameda',
'familyDoctor/address/zipcode': '90220',
'familyDoctor/address/town': 'Compton',
'allergy1': 'butterscotch, imitation butterscotch, glow-in-the-dark monster make-up, and shrimp',
'allergy2': 'cauliflower',
'comment1': "the shrimp allergy isn't fully identified",
'comment2': None,
'observ1': 'Ay Caramba!',
'observ2': None,
'isAuthHospital': True,
'hospital': 'Springfield General Hospital',
'vaccinList/0/code': 'DTC',
'vaccinList/0/vaccinationDate': '2011-01-11',
'vaccinList/1/code': 'ROR',
@ -2750,6 +2753,34 @@ def test_update_child_medical_record(mocked_post, mocked_get, con, app):
assert resp.json['data'] == 'ok'
@mock.patch('passerelle.utils.Request.get')
@mock.patch('passerelle.utils.Request.post')
def test_update_child_medical_record_with_empty_vaccin_list(mocked_post, mocked_get, con, app):
mocked_get.return_value = FAMILY_SERVICE_WSDL
mocked_post.side_effect = [READ_VACCIN, UPDATE_MEDICAL]
url = get_endpoint('update-child-medical-record')
params = {
'familyDoctor/name': 'Dre',
'familyDoctor/phone': '0612341234',
'familyDoctor/address/street1': 'Alameda',
'familyDoctor/address/zipcode': '90220',
'familyDoctor/address/town': 'Compton',
'allergy1': 'butterscotch, imitation butterscotch, glow-in-the-dark monster make-up, and shrimp',
'allergy2': 'cauliflower',
'comment1': "the shrimp allergy isn't fully identified",
'comment2': None,
'observ1': 'Ay Caramba!',
'observ2': None,
'isAuthHospital': True,
'hospital': 'Springfield General Hospital',
}
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'] == 0
assert resp.json['data'] == 'ok'
def test_update_child_medical_record_not_linked_error(con, app):
url = get_endpoint('update-child-medical-record')
@ -2762,9 +2793,10 @@ def test_update_child_medical_record_not_linked_error(con, app):
@mock.patch('passerelle.utils.Request.post')
def test_update_child_medical_record_soap_error(mocked_post, mocked_get, con, app):
mocked_get.return_value = FAMILY_SERVICE_WSDL
mocked_post.side_effect = [UPDATE_MEDICAL_500]
mocked_post.side_effect = [READ_VACCIN, UPDATE_MEDICAL_500]
url = get_endpoint('update-child-medical-record')
params = {
'vaccinList/0/code': 'DTC',
'vaccinList/0/vaccinationDate': '2022-02-31',
}

View File

@ -41,6 +41,7 @@ deps =
vobject
django-ratelimit
bleach
phonenumbers
dnspython
pyquery
responses