toulouse-maelis: accept None on conveyance selected place (#76736) #219

Merged
nroche merged 1 commits from wip/76736-parsifal-accept-none-conveyance into main 2023-04-28 08:12:19 +02:00
2 changed files with 47 additions and 4 deletions

View File

@ -160,12 +160,22 @@ SUBSCRIPTION_SCHEMA = {
'type': 'object',
'properties': {
'idPlaceMorning': {
'type': 'string',
'pattern': '^[A-Za-z0-9]*$',
'oneOf': [
{
'type': 'string',
'pattern': '^[A-Za-z0-9]*$',
},
{'type': 'null'},
],
},
'idPlaceAfternoon': {
'type': 'string',
'pattern': '^[A-Za-z0-9]*$',
'oneOf': [
{
'type': 'string',
'pattern': '^[A-Za-z0-9]*$',
},
{'type': 'null'},
],
},
},
},

View File

@ -7648,6 +7648,39 @@ def test_add_person_basket_subscription_with_conveyance_not_found(family_service
assert resp.json['err_desc'] == 'no "plop" place defined on "afternoonJourney" conveyance'
def test_add_person_basket_subscription_with_none_conveyance(family_service, activity_service, con, app):
def request_check(request):
assert serialize_object(request.conveyanceSubscribe) == {
'idPlaceMorning': None,
'idPlaceAfternoon': None,
}
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_conveyance.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': 'A10053179798',
'unit_id': 'A10053179803',
'place_id': 'A10053179757',
'start_date': '2022-09-01',
'end_date': '2023-08-31',
'conveyanceSubscribe/idPlaceMorning': '',
'conveyanceSubscribe/idPlaceAfternoon': None,
}
resp = app.post_json(url + '?family_id=322423', params=params)
assert resp.json['err'] == 0
def test_add_person_subscription(family_service, activity_service, con, app):
family_service.add_soap_response('readFamily', get_xml_file('R_read_family.xml'))
activity_service.add_soap_response(