from __future__ import unicode_literals

from saleor.integrations.feeds import SaleorFeed


def test_saleor_feed_items(product_in_stock):
    valid_variant = product_in_stock.variants.first()
    feed = SaleorFeed()
    items = feed.items()
    assert len(items) == 1
    attributes = feed.item_attributes(items[0])
    assert attributes.get('mpn') == valid_variant.sku
    assert attributes.get('availability') == 'in stock'

@@ -34,16 +34,59 @@
 terals%0A%0A
+from saleor.product.models import Category%0A
 from sal
@@ -462,8 +462,389 @@
  stock'%0A
+%0A%0Adef test_category_formatter(db):%0A    feed = SaleorFeed()%0A    main_category = Category(name='Main', slug='main')%0A    main_category.save()%0A    sub_category = Category(name='Sub', slug='sub', parent=main_category)%0A    sub_category.save()%0A    assert feed.get_full_category_name_path(main_category) == 'Main'%0A    assert feed.get_full_category_name_path(sub_category) == 'Main %3E Sub'%0A%0A

Add category formatter test