toulouse-maelis: accept an empty string as recurrent week (#78009)
gitea/passerelle/pipeline/head This commit looks good
Details
gitea/passerelle/pipeline/head This commit looks good
Details
This commit is contained in:
parent
d21669a250
commit
8df0c9ec11
|
@ -83,6 +83,23 @@ BOOKING_ACTIVITY_SCHEMA = {
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RECURRENT_WEEK_SCHEMA = {
|
||||||
|
'oneOf': [
|
||||||
|
{
|
||||||
|
'type': 'array',
|
||||||
|
'items': {
|
||||||
|
'type': 'string',
|
||||||
|
'pattern': '^[1-7]-[A-Z]$',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{'type': 'null'},
|
||||||
|
{
|
||||||
|
'type': 'string',
|
||||||
|
'pattern': '^$',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
UPDATE_RECURRENT_WEEK_SCHEMA = {
|
UPDATE_RECURRENT_WEEK_SCHEMA = {
|
||||||
'type': 'object',
|
'type': 'object',
|
||||||
'properties': {
|
'properties': {
|
||||||
|
@ -102,13 +119,7 @@ UPDATE_RECURRENT_WEEK_SCHEMA = {
|
||||||
'type': 'string',
|
'type': 'string',
|
||||||
'pattern': '^([0-9]{4}-[0-9]{2}-[0-9]{2}){0,1}$',
|
'pattern': '^([0-9]{4}-[0-9]{2}-[0-9]{2}){0,1}$',
|
||||||
},
|
},
|
||||||
'recurrent_week': {
|
'recurrent_week': RECURRENT_WEEK_SCHEMA,
|
||||||
'type': 'array',
|
|
||||||
'items': {
|
|
||||||
'type': 'string',
|
|
||||||
'pattern': '^[1-7]-[A-Z]$',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
'required': [
|
'required': [
|
||||||
'person_id',
|
'person_id',
|
||||||
|
@ -147,15 +158,7 @@ SUBSCRIPTION_SCHEMA = {
|
||||||
'type': 'string',
|
'type': 'string',
|
||||||
'pattern': '^[0-9]{4}-[0-9]{2}-[0-9]{2}$',
|
'pattern': '^[0-9]{4}-[0-9]{2}-[0-9]{2}$',
|
||||||
},
|
},
|
||||||
'recurrent_week': {
|
'recurrent_week': RECURRENT_WEEK_SCHEMA,
|
||||||
'oneOf': [
|
|
||||||
{
|
|
||||||
'type': 'array',
|
|
||||||
'items': {'type': 'string'},
|
|
||||||
},
|
|
||||||
{'type': 'null'},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
'conveyanceSubscribe': {
|
'conveyanceSubscribe': {
|
||||||
'type': 'object',
|
'type': 'object',
|
||||||
'properties': {
|
'properties': {
|
||||||
|
|
|
@ -5705,6 +5705,38 @@ def test_update_recurrent_week(family_service, activity_service, con, app):
|
||||||
assert resp.json['data'] == 'ok'
|
assert resp.json['data'] == 'ok'
|
||||||
|
|
||||||
|
|
||||||
|
def test_update_recurrent_week_empty(family_service, activity_service, con, app):
|
||||||
|
def request_check(request):
|
||||||
|
assert serialize_object(request.dayWeekInfoList) == [
|
||||||
|
{'dayNum': 1, 'isPresent': False, 'isOpen': None, 'calendarLetter': None},
|
||||||
|
{'dayNum': 2, 'isPresent': False, 'isOpen': None, 'calendarLetter': None},
|
||||||
|
{'dayNum': 3, 'isPresent': False, 'isOpen': None, 'calendarLetter': None},
|
||||||
|
{'dayNum': 4, 'isPresent': False, 'isOpen': None, 'calendarLetter': None},
|
||||||
|
{'dayNum': 5, 'isPresent': False, 'isOpen': None, 'calendarLetter': None},
|
||||||
|
{'dayNum': 6, 'isPresent': False, 'isOpen': None, 'calendarLetter': None},
|
||||||
|
{'dayNum': 7, 'isPresent': False, 'isOpen': None, 'calendarLetter': None},
|
||||||
|
]
|
||||||
|
|
||||||
|
family_service.add_soap_response('readFamily', get_xml_file('R_read_family.xml'))
|
||||||
|
activity_service.add_soap_response(
|
||||||
|
'updateWeekCalendar',
|
||||||
|
get_xml_file('R_update_week_calendar.xml'),
|
||||||
|
request_check=request_check,
|
||||||
|
)
|
||||||
|
url = get_endpoint('update-recurrent-week')
|
||||||
|
params = {
|
||||||
|
'person_id': '613880',
|
||||||
|
'activity_id': 'A10049327682',
|
||||||
|
'start_date': '2023-04-01',
|
||||||
|
'end_date': '2023-04-30',
|
||||||
|
'recurrent_week': '',
|
||||||
|
}
|
||||||
|
|
||||||
|
resp = app.post_json(url + '?family_id=311323', params=params)
|
||||||
|
assert resp.json['err'] == 0
|
||||||
|
assert resp.json['data'] == 'ok'
|
||||||
|
|
||||||
|
|
||||||
def test_update_recurrent_week_not_linked_error(con, app):
|
def test_update_recurrent_week_not_linked_error(con, app):
|
||||||
url = get_endpoint('update-recurrent-week')
|
url = get_endpoint('update-recurrent-week')
|
||||||
params = {
|
params = {
|
||||||
|
@ -7648,6 +7680,35 @@ def test_add_person_basket_subscription_with_recurrent_week(family_service, acti
|
||||||
assert resp.json['err'] == 0
|
assert resp.json['err'] == 0
|
||||||
|
|
||||||
|
|
||||||
|
def test_add_person_basket_subscription_with_recurrent_week_empty(family_service, activity_service, con, app):
|
||||||
|
def request_check(request):
|
||||||
|
assert serialize_object(request.dayWeekInfoList) == []
|
||||||
|
|
||||||
|
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.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_basket_subscription_providing_wcs_demand(family_service, activity_service, con, app):
|
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'))
|
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'))
|
activity_service.add_soap_response('getPersonUnitInfo', get_xml_file('R_get_person_unit_info.xml'))
|
||||||
|
@ -7930,6 +7991,35 @@ def test_add_person_subscription_with_recurrent_week(family_service, activity_se
|
||||||
assert resp.json['err'] == 0
|
assert resp.json['err'] == 0
|
||||||
|
|
||||||
|
|
||||||
|
def test_add_person_subscription_with_recurrent_week_empty(family_service, activity_service, con, app):
|
||||||
|
def request_check(request):
|
||||||
|
assert serialize_object(request.dayWeekInfoList) == []
|
||||||
|
|
||||||
|
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.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_conveyance(family_service, activity_service, con, app):
|
def test_add_person_subscription_with_conveyance(family_service, activity_service, con, app):
|
||||||
def request_check(request):
|
def request_check(request):
|
||||||
assert serialize_object(request.conveyanceSubscribe) == {
|
assert serialize_object(request.conveyanceSubscribe) == {
|
||||||
|
|
Loading…
Reference in New Issue