当前位置: 首页>>代码示例>>Python>>正文


Python BasketishOrderSource.status方法代码示例

本文整理汇总了Python中shoop_tests.utils.basketish_order_source.BasketishOrderSource.status方法的典型用法代码示例。如果您正苦于以下问题:Python BasketishOrderSource.status方法的具体用法?Python BasketishOrderSource.status怎么用?Python BasketishOrderSource.status使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在shoop_tests.utils.basketish_order_source.BasketishOrderSource的用法示例。


在下文中一共展示了BasketishOrderSource.status方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: seed_source

# 需要导入模块: from shoop_tests.utils.basketish_order_source import BasketishOrderSource [as 别名]
# 或者: from shoop_tests.utils.basketish_order_source.BasketishOrderSource import status [as 别名]
def seed_source(user, shop):
    source = BasketishOrderSource(shop)
    source.status = get_initial_order_status()
    source.customer = get_person_contact(user)
    source.payment_method = get_default_payment_method()
    source.shipping_method = get_default_shipping_method()
    return source
开发者ID:00WhengWheng,项目名称:shuup,代码行数:9,代码来源:test_order_source.py

示例2: test_package

# 需要导入模块: from shoop_tests.utils.basketish_order_source import BasketishOrderSource [as 别名]
# 或者: from shoop_tests.utils.basketish_order_source.BasketishOrderSource import status [as 别名]
def test_package():
    shop = get_default_shop()
    supplier = get_default_supplier()
    package_product = create_product("PackageParent", shop=shop, supplier=supplier)
    assert not package_product.get_package_child_to_quantity_map()
    children = [create_product("PackageChild-%d" % x, shop=shop, supplier=supplier) for x in range(4)]
    package_def = {child: 1 + i for (i, child) in enumerate(children)}
    package_product.make_package(package_def)
    assert package_product.mode == ProductMode.PACKAGE_PARENT
    package_product.save()
    sp = package_product.get_shop_instance(shop)
    assert not list(sp.get_orderability_errors(supplier=supplier, quantity=1, customer=AnonymousContact()))

    with pytest.raises(ValueError):  # Test re-packaging fails
        package_product.make_package(package_def)

    # Check that OrderCreator can deal with packages

    source = BasketishOrderSource()
    source.lines.append(SourceLine(
        type=OrderLineType.PRODUCT,
        product=package_product,
        supplier=get_default_supplier(),
        quantity=10,
        unit_price=TaxlessPrice(10),
    ))

    source.shop = get_default_shop()
    source.status = get_initial_order_status()
    creator = OrderCreator(request=None)
    order = creator.create_order(source)
    pids_to_quantities = order.get_product_ids_and_quantities()
    for child, quantity in six.iteritems(package_def):
        assert pids_to_quantities[child.pk] == 10 * quantity
开发者ID:charn,项目名称:shoop,代码行数:36,代码来源:test_product_packages.py

示例3: get_order_and_source

# 需要导入模块: from shoop_tests.utils.basketish_order_source import BasketishOrderSource [as 别名]
# 或者: from shoop_tests.utils.basketish_order_source.BasketishOrderSource import status [as 别名]
def get_order_and_source(admin_user):
    # create original source to tamper with
    source = BasketishOrderSource(get_default_shop())
    source.status = get_initial_order_status()
    source.billing_address = MutableAddress.objects.create(name="Original Billing")
    source.shipping_address = MutableAddress.objects.create(name="Original Shipping")
    source.customer = get_person_contact(admin_user)
    source.payment_method = get_default_payment_method()
    source.shipping_method = get_default_shipping_method()
    source.add_line(
        type=OrderLineType.PRODUCT,
        product=get_default_product(),
        supplier=get_default_supplier(),
        quantity=1,
        base_unit_price=source.create_price(10),
    )
    source.add_line(
        type=OrderLineType.OTHER,
        quantity=1,
        base_unit_price=source.create_price(10),
        require_verification=True,
    )
    assert len(source.get_lines()) == 2
    source.creator = admin_user
    creator = OrderCreator()
    order = creator.create_order(source)
    return order, source
