summaryrefslogtreecommitdiff
path: root/addons/payment_stripe/tests
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-06-28 19:01:52 +0200
committerChristophe Simonis <chs@odoo.com>2018-06-28 19:01:52 +0200
commitc8bb02141d2801c243ae65ba6800b07f090bb5c6 (patch)
tree2d099c5577df4783a6db3d853cf0141bf41c1aa9 /addons/payment_stripe/tests
parent4e2733e83a1f42773fb28f66431a0d6fb0393be9 (diff)
parent3cdcbce93cbde548d2d24426ee8de1d93f06706e (diff)
[MERGE] forward port branch saas-11.3 up to 3cdcbce93cb
Diffstat (limited to 'addons/payment_stripe/tests')
-rw-r--r--addons/payment_stripe/tests/test_stripe.py25
1 files changed, 4 insertions, 21 deletions
diff --git a/addons/payment_stripe/tests/test_stripe.py b/addons/payment_stripe/tests/test_stripe.py
index 33d7e72c671..5308f54dbe0 100644
--- a/addons/payment_stripe/tests/test_stripe.py
+++ b/addons/payment_stripe/tests/test_stripe.py
@@ -56,31 +56,14 @@ class StripeTest(StripeCommon):
# ----------------------------------------
# Test: button direct rendering
# ----------------------------------------
- form_values = {
- 'amount': 320.0,
- 'currency': 'EUR',
- 'address_line1': 'Huge Street 2/543',
- 'address_city': 'Sin City',
- 'address_country': 'Belgium',
- 'email': 'norbert.buyer@example.com',
- 'address_zip': '1000',
- 'name': 'Norbert Buyer',
- 'phone': '0032 12 34 56 78'
- }
# render the button
- res = self.stripe.render('SO404', 320.0, self.currency_euro.id, values=self.buyer_values)
- post_url = "https://checkout.stripe.com/checkout.js"
- email = "norbert.buyer@example.com"
+ res = self.stripe.render('SO404', 320.0, self.currency_euro.id, values=self.buyer_values).decode('utf-8')
+ popup_script_src = 'script src="https://checkout.stripe.com/checkout.js"'
# check form result
- if "https://checkout.stripe.com/checkout.js" in res[0]:
- self.assertEqual(post_url, 'https://checkout.stripe.com/checkout.js', 'Stripe: wrong form POST url')
+ self.assertIn(popup_script_src, res, "Stripe: popup script not found in template render")
# Generated and received
- if email in res[0]:
- self.assertEqual(
- email, form_values.get('email'),
- 'Stripe: wrong value for input %s: received %s instead of %s' % (email, email, form_values.get('email'))
- )
+ self.assertIn(self.buyer_values.get('partner_email'), res, 'Stripe: email input not found in rendered template')
def test_30_stripe_form_management(self):
self.assertEqual(self.stripe.environment, 'test', 'test without test environment')