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
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
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)
def create_article(self, shop_id, **kwargs): article = create_article(shop_id, **kwargs) self.db.session.add(article) self.db.session.commit() return article
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
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)
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
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
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
def create_item(quantity): article = create_article('shop-123') return CartItem(article, quantity)
def add_item(cart, quantity): article = create_article() cart.add_item(article, quantity)
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('shop-123') cart.add_item(article, quantity)