summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2019-10-29 14:30:38 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2019-10-29 15:24:44 (GMT)
commit8a6702066d806b578ddc04145ec6910e6474f553 (patch)
tree12100a31945ad70ff6adb3c879704980fded014e /tests
parent3d34d44246a90a73bad076d0d31dda6da9d08e34 (diff)
downloadeopayment-8a6702066d806b578ddc04145ec6910e6474f553.zip
eopayment-8a6702066d806b578ddc04145ec6910e6474f553.tar.gz
eopayment-8a6702066d806b578ddc04145ec6910e6474f553.tar.bz2
paybox: fix validate/cancel operations encoding handling (#37322)v1.38
Diffstat (limited to 'tests')
-rw-r--r--tests/test_paybox.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/tests/test_paybox.py b/tests/test_paybox.py
index 1782f4b..a503063 100644
--- a/tests/test_paybox.py
+++ b/tests/test_paybox.py
@@ -177,7 +177,7 @@ class PayboxTests(TestCase):
'numero_appel': ['30310733'],
'reference': ['830657461681']
}
- backend_raw_response = """NUMTRANS=0013989865&NUMAPPEL=0030378572&NUMQUESTION=0013989862&SITE=1999888&RANG=32&AUTORISATION=XXXXXX&CODEREPONSE=00000&COMMENTAIRE=Demande trait\xe9e avec succ\xe8s&REFABONNE=&PORTEUR="""
+ backend_raw_response = u"""NUMTRANS=0013989865&NUMAPPEL=0030378572&NUMQUESTION=0013989862&SITE=1999888&RANG=32&AUTORISATION=XXXXXX&CODEREPONSE=00000&COMMENTAIRE=Demande traitée avec succès&REFABONNE=&PORTEUR="""
backend_expected_response = {"CODEREPONSE": "00000",
"RANG": "32",
"AUTORISATION": "XXXXXX",
@@ -190,7 +190,7 @@ class PayboxTests(TestCase):
"NUMQUESTION": "0013989862"}
with mock.patch('eopayment.paybox.requests.post') as requests_post:
- response = mock.Mock(status_code=200, content=backend_raw_response)
+ response = mock.Mock(status_code=200, text=backend_raw_response)
requests_post.return_value = response
backend_response = getattr(backend, operation_name)(Decimal('10'), bank_data)
self.assertEqual(requests_post.call_args[0][0], 'https://preprod-ppps.paybox.com/PPPS.php')
@@ -217,14 +217,14 @@ class PayboxTests(TestCase):
params['platform'] = 'prod'
backend = eopayment.Payment('paybox', params)
with mock.patch('eopayment.paybox.requests.post') as requests_post:
- response = mock.Mock(status_code=200, content=backend_raw_response)
+ response = mock.Mock(status_code=200, text=backend_raw_response)
requests_post.return_value = response
getattr(backend, operation_name)(Decimal('10'), bank_data)
self.assertEqual(requests_post.call_args[0][0], 'https://ppps.paybox.com/PPPS.php')
with mock.patch('eopayment.paybox.requests.post') as requests_post:
- error_response = """CODEREPONSE=00015&COMMENTAIRE=PAYBOX : Transaction non trouv\xe9e"""
- response = mock.Mock(status_code=200, content=error_response)
+ error_response = u"""CODEREPONSE=00015&COMMENTAIRE=PAYBOX : Transaction non trouvée"""
+ response = mock.Mock(status_code=200, text=error_response)
requests_post.return_value = response
self.assertRaisesRegexp(eopayment.ResponseError, 'Transaction non trouvée', getattr(backend, operation_name),
Decimal('10'), bank_data)
@@ -238,7 +238,12 @@ class PayboxTests(TestCase):
'numero_appel': ['30310733'],
'reference': ['830657461681']
}
- backend_raw_response = """NUMTRANS=0013989865&NUMAPPEL=0030378572&NUMQUESTION=0013989862&SITE=1999888&RANG=32&AUTORISATION=XXXXXX&CODEREPONSE=00000&COMMENTAIRE=Demande traitée avec succès&REFABONNE=&PORTEUR="""
+ backend_raw_response = u"""NUMTRANS=0013989865&NUMAPPEL=0030378572&NUMQUESTION=0013989862&SITE=1999888&RANG=32&AUTORISATION=XXXXXX&CODEREPONSE=00000&COMMENTAIRE=Demande traitée avec succès&REFABONNE=&PORTEUR="""
+
+ with mock.patch('eopayment.paybox.requests.post') as requests_post:
+ response = mock.Mock(status_code=200, text=backend_raw_response)
+ requests_post.return_value = response
+ backend.validate(Decimal(12), bank_data)
def test_rsa_signature_validation(self):