def test_is_available_with_start_and_end(now, expected):
    article = create_article(
        available_from=datetime(2014, 9, 15, 18, 0, 0),
        available_until=datetime(2014, 9, 23, 18, 0, 0))

    with freeze_time(now):
        assert article.is_available == expected
def test_is_available_without_start_and_without_end(now, expected):
    article = create_article(
        available_from=None,
        available_until=None)

    with freeze_time(now):
        assert article.is_available == expected
示例#3
0
    def setup_article(self):
        article = create_article(self.shop.id, quantity=5)

        self.db.session.add(article)
        self.db.session.commit()

        self.article_id = article.id
示例#4
0
 def build_article(self, item_number, description, price, tax_rate):
     return create_article(party=self.party,
                           item_number=item_number,
                           description=description,
                           price=price,
                           tax_rate=tax_rate,
                           quantity=10)
示例#5
0
文件: base.py 项目: leathe/byceps
    def create_article(self, shop_id, **kwargs):
        article = create_article(shop_id, **kwargs)

        self.db.session.add(article)
        self.db.session.commit()

        return article
示例#6
0
    def create_article(self):
        article = create_article(party_id=self.party.id, quantity=10)

        self.db.session.add(article)
        self.db.session.commit()

        return article
示例#7
0
 def build_article(self, item_number, description, price, tax_rate):
     return create_article(
         party=self.party,
         item_number=item_number,
         description=description,
         price=price,
         tax_rate=tax_rate,
         quantity=10)
示例#8
0
def create_order_with_items(price_quantity_pairs):
    user = create_user()

    party_id = 'acme-party-2016'
    placed_by = user

    order = create_order(party_id, placed_by)

    for price, quantity in price_quantity_pairs:
        article = create_article(price=price, quantity=quantity)
        order_item = create_order_item(order, article, quantity)

    return order
def create_order_with_items(price_quantity_pairs):
    user = create_user(42)

    party_id = 'acme-party-2016'
    placed_by = user

    order = create_order(party_id, placed_by)

    for price, quantity in price_quantity_pairs:
        article = create_article(price=price, quantity=quantity)
        order_item = create_order_item(order, article, quantity)

    return order
示例#10
0
    def setup_article(self):
        article = create_article(party=self.party, quantity=5)
        self.db.session.add(article)
        self.db.session.commit()

        self.article_id = article.id
示例#11
0
def create_item(quantity):
    article = create_article()
    return CartItem(article, quantity)
def test_is_available_with_start_and_end(now, expected):
    article = create_article(available_from=datetime(2014, 9, 15, 18, 0, 0),
                             available_until=datetime(2014, 9, 23, 18, 0, 0))

    with freeze_time(now):
        assert article.is_available == expected
示例#13
0
def create_item(quantity):
    article = create_article('shop-123')
    return CartItem(article, quantity)
def create_item(quantity):
    article = create_article()
    return CartItem(article, quantity)
示例#15
0
def add_item(cart, quantity):
    article = create_article()
    cart.add_item(article, quantity)
示例#16
0
 def create_article(self, quantity):
     article = create_article(party=self.party, quantity=quantity)
     self.db.session.add(article)
     return article
def test_is_available_without_start_and_without_end(now, expected):
    article = create_article(available_from=None, available_until=None)

    with freeze_time(now):
        assert article.is_available == expected
def add_item(cart, quantity):
    article = create_article()
    cart.add_item(article, quantity)
示例#19
0
def add_item(cart, quantity):
    article = create_article('shop-123')
    cart.add_item(article, quantity)