Compare commits
21 Commits
5f6a4407bb
...
6e5870d1ad
Author | SHA1 | Date |
---|---|---|
Nicolas Roche | 6e5870d1ad | |
Nicolas Roche | e84a7b01af | |
Nicolas Roche | 7ad1ff1430 | |
Nicolas Roche | 4e77bd8b49 | |
Nicolas Roche | 4d9dd0ff2d | |
Nicolas Roche | 3b6b8875ee | |
Nicolas Roche | 3cb56b7344 | |
Nicolas Roche | d865146f93 | |
Nicolas Roche | 693a37250b | |
Nicolas Roche | f7c9d85c5a | |
Nicolas Roche | c5f7232fb2 | |
Nicolas Roche | bebfe627d8 | |
Nicolas Roche | 0ad6b3da2d | |
Nicolas Roche | fa3c3ae29d | |
Nicolas Roche | d780b1d52d | |
Nicolas Roche | dfa19e8ae2 | |
Nicolas Roche | d205cf46ad | |
Nicolas Roche | 4e5ec54b26 | |
Nicolas Roche | 61308407de | |
Nicolas Roche | ec1c4886fd | |
Frédéric Péters | 2618463abb |
|
@ -13,7 +13,16 @@ def test_catalog_personnalise_extrasco(extrasco_subscribe_info):
|
|||
'quantity': None,
|
||||
'unitPrice': 11.5,
|
||||
}
|
||||
assert item['activity']['activityPortail']['blocNoteList'] == []
|
||||
assert extrasco_subscribe_info['info']['activity']['blocNoteList'] == [
|
||||
{
|
||||
'note': 'Lien vers le réglement intérieur :\r\nhttps://portail-parsifal.test.entrouvert.org/media/uploads/2023/03/23/flyer-sejour.pdf\r\nLien vers arrêté municipal :\r\nhttps://portail-parsifal.test.entrouvert.org/media/uploads/2023/04/05/arrete-municipal.pdf',
|
||||
'numIndex': 1,
|
||||
}
|
||||
]
|
||||
assert (
|
||||
extrasco_subscribe_info['info']['agenda'][0]['details']['activity_label']
|
||||
== 'ADL ELEMENTAIRE Maourine Juin'
|
||||
)
|
||||
|
||||
|
||||
def test_catalog_personnalise_extrasco2(extrasco_subscribe_info2):
|
||||
|
@ -27,7 +36,12 @@ def test_catalog_personnalise_extrasco2(extrasco_subscribe_info2):
|
|||
'quantity': None,
|
||||
'unitPrice': 11.5,
|
||||
}
|
||||
assert item['activity']['activityPortail']['blocNoteList'] == []
|
||||
assert extrasco_subscribe_info2['info']['activity']['blocNoteList'] == [
|
||||
{
|
||||
'note': 'Lien vers le réglement intérieur :\r\nhttps://portail-parsifal.test.entrouvert.org/media/uploads/2023/03/23/flyer-sejour.pdf\r\nLien vers arrêté municipal :\r\nhttps://portail-parsifal.test.entrouvert.org/media/uploads/2023/04/05/arrete-municipal.pdf',
|
||||
'numIndex': 1,
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
def test_direct_subscribe(conn, create_data, extrasco_subscribe_info, reference_year):
|
||||
|
@ -131,7 +145,9 @@ def test_subscribe_with_recurrent_week(conn, create_data, extrasco_subscribe_inf
|
|||
resp.raise_for_status()
|
||||
assert resp.json()['err'] == 0
|
||||
line = resp.json()['data'][0]['lignes'][0]
|
||||
assert (line['prixUnit'], line['qte'], line['montant']) == (11.5, 4.0, 46.0)
|
||||
assert line['prixUnit'] == 11.5
|
||||
assert line['qte'] > 0
|
||||
assert line['montant'] == line['prixUnit'] * line['qte']
|
||||
|
||||
# remove subscription
|
||||
url = conn + '/delete-basket?NameID=%s' % create_data['name_id']
|
||||
|
@ -157,7 +173,23 @@ def test_subscribe_with_agenda(conn, create_data, extrasco_subscribe_info):
|
|||
assert resp.json()['err'] == 0
|
||||
return resp.json()['data']
|
||||
|
||||
# subscribe witout providing calendar
|
||||
def get_perisco_bookings():
|
||||
url = conn + '/read-child-agenda?NameID=%s' % create_data['name_id']
|
||||
params = {
|
||||
'child_id': create_data['bart_num'],
|
||||
'start_date': extrasco_subscribe_info['unit']['dateStart'][:10],
|
||||
'end_date': extrasco_subscribe_info['unit']['dateEnd'][:10],
|
||||
}
|
||||
resp = requests.get(url, params=params)
|
||||
resp.raise_for_status()
|
||||
assert resp.json()['err'] == 0
|
||||
return [
|
||||
item
|
||||
for item in resp.json()['data']
|
||||
if item['details']['activity_id'] == extrasco_subscribe_info['activity']['id']
|
||||
]
|
||||
|
||||
# subscribe without providing calendar
|
||||
url = conn + '/add-person-basket-subscription?NameID=%s' % create_data['name_id']
|
||||
payload = {
|
||||
'person_id': create_data['bart_num'],
|
||||
|
@ -174,6 +206,7 @@ def test_subscribe_with_agenda(conn, create_data, extrasco_subscribe_info):
|
|||
|
||||
# no booking
|
||||
assert not any(x['prefill'] for x in get_bookings())
|
||||
assert not any(x['prefill'] for x in get_perisco_bookings())
|
||||
|
||||
# book using info calendar gabarit (booking registered from w.c.s. form)
|
||||
assert len(extrasco_subscribe_info['info']['agenda']) > 0
|
||||
|
@ -195,6 +228,9 @@ def test_subscribe_with_agenda(conn, create_data, extrasco_subscribe_info):
|
|||
|
||||
# there is now 2 bookings
|
||||
assert len([x['prefill'] for x in get_bookings() if x['prefill'] is True]) == 2
|
||||
perisco_bookings = get_perisco_bookings()
|
||||
assert len([x['prefill'] for x in perisco_bookings if x['prefill'] is True]) == 2
|
||||
assert perisco_bookings[0]['details']['activity_label'] == 'ADL ELEMENTAIRE Maourine Juin'
|
||||
|
||||
# check quantity into basket
|
||||
url = conn + '/get-baskets?NameID=%s' % create_data['name_id']
|
||||
|
|
|
@ -265,9 +265,6 @@ def test_basket_subscribe_extrasco2(conn, create_data, extrasco_subscribe_info2,
|
|||
assert data['controlResult'] == {'controlOK': True, 'message': None}
|
||||
assert data['basket']['codeRegie'] == 105
|
||||
assert len({x['personneInfo']['numPerson'] for x in data['basket']['lignes']}) == 1
|
||||
import pdb
|
||||
|
||||
pdb.set_trace()
|
||||
assert len({x['idIns'] for x in data['basket']['lignes']}) == 1 # 3 expected
|
||||
|
||||
assert len(subscriptions(create_data['bart_num'])) == 2 # redoundant
|
||||
|
|
|
@ -167,7 +167,8 @@ class PloneRestApi(BaseResource, HTTPResource):
|
|||
headers = {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
}
|
||||
response = self.requests.post(self.token_ws_url, headers=headers, data=payload)
|
||||
with self.logger.disable_admin_emails():
|
||||
response = self.requests.post(self.token_ws_url, headers=headers, data=payload)
|
||||
if not response.status_code // 100 == 2:
|
||||
raise APIError(response.content)
|
||||
token = response.json().get('id_token')
|
||||
|
|
|
@ -2725,7 +2725,7 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
add_criteria('nature', activity_nature['code'], activity_nature['libelle'])
|
||||
type_value = activity_type['libelle'].split('-')[0].strip()
|
||||
add_criteria('type', slugify(type_value), type_value)
|
||||
add_criteria('service', service_id, service_text)
|
||||
add_criteria('service', slugify(service_text), service_text)
|
||||
|
||||
if activity['activityPortail']['weeklyCalendarActivityList']:
|
||||
for day in activity['activityPortail']['weeklyCalendarActivityList'][0]['dayWeekInfoList']:
|
||||
|
@ -3143,6 +3143,42 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
levels[level['id']] = indicators
|
||||
return {'data': data, 'meta': levels}
|
||||
|
||||
def get_recurrent_info_from_subscription_info(self, response):
|
||||
day_names = ['Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi', 'Dimanche']
|
||||
recurrent_week = []
|
||||
weekly_calendar = response.get('weeklyCalendarActivity')
|
||||
calendar_generation = response.get('calendarGeneration') or {}
|
||||
calendar_generation_value = calendar_generation.get('value') or 'I'
|
||||
if calendar_generation_value in ('O', 'F') and weekly_calendar:
|
||||
units = []
|
||||
for item in response.get('unitScheduleList') or []:
|
||||
key = item['unit']['calendarLetter']
|
||||
value = item['unit']['libelle']
|
||||
units.append((key, value))
|
||||
if calendar_generation.get('value') == 'O' and len(units) > 1:
|
||||
raise APIError(
|
||||
'connector do not manage activity having both calendarGeneration required and several units'
|
||||
)
|
||||
|
||||
for item in weekly_calendar.get('dayWeekInfoList') or []:
|
||||
if item['isOpen']:
|
||||
day_num = item['dayNum']
|
||||
day = day_names[day_num - 1]
|
||||
for key, value in units:
|
||||
recurrent_week.append(
|
||||
{
|
||||
'id': '%s-%s' % (day_num, key),
|
||||
'day': day,
|
||||
'label': value,
|
||||
'overlaps': ['%s-%s' % (day_num, k) for k, v in units if k != key],
|
||||
'text': '%s %s' % (day, value),
|
||||
}
|
||||
)
|
||||
return {
|
||||
'calendar_generation': calendar_generation_value,
|
||||
'recurrent_week': recurrent_week,
|
||||
}
|
||||
|
||||
@endpoint(
|
||||
display_category='Inscriptions',
|
||||
description="Obtenir les informations pour s'inscrire puis réserver sur l'extra-scolaire ou le loisir",
|
||||
|
@ -3189,33 +3225,11 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
'dateRef': ref_date,
|
||||
}
|
||||
response = self.call('Activity', 'getPersonUnitInfo', getPersonUnitInfoRequestBean=params)
|
||||
|
||||
day_names = ['Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi', 'Dimanche']
|
||||
recurrent_week = []
|
||||
weekly_calendar = response.get('weeklyCalendarActivity')
|
||||
calendar_generation = response.get('calendarGeneration')
|
||||
if calendar_generation and calendar_generation.get('value') in ('O', 'F') and weekly_calendar:
|
||||
units = []
|
||||
for item in response.get('unitScheduleList') or []:
|
||||
key = item['unit']['calendarLetter']
|
||||
value = item['unit']['libelle']
|
||||
units.append((key, value))
|
||||
|
||||
for item in weekly_calendar.get('dayWeekInfoList') or []:
|
||||
if item['isOpen']:
|
||||
day_num = item['dayNum']
|
||||
day = day_names[day_num - 1]
|
||||
for key, value in units:
|
||||
recurrent_week.append(
|
||||
{
|
||||
'id': '%s-%s' % (day_num, key),
|
||||
'day': day,
|
||||
'label': value,
|
||||
'overlaps': ['%s-%s' % (day_num, k) for k, v in units if k != key],
|
||||
'text': '%s %s' % (day, value),
|
||||
}
|
||||
)
|
||||
response['recurrent_week'] = recurrent_week
|
||||
recurrent_info = self.get_recurrent_info_from_subscription_info(response)
|
||||
if recurrent_info['calendar_generation'] == 'F':
|
||||
response['recurrent_week'] = recurrent_info['recurrent_week']
|
||||
else:
|
||||
response['recurrent_week'] = []
|
||||
|
||||
if response.get('conveyance'):
|
||||
for part_of_day in response['conveyance'].values():
|
||||
|
@ -3306,8 +3320,17 @@ class ToulouseMaelis(BaseResource, HTTPResource):
|
|||
'no "%s" place defined on "%s" conveyance' % (payload_bus_id, info_key)
|
||||
)
|
||||
|
||||
recurrent_info = self.get_recurrent_info_from_subscription_info(subscription_info)
|
||||
available_items = [x['id'] for x in recurrent_info['recurrent_week']]
|
||||
if recurrent_info['calendar_generation'] == 'O':
|
||||
# automaticaly select all recurrent slots
|
||||
selected_recurrent_week = available_items
|
||||
else:
|
||||
selected_recurrent_week = post_data.get('recurrent_week')
|
||||
recurrent_week = []
|
||||
for item in post_data.get('recurrent_week') or []:
|
||||
for item in selected_recurrent_week or []:
|
||||
if item not in available_items:
|
||||
raise APIError("recurrent item '%s' is not available no on this activity" % item)
|
||||
day_num, key = item.split('-')
|
||||
recurrent_week.append(
|
||||
{
|
||||
|
|
|
@ -39,8 +39,8 @@
|
|||
<lib1>MAOURINE (la) ELEMENTAIRE</lib1>
|
||||
</place>
|
||||
<calendarGeneration>
|
||||
<code>REQUIRED</code>
|
||||
<value>O</value>
|
||||
<code>NOT_REQUIRED</code>
|
||||
<value>F</value>
|
||||
</calendarGeneration>
|
||||
<weeklyCalendarActivity>
|
||||
<dayWeekInfoList>
|
||||
|
|
|
@ -38,8 +38,8 @@
|
|||
<lib1>MAOURINE (la) ELEMENTAIRE</lib1>
|
||||
</place>
|
||||
<calendarGeneration>
|
||||
<code>REQUIRED</code>
|
||||
<value>O</value>
|
||||
<code>NOT_REQUIRED</code>
|
||||
<value>F</value>
|
||||
</calendarGeneration>
|
||||
<weeklyCalendarActivity>
|
||||
<dayWeekInfoList>
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
<soap:Body>
|
||||
<ns2:getPersonUnitInfoResponse xmlns:ns2="activity.ws.maelis.sigec.com" xmlns:ns3="bean.persistence.activity.ws.maelis.sigec.com" xmlns:ns4="bean.persistence.school.ws.maelis.sigec.com">
|
||||
<getPersonUnitInfoResponseBean>
|
||||
<controlResult>
|
||||
<controlOK>false</controlOK>
|
||||
<message>E1023 : L'inscription ne peut pas être réalisée car le mode de facturation n'a pas été trouvé</message>
|
||||
</controlResult>
|
||||
<personInfo>
|
||||
<idMaelis>S10056966965</idMaelis>
|
||||
<num>217553</num>
|
||||
<lastname>TEST_NICO</lastname>
|
||||
<firstname>BART</firstname>
|
||||
<dateBirth>2014-04-01T00:00:00+02:00</dateBirth>
|
||||
<sexe>M</sexe>
|
||||
</personInfo>
|
||||
<activity>
|
||||
<idActivity>A10056514645</idActivity>
|
||||
<libelle1>TEST ECOLE DES SPORTS 22/23 SEMESTRE 2 - MULTIACTIVITES</libelle1>
|
||||
<activityType>
|
||||
<code>1-AAQ</code>
|
||||
<libelle>Activités Aquatiques - Activité Réguliére</libelle>
|
||||
<natureSpec>
|
||||
<code>1</code>
|
||||
<libelle>Activités Régulières</libelle>
|
||||
</natureSpec>
|
||||
</activityType>
|
||||
<typInsPortal>I</typInsPortal>
|
||||
<paiementPortal>O</paiementPortal>
|
||||
</activity>
|
||||
<unit>
|
||||
<idUnit>A10056514650</idUnit>
|
||||
<libelle>MERCREDI - 13h45/17h - 8/15Ans</libelle>
|
||||
<dateStart>2023-02-01T00:00:00+01:00</dateStart>
|
||||
<dateEnd>2023-06-30T00:00:00+02:00</dateEnd>
|
||||
</unit>
|
||||
<place>
|
||||
<idPlace>A10053179757</idPlace>
|
||||
<lib1>ARGOULETS</lib1>
|
||||
</place>
|
||||
<calendarGeneration>
|
||||
<code>REQUIRED</code>
|
||||
<value>O</value>
|
||||
</calendarGeneration>
|
||||
<weeklyCalendarActivity>
|
||||
<dayWeekInfoList>
|
||||
<dayNum>1</dayNum>
|
||||
<isOpen>false</isOpen>
|
||||
</dayWeekInfoList>
|
||||
<dayWeekInfoList>
|
||||
<dayNum>2</dayNum>
|
||||
<isOpen>false</isOpen>
|
||||
</dayWeekInfoList>
|
||||
<dayWeekInfoList>
|
||||
<dayNum>3</dayNum>
|
||||
<isOpen>true</isOpen>
|
||||
</dayWeekInfoList>
|
||||
<dayWeekInfoList>
|
||||
<dayNum>4</dayNum>
|
||||
<isOpen>false</isOpen>
|
||||
</dayWeekInfoList>
|
||||
<dayWeekInfoList>
|
||||
<dayNum>5</dayNum>
|
||||
<isOpen>false</isOpen>
|
||||
</dayWeekInfoList>
|
||||
<dayWeekInfoList>
|
||||
<dayNum>6</dayNum>
|
||||
<isOpen>false</isOpen>
|
||||
</dayWeekInfoList>
|
||||
<dayWeekInfoList>
|
||||
<dayNum>7</dayNum>
|
||||
<isOpen>false</isOpen>
|
||||
</dayWeekInfoList>
|
||||
</weeklyCalendarActivity>
|
||||
<unitScheduleList>
|
||||
<unit>
|
||||
<idUnit>A10056514650</idUnit>
|
||||
<libelle>MERCREDI - 13h45/17h - 8/15Ans</libelle>
|
||||
<calendarLetter>B</calendarLetter>
|
||||
<dateDeb>2023-02-01T00:00:00+01:00</dateDeb>
|
||||
<dateFin>2023-06-30T00:00:00+02:00</dateFin>
|
||||
</unit>
|
||||
</unitScheduleList>
|
||||
<billingInformation/>
|
||||
<action>ADD_SUBSCRIBE</action>
|
||||
<conveyance/>
|
||||
</getPersonUnitInfoResponseBean>
|
||||
</ns2:getPersonUnitInfoResponse>
|
||||
</soap:Body>
|
||||
</soap:Envelope>
|
|
@ -0,0 +1,97 @@
|
|||
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
|
||||
<soap:Body>
|
||||
<ns2:getPersonUnitInfoResponse xmlns:ns2="activity.ws.maelis.sigec.com" xmlns:ns3="bean.persistence.activity.ws.maelis.sigec.com" xmlns:ns4="bean.persistence.school.ws.maelis.sigec.com">
|
||||
<getPersonUnitInfoResponseBean>
|
||||
<controlResult>
|
||||
<controlOK>true</controlOK>
|
||||
</controlResult>
|
||||
<personInfo>
|
||||
<idMaelis>S10055586371</idMaelis>
|
||||
<num>261768</num>
|
||||
<lastname>NICO</lastname>
|
||||
<firstname>BART</firstname>
|
||||
<dateBirth>2014-04-01T00:00:00+02:00</dateBirth>
|
||||
<sexe>M</sexe>
|
||||
</personInfo>
|
||||
<activity>
|
||||
<idActivity>A10055585858</idActivity>
|
||||
<libelle1>ADL ELEMENTAIRE Maourine FEVRIER 22/23</libelle1>
|
||||
<activityType>
|
||||
<code>EXTVAC</code>
|
||||
<libelle>Vacances</libelle>
|
||||
<natureSpec>
|
||||
<code>X</code>
|
||||
<libelle>Extrascolaire</libelle>
|
||||
</natureSpec>
|
||||
</activityType>
|
||||
<typInsPortal>I</typInsPortal>
|
||||
<paiementPortal>I</paiementPortal>
|
||||
</activity>
|
||||
<unit>
|
||||
<idUnit>A10055585860</idUnit>
|
||||
<libelle>ADL ELEMENTAIRE Maourine FEVRIER 22/23</libelle>
|
||||
<dateStart>2023-02-13T00:00:00+01:00</dateStart>
|
||||
<dateEnd>2023-02-24T00:00:00+01:00</dateEnd>
|
||||
</unit>
|
||||
<place>
|
||||
<idPlace>M10053212196</idPlace>
|
||||
<lib1>MAOURINE (la) ELEMENTAIRE</lib1>
|
||||
</place>
|
||||
<calendarGeneration>
|
||||
<code>REQUIRED</code>
|
||||
<value>O</value>
|
||||
</calendarGeneration>
|
||||
<weeklyCalendarActivity>
|
||||
<dayWeekInfoList>
|
||||
<dayNum>1</dayNum>
|
||||
<isOpen>true</isOpen>
|
||||
</dayWeekInfoList>
|
||||
<dayWeekInfoList>
|
||||
<dayNum>2</dayNum>
|
||||
<isOpen>true</isOpen>
|
||||
</dayWeekInfoList>
|
||||
<dayWeekInfoList>
|
||||
<dayNum>3</dayNum>
|
||||
<isOpen>true</isOpen>
|
||||
</dayWeekInfoList>
|
||||
<dayWeekInfoList>
|
||||
<dayNum>4</dayNum>
|
||||
<isOpen>true</isOpen>
|
||||
</dayWeekInfoList>
|
||||
<dayWeekInfoList>
|
||||
<dayNum>5</dayNum>
|
||||
<isOpen>true</isOpen>
|
||||
</dayWeekInfoList>
|
||||
<dayWeekInfoList>
|
||||
<dayNum>6</dayNum>
|
||||
<isOpen>false</isOpen>
|
||||
</dayWeekInfoList>
|
||||
<dayWeekInfoList>
|
||||
<dayNum>7</dayNum>
|
||||
<isOpen>false</isOpen>
|
||||
</dayWeekInfoList>
|
||||
</weeklyCalendarActivity>
|
||||
<unitScheduleList>
|
||||
<unit>
|
||||
<idUnit>A10055586816</idUnit>
|
||||
<libelle>Journée</libelle>
|
||||
<calendarLetter>C</calendarLetter>
|
||||
<dateDeb>2023-02-13T00:00:00+01:00</dateDeb>
|
||||
<dateFin>2023-02-24T00:00:00+01:00</dateFin>
|
||||
</unit>
|
||||
</unitScheduleList>
|
||||
<unitScheduleList>
|
||||
<unit>
|
||||
<idUnit>A10055586815</idUnit>
|
||||
<libelle>Demi-journée</libelle>
|
||||
<calendarLetter>B</calendarLetter>
|
||||
<dateDeb>2023-02-13T00:00:00+01:00</dateDeb>
|
||||
<dateFin>2023-02-24T00:00:00+01:00</dateFin>
|
||||
</unit>
|
||||
</unitScheduleList>
|
||||
<billingInformation/>
|
||||
<action>ADD_SUBSCRIBE</action>
|
||||
</getPersonUnitInfoResponseBean>
|
||||
</ns2:getPersonUnitInfoResponse>
|
||||
</soap:Body>
|
||||
</soap:Envelope>
|
|
@ -6050,9 +6050,6 @@ def test_read_activity_list(activity_service, con, app):
|
|||
resp = app.get(url, params=params)
|
||||
assert resp.json['err'] == 0
|
||||
assert len(resp.json['data']) == 8
|
||||
import pdb
|
||||
|
||||
pdb.set_trace()
|
||||
assert [
|
||||
(
|
||||
x['id'],
|
||||
|
@ -6085,8 +6082,8 @@ def test_read_activity_list(activity_service, con, app):
|
|||
'criterias': {
|
||||
'service': {
|
||||
'text': 'Service',
|
||||
'data': {'A10049329051': 'Sorties'},
|
||||
'order': ['A10049329051'],
|
||||
'data': {'sorties': 'Sorties'},
|
||||
'order': ['sorties'],
|
||||
},
|
||||
'nature': {'text': "Nature de l'activité", 'data': {'4': 'ART PLASTIQUE'}, 'order': ['4']},
|
||||
'type': {
|
||||
|
@ -6117,7 +6114,7 @@ def test_read_activity_list(activity_service, con, app):
|
|||
assert resp.json['meta'] == {
|
||||
'reference_year': 2022,
|
||||
'all_criterias': {
|
||||
'service': {'text': 'Service', 'data': {'A10049329051': 'Sorties'}, 'order': ['A10049329051']},
|
||||
'service': {'text': 'Service', 'data': {'sorties': 'Sorties'}, 'order': ['sorties']},
|
||||
'nature': {
|
||||
'text': "Nature de l'activité",
|
||||
'data': {'4': 'ART PLASTIQUE', '1': 'Activités Régulières'},
|
||||
|
@ -7173,7 +7170,7 @@ def test_get_person_subscription_info_with_recurrent_week(activity_service, con,
|
|||
'endHour': None,
|
||||
'endHour2': None,
|
||||
},
|
||||
'calendarGeneration': {'code': 'REQUIRED', 'value': 'O'},
|
||||
'calendarGeneration': {'code': 'NOT_REQUIRED', 'value': 'F'},
|
||||
'weeklyCalendarActivity': {
|
||||
'dayWeekInfoList': [
|
||||
{'dayNum': 1, 'isOpen': True},
|
||||
|
@ -7285,6 +7282,78 @@ def test_get_person_subscription_info_with_recurrent_week(activity_service, con,
|
|||
assert resp.json['err'] == 0
|
||||
|
||||
|
||||
def test_get_person_subscription_info_with_recurrent_week_required(activity_service, con, app):
|
||||
activity_service.add_soap_response(
|
||||
'getPersonUnitInfo',
|
||||
get_xml_file('R_get_person_unit_info_with_recurrent_week_required.xml'),
|
||||
)
|
||||
url = get_endpoint('get-person-subscription-info')
|
||||
|
||||
params = {
|
||||
'NameID': '',
|
||||
'family_id': '311323',
|
||||
'person_id': '246423',
|
||||
'activity_id': 'A10053187087',
|
||||
'unit_id': 'A10053187241',
|
||||
'place_id': 'A10053179604',
|
||||
'ref_date': '2023-01-22',
|
||||
}
|
||||
resp = app.get(url, params=params)
|
||||
assert resp.json['err'] == 0
|
||||
assert resp.json['data']['calendarGeneration'] == {'code': 'REQUIRED', 'value': 'O'}
|
||||
assert any([x['isOpen'] for x in resp.json['data']['weeklyCalendarActivity']['dayWeekInfoList']])
|
||||
# recurrent_week is not display to user
|
||||
assert resp.json['data']['recurrent_week'] == []
|
||||
|
||||
|
||||
def test_get_person_subscription_info_with_recurrent_week_required_error(activity_service, con, app):
|
||||
activity_service.add_soap_response(
|
||||
'getPersonUnitInfo',
|
||||
get_xml_file('R_get_person_unit_info_with_recurrent_week_required_error.xml'),
|
||||
)
|
||||
url = get_endpoint('get-person-subscription-info')
|
||||
|
||||
params = {
|
||||
'NameID': '',
|
||||
'family_id': '311323',
|
||||
'person_id': '246423',
|
||||
'activity_id': 'A10053187087',
|
||||
'unit_id': 'A10053187241',
|
||||
'place_id': 'A10053179604',
|
||||
'ref_date': '2023-01-22',
|
||||
}
|
||||
resp = app.get(url, params=params)
|
||||
assert resp.json['err'] == 1
|
||||
assert (
|
||||
resp.json['err_desc']
|
||||
== 'connector do not manage activity having both calendarGeneration required and several units'
|
||||
)
|
||||
|
||||
|
||||
def test_get_person_subscription_info_with_recurrent_week_forbidden(activity_service, con, app):
|
||||
activity_service.add_soap_response(
|
||||
'getPersonUnitInfo',
|
||||
get_xml_file('R_get_person_unit_info.xml'),
|
||||
)
|
||||
url = get_endpoint('get-person-subscription-info')
|
||||
|
||||
params = {
|
||||
'NameID': '',
|
||||
'family_id': '311323',
|
||||
'person_id': '246423',
|
||||
'activity_id': 'A10053187087',
|
||||
'unit_id': 'A10053187241',
|
||||
'place_id': 'A10053179604',
|
||||
'ref_date': '2023-01-22',
|
||||
}
|
||||
resp = app.get(url, params=params)
|
||||
assert resp.json['err'] == 0
|
||||
assert resp.json['data']['calendarGeneration'] == {'code': 'FORBIDDEN', 'value': 'I'}
|
||||
assert any([x['isOpen'] for x in resp.json['data']['weeklyCalendarActivity']['dayWeekInfoList']])
|
||||
# recurrent_week is not display to user
|
||||
assert resp.json['data']['recurrent_week'] == []
|
||||
|
||||
|
||||
def test_get_person_subscription_info_with_conveyance(activity_service, con, app):
|
||||
activity_service.add_soap_response(
|
||||
'getPersonUnitInfo',
|
||||
|
@ -7861,6 +7930,63 @@ def test_add_person_basket_subscription_with_recurrent_week_empty(family_service
|
|||
assert resp.json['err'] == 0
|
||||
|
||||
|
||||
def test_add_person_basket_subscription_with_recurrent_week_required(
|
||||
family_service, activity_service, con, app
|
||||
):
|
||||
def request_check(request):
|
||||
assert serialize_object(request.dayWeekInfoList) == [
|
||||
{'dayNum': 3, 'isPresent': True, 'isOpen': None, 'calendarLetter': 'B'},
|
||||
]
|
||||
|
||||
family_service.add_soap_response('readFamily', get_xml_file('R_read_family.xml'))
|
||||
activity_service.add_soap_response(
|
||||
'getPersonUnitInfo',
|
||||
get_xml_file('R_get_person_unit_info_with_recurrent_week_required.xml'),
|
||||
)
|
||||
activity_service.add_soap_response(
|
||||
'addPersonUnitBasket',
|
||||
get_xml_file('R_add_person_unit_basket.xml'),
|
||||
request_check=request_check,
|
||||
)
|
||||
url = get_endpoint('add-person-basket-subscription')
|
||||
|
||||
params = {
|
||||
'person_id': '613880',
|
||||
'activity_id': 'A10051141965',
|
||||
'unit_id': 'A10051141990',
|
||||
'place_id': 'A10053179226',
|
||||
'start_date': '2022-09-01',
|
||||
'end_date': '2023-08-31',
|
||||
'recurrent_week': '',
|
||||
}
|
||||
resp = app.post_json(url + '?family_id=311323', params=params)
|
||||
assert resp.json['err'] == 0
|
||||
|
||||
|
||||
def test_add_person_basket_subscription_with_recurrent_week_forbidden_error(
|
||||
family_service, activity_service, con, app
|
||||
):
|
||||
family_service.add_soap_response('readFamily', get_xml_file('R_read_family.xml'))
|
||||
activity_service.add_soap_response(
|
||||
'getPersonUnitInfo',
|
||||
get_xml_file('R_get_person_unit_info.xml'),
|
||||
)
|
||||
url = get_endpoint('add-person-basket-subscription')
|
||||
|
||||
params = {
|
||||
'person_id': '613880',
|
||||
'activity_id': 'A10051141965',
|
||||
'unit_id': 'A10051141990',
|
||||
'place_id': 'A10053179226',
|
||||
'start_date': '2022-09-01',
|
||||
'end_date': '2023-08-31',
|
||||
'recurrent_week': ['1-B', '2-C'],
|
||||
}
|
||||
resp = app.post_json(url + '?family_id=311323', params=params)
|
||||
assert resp.json['err'] == 1
|
||||
assert resp.json['err_desc'] == "recurrent item '1-B' is not available no on this activity"
|
||||
|
||||
|
||||
def test_basket_subscription_providing_wcs_demand(family_service, activity_service, con, app):
|
||||
family_service.add_soap_response('readFamily', get_xml_file('R_read_family_for_subscription.xml'))
|
||||
activity_service.add_soap_response('getPersonUnitInfo', get_xml_file('R_get_person_unit_info.xml'))
|
||||
|
@ -8172,6 +8298,61 @@ def test_add_person_subscription_with_recurrent_week_empty(family_service, activ
|
|||
assert resp.json['err'] == 0
|
||||
|
||||
|
||||
def test_add_person_subscription_with_recurrent_week_required(family_service, activity_service, con, app):
|
||||
def request_check(request):
|
||||
assert serialize_object(request.dayWeekInfoList) == [
|
||||
{'dayNum': 3, 'isPresent': True, 'isOpen': None, 'calendarLetter': 'B'},
|
||||
]
|
||||
|
||||
family_service.add_soap_response('readFamily', get_xml_file('R_read_family.xml'))
|
||||
activity_service.add_soap_response(
|
||||
'getPersonUnitInfo',
|
||||
get_xml_file('R_get_person_unit_info_with_recurrent_week_required.xml'),
|
||||
)
|
||||
activity_service.add_soap_response(
|
||||
'addPersonUnitSubscribe',
|
||||
get_xml_file('R_add_person_unit_subscribe.xml'),
|
||||
request_check=request_check,
|
||||
)
|
||||
url = get_endpoint('add-person-subscription')
|
||||
|
||||
params = {
|
||||
'person_id': '613880',
|
||||
'activity_id': 'A10051141965',
|
||||
'unit_id': 'A10051141990',
|
||||
'place_id': 'A10053179226',
|
||||
'start_date': '2022-09-01',
|
||||
'end_date': '2023-08-31',
|
||||
'recurrent_week': '',
|
||||
}
|
||||
resp = app.post_json(url + '?family_id=311323', params=params)
|
||||
assert resp.json['err'] == 0
|
||||
|
||||
|
||||
def test_add_person_subscription_with_recurrent_week_forbidden_error(
|
||||
family_service, activity_service, con, app
|
||||
):
|
||||
family_service.add_soap_response('readFamily', get_xml_file('R_read_family.xml'))
|
||||
activity_service.add_soap_response(
|
||||
'getPersonUnitInfo',
|
||||
get_xml_file('R_get_person_unit_info.xml'),
|
||||
)
|
||||
url = get_endpoint('add-person-subscription')
|
||||
|
||||
params = {
|
||||
'person_id': '613880',
|
||||
'activity_id': 'A10051141965',
|
||||
'unit_id': 'A10051141990',
|
||||
'place_id': 'A10053179226',
|
||||
'start_date': '2022-09-01',
|
||||
'end_date': '2023-08-31',
|
||||
'recurrent_week': ['1-B', '2-C'],
|
||||
}
|
||||
resp = app.post_json(url + '?family_id=311323', params=params)
|
||||
assert resp.json['err'] == 1
|
||||
assert resp.json['err_desc'] == "recurrent item '1-B' is not available no on this activity"
|
||||
|
||||
|
||||
def test_add_person_subscription_with_conveyance(family_service, activity_service, con, app):
|
||||
def request_check(request):
|
||||
assert serialize_object(request.conveyanceSubscribe) == {
|
||||
|
|
Loading…
Reference in New Issue