Commit b6f90aba authored by Jérome Perrin's avatar Jérome Perrin

stripe: fix test (ok for py2)

parent dc3c531b
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
############################################################################## ##############################################################################
import json import json
from six.moves import urllib
from io import BytesIO from io import BytesIO
from six.moves.urllib.parse import parse_qs from six.moves.urllib.parse import parse_qs
...@@ -461,8 +460,8 @@ class TestStripePaymentSession(ERP5TypeTestCase): ...@@ -461,8 +460,8 @@ class TestStripePaymentSession(ERP5TypeTestCase):
) )
ret = self.publish( ret = self.publish(
"%s/ERP5Site_receiveStripeWebHook" % self.portal.getPath(), "%s/ERP5Site_receiveStripeWebHook" % self.portal.getPath(),
stdin=BytesIO(urllib.parse.urlencode({ stdin=BytesIO(
"BODY": json.dumps({ json.dumps({
"url": "https://stripe.url", "url": "https://stripe.url",
"id": "evt_%s" % "abc321_expired", "id": "evt_%s" % "abc321_expired",
"object": "event", "object": "event",
...@@ -474,9 +473,10 @@ class TestStripePaymentSession(ERP5TypeTestCase): ...@@ -474,9 +473,10 @@ class TestStripePaymentSession(ERP5TypeTestCase):
"object": "checkout.session" "object": "checkout.session"
} }
} }
}) }).encode()
}).encode()), ),
request_method="POST", request_method="POST",
env={'CONTENT_TYPE': 'application/json'},
handle_errors=False) handle_errors=False)
self.assertEqual(200, ret.getStatus()) self.assertEqual(200, ret.getStatus())
self.tic() self.tic()
...@@ -658,8 +658,8 @@ class TestStripePaymentSession(ERP5TypeTestCase): ...@@ -658,8 +658,8 @@ class TestStripePaymentSession(ERP5TypeTestCase):
) )
ret = self.publish( ret = self.publish(
"%s/ERP5Site_receiveStripeWebHook" % self.portal.getPath(), "%s/ERP5Site_receiveStripeWebHook" % self.portal.getPath(),
stdin=BytesIO(urllib.parse.urlencode({ stdin=BytesIO(
"BODY": json.dumps({ json.dumps({
"id": "evt_%s" % session_id, "id": "evt_%s" % session_id,
"object": "event", "object": "event",
"data": { "data": {
...@@ -670,9 +670,10 @@ class TestStripePaymentSession(ERP5TypeTestCase): ...@@ -670,9 +670,10 @@ class TestStripePaymentSession(ERP5TypeTestCase):
"object": "checkout.session" "object": "checkout.session"
} }
} }
}) }).encode(),
}).encode()), ),
request_method="POST", request_method="POST",
env={'CONTENT_TYPE': 'application/json'},
handle_errors=False) handle_errors=False)
self.assertEqual(200, ret.getStatus()) self.assertEqual(200, ret.getStatus())
self.tic() self.tic()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment