summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSerghei Mihai <smihai@entrouvert.com>2016-10-13 14:59:10 (GMT)
committerSerghei Mihai <smihai@entrouvert.com>2016-10-21 14:09:00 (GMT)
commit0432124e0a93c25a6217c265fabd436c5e4ba9cb (patch)
treeff7c0bd8f2025bd1b637d3ea37bb8707ebd7c68c /tests
parentd6b80acd0241d31788abc9240ebc65b9f97e6335 (diff)
downloadeopayment-0432124e0a93c25a6217c265fabd436c5e4ba9cb.zip
eopayment-0432124e0a93c25a6217c265fabd436c5e4ba9cb.tar.gz
eopayment-0432124e0a93c25a6217c265fabd436c5e4ba9cb.tar.bz2
tests: make sure API handles unicode input params (#13592)v1.15
Diffstat (limited to 'tests')
-rw-r--r--tests/test_paybox.py36
-rw-r--r--tests/test_sips2.py10
2 files changed, 25 insertions, 21 deletions
diff --git a/tests/test_paybox.py b/tests/test_paybox.py
index 7e1e99f..0a8de60 100644
--- a/tests/test_paybox.py
+++ b/tests/test_paybox.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
from unittest import TestCase
from decimal import Decimal
import base64
@@ -7,31 +9,31 @@ import eopayment.paybox as paybox
import eopayment
BACKEND_PARAMS = {
- 'platform': 'test',
- 'site': '12345678',
- 'rang': '001',
- 'identifiant': '12345678',
- 'shared_secret': '0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF',
- 'callback': 'http://example.com/callback',
+ 'platform': u'test',
+ 'site': u'12345678',
+ 'rang': u'001',
+ 'identifiant': u'12345678',
+ 'shared_secret': u'0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF',
+ 'callback': u'http://example.com/callback',
}
class PayboxTests(TestCase):
def test_sign(self):
key = '0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF'.decode('hex')
d = dict(paybox.sign([
- ['PBX_SITE', '12345678'],
- ['PBX_RANG', '32'],
- ['PBX_IDENTIFIANT', '12345678'],
- ['PBX_TOTAL', '999'],
- ['PBX_DEVISE', '978'],
- ['PBX_CMD', 'TEST Paybox'],
- ['PBX_PORTEUR', 'test@paybox.com'],
- ['PBX_RETOUR', 'Mt:M;Ref:R;Auto:A;Erreur:E'],
- ['PBX_HASH', 'SHA512'],
- ['PBX_TIME', '2015-06-08T16:21:16+02:00'],
+ ['PBX_SITE', u'12345678'],
+ ['PBX_RANG', u'32'],
+ ['PBX_IDENTIFIANT', u'12345678'],
+ ['PBX_TOTAL', u'999'],
+ ['PBX_DEVISE', u'978'],
+ ['PBX_CMD', u'appel à Paybox'],
+ ['PBX_PORTEUR', u'test@paybox.com'],
+ ['PBX_RETOUR', u'Mt:M;Ref:R;Auto:A;Erreur:E'],
+ ['PBX_HASH', u'SHA512'],
+ ['PBX_TIME', u'2015-06-08T16:21:16+02:00'],
],
key))
- result = '475FE1C45A0D09D26D2CAC9A1AC39C024773D790F50B6DD15B260F55FCD527FD3AD4AA3998F4162EFE9BDC494B9850A673355A32ACC4F85B67F8566037836F8E'
+ result = '7E74D8E9A0DBB65AAE51C5C50C2668FD98FC99AEDF18244BB1935F602B6C2E953B61FD84364F34FDB88B049901C0A07F6040AF446BBF5589113F48A733D551D4'
self.assertIn('PBX_HMAC', d)
self.assertEqual(d['PBX_HMAC'], result)
diff --git a/tests/test_sips2.py b/tests/test_sips2.py
index 53ec055..d76a6be 100644
--- a/tests/test_sips2.py
+++ b/tests/test_sips2.py
@@ -1,14 +1,16 @@
-import pytest
-import pprint
+# -*- coding: utf-8 -*-
import eopayment
def test_build_request():
backend = eopayment.Payment('sips2', {})
- assert backend.request(amount='12')
+ transaction, f, form = backend.request(amount=u'12', last_name=u'Foo',
+ first_name=u'Félix')
+ data = [f for f in form.fields if f['name'] == 'Data']
+ assert u'Félix' in data[0]['value']
def test_options():
- payment = eopayment.Payment('sips2', {'capture_mode': 'VALIDATION'})
+ payment = eopayment.Payment('sips2', {'capture_mode': u'VALIDATION'})
assert payment.backend.get_data()['captureMode'] == 'VALIDATION'
payment = eopayment.Payment('sips2', {})