def test_shipping_method_update(client):
    """Test the return value of the update methods.

    It doesn't test the actual update itself.
    TODO: See if this is worth testing since we're using a mocking backend
    """
    shipping_method = client.shipping_methods.create(
        types.ShippingMethodDraft(
            key="test-shipping-method",
            name="test shipping method",
            tax_category=types.TaxCategoryResourceIdentifier(id="dummy"),
            zone_rates=[],
            is_default=False,
        ))
    assert shipping_method.key == "test-shipping-method"

    shipping_method = client.shipping_methods.update_by_id(
        id=shipping_method.id,
        version=shipping_method.version,
        actions=[
            types.ShippingMethodChangeNameAction(name="shipping-method-2")
        ],
    )

    assert shipping_method.key == "test-shipping-method"
Example #2
0
def test_shipping_method_update(client):
    """Test the return value of the update methods.

    It doesn't test the actual update itself.
    TODO: See if this is worth testing since we're using a mocking backend
    """
    shipping_method = client.shipping_methods.create(
        types.ShippingMethodDraft(key="test-shipping-method",
                                  name="test shipping method"))
    assert shipping_method.key == "test-shipping-method"

    shipping_method = client.shipping_methods.update_by_id(
        id=shipping_method.id,
        version=shipping_method.version,
        actions=[
            types.ShippingMethodChangeNameAction(name="shipping-method-2")
        ],
    )

    assert shipping_method.key == "test-shipping-method"
Example #3
0
 def post_load(self, data, **kwargs):
     del data["action"]
     return types.ShippingMethodChangeNameAction(**data)