Projet

Général

Profil

0001-iws-accept-optionnal-17th-char-on-STI-code-29632.patch

Emmanuel Cazenave, 10 janvier 2019 11:15

Télécharger (2,06 ko)

Voir les différences:

Subject: [PATCH] iws: accept optionnal 17th char on STI code (#29632)

 passerelle/contrib/iws/models.py |  2 +-
 tests/test_iws.py                | 16 ++++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)
passerelle/contrib/iws/models.py
142 142

  
143 143
    @endpoint(
144 144
        methods=['get'], perm='can_access', example_pattern='{sti_code}/{request_type}/{volume}/',
145
        pattern='^(?P<sti_code>[0-9]{16})/(?P<request_type>\w+)/(?P<volume>[0-9]+)/$',
145
        pattern='^(?P<sti_code>[0-9]{16}.?)/(?P<request_type>\w+)/(?P<volume>[0-9]+)/$',
146 146
        parameters={
147 147
            'sti_code': {
148 148
                'description': _('Address STI code'), 'example_value': '3155570464130003'
tests/test_iws.py
45 45
    assert u'ENCOMBRANT' in json_result['err_desc']
46 46

  
47 47

  
48
def test_checkdate_sti_code_optionnal_last_char(app, setup, endpoint_dummy_cache, monkeypatch):
49
    mock_soap_call(
50
        monkeypatch, {
51
            'status': 'responseOk', 'trace': '',
52
            'fields': {
53
                'NO_APPEL': 'sometoken',
54
                'I_APP_DATESPOSSIBLES': 'Aucune dates disponibles'
55
            }
56
        })
57
    response = app.get(
58
        '/iws/slug-iws/checkdate/3155570464130003B/DECHET/3/?city=toulouse'
59
        '&session_id=7a896f464ede7b4e')
60
    json_result = response.json_body
61
    assert json_result['err'] == 0
62

  
63

  
48 64
def test_checkdate_iws_error_status(app, setup, monkeypatch, endpoint_dummy_cache):
49 65
    mock_soap_call(monkeypatch, {'status': 'KO', 'trace': 'some trace'})
50 66
    response = app.get(
51
-