def test_new_cart(): _, token = next(token_gen) res = json_post("/carts", token) assert res.status_code == 200 cart_id = res.json().get("cart_id", "") assert len(cart_id) > 0 # carts should not equal to each other cart_id2 = json_post("/carts", token).json().get("cart_id") assert cart_id != cart_id2
def _make(cart_id, token, food_items): res = json_post("/orders", token, {"cart_id": cart_id}) if res.status_code == 200: for food_item in food_items: food_store[food_item["food_id"]]["stock"] -= 1 return res
def _make(cart_id, token, item_items): res = json_post("/orders", token, {"cart_id": cart_id}) if res.status_code == 200: for item_item in item_items: item_store[item_item["item_id"]]["stock"] -= 1 return res