def get_dashboard_blocks(self, request): import shuup.admin.modules.sales_dashboard.dashboard as dashboard currency = self.currency if not currency: return yield dashboard.get_sales_of_the_day_block(request, currency) yield dashboard.get_lifetime_sales_block(request, currency) yield dashboard.get_avg_purchase_size_block(request, currency) yield dashboard.get_open_orders_block(request, currency) yield dashboard.get_order_value_chart_dashboard_block(request, currency) yield dashboard.get_shop_overview_block(request, currency) yield dashboard.get_recent_orders_block(request, currency)
def get_dashboard_blocks(self, request): import shuup.admin.modules.sales_dashboard.dashboard as dashboard currency = self.currency if not currency: return yield dashboard.get_sales_of_the_day_block(request, currency) yield dashboard.get_lifetime_sales_block(request, currency) yield dashboard.get_avg_purchase_size_block(request, currency) yield dashboard.get_open_orders_block(request, currency) yield dashboard.get_order_value_chart_dashboard_block( request, currency) yield dashboard.get_shop_overview_block(request, currency) yield dashboard.get_recent_orders_block(request, currency)
def test_recent_orders_block(rf, admin_user): with override_settings(SHUUP_ENABLE_MULTIPLE_SHOPS=True): shop1 = get_default_shop() shop2 = get_shop(identifier="shop2", status=ShopStatus.ENABLED, name="Shop2") order = create_random_order(customer=create_random_person(), products=[get_default_product()]) for shop in [shop1, shop2]: request = apply_request_middleware(rf.get("/"), user=admin_user, shop=shop) block = get_recent_orders_block(request) if shop == shop1: assert order.customer.name in block.content else: assert order.customer.name not in block.content
def test_recent_orders_block(rf, admin_user): with override_settings(SHUUP_ENABLE_MULTIPLE_SHOPS=True): shop1 = get_default_shop() shop2 = get_shop(identifier="shop2", status=ShopStatus.ENABLED, name="Shop2") customer = create_random_person() # prevent weird names with random chars customer.name = "Jon Doe" customer.save() order = create_random_order(customer=customer, products=[get_default_product()]) for shop in [shop1, shop2]: request = apply_request_middleware(rf.get("/"), user=admin_user, shop=shop) block = get_recent_orders_block(request) if shop == shop1: assert order.customer.name in block.content else: assert order.customer.name not in block.content
def test_recent_orders_block(rf): order = create_random_order(customer=create_random_person(), products=[get_default_product()]) block = get_recent_orders_block(rf.get("/"), DEFAULT_CURRENCY) assert html.escape(order.customer.name) in block.content
def test_recent_orders_block(rf): order = create_random_order(customer=create_random_person(), products=[get_default_product()]) block = get_recent_orders_block(rf.get("/"), DEFAULT_CURRENCY) assert html.escape(order.customer.name) in block.content
def test_recent_orders_block(rf, admin_user): order = create_random_order(customer=create_random_person(), products=[get_default_product()]) request = apply_request_middleware(rf.get("/"), user=admin_user) block = get_recent_orders_block(request) assert order.customer.name in block.content