summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2018-07-25 09:04:54 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2018-07-26 14:26:03 (GMT)
commit12e836b6c7d33464a22930d043bf88ff073888f4 (patch)
treec189ec34493011d242fd966f355406678681c42e /tests
parent887832bc5fb442ef887e8690c5353bf833854c32 (diff)
downloadeopayment-12e836b6c7d33464a22930d043bf88ff073888f4.zip
eopayment-12e836b6c7d33464a22930d043bf88ff073888f4.tar.gz
eopayment-12e836b6c7d33464a22930d043bf88ff073888f4.tar.bz2
add basic unit test for tipi
Diffstat (limited to 'tests')
-rw-r--r--tests/test_tipi.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/test_tipi.py b/tests/test_tipi.py
new file mode 100644
index 0000000..2f8a665
--- /dev/null
+++ b/tests/test_tipi.py
@@ -0,0 +1,25 @@
+from decimal import Decimal
+from six.moves.urllib.parse import urlparse, parse_qs
+import eopayment
+
+def test_tipi():
+ p = eopayment.Payment('tipi', {'numcli': '12345'})
+ payment_id, kind, url = p.request(amount=Decimal('123.12'),
+ exer=9999,
+ refdet=999900000000999999,
+ objet='tout a fait',
+ email='info@entrouvert.com',
+ urlcl='http://example.com/tipi/test',
+ saisie='T')
+ parsed_qs = parse_qs(urlparse(url).query)
+ assert parsed_qs['objet'][0].startswith('tout a fait ')
+ assert parsed_qs['montant'] == ['12312']
+ assert parsed_qs['saisie'] == ['T']
+ assert parsed_qs['mel'] == ['info@entrouvert.com']
+ assert parsed_qs['numcli'] == ['12345']
+ assert parsed_qs['exer'] == ['9999']
+ assert parsed_qs['refdet'] == ['999900000000999999']
+
+ response = p.response('objet=tout+a+fait&montant=12312&saisie=T&mel=info%40entrouvert.com&numcli=12345&exer=9999&refdet=999900000000999999&resultrans=P')
+ assert response.signed # ...
+ assert response.result == eopayment.PAID