labd / commercetools-python-sdk

Commercetools Python SDK
https://commercetools-python-sdk.readthedocs.io/en/latest/
MIT License
17 stars 16 forks source link

predicate with date not allowed #128

Open davidweterings opened 3 years ago

davidweterings commented 3 years ago

Commercetools allows predicates like lastModifiedAt > "2021-05-01" but it gives a marshmallow validation error.

def test_orders_query_filter_single_date(commercetools_api, old_client):
    order = get_test_order()
    commercetools_api.orders.add_existing(order)
    where = [
        'createdAt >= "2019-10-15"',
    ]

    results = old_client.orders.query(where=where)
    assert results.total == 1

Probably have to handle/detect in testing/predicates.py 503 if it's a datetime and convert to a valid datetime