diff --git a/tests/platform/test_service_cart_discounts.py b/tests/platform/test_service_cart_discounts.py index a239ef9f..88bdebf9 100644 --- a/tests/platform/test_service_cart_discounts.py +++ b/tests/platform/test_service_cart_discounts.py @@ -18,7 +18,7 @@ def test_cart_discount_with_id(ct_platform_client: Client): value=models.CartDiscountValueRelative(permyriad=10), cart_predicate="", sort_order="", - requires_discount_code=False + requires_discount_code=False, ) ) ) @@ -33,13 +33,13 @@ def test_cart_discount_with_id(ct_platform_client: Client): ) assert cart_discount.id - with pytest.raises(HTTPError): - ( - ct_platform_client.with_project_key("unittest") - .cart_discounts() - .with_id("invalid") - .get() - ) + cart_discount = ( + ct_platform_client.with_project_key("unittest") + .cart_discounts() + .with_id("invalid") + .get() + ) + assert cart_discount is None def test_cart_discount_query(ct_platform_client: Client): diff --git a/tests/platform/test_service_categories.py b/tests/platform/test_service_categories.py index 4fb2d189..6a438054 100644 --- a/tests/platform/test_service_categories.py +++ b/tests/platform/test_service_categories.py @@ -30,10 +30,13 @@ def test_category_with_id_get(ct_platform_client: Client): assert category.id assert category.key == "test-category" - with pytest.raises(HTTPError): - ct_platform_client.with_project_key("unittest").categories().with_id( - "invalid" - ).get() + category = ( + ct_platform_client.with_project_key("unittest") + .categories() + .with_id("invalid") + .get() + ) + assert category is None def test_category_get_by_key(ct_platform_client: Client): @@ -61,10 +64,13 @@ def test_category_get_by_key(ct_platform_client: Client): assert category.id assert category.key == "test-category" - with pytest.raises(HTTPError): - ct_platform_client.with_project_key("unittest").categories().with_key( - "invalid" - ).get() + category = ( + ct_platform_client.with_project_key("unittest") + .categories() + .with_key("invalid") + .get() + ) + assert category is None def test_category_query(ct_platform_client: Client): diff --git a/tests/platform/test_service_channels.py b/tests/platform/test_service_channels.py index 58088e3e..568d2914 100644 --- a/tests/platform/test_service_channels.py +++ b/tests/platform/test_service_channels.py @@ -28,10 +28,13 @@ def test_channel_with_id_get(ct_platform_client: Client): assert channel.id assert channel.key == "test-channel" - with pytest.raises(HTTPError): - ct_platform_client.with_project_key("unittest").channels().with_id( - "invalid" - ).get() + channel = ( + ct_platform_client.with_project_key("unittest") + .channels() + .with_id("invalid") + .get() + ) + assert channel is None def test_channel_query(ct_platform_client: Client): diff --git a/tests/platform/test_service_custom_objects.py b/tests/platform/test_service_custom_objects.py index eb697764..9e669bf6 100644 --- a/tests/platform/test_service_custom_objects.py +++ b/tests/platform/test_service_custom_objects.py @@ -32,10 +32,13 @@ def test_custom_object_get_by_container_and_key(ct_platform_client: Client): assert custom_object.key == "test-object" assert custom_object.value == 1234 - with pytest.raises(HTTPError): - ct_platform_client.with_project_key( - "unittest" - ).custom_objects().with_container_and_key("invalid", "invalid").get() + custom_object = ( + ct_platform_client.with_project_key("unittest") + .custom_objects() + .with_container_and_key("invalid", "invalid") + .get() + ) + assert custom_object is None def test_custom_object_query(ct_platform_client: Client): @@ -156,9 +159,11 @@ def test_delete_by_container_and_key(ct_platform_client: Client): assert deleted_object.key == "test-object-1" - with pytest.raises(HTTPError): - ct_platform_client.with_project_key( - "unittest" - ).custom_objects().with_container_and_key( + deleted_object = ( + ct_platform_client.with_project_key("unittest") + .custom_objects() + .with_container_and_key( container=custom_object.container, key=custom_object.key - ).delete() + ) + .delete() + ) diff --git a/tests/platform/test_service_discount_codes.py b/tests/platform/test_service_discount_codes.py index a3b1fd8e..420402e0 100644 --- a/tests/platform/test_service_discount_codes.py +++ b/tests/platform/test_service_discount_codes.py @@ -35,10 +35,13 @@ def test_discount_code_with_id_get(ct_platform_client: Client): assert discount_code.id assert discount_code.code == "1337" - with pytest.raises(HTTPError): - ct_platform_client.with_project_key("unittest").discount_codes().with_id( - "invalid" - ).get() + discount_code = ( + ct_platform_client.with_project_key("unittest") + .discount_codes() + .with_id("invalid") + .get() + ) + assert discount_code is None def test_discount_code_query(ct_platform_client: Client): diff --git a/tests/platform/test_service_order.py b/tests/platform/test_service_order.py index bea19478..5fb274f9 100644 --- a/tests/platform/test_service_order.py +++ b/tests/platform/test_service_order.py @@ -236,7 +236,7 @@ def get_test_order(): total_gross=models.CentPrecisionMoney( cent_amount=1000, currency_code="GBP", fraction_digits=2 ), - tax_portions=[] + tax_portions=[], ), shipping_method_state=models.ShippingMethodState.MATCHES_CART, ), @@ -301,7 +301,7 @@ def get_test_order(): total_gross=models.CentPrecisionMoney( cent_amount=1190, currency_code="GBP", fraction_digits=2 ), - tax_portions=[] + tax_portions=[], ), line_item_mode=models.LineItemMode.STANDARD, ) diff --git a/tests/platform/test_service_product_projections.py b/tests/platform/test_service_product_projections.py index 290b8927..36c43c3c 100644 --- a/tests/platform/test_service_product_projections.py +++ b/tests/platform/test_service_product_projections.py @@ -35,10 +35,13 @@ def test_product_projections_with_id_get(ct_platform_client: Client): def test_product_projections_get_by_id_not_found(ct_platform_client: Client): - with pytest.raises(HTTPError): - ct_platform_client.with_project_key("unittest").products().with_id( - "invalid" - ).get() + product = ( + ct_platform_client.with_project_key("unittest") + .products() + .with_id("invalid") + .get() + ) + assert product is None def test_product_projections_get_by_key(ct_platform_client: Client): @@ -83,10 +86,13 @@ def test_product_projections_query_parameters_are_passed( def test_product_projections_get_by_key_not_found(ct_platform_client: Client): - with pytest.raises(HTTPError): - ct_platform_client.with_project_key("unittest").products().with_id( - "invalid" - ).get() + product = ( + ct_platform_client.with_project_key("unittest") + .products() + .with_id("invalid") + .get() + ) + assert product is None def test_product_projections_query(ct_platform_client: Client): diff --git a/tests/platform/test_service_product_types.py b/tests/platform/test_service_product_types.py index dc9c485a..4186c56e 100644 --- a/tests/platform/test_service_product_types.py +++ b/tests/platform/test_service_product_types.py @@ -28,10 +28,13 @@ def test_product_types_with_id_get(ct_platform_client: Client): assert product_type.id assert product_type.key == "test-product-type" - with pytest.raises(HTTPError) as e: - ct_platform_client.with_project_key("unittest").product_types().with_id( - "invalid" - ).get() + product_type = ( + ct_platform_client.with_project_key("unittest") + .product_types() + .with_id("invalid") + .get() + ) + assert product_type is None def test_product_types_get_by_key(ct_platform_client: Client): @@ -57,10 +60,13 @@ def test_product_types_get_by_key(ct_platform_client: Client): assert product_type.id assert product_type.key == "test-product-type" - with pytest.raises(HTTPError) as e: - ct_platform_client.with_project_key("unittest").product_types().with_id( - "invalid" - ).get() + product_type = ( + ct_platform_client.with_project_key("unittest") + .product_types() + .with_id("invalid") + .get() + ) + assert product_type is None def test_product_type_query(ct_platform_client: Client): diff --git a/tests/platform/test_service_products.py b/tests/platform/test_service_products.py index 14734228..5cd5a6c7 100644 --- a/tests/platform/test_service_products.py +++ b/tests/platform/test_service_products.py @@ -90,10 +90,13 @@ def test_products_with_id_get(ct_platform_client: Client): assert product.id assert product.key == "test-product" - with pytest.raises(HTTPError) as e: - ct_platform_client.with_project_key("unittest").products().with_id( - "invalid" - ).get() + product = ( + ct_platform_client.with_project_key("unittest") + .products() + .with_id("invalid") + .get() + ) + assert product is None def test_products_get_by_key(ct_platform_client: Client): @@ -123,10 +126,13 @@ def test_products_get_by_key(ct_platform_client: Client): assert product.id assert product.key == "test-product" - with pytest.raises(HTTPError) as e: - ct_platform_client.with_project_key("unittest").products().with_key( - "invalid" - ).get() + product = ( + ct_platform_client.with_project_key("unittest") + .products() + .with_key("invalid") + .get() + ) + assert product is None def test_product_query(ct_platform_client: Client): diff --git a/tests/platform/test_service_shipping_methods.py b/tests/platform/test_service_shipping_methods.py index 84dad4eb..df4149e0 100644 --- a/tests/platform/test_service_shipping_methods.py +++ b/tests/platform/test_service_shipping_methods.py @@ -34,10 +34,13 @@ def test_shipping_method_with_id_get(ct_platform_client: Client): assert shipping_method.id assert shipping_method.key == "test-shipping-method" - with pytest.raises(HTTPError): - ct_platform_client.with_project_key("unittest").shipping_methods().with_id( - "invalid" - ).get() + shipping_method = ( + ct_platform_client.with_project_key("unittest") + .shipping_methods() + .with_id("invalid") + .get() + ) + assert shipping_method is None def test_shipping_method_query(ct_platform_client: Client):