Skip to content

Commit

Permalink
Validate script generation if billing email is not set
Browse files Browse the repository at this point in the history
It should generate the script as expected
  • Loading branch information
XaviTorello committed May 14, 2019
1 parent 81019c8 commit 226841a
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions payments/stripe/test_stripe.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,28 @@ def test_form_contains_stripe_script(self):
PUBLIC_KEY, store_name)
in str(form))

def test_form_contains_stripe_script_withou_billing_email(self):
"""
If billing email is not set, it should generate the script as expected
"""
payment = Payment()
store_name = 'Test store'
provider = StripeProvider(
name=store_name,
secret_key=SECRET_KEY, public_key=PUBLIC_KEY)

form = provider.get_form(payment)

payment.billing_email = None
form = provider.get_form(payment)
self.assertTrue(
'<script class="stripe-button" data-amount="10000" '
'data-currency="USD" data-description="payment" '
'data-image="" data-key="%s" data-name="%s" '
'src="https://checkout.stripe.com/checkout.js"></script>' % (
PUBLIC_KEY, store_name)
in str(form))

def test_provider_raises_redirect_needed_when_token_does_not_exist(self):
payment = Payment()
provider = StripeProvider(
Expand Down

0 comments on commit 226841a

Please sign in to comment.