def cart_id(url, token): res = jpost(url + "/carts", token) return res.status_code == 200 and res.json()["cart_id"]
def _f(token, _items=None): res = jpost(url + "/carts", token) cart_id = res.json()["cart_id"] jpatch(url + "/carts/%s" % cart_id, token, _items or items) return jpost(url + "/orders", token, {"cart_id": cart_id})
def test_new_carts(url, token): res = jpost(url + "/carts", token) assert res.status_code == 200 assert len(res.json().get("cart_id", "")) > 0