def test_widget_with_additional_attr(stripe_payment, gateway_params): payment_info = create_payment_information(stripe_payment) widget = StripeCheckoutWidget(payment_info, gateway_params, attrs={'data-custom': 'custom-data'}) assert 'data-custom="custom-data"' in widget.render()
def test_widget_with_additional_attr(stripe_payment, gateway_config): payment_info = create_payment_information(stripe_payment) widget = StripeCheckoutWidget( payment_info, gateway_config.connection_params, attrs={"data-custom": "custom-data"}, ) assert 'data-custom="custom-data"' in widget.render()
def test_widget_with_additional_attr(stripe_payment, gateway_config): payment_info = create_payment_information(stripe_payment) widget = StripeCheckoutWidget( payment_info, gateway_config.connection_params, attrs={"data-custom": "custom-data"}, ) assert 'data-custom="custom-data"' in widget.render()
def test_widget_with_prefill_option(stripe_payment, gateway_config): payment_info = create_payment_information(stripe_payment) connection_params = gateway_config.connection_params connection_params["prefill"] = True widget = StripeCheckoutWidget(payment_info, connection_params) assert 'data-email="*****@*****.**"' in widget.render() connection_params["prefill"] = False widget = StripeCheckoutWidget(payment_info, connection_params) assert 'data-email="*****@*****.**"' not in widget.render()
def test_widget_with_enable_shipping_address_option(stripe_payment, gateway_params): payment_info = create_payment_information(stripe_payment, FAKE_TOKEN) gateway_params['enable_shipping_address'] = True widget = StripeCheckoutWidget(payment_info, gateway_params) assert 'data-shipping-address="true"' in widget.render() gateway_params['enable_shipping_address'] = False widget = StripeCheckoutWidget(payment_info, gateway_params) assert 'data-shipping-address="false"' in widget.render()
def test_widget_with_default_options(stripe_payment, gateway_params): widget = StripeCheckoutWidget(stripe_payment, gateway_params) assert widget.render() == ( '<script class="stripe-button" data-allow-remember-me="true" ' 'data-amount="4242" data-billing-address="false" data-currency="USD" ' 'data-description="Total payment" data-email="*****@*****.**" ' 'data-image="image.gif" data-key="public" data-locale="auto" ' 'data-name="Saleor" data-shipping-address="false" ' 'data-zip-code="false" src="https://checkout.stripe.com/checkout.js">' '</script>')
def test_widget_with_remember_me_option(stripe_payment, gateway_params): payment_info = create_payment_information(stripe_payment) gateway_params['remember_me'] = True widget = StripeCheckoutWidget(payment_info, gateway_params) assert 'data-allow-remember-me="true"' in widget.render() gateway_params['remember_me'] = False widget = StripeCheckoutWidget(payment_info, gateway_params) assert 'data-allow-remember-me="false"' in widget.render()
def test_widget_with_prefill_option(stripe_payment, gateway_params): payment_info = create_payment_information(stripe_payment) gateway_params['prefill'] = True widget = StripeCheckoutWidget(payment_info, gateway_params) assert 'data-email="*****@*****.**"' in widget.render() gateway_params['prefill'] = False widget = StripeCheckoutWidget(payment_info, gateway_params) assert 'data-email="*****@*****.**"' not in widget.render()
def test_widget_with_remember_me_option(stripe_payment, gateway_config): payment_info = create_payment_information(stripe_payment) connection_params = gateway_config.connection_params connection_params["remember_me"] = True widget = StripeCheckoutWidget(payment_info, connection_params) assert 'data-allow-remember-me="true"' in widget.render() connection_params["remember_me"] = False widget = StripeCheckoutWidget(payment_info, connection_params) assert 'data-allow-remember-me="false"' in widget.render()
def test_widget_with_enable_shipping_address_option(stripe_payment, gateway_config): payment_info = create_payment_information(stripe_payment, FAKE_TOKEN) connection_params = gateway_config.connection_params connection_params["enable_shipping_address"] = True widget = StripeCheckoutWidget(payment_info, connection_params) assert 'data-shipping-address="true"' in widget.render() connection_params["enable_shipping_address"] = False widget = StripeCheckoutWidget(payment_info, connection_params) assert 'data-shipping-address="false"' in widget.render()
def test_widget_with_default_options(stripe_payment, gateway_params): payment_info = create_payment_information(stripe_payment) widget = StripeCheckoutWidget(payment_info, gateway_params) assert widget.render() == ( '<script class="stripe-button" data-allow-remember-me="true" ' 'data-amount="4242" data-billing-address="false" data-currency="USD" ' 'data-description="Total payment" data-email="*****@*****.**" ' 'data-image="image.gif" data-key="public" data-locale="auto" ' 'data-name="Saleor" data-shipping-address="false" ' 'data-zip-code="false" src="https://checkout.stripe.com/checkout.js">' '</script>')
def test_widget_with_enable_billing_address_option(stripe_payment, gateway_params): gateway_params['enable_billing_address'] = True widget = StripeCheckoutWidget(stripe_payment, gateway_params) assert 'data-billing-address="true"' in widget.render() assert 'data-zip-code="true"' in widget.render() gateway_params['enable_billing_address'] = False widget = StripeCheckoutWidget(stripe_payment, gateway_params) assert 'data-billing-address="false"' in widget.render() assert 'data-zip-code="false"' in widget.render()
def test_widget_with_enable_billing_address_option(stripe_payment, gateway_params): payment_info = create_payment_information(stripe_payment, FAKE_TOKEN) gateway_params["enable_billing_address"] = True widget = StripeCheckoutWidget(payment_info, gateway_params) assert 'data-billing-address="true"' in widget.render() assert 'data-zip-code="true"' in widget.render() gateway_params["enable_billing_address"] = False widget = StripeCheckoutWidget(payment_info, gateway_params) assert 'data-billing-address="false"' in widget.render() assert 'data-zip-code="false"' in widget.render()
def test_widget_with_remember_me_option(stripe_payment, gateway_params): gateway_params['remember_me'] = True widget = StripeCheckoutWidget(stripe_payment, gateway_params) assert 'data-allow-remember-me="true"' in widget.render() gateway_params['remember_me'] = False widget = StripeCheckoutWidget(stripe_payment, gateway_params) assert 'data-allow-remember-me="false"' in widget.render()
def test_widget_with_prefill_option(stripe_payment, gateway_params): gateway_params['prefill'] = True widget = StripeCheckoutWidget(stripe_payment, gateway_params) assert 'data-email="*****@*****.**"' in widget.render() gateway_params['prefill'] = False widget = StripeCheckoutWidget(stripe_payment, gateway_params) assert 'data-email="*****@*****.**"' not in widget.render()
def test_widget_with_prefill_option(stripe_payment, gateway_config): payment_info = create_payment_information(stripe_payment) connection_params = gateway_config.connection_params connection_params["prefill"] = True widget = StripeCheckoutWidget(payment_info, connection_params) assert 'data-email="*****@*****.**"' in widget.render() connection_params["prefill"] = False widget = StripeCheckoutWidget(payment_info, connection_params) assert 'data-email="*****@*****.**"' not in widget.render()
def test_widget_with_remember_me_option(stripe_payment, gateway_params): payment_info = create_payment_information(stripe_payment) gateway_params["remember_me"] = True widget = StripeCheckoutWidget(payment_info, gateway_params) assert 'data-allow-remember-me="true"' in widget.render() gateway_params["remember_me"] = False widget = StripeCheckoutWidget(payment_info, gateway_params) assert 'data-allow-remember-me="false"' in widget.render()
def test_widget_with_enable_address_option(stripe_payment, gateway_config): payment_info = create_payment_information(stripe_payment, FAKE_TOKEN) connection_params = gateway_config.connection_params connection_params["enable_address"] = True widget = StripeCheckoutWidget(payment_info, connection_params) assert 'data-address="true"' in widget.render() connection_params["enable_address"] = False widget = StripeCheckoutWidget(payment_info, connection_params) assert 'data-address="false"' in widget.render()
def test_widget_with_additional_attr(stripe_payment, gateway_params): payment_info = create_payment_information(stripe_payment) widget = StripeCheckoutWidget( payment_info, gateway_params, attrs={'data-custom': 'custom-data'}) assert 'data-custom="custom-data"' in widget.render()