toulouse-maelis: [functests] adapt tests to last build (#77362)
gitea/passerelle/pipeline/head This commit looks good Details

This commit is contained in:
Nicolas Roche 2023-05-08 18:55:46 +02:00 committed by Nicolas Roche
parent 4cdfeb47b0
commit 8e215185ec
4 changed files with 61 additions and 189 deletions

View File

@ -1,4 +1,10 @@
[
{
"id": "MORAL",
"code": "MORAL",
"text": "",
"libelle": null
},
{
"id": "MME",
"code": "MME",
@ -10,11 +16,5 @@
"code": "MR",
"text": "MONSIEUR",
"libelle": "MONSIEUR"
},
{
"id": "MORAL",
"code": "MORAL",
"text": "MORAL",
"libelle": "MORAL"
}
]

View File

@ -1,34 +1,4 @@
[
{
"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,
@ -79,86 +49,6 @@
"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,
@ -198,45 +88,5 @@
"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
}
]

View File

@ -5,8 +5,8 @@
"schoolYear": 2022,
"dateEndYearSchool": "2023-07-07T00:00:00+02:00",
"dateStartYearSchool": "2022-09-01T00:00:00+02:00",
"dateEndSubscribeSchool": null,
"dateStartSubscribeSchool": null
"dateEndSubscribeSchool": "2023-09-01T00:00:00+02:00",
"dateStartSubscribeSchool": "2022-09-01T00:00:00+02:00"
},
{
"id": 2023,
@ -14,6 +14,15 @@
"schoolYear": 2023,
"dateEndYearSchool": "2024-07-07T00:00:00+02:00",
"dateStartYearSchool": "2023-09-01T00:00:00+02:00",
"dateEndSubscribeSchool": "2023-09-01T00:00:00+02:00",
"dateStartSubscribeSchool": "2022-09-01T00:00:00+02:00"
},
{
"id": 2024,
"text": "2024",
"schoolYear": 2024,
"dateEndYearSchool": "2024-07-04T00:00:00+02:00",
"dateStartYearSchool": "2023-09-04T00:00:00+02:00",
"dateEndSubscribeSchool": null,
"dateStartSubscribeSchool": null
}

View File

@ -1,3 +1,5 @@
import datetime
import pytest
import requests
@ -31,7 +33,7 @@ def test_school_pre_registration_by_sector(conn, create_data, school_year, exemp
# create a 7 year-old child
url = conn + '/create-child?NameID=%s' % create_data['name_id']
payload = {
'sexe': 'M',
'sexe': 'F',
'firstname': 'Sego',
'lastname': create_data['lastname'],
'birth': {'dateBirth': '2016-05-09'},
@ -67,6 +69,8 @@ def test_school_pre_registration_by_sector(conn, create_data, school_year, exemp
assert resp.json()['err'] == 0
assert len(resp.json()['data']) == 1
assert resp.json()['data'][0]['text'] == 'DUPONT PIERRE ELEMENTAIRE'
school_id = resp.json()['data'][0]['idSchool']
assert school_id == '2435'
# book
url = conn + '/create-child-school-pre-registration'
@ -76,12 +80,29 @@ def test_school_pre_registration_by_sector(conn, create_data, school_year, exemp
'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'
assert resp.json()['data']['subscribeSchoolBean']['adresse'] == '101 GRANDE-RUE SAINT MICHEL'
# 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) == 0 # school is filtered, see dateStartYearSchool bellow
url = conn + '/read-school-years-list'
resp = requests.get(url)
resp.raise_for_status()
res = resp.json()['data']
assert school_year == '2023'
assert res[1]['text'] == school_year
assert res[1]['dateStartYearSchool'][10] > datetime.datetime.now().strftime('%Y-%m-%d')
"""
Pré-inscription d'un enfant de 5 ans en CP avec rappprochement de fratrie pour celui de 7 ans :
@ -98,21 +119,10 @@ def test_school_pre_registration_by_sector(conn, create_data, school_year, exemp
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']
schools = data['childSubscribeSchoolInformation']['subscribeSchoolYearList']
assert len(schools) == 1
assert str(schools[0]['year']) == school_year
assert schools[0]['schoolName'] == 'DUPONT PIERRE ELEMENTAIRE'
assert schools[0]['isWaitList'] == True
school_id = schools[0]['idSchool']
assert schools[0]['subscribeSchool']['school']['idSchool'] == school_id
assert schools[0]['subscribeSchool']['perim']['idPerim'] == '2707'
url = conn + '/create-child-school-pre-registration-with-sibling'
payload = {
@ -123,12 +133,12 @@ def test_school_pre_registration_by_sector(conn, create_data, school_year, exemp
'idSchoolRequested': school_id,
'numPersonSibling': sego_id,
}
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'
assert resp.json()['data']['schoolName'] == 'CALAS MATERNELLE'
assert resp.json()['data']['adresse'] == '47 RUE ACHILLE VIADIEU' # same sector
def test_school_pre_registration_by_exemption(conn, create_data, school_year, exemption):
@ -162,30 +172,33 @@ def test_school_pre_registration_by_exemption(conn, create_data, school_year, ex
'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'
assert resp.json()['data']['adresse'] == '123 ALL DE BRIENNE'
"""
Pré-inscription de l'autre enfant de 5 ans en CP
avec rapprochement de fratrie pour celui de 9 ans :
rapprochement hors du secteur de l'enfant.
"""
# get Bart school from read-family
url = conn + '/read-family?NameID=%s' % create_data['name_id']
resp = requests.get(url)
# get Bart school
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()
res = resp.json()
assert res['err'] == 0
schools = res['data']['childList'][0]['subscribeSchoolList']
assert resp.json()['err'] == 0
data = resp.json()['data']
schools = data['childSubscribeSchoolInformation']['subscribeSchoolYearList']
assert len(schools) == 1
assert str(schools[0]['year']) == school_year
assert schools[0]['schoolName'] == 'AMIDONNIERS ELEMENTAIRE'
assert schools[0]['isWaitList'] == True
school_id = schools[0]['idSchool']
assert schools[0]['subscribeSchool']['school']['idSchool'] == school_id
assert schools[0]['subscribeSchool']['perim']['idPerim'] == '2663'
# book
url = conn + '/create-child-school-pre-registration-with-sibling'
@ -197,9 +210,9 @@ def test_school_pre_registration_by_exemption(conn, create_data, school_year, ex
'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'
assert resp.json()['data']['schoolName'] == 'AMIDONNIERS MATERNELLE'
assert resp.json()['data']['adresse'] == '125 ALL DE BRIENNE'