Example #1
0
def test_saleor_feed_items(product_in_stock):
    valid_variant = product_in_stock.variants.first()
    items = get_feed_items()
    assert len(items) == 1
    categories = Category.objects.all()
    discounts = []
    category_paths = {}
    attributes_dict = {}
    current_site = get_site_settings()
    attribute_values_dict = {smart_text(a.pk): smart_text(a) for a
                             in AttributeChoiceValue.objects.all()}
    attributes = item_attributes(items[0], categories, category_paths,
                                 current_site, discounts, attributes_dict,
                                 attribute_values_dict)
    assert attributes.get('mpn') == valid_variant.sku
    assert attributes.get('availability') == 'in stock'
Example #2
0
def test_saleor_feed_items(product_in_stock):
    valid_variant = product_in_stock.variants.first()
    items = get_feed_items()
    assert len(items) == 1
    categories = Category.objects.all()
    discounts = []
    category_paths = {}
    attributes_dict = {}
    current_site = Site.objects.get_current()
    attribute_values_dict = {
        smart_text(a.pk): smart_text(a)
        for a in AttributeChoiceValue.objects.all()
    }
    attributes = item_attributes(items[0], categories, category_paths,
                                 current_site, discounts, attributes_dict,
                                 attribute_values_dict)
    assert attributes.get('mpn') == valid_variant.sku
    assert attributes.get('availability') == 'in stock'
Example #3
0
def test_saleor_feed_items(product, site_settings):
    valid_variant = product.variants.first()
    items = get_feed_items()
    assert len(items) == 1
    categories = Category.objects.all()
    discounts = []
    category_paths = {}
    attributes_dict = {}
    current_site = site_settings.site
    attribute_values_dict = {
        smart_text(a.pk): smart_text(a) for a in AttributeValue.objects.all()
    }
    attributes = item_attributes(
        items[0],
        categories,
        category_paths,
        current_site,
        discounts,
        attributes_dict,
        attribute_values_dict,
    )
    assert attributes.get("mpn") == valid_variant.sku
    assert attributes.get("availability") == "in stock"