Exemplo n.º 1
0
def test_get_cached_tax_codes_or_fetch_wrong_response(monkeypatch):
    monkeypatch.setattr("saleor.extensions.plugins.avatax.cache.get",
                        lambda x, y: {})
    config = AvataxConfiguration(username_or_account="wrong_data",
                                 password_or_license="wrong_data")
    tax_codes = get_cached_tax_codes_or_fetch(config)
    assert len(tax_codes) == 0
Exemplo n.º 2
0
def test_checkout_needs_new_fetch(monkeypatch, checkout_with_item, address):
    monkeypatch.setattr("saleor.extensions.plugins.avatax.cache.get", lambda x: None)
    checkout_with_item.shipping_address = address
    config = AvataxConfiguration(
        username_or_account="wrong_data", password_or_license="wrong_data"
    )
    checkout_data = generate_request_data_from_checkout(checkout_with_item, config)
    assert checkout_needs_new_fetch(checkout_data, str(checkout_with_item.token))