toulouse-maelis: [functests] add test on school pre-booking (#76379)
gitea/passerelle/pipeline/head This commit looks good
Details
gitea/passerelle/pipeline/head This commit looks good
Details
This commit is contained in:
parent
6f562d6e10
commit
fc9444cd98
|
@ -0,0 +1,26 @@
|
|||
[
|
||||
{
|
||||
"id": "05DERO-8",
|
||||
"code": "05DERO-8",
|
||||
"text": "DERO05 - SANTE",
|
||||
"libelle": "DERO05 - SANTE"
|
||||
},
|
||||
{
|
||||
"id": "05DERO-6",
|
||||
"code": "05DERO-6",
|
||||
"text": "DERO05 - SANTE : SANTE / ORGANISATION",
|
||||
"libelle": "DERO05 - SANTE : SANTE / ORGANISATION"
|
||||
},
|
||||
{
|
||||
"id": "10DERO-2",
|
||||
"code": "10DERO-2",
|
||||
"text": "DERO10 - ORGANISATION",
|
||||
"libelle": "DERO10 - ORGANISATION"
|
||||
},
|
||||
{
|
||||
"id": "11DERO-1",
|
||||
"code": "11DERO-1",
|
||||
"text": "DERO11 - AUTRE",
|
||||
"libelle": "DERO11 - AUTRE"
|
||||
}
|
||||
]
|
|
@ -0,0 +1,242 @@
|
|||
[
|
||||
{
|
||||
"id": "ADP",
|
||||
"age": null,
|
||||
"code": "ADP",
|
||||
"text": "adaptation ouverte",
|
||||
"nature": null,
|
||||
"libelle": "adaptation ouverte",
|
||||
"numOrder": null,
|
||||
"nextLevelCode": null
|
||||
},
|
||||
{
|
||||
"id": "CLA",
|
||||
"age": null,
|
||||
"code": "CLA",
|
||||
"text": "Classe aide p\u00e9dagogique ouvert",
|
||||
"nature": null,
|
||||
"libelle": "Classe aide p\u00e9dagogique ouvert",
|
||||
"numOrder": null,
|
||||
"nextLevelCode": null
|
||||
},
|
||||
{
|
||||
"id": "CLI",
|
||||
"age": null,
|
||||
"code": "CLI",
|
||||
"text": "Classe Initation ouverte",
|
||||
"nature": null,
|
||||
"libelle": "Classe Initation ouverte",
|
||||
"numOrder": null,
|
||||
"nextLevelCode": null
|
||||
},
|
||||
{
|
||||
"id": "CE1",
|
||||
"age": 7,
|
||||
"code": "CE1",
|
||||
"text": "Cours \u00e9l\u00e9mentaire 1",
|
||||
"nature": null,
|
||||
"libelle": "Cours \u00e9l\u00e9mentaire 1",
|
||||
"numOrder": "6",
|
||||
"nextLevelCode": "CE2"
|
||||
},
|
||||
{
|
||||
"id": "CE2",
|
||||
"age": 8,
|
||||
"code": "CE2",
|
||||
"text": "Cours \u00e9l\u00e9mentaire 2",
|
||||
"nature": null,
|
||||
"libelle": "Cours \u00e9l\u00e9mentaire 2",
|
||||
"numOrder": "7",
|
||||
"nextLevelCode": "CM1"
|
||||
},
|
||||
{
|
||||
"id": "CM1",
|
||||
"age": 9,
|
||||
"code": "CM1",
|
||||
"text": "Cours moyen 1",
|
||||
"nature": null,
|
||||
"libelle": "Cours moyen 1",
|
||||
"numOrder": "8",
|
||||
"nextLevelCode": "CM2"
|
||||
},
|
||||
{
|
||||
"id": "CM2",
|
||||
"age": 10,
|
||||
"code": "CM2",
|
||||
"text": "Cours moyen 2",
|
||||
"nature": null,
|
||||
"libelle": "Cours moyen 2",
|
||||
"numOrder": "9",
|
||||
"nextLevelCode": null
|
||||
},
|
||||
{
|
||||
"id": "CP",
|
||||
"age": 6,
|
||||
"code": "CP",
|
||||
"text": "Cours pr\u00e9paratoire",
|
||||
"nature": null,
|
||||
"libelle": "Cours pr\u00e9paratoire",
|
||||
"numOrder": "5",
|
||||
"nextLevelCode": "CE1"
|
||||
},
|
||||
{
|
||||
"id": "DAN",
|
||||
"age": null,
|
||||
"code": "DAN",
|
||||
"text": "Danse",
|
||||
"nature": null,
|
||||
"libelle": "Danse",
|
||||
"numOrder": null,
|
||||
"nextLevelCode": null
|
||||
},
|
||||
{
|
||||
"id": "IME",
|
||||
"age": null,
|
||||
"code": "IME",
|
||||
"text": "IME SCOL FICTIVE",
|
||||
"nature": null,
|
||||
"libelle": "IME SCOL FICTIVE",
|
||||
"numOrder": null,
|
||||
"nextLevelCode": null
|
||||
},
|
||||
{
|
||||
"id": "INT",
|
||||
"age": null,
|
||||
"code": "INT",
|
||||
"text": "Initiation ouverte",
|
||||
"nature": null,
|
||||
"libelle": "Initiation ouverte",
|
||||
"numOrder": null,
|
||||
"nextLevelCode": null
|
||||
},
|
||||
{
|
||||
"id": "LYC",
|
||||
"age": null,
|
||||
"code": "LYC",
|
||||
"text": "LYCEE",
|
||||
"nature": null,
|
||||
"libelle": "LYCEE",
|
||||
"numOrder": null,
|
||||
"nextLevelCode": null
|
||||
},
|
||||
{
|
||||
"id": "OCC",
|
||||
"age": null,
|
||||
"code": "OCC",
|
||||
"text": "Occitan",
|
||||
"nature": null,
|
||||
"libelle": "Occitan",
|
||||
"numOrder": null,
|
||||
"nextLevelCode": null
|
||||
},
|
||||
{
|
||||
"id": "RAN",
|
||||
"age": null,
|
||||
"code": "RAN",
|
||||
"text": "RANGUEIL SPECIFIQUE",
|
||||
"nature": null,
|
||||
"libelle": "RANGUEIL SPECIFIQUE",
|
||||
"numOrder": null,
|
||||
"nextLevelCode": null
|
||||
},
|
||||
{
|
||||
"id": "RAS",
|
||||
"age": null,
|
||||
"code": "RAS",
|
||||
"text": "R\u00e9seau d'aide sp\u00e9cialis\u00e9e",
|
||||
"nature": null,
|
||||
"libelle": "R\u00e9seau d'aide sp\u00e9cialis\u00e9e",
|
||||
"numOrder": null,
|
||||
"nextLevelCode": null
|
||||
},
|
||||
{
|
||||
"id": "MDP",
|
||||
"age": null,
|
||||
"code": "MDP",
|
||||
"text": "SCOL HANDICAP",
|
||||
"nature": null,
|
||||
"libelle": "SCOL HANDICAP",
|
||||
"numOrder": null,
|
||||
"nextLevelCode": null
|
||||
},
|
||||
{
|
||||
"id": "GS",
|
||||
"age": 5,
|
||||
"code": "GS",
|
||||
"text": "Section grand",
|
||||
"nature": null,
|
||||
"libelle": "Section grand",
|
||||
"numOrder": "4",
|
||||
"nextLevelCode": "CP"
|
||||
},
|
||||
{
|
||||
"id": "MS",
|
||||
"age": 4,
|
||||
"code": "MS",
|
||||
"text": "Section moyen",
|
||||
"nature": null,
|
||||
"libelle": "Section moyen",
|
||||
"numOrder": "3",
|
||||
"nextLevelCode": "GS"
|
||||
},
|
||||
{
|
||||
"id": "PS",
|
||||
"age": 3,
|
||||
"code": "PS",
|
||||
"text": "Section petit",
|
||||
"nature": null,
|
||||
"libelle": "Section petit",
|
||||
"numOrder": "2",
|
||||
"nextLevelCode": "MS"
|
||||
},
|
||||
{
|
||||
"id": "TPS",
|
||||
"age": 2,
|
||||
"code": "TPS",
|
||||
"text": "Section tout petit",
|
||||
"nature": null,
|
||||
"libelle": "Section tout petit",
|
||||
"numOrder": "1",
|
||||
"nextLevelCode": "PS"
|
||||
},
|
||||
{
|
||||
"id": "STP",
|
||||
"age": null,
|
||||
"code": "STP",
|
||||
"text": "Section tout petit en REP",
|
||||
"nature": null,
|
||||
"libelle": "Section tout petit en REP",
|
||||
"numOrder": null,
|
||||
"nextLevelCode": null
|
||||
},
|
||||
{
|
||||
"id": "UPE",
|
||||
"age": null,
|
||||
"code": "UPE",
|
||||
"text": "Uni P\u00e9da Elev Alloph Arrivants",
|
||||
"nature": null,
|
||||
"libelle": "Uni P\u00e9da Elev Alloph Arrivants",
|
||||
"numOrder": null,
|
||||
"nextLevelCode": null
|
||||
},
|
||||
{
|
||||
"id": "ULI",
|
||||
"age": null,
|
||||
"code": "ULI",
|
||||
"text": "Unit\u00e9 d'inclusion scolaire",
|
||||
"nature": null,
|
||||
"libelle": "Unit\u00e9 d'inclusion scolaire",
|
||||
"numOrder": null,
|
||||
"nextLevelCode": null
|
||||
},
|
||||
{
|
||||
"id": "UM ",
|
||||
"age": null,
|
||||
"code": "UM ",
|
||||
"text": "Unit\u00e9 mobile",
|
||||
"nature": null,
|
||||
"libelle": "Unit\u00e9 mobile",
|
||||
"numOrder": null,
|
||||
"nextLevelCode": null
|
||||
}
|
||||
]
|
|
@ -0,0 +1,20 @@
|
|||
[
|
||||
{
|
||||
"id": 2022,
|
||||
"text": "2022",
|
||||
"schoolYear": 2022,
|
||||
"dateEndYearSchool": "2023-07-07T00:00:00+02:00",
|
||||
"dateStartYearSchool": "2022-09-01T00:00:00+02:00",
|
||||
"dateEndSubscribeSchool": null,
|
||||
"dateStartSubscribeSchool": null
|
||||
},
|
||||
{
|
||||
"id": 2023,
|
||||
"text": "2023",
|
||||
"schoolYear": 2023,
|
||||
"dateEndYearSchool": "2024-07-07T00:00:00+02:00",
|
||||
"dateStartYearSchool": "2023-09-01T00:00:00+02:00",
|
||||
"dateEndSubscribeSchool": null,
|
||||
"dateStartSubscribeSchool": null
|
||||
}
|
||||
]
|
|
@ -16,6 +16,7 @@ from .conftest import diff
|
|||
'csp',
|
||||
'dietcode',
|
||||
'document',
|
||||
'exemption-reasons',
|
||||
'nursery',
|
||||
'organ',
|
||||
'pai',
|
||||
|
@ -23,6 +24,8 @@ from .conftest import diff
|
|||
'quotient',
|
||||
'regie',
|
||||
'rl-indicator',
|
||||
'school-levels',
|
||||
'school-years',
|
||||
'situation',
|
||||
'street',
|
||||
'vaccin',
|
||||
|
|
|
@ -0,0 +1,205 @@
|
|||
import pytest
|
||||
import requests
|
||||
|
||||
|
||||
@pytest.fixture(scope='session')
|
||||
def school_year(conn):
|
||||
url = conn + '/read-school-years-list'
|
||||
resp = requests.get(url)
|
||||
resp.raise_for_status()
|
||||
res = resp.json()
|
||||
assert res['err'] == 0
|
||||
return res['data'][0]['text']
|
||||
|
||||
|
||||
@pytest.fixture(scope='session')
|
||||
def exemption(conn):
|
||||
# get an exemption code
|
||||
url = conn + '/read-exemption-reasons-list'
|
||||
resp = requests.get(url)
|
||||
resp.raise_for_status()
|
||||
res = resp.json()
|
||||
assert res['err'] == 0
|
||||
return res['data'][0]['id']
|
||||
|
||||
|
||||
def test_school_pre_registration_by_sector(conn, create_data, school_year, exemption):
|
||||
"""
|
||||
Pré-inscription de l'enfant de 7 ans dans son secteur
|
||||
"""
|
||||
# create a 7 year-old child
|
||||
url = conn + '/create-child?NameID=%s' % create_data['name_id']
|
||||
payload = {
|
||||
'sexe': 'M',
|
||||
'firstname': 'Sego',
|
||||
'lastname': create_data['lastname'],
|
||||
'birth': {'dateBirth': '2016-05-09'},
|
||||
}
|
||||
resp = requests.post(url, json=payload)
|
||||
resp.raise_for_status()
|
||||
assert resp.json()['err'] == 0
|
||||
sego_id = str(resp.json()['data']['child_id'])
|
||||
|
||||
# assert there is a school at this address
|
||||
url = conn + '/read-schools-for-address-and-level'
|
||||
params = {
|
||||
'id_street': '2317',
|
||||
'num': '4',
|
||||
'year': school_year,
|
||||
'level': 'CE1',
|
||||
}
|
||||
resp = requests.get(url, params=params)
|
||||
resp.raise_for_status()
|
||||
assert resp.json()['err'] == 0
|
||||
assert len(resp.json()['data']) == 1
|
||||
assert resp.json()['data'][0]['text'] == 'DUPONT PIERRE ELEMENTAIRE'
|
||||
|
||||
# assert there is a school at child address
|
||||
url = conn + '/read-schools-for-child-and-level'
|
||||
params = {
|
||||
'child_id': sego_id,
|
||||
'year': school_year,
|
||||
'level': 'CE1',
|
||||
}
|
||||
resp = requests.get(url, params=params)
|
||||
resp.raise_for_status()
|
||||
assert resp.json()['err'] == 0
|
||||
assert len(resp.json()['data']) == 1
|
||||
assert resp.json()['data'][0]['text'] == 'DUPONT PIERRE ELEMENTAIRE'
|
||||
|
||||
# book
|
||||
url = conn + '/create-child-school-pre-registration'
|
||||
payload = {
|
||||
'numPerson': sego_id,
|
||||
'schoolYear': school_year,
|
||||
'levelCode': 'CE1',
|
||||
'dateSubscribe': school_year + '-01-01',
|
||||
}
|
||||
resp = requests.get(url)
|
||||
resp = requests.post(url, json=payload)
|
||||
resp.raise_for_status()
|
||||
assert resp.json()['err'] == 0
|
||||
assert resp.json()['data']['returnMessage'] is None
|
||||
assert resp.json()['data']['subscribeSchoolBean']['schoolName'] == 'DUPONT PIERRE ELEMENTAIRE'
|
||||
|
||||
"""
|
||||
Pré-inscription d'un enfant de 5 ans en CP avec rappprochement de fratrie pour celui de 7 ans :
|
||||
c'est une inscription avec "fausse dérogation" :
|
||||
à savoir on enregistre dans la description de la dérogation le nom du membre de la fratrie
|
||||
rapprochée mais l'état de la dérogation est vide.
|
||||
"""
|
||||
# get Sego school
|
||||
url = conn + '/read-child-school-informations?NameID=%s' % create_data['name_id']
|
||||
params = {
|
||||
'child_id': sego_id,
|
||||
'year': school_year,
|
||||
'level': 'CE1',
|
||||
}
|
||||
resp = requests.get(url, params=params)
|
||||
resp.raise_for_status()
|
||||
assert resp.json()['err'] == 0
|
||||
data = resp.json()['data']
|
||||
schools = data['personSubscribeSchoolList']
|
||||
assert len(schools) == 0 # bug ?
|
||||
|
||||
# get Sego school from read-family
|
||||
url = conn + '/read-family?NameID=%s' % create_data['name_id']
|
||||
resp = requests.get(url)
|
||||
resp.raise_for_status()
|
||||
res = resp.json()
|
||||
assert res['err'] == 0
|
||||
schools = res['data']['childList'][-1]['subscribeSchoolList']
|
||||
assert len(schools) == 1
|
||||
assert str(schools[0]['year']) == school_year
|
||||
assert schools[0]['schoolName'] == 'DUPONT PIERRE ELEMENTAIRE'
|
||||
school_id = schools[0]['idSchool']
|
||||
|
||||
url = conn + '/create-child-school-pre-registration-with-exemption'
|
||||
payload = {
|
||||
'numPerson': create_data['maggie_num'],
|
||||
'schoolYear': school_year,
|
||||
'levelCode': 'GS',
|
||||
'datePresubscribe': school_year + '-01-01',
|
||||
'idRequestSchool1': school_id,
|
||||
'derogReasonCode': exemption, # should be empty ?
|
||||
'derogComment': 'Sego',
|
||||
}
|
||||
resp = requests.get(url)
|
||||
resp = requests.post(url, json=payload)
|
||||
resp.raise_for_status()
|
||||
assert resp.json()['err'] == 0
|
||||
assert 'returnMessage' not in resp.json()
|
||||
assert resp.json()['data']['schoolName'] == 'DUPONT PIERRE ELEMENTAIRE'
|
||||
|
||||
|
||||
def test_school_pre_registration_by_exemption(conn, create_data, school_year, exemption):
|
||||
"""
|
||||
Pré-inscription de l'enfant de 9 ans en dérogation :
|
||||
c'est une dérogation avec sélection du motif sur un établissement hors secteur
|
||||
"""
|
||||
# school list
|
||||
url = conn + '/read-child-school-informations?NameID=%s' % create_data['name_id']
|
||||
params = {
|
||||
'child_id': create_data['bart_num'],
|
||||
'year': school_year,
|
||||
'level': 'CM1',
|
||||
}
|
||||
resp = requests.get(url, params=params)
|
||||
resp.raise_for_status()
|
||||
assert resp.json()['err'] == 0
|
||||
data = resp.json()['data']
|
||||
schools = data['childSubscribeSchoolInformation']['subscribeSchoolInformation']['derogSchoolList']
|
||||
assert len(schools) > 1
|
||||
school_id = schools[0]['id']
|
||||
|
||||
# book
|
||||
url = conn + '/create-child-school-pre-registration-with-exemption'
|
||||
payload = {
|
||||
'numPerson': create_data['bart_num'],
|
||||
'schoolYear': school_year,
|
||||
'levelCode': 'CM1',
|
||||
'datePresubscribe': school_year + '-01-01',
|
||||
'idRequestSchool1': school_id,
|
||||
'derogReasonCode': exemption,
|
||||
'derogComment': 'bla',
|
||||
}
|
||||
resp = requests.get(url)
|
||||
resp = requests.post(url, json=payload)
|
||||
resp.raise_for_status()
|
||||
assert resp.json()['err'] == 0
|
||||
assert 'returnMessage' not in resp.json()
|
||||
assert resp.json()['data']['schoolName'] == 'AMIDONNIERS ELEMENTAIRE'
|
||||
|
||||
"""
|
||||
Pré-inscription de l'autre enfant de 5 ans en CP
|
||||
avec rapprochement de fratrie pour celui de 9 ans :
|
||||
c'est une inscription avec demande de dérogation en attente
|
||||
"""
|
||||
# get Bart school from read-family
|
||||
url = conn + '/read-family?NameID=%s' % create_data['name_id']
|
||||
resp = requests.get(url)
|
||||
resp.raise_for_status()
|
||||
res = resp.json()
|
||||
assert res['err'] == 0
|
||||
schools = res['data']['childList'][0]['subscribeSchoolList']
|
||||
assert len(schools) == 1
|
||||
assert str(schools[0]['year']) == school_year
|
||||
assert schools[0]['schoolName'] == 'AMIDONNIERS ELEMENTAIRE'
|
||||
school_id = schools[0]['idSchool']
|
||||
|
||||
# book
|
||||
url = conn + '/create-child-school-pre-registration-with-sibling'
|
||||
payload = {
|
||||
'numPerson': create_data['hugo_num'],
|
||||
'schoolYear': school_year,
|
||||
'levelCode': 'GS',
|
||||
'datePresubscribe': school_year + '-01-01',
|
||||
'idSchoolRequested': school_id,
|
||||
'numPersonSibling': create_data['bart_num'],
|
||||
}
|
||||
resp = requests.get(url)
|
||||
resp = requests.post(url, json=payload)
|
||||
resp.raise_for_status()
|
||||
assert resp.json()['err'] == 0
|
||||
assert 'returnMessage' not in resp.json()
|
||||
assert resp.json()['data']['schoolName'] == 'AMIDONNIERS ELEMENTAIRE'
|
|
@ -45,9 +45,9 @@ if __name__ == "__main__":
|
|||
parser.add_argument(
|
||||
'referential',
|
||||
help='category childIndicator civility country county csp dietcode direct organ pai quality quotient rlIndicator service situation street town vaccin'
|
||||
+ 'activityNatureType derogReason level yearschool'
|
||||
+ 'regie'
|
||||
+ 'apeIndicator',
|
||||
+ ' activityNatureType derogReason level yearschool'
|
||||
+ ' regie'
|
||||
+ ' apeIndicator',
|
||||
nargs='?',
|
||||
default='civility',
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue