Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_create_ticket_bundles(
admin_app,
party,
storefront,
article,
ticket_category,
admin_user,
make_user_with_detail,
):
ticket_quantity = 5
bundle_quantity = 2
orderer = create_orderer(make_user_with_detail('TicketBundleOrderer'))
action_registry_service.register_ticket_bundles_creation(
article.item_number, ticket_category.id, ticket_quantity
)
articles_with_quantity = [(article, bundle_quantity)]
order = place_order(storefront.id, orderer, articles_with_quantity)
tickets_before_paid = get_tickets_for_order(order)
assert len(tickets_before_paid) == 0
mark_order_as_paid(order.id, admin_user.id)
tickets_after_paid = get_tickets_for_order(order)
assert len(tickets_after_paid) == 10
def orderer(make_user_with_detail):
return create_orderer(make_user_with_detail('TotalAmountOrderer'))
def orderer1(make_user_with_detail):
user = make_user_with_detail('Orderer1')
return create_orderer(user)
def order(storefront1, user1):
orderer = create_orderer(user1)
cart = Cart()
order, _ = order_service.place_order(storefront1.id, orderer, cart)
yield order
order_service.delete_order(order.id)
def orderer(make_user_with_detail):
return create_orderer(make_user_with_detail('PayingOrderer'))
def orderer(make_user_with_detail):
return create_orderer(make_user_with_detail('ArticlesForStatsOrderer'))
def orderer2(make_user_with_detail):
user = make_user_with_detail('Orderer2')
return create_orderer(user)
def place_order_with_items(
storefront_id, user, created_at=None, items_with_quantity=None
):
orderer = create_orderer(user)
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(
storefront_id, orderer, cart, created_at=created_at
)
return order
def orderer(make_user_with_detail):
user = make_user_with_detail('Ken_von_Kaufkraft')
user_id = user.id
yield create_orderer(user)
user_command_service.delete_account(user_id, user_id, 'clean up')
def test_create_tickets(
admin_app,
party,
storefront,
article,
ticket_category,
admin_user,
make_user_with_detail,
):
ticket_quantity = 4
orderer = create_orderer(make_user_with_detail('TicketsOrderer'))
action_registry_service.register_tickets_creation(
article.item_number, ticket_category.id
)
articles_with_quantity = [(article, ticket_quantity)]
order = place_order(storefront.id, orderer, articles_with_quantity)
tickets_before_paid = get_tickets_for_order(order)
assert len(tickets_before_paid) == 0
mark_order_as_paid(order.id, admin_user.id)
tickets_after_paid = get_tickets_for_order(order)
assert len(tickets_after_paid) == ticket_quantity