Projet

Général

Profil

0001-misc-do-not-convert-parameters-to-text-46520.patch

Serghei Mihai (congés, retour 15/05), 10 septembre 2020 15:00

Télécharger (3,56 ko)

Voir les différences:

Subject: [PATCH] misc: do not convert parameters to text (#46520)

 eopayment/__init__.py     | 5 +----
 tests/test_paybox.py      | 6 +++---
 tests/test_systempayv2.py | 4 ++++
 tests/test_tipi.py        | 4 ++--
 4 files changed, 10 insertions(+), 9 deletions(-)
eopayment/__init__.py
161 161
            if capture_day <= 0:
162 162
                raise ValueError("capture_date needs to be superior to the transaction date.")
163 163

  
164
            kwargs['capture_day'] = capture_day
164
            kwargs['capture_day'] = force_text(capture_day)
165 165

  
166
        for param in kwargs:
167
            # encode all input params to unicode
168
            kwargs[param] = force_text(kwargs[param])
169 166
        return self.backend.request(amount, **kwargs)
170 167

  
171 168
    def response(self, query_string, **kwargs):
tests/test_paybox.py
85 85
        amount = '19.99'
86 86
        transaction_id, kind, what = backend.request(
87 87
            Decimal(amount), email=email, orderid=order_id,
88
            transaction_id=transaction, time=time)
88
            transaction_id=transaction, time=time, manual_validation=False)
89 89
        self.assertEqual(kind, eopayment.FORM)
90 90
        self.assertEqual(transaction_id, '1234')
91 91
        root = ET.fromstring(str(what))
......
155 155
        backend = eopayment.Payment('paybox', params)
156 156
        transaction_id, kind, what = backend.request(
157 157
            Decimal(amount), email=email, orderid=order_id,
158
            transaction_id=transaction, time=time, capture_day=2)
158
            transaction_id=transaction, time=time, capture_day='2')
159 159
        root = ET.fromstring(str(what))
160 160

  
161 161
        form_params = dict(((
......
171 171
        backend = eopayment.Payment('paybox', params)
172 172
        transaction_id, kind, what = backend.request(
173 173
            Decimal(amount), email=email, orderid=order_id,
174
            transaction_id=transaction, time=time, capture_day=2)
174
            transaction_id=transaction, time=time, capture_day='2')
175 175
        root = ET.fromstring(str(what))
176 176

  
177 177
        form_params = dict(((
tests/test_systempayv2.py
143 143
    data['manual_validation'] = True
144 144
    transaction_id, f, form = backend.request(**data.copy())
145 145
    assert get_field(form, 'vads_validation_mode')['value'] == '1'
146

  
147
    data['manual_validation'] = False
148
    transaction_id, f, form = backend.request(**data.copy())
149
    assert get_field(form, 'vads_validation_mode')['value'] == ''
tests/test_tipi.py
27 27
    p = eopayment.Payment('tipi', {'numcli': '12345'})
28 28
    payment_id, kind, url = p.request(
29 29
        amount=Decimal('123.12'),
30
        exer=9999,
31
        refdet=999900000000999999,
30
        exer='9999',
31
        refdet='999900000000999999',
32 32
        objet='tout a fait',
33 33
        email='info@entrouvert.com',
34 34
        urlcl='http://example.com/tipi/test',
35
-