开发者ID:00WhengWheng,项目名称:shuup,代码行数:29,代码来源:test_order_modifier.py

示例4: seed_source

# 需要导入模块: from shoop_tests.utils.basketish_order_source import BasketishOrderSource [as 别名]
# 或者: from shoop_tests.utils.basketish_order_source.BasketishOrderSource import status [as 别名]
def seed_source(user):
    source = BasketishOrderSource(get_default_shop())
    billing_address = get_address()
    shipping_address = get_address(name="Shippy Doge")
    source.status = get_initial_order_status()
    source.billing_address = billing_address
    source.shipping_address = shipping_address
    source.customer = get_person_contact(user)
    source.payment_method = get_default_payment_method()
    source.shipping_method = get_default_shipping_method()
    assert source.payment_method_id == get_default_payment_method().id
    assert source.shipping_method_id == get_default_shipping_method().id
    return source
开发者ID:DemOneEh,项目名称:shoop,代码行数:15,代码来源:test_order_creator.py

示例5: get_order_source_with_a_package

# 需要导入模块: from shoop_tests.utils.basketish_order_source import BasketishOrderSource [as 别名]
# 或者: from shoop_tests.utils.basketish_order_source.BasketishOrderSource import status [as 别名]
def get_order_source_with_a_package():
    package_product = get_package_product()

    source = BasketishOrderSource(get_default_shop())
    source.add_line(
        type=OrderLineType.PRODUCT,
        product=package_product,
        supplier=get_default_supplier(),
        quantity=10,
        base_unit_price=source.create_price(10),
        sku=package_product.sku,
        text=package_product.name,
    )

    source.status = get_initial_order_status()
    return source
开发者ID:00WhengWheng,项目名称:shuup,代码行数:18,代码来源:test_product_packages.py

示例6: test_order_creator_parent_linkage

# 需要导入模块: from shoop_tests.utils.basketish_order_source import BasketishOrderSource [as 别名]
# 或者: from shoop_tests.utils.basketish_order_source.BasketishOrderSource import status [as 别名]
def test_order_creator_parent_linkage():
    """
    Test OrderCreator creates parent links from OrderSource.
    """
    source = BasketishOrderSource(get_default_shop())
    source.status = get_initial_order_status()
    source.add_line(
        line_id='LINE1',
        type=OrderLineType.OTHER, quantity=1,
        sku='parent', text='Parent line',
    )
    source.add_line(
        line_id='LINE1.1',
        parent_line_id='LINE1',
        type=OrderLineType.OTHER, quantity=1,
        sku='child1.1', text='Child line 1.1',
    )
    source.add_line(
        line_id='LINE1.2',
        parent_line_id='LINE1',
        type=OrderLineType.OTHER, quantity=1,
        sku='child1.2', text='Child line 1.2',
    )
    source.add_line(
        line_id='LINE1.2.1',
        parent_line_id='LINE1.2',
        type=OrderLineType.OTHER, quantity=1,
        sku='child1.2.1', text='Child line 1.2.1',
    )
    source.add_line(
        line_id='LINE1.3',
        parent_line_id='LINE1',
        type=OrderLineType.OTHER, quantity=1,
        sku='child1.3', text='Child line 1.3',
    )
    order = OrderCreator().create_order(source)

    lines = [prettify_order_line(line) for line in order.lines.all()]
    assert lines == [
        '#0 1 x parent',
        '#1   1 x child1.1, child of #0',
        '#2   1 x child1.2, child of #0',
        '#3     1 x child1.2.1, child of #2',
        '#4   1 x child1.3, child of #0',
    ]
开发者ID:00WhengWheng,项目名称:shuup,代码行数:47,代码来源:test_product_packages.py


注:本文中的shoop_tests.utils.basketish_order_source.BasketishOrderSource.status方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。