add basic unit test for tipi
This commit is contained in:
parent
bbf699c827
commit
fd56510014
|
@ -180,14 +180,3 @@ class Payment(PaymentCommon):
|
||||||
bank_data=fields,
|
bank_data=fields,
|
||||||
transaction_id=transaction_id,
|
transaction_id=transaction_id,
|
||||||
test=test)
|
test=test)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
p = Payment({'numcli': '12345'})
|
|
||||||
print(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'))
|
|
||||||
print(p.response('objet=tout+a+fait&montant=12312&saisie=T&mel=info%40entrouvert.com&numcli=12345&exer=9999&refdet=999900000000999999&resultrans=P'))
|
|
||||||
|
|
|
@ -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
|
Loading…
Reference in New Issue