iws: accept optionnal 17th char on STI code (#29632)

This commit is contained in:
Emmanuel Cazenave 2019-01-10 11:13:00 +01:00
parent d3be91b12b
commit 00dd8c4db8
2 changed files with 17 additions and 1 deletions

View File

@ -142,7 +142,7 @@ class IWSConnector(BaseResource):
@endpoint(
methods=['get'], perm='can_access', example_pattern='{sti_code}/{request_type}/{volume}/',
pattern='^(?P<sti_code>[0-9]{16})/(?P<request_type>\w+)/(?P<volume>[0-9]+)/$',
pattern='^(?P<sti_code>[0-9]{16}.?)/(?P<request_type>\w+)/(?P<volume>[0-9]+)/$',
parameters={
'sti_code': {
'description': _('Address STI code'), 'example_value': '3155570464130003'

View File

@ -45,6 +45,22 @@ def test_checkdate_dechet_or_encombrant(app, setup, endpoint_dummy_cache):
assert u'ENCOMBRANT' in json_result['err_desc']
def test_checkdate_sti_code_optionnal_last_char(app, setup, endpoint_dummy_cache, monkeypatch):
mock_soap_call(
monkeypatch, {
'status': 'responseOk', 'trace': '',
'fields': {
'NO_APPEL': 'sometoken',
'I_APP_DATESPOSSIBLES': 'Aucune dates disponibles'
}
})
response = app.get(
'/iws/slug-iws/checkdate/3155570464130003B/DECHET/3/?city=toulouse'
'&session_id=7a896f464ede7b4e')
json_result = response.json_body
assert json_result['err'] == 0
def test_checkdate_iws_error_status(app, setup, monkeypatch, endpoint_dummy_cache):
mock_soap_call(monkeypatch, {'status': 'KO', 'trace': 'some trace'})
response = app.get(