Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Update tests and docs

Krzysztof Wolski02c3ca3130c5
diff --git a/docs/integrations.rst b/docs/integrations.rst
index fcc9d21114..6dd8b17731 100644
--- a/docs/integrations.rst
+++ b/docs/integrations.rst
@@ -117,6 +117,8 @@ To generate feed use command:
$ python manage.py update_feeds
+It's recommended to run this command periodically.
+
Merchant Center has few country dependent settings, so please validate your feed at Google dashboard. You can also specify there your shipping cost, which is required feed parameter in many countries. More info be found at `Google Support pages <https://support.google.com/merchants>`_.
Feed can be downloaded from url: ``http://<yourserver>/feeds/google/``
diff --git a/saleor/data_feeds/google_merchant.py b/saleor/data_feeds/google_merchant.py
index 75f5cc6b40..fbed7d314f 100644
--- a/saleor/data_feeds/google_merchant.py
+++ b/saleor/data_feeds/google_merchant.py
@@ -15,7 +15,7 @@ from ..product.models import ProductVariant, Category
CATEGORY_SEPARATOR = ' > '
-FILE_PATH = path.join('google-feed.csv.gz')
+FILE_PATH = 'google-feed.csv.gz'
FILE_URL = default_storage.url(FILE_PATH)
ATTRIBUTES = ['id', 'title', 'product_type', 'google_product_category',
diff --git a/tests/test_data_feeds.py b/tests/test_data_feeds.py
index 23f6e97294..428c3b1b88 100644
--- a/tests/test_data_feeds.py
+++ b/tests/test_data_feeds.py
@@ -10,7 +10,6 @@ if six.PY3:
else:
from StringIO import StringIO
-from saleor.discount.models import Sale
from saleor.product.models import Category
from saleor.data_feeds.google_merchant import (get_feed_items,
item_attributes,
@@ -48,19 +47,18 @@ def test_category_formatter(db):
def test_write_feed(product_in_stock, monkeypatch):
- variant = product_in_stock.variants.first()
buffer = StringIO()
write_feed(buffer)
buffer.seek(0)
+ dialect = csv.Sniffer().sniff(buffer.getvalue())
+ assert dialect.delimiter == csv.excel_tab.delimiter
+ assert dialect.quotechar == csv.excel_tab.quotechar
+ assert dialect.escapechar == csv.excel_tab.escapechar
assert csv.Sniffer().has_header(buffer.getvalue())
- categories = Category.objects.all()
- discounts = Sale.objects.all().prefetch_related('products',
- 'categories')
- category_paths = {}
- current_site = Site.objects.get_current()
- reader = csv.DictReader(buffer, dialect=csv.excel_tab)
- for generated_item in reader:
- attributes = item_attributes(variant, categories, category_paths,
- current_site, discounts)
- for key in attributes.keys():
- assert attributes[key] == generated_item[key]
+ lines = [line for line in csv.reader(buffer, dialect=csv.excel_tab)]
+ assert len(lines) == 2
+ header = lines[0]
+ google_required_fields = ['id', 'title', 'link', 'image_link',
+ 'availability', 'price', 'condition']
+ for field in google_required_fields:
+ assert field in header