def test_is_empty_with_multiple_items():
    cart = Cart()

    add_item(cart, 3)
    add_item(cart, 1)
    add_item(cart, 6)

    assert not cart.is_empty()
示例#2
0
def test_is_empty_with_multiple_items():
    cart = Cart()

    add_item(cart, 3)
    add_item(cart, 1)
    add_item(cart, 6)

    assert not cart.is_empty()
示例#3
0
    def place_order(self, article_quantity):
        payment_method = PaymentMethod.bank_transfer

        cart = Cart()
        cart.add_item(self.article, article_quantity)

        return order_service.place_order(self.shop.id, self.orderer,
                                         payment_method, cart)
示例#4
0
    def place_order(self, articles_with_quantity):
        orderer = create_orderer(self.buyer)

        cart = Cart()
        for article, quantity in articles_with_quantity:
            cart.add_item(article, quantity)

        return order_service.place_order(self.shop.id, orderer,
                                         ANY_PAYMENT_METHOD, cart)
示例#5
0
    def place_order(self, quantified_articles):
        orderer = create_orderer(self.orderer)
        payment_method = PaymentMethod.bank_transfer
        cart = Cart()

        for article, quantity_to_order in quantified_articles:
            cart.add_item(article, quantity_to_order)

        return order_service.place_order(self.shop.id, orderer, payment_method,
                                         cart)
示例#6
0
    def place_order(self, articles):
        payment_method = PaymentMethod.bank_transfer

        cart = Cart()
        for article, quantity in articles:
            cart.add_item(article, quantity)

        order, _ = order_service.place_order(self.shop.id, self.orderer,
                                             payment_method, cart)

        return order
示例#7
0
    def create_cart(self):
        cart = Cart()

        cart.add_item(self.article_bungalow, 1)
        cart.add_item(self.article_guest_fee, 1)
        cart.add_item(self.article_table, 2)

        return cart
示例#8
0
    def place_order(self, shop_id, orderer):
        payment_method = PaymentMethod.bank_transfer

        cart = Cart()

        order, _ = order_service.place_order(shop_id, orderer, payment_method,
                                             cart)

        return order
示例#9
0
文件: base.py 项目: leathe/byceps
    def place_order_with_items(self, shop_id, orderer, created_at,
                               items_with_quantity):
        orderer = create_orderer(orderer)
        payment_method = PaymentMethod.bank_transfer
        cart = Cart()

        if items_with_quantity is not None:
            for article, quantity in items_with_quantity:
                cart.add_item(article, quantity)

        order, _ = order_service.place_order(self.shop.id, orderer,
                                             payment_method, cart)

        if created_at is not None:
            db_order = Order.query.get(order.id)
            db_order.created_at = created_at
            self.db.session.commit()

        return order.id
def test_is_empty_with_one_item():
    cart = Cart()

    add_item(cart, 1)

    assert not cart.is_empty()
def test_is_empty_without_items():
    cart = Cart()

    assert cart.is_empty()
示例#12
0
def test_is_empty_with_one_item():
    cart = Cart()

    add_item(cart, 1)

    assert not cart.is_empty()
示例#13
0
def test_is_empty_without_items():
    cart = Cart()

    assert cart.is_empty()