@pytest.mark.django_db
def test_cross_sell_plugin_renders():
 shop = get_default_shop()
 supplier = get_default_supplier()
 product = create_product('test-sku', shop=shop, supplier=supplier, stock_behavior=StockBehavior.UNSTOCKED)
 computed = create_product('test-computed-sku', shop=shop, supplier=supplier, stock_behavior=StockBehavior.UNSTOCKED)
 type = ProductCrossSellType.COMPUTED
 ProductCrossSell.objects.create(product1=product, product2=computed, type=type)
 assert (ProductCrossSell.objects.filter(product1=product, type=type).count() == 1)
 context = get_jinja_context(product=product)
 rendered = ProductCrossSellsPlugin({'type': type}).render(context)
 assert (computed.sku in rendered)

@ pytest . mark . django_db def test_cross_sell_plugin_renders ( ) : shop = get_default_shop ( ) supplier = get_default_supplier ( ) product = create_product ( 'test-sku' , shop = shop , supplier = supplier , stock_behavior = StockBehavior . UNSTOCKED ) computed = create_product ( 'test-computed-sku' , shop = shop , supplier = supplier , stock_behavior = StockBehavior . UNSTOCKED ) type = ProductCrossSellType . COMPUTED ProductCrossSell . objects . create ( product1 = product , product2 = computed , type = type ) assert ( ProductCrossSell . objects . filter ( product1 = product , type = type ) . count ( ) == 1 ) context = get_jinja_context ( product = product ) rendered = ProductCrossSellsPlugin ( { 'type' : type } ) . render ( context ) assert ( computed . sku in rendered )
test that the plugin renders a product .