def test_order_received_admin(rf, admin_user): get_test_script("test script", "order_received") template_data = STEP_DATA[0]["actions"][0]["template_data"] for lang in ["en", "fi"]: get_initial_order_status() # Needed for the API n_outbox_pre = len(mail.outbox) contact = create_random_person(locale=lang, minimum_name_comp_len=5) get_order_from_state(get_frontend_order_state(contact), admin_user) assert (len(mail.outbox) == n_outbox_pre + 1), "Sending email failed" latest_mail = mail.outbox[-1] assert latest_mail.subject == template_data[lang]["subject"], "Subject doesn't match" assert latest_mail.body == template_data[lang]["body"], "Body doesn't match"
def test_admin_cash_order(rf, admin_user, price, target, mode): activate("en") get_initial_order_status() # Needed for the API shop = get_default_shop() contact = create_random_person(locale="en_US", minimum_name_comp_len=5) processor = CustomPaymentProcessor.objects.create(rounding_mode=mode) cash_method = PaymentMethod.objects.create( shop=shop, payment_processor=processor, choice_identifier="cash", tax_class=get_default_tax_class(), name="Cash" ) state = get_frontend_order_state(contact, cash_method, price) order = get_order_from_state(state, admin_user) assert order.payment_method == cash_method assert order.lines.count() == 5 # 2 submitted, two for the shipping and payment method, and a rounding line assert order.creator == admin_user assert order.customer == contact assert order.taxful_total_price == shop.create_price(target)
def test_admin_cash_order(rf, admin_user, price, target, mode): activate("en") get_initial_order_status() # Needed for the API shop = get_default_shop() contact = create_random_person(locale="en_US", minimum_name_comp_len=5) processor = CustomPaymentProcessor.objects.create(rounding_mode=mode) cash_method = PaymentMethod.objects.create( shop=shop, payment_processor=processor, choice_identifier="cash", tax_class=get_default_tax_class(), name="Cash") state = get_frontend_order_state(contact, cash_method, price) order = get_order_from_state(state, admin_user) assert order.payment_method == cash_method assert order.lines.count() == 5 # 2 submitted, two for the shipping and payment method, and a rounding line assert order.creator == admin_user assert order.customer == contact assert order.taxful_total_price == shop.create_price(target)