Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Add tests for validate voucher, payment info and get product data
IKarbowiak64541acc0098
diff --git a/tests/gateway/stripe/test_utils.py b/tests/gateway/stripe/test_utils.pyindex 87fcd40768..53af6d7132 100644--- a/tests/gateway/stripe/test_utils.py+++ b/tests/gateway/stripe/test_utils.py@@ -61,6 +61,14 @@ def test_get_payment_billing_fullname(payment_dummy):assert get_payment_billing_fullname(payment_info) == expected_fullname+def test_get_payment_billing_fullname_no_billing(payment_dummy):+ payment_info = create_payment_information(payment_dummy)+ payment_info.billing = None++ assert not payment_info.billing+ assert get_payment_billing_fullname(payment_info) == ""++def test_shipping_address_to_stripe_dict(address):address_data = AddressData(**address.as_data())expected_address_dict = {diff --git a/tests/test_order.py b/tests/test_order.pyindex 47fb53a1b2..3e25a9fbac 100644--- a/tests/test_order.py+++ b/tests/test_order.py@@ -423,6 +423,19 @@ def test_get_voucher_discount_for_order_voucher_validation()+@patch("saleor.discount.utils.validate_voucher")+def test_validate_voucher_in_order_without_voucher(+ mock_validate_voucher, order_with_lines+):+ order_with_lines.voucher = None+ order_with_lines.save()++ assert not order_with_lines.voucher++ validate_voucher_in_order(order_with_lines)+ mock_validate_voucher.assert_not_called()++@pytest.mark.parametrize("product_name, variant_name, translated_product_name, translated_variant_name,""expected_display_name",diff --git a/tests/test_seo_schema.py b/tests/test_seo_schema.pyindex f54f134b03..60fb656311 100644--- a/tests/test_seo_schema.py+++ b/tests/test_seo_schema.py@@ -40,6 +40,19 @@ def test_get_product_data_with_image(order_with_lines, product_with_image):assert result["itemOffered"]["name"] == variant.display_product()+def test_get_product_data_without_line_variant(order_with_lines):+ """Tested OrderLine Product has no image assigned."""+ line = order_with_lines.lines.first()+ organization = get_organization()+ line.variant = None+ line.save()++ assert not line.variant+ result = get_product_data(line, organization)++ assert result == {}++def test_get_order_confirmation_markup(order_with_lines):try:result = get_order_confirmation_markup(order_with_lines)