def test_update_order(): # ORDER_ID = 1 order = dict(id=1, order_lines=[dict(product_id=1, price=10, quantities=2)]) order_instance = os.load(order, partial=True) with order_instance.auto_commit(): session.add(order_instance) print(os.dump(order_instance))
def test_update_order_with_order_ids(): os = OrderSchema() order = dict(id=1, order_line_ids=[1]) order_instance = os.load(order, partial=True) with order_instance.auto_commit(): session.add(order_instance) print(os.dump(order_instance))
def test_create_order_lines_while_create_order(): ols = OrderLineSchema() order_lines = dict(product_id=1, price=10, quantities=2, order=dict()) order_lines_instance = ols.load(order_lines, partial=True) with order_lines_instance.auto_commit(): session.add(order_lines_instance) print(ols.dump(order_lines_instance))
def test_create_order(): order = dict(order_lines=[dict(product_id=1, price=100, quantities=1)]) order_instance = os.load(order, partial=True) with order_instance.auto_commit(): session.add(order_instance)
def test_create_product(): product = dict(product_name='星爸爸马克杯', sku_name='0000001', standard_price="100", ) product_instance = ps.load(product) with product_instance.auto_commit(): session.add(product_instance)