vivaticket: accept quantity parameter as decimal string (#72537)
gitea-wip/passerelle/pipeline/pr-main This commit looks good Details

This commit is contained in:
Serghei Mihai 2022-12-16 10:15:07 +01:00
parent ba308415e1
commit 64ef32a922
2 changed files with 4 additions and 6 deletions

View File

@ -111,10 +111,7 @@ EVENTBOOK_SCHEMA = {
"description": "room id",
"type": "string",
},
"quantity": {
"description": "quantity",
"type": "integer",
},
"quantity": {"description": "quantity", "type": "string", "pattern": "^[0-9]+$"},
"booking_comment": {
"description": "booking comment",
"type": "string",
@ -279,7 +276,7 @@ class VivaTicket(BaseResource):
'eventCategoryCode': post_data['event'],
'roomCode': post_data['room'],
'themeCode': post_data['theme'],
'quantity': post_data['quantity'],
'quantity': int(post_data['quantity']),
'startDateTime': post_data['start_datetime'],
'endDateTime': post_data['end_datetime'],
'comment': post_data.get('room_comment', ''),

View File

@ -355,7 +355,7 @@ def test_book(mocked_get, mocked_put, mocked_post, app, connector):
payload['theme'] = '001'
payload['room'] = 'v001'
payload['school_level'] = '01'
payload['quantity'] = 1
payload['quantity'] = '01'
payload['booking_comment'] = 'Booking comment'
payload['room_comment'] = 'Room comment'
payload['form_url'] = "http://mysite.com/form/id/"
@ -376,6 +376,7 @@ def test_book(mocked_get, mocked_put, mocked_post, app, connector):
assert mocked_post.call_args[1]['json']['Booking']['endDateTime'] == '2019-01-15T11:00'
assert mocked_post.call_args[1]['json']['Booking']['comment'] == 'Booking comment'
assert mocked_post.call_args[1]['json']['Booking']['roomList'][0]['comment'] == 'Room comment'
assert mocked_post.call_args[1]['json']['Booking']['roomList'][0]['quantity'] == 1
assert mocked_post.call_args[1]['json']['Booking']['roomList'][0]['schoolLevelCode'] == '01'
assert mocked_post.call_args[1]['json']['Booking']['contact'] == {'InternalCode': '0000000273'}
assert mocked_post.call_args[1]['headers'] == {'X-Vivaticket-Form-URL': 'http://mysite.com/form/id/'}