Skip to content

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

Add tests from PR #1196

michal873e564692bd
diff --git a/tests/test_data_feeds.py b/tests/test_data_feeds.py
index 017bf5979b..8eccc31401 100644
--- a/tests/test_data_feeds.py
+++ b/tests/test_data_feeds.py
@@ -2,7 +2,7 @@ from __future__ import unicode_literals
import csv
-from mock import Mock
+from mock import Mock, patch
from django.utils import six
from django.utils.encoding import smart_text
@@ -69,3 +69,10 @@ def test_write_feed(product_in_stock, monkeypatch):
'availability', 'price', 'condition']
for field in google_required_fields:
assert field in header
+
+
+@patch('saleor.data_feeds.google_merchant.item_link')
+def test_feed_contains_site_settings_domain(mocked_item_link, product_in_stock):
+ write_feed(StringIO())
+ mocked_item_link.assert_called_once_with(
+ product_in_stock.variants.first(), Site.objects.get_current())
diff --git a/tests/test_sitemap.py b/tests/test_sitemap.py
new file mode 100644
index 0000000000..f913a7e238
--- /dev/null
+++ b/tests/test_sitemap.py
@@ -0,0 +1,10 @@
+from django.contrib.sites.models import Site
+from django.urls import reverse
+
+
+def test_sitemap_uses_site_settings_domain(client, product_in_stock):
+ url = 'http://%(domain)s%(product_url)s' % {
+ 'domain': Site.objects.get_current().domain,
+ 'product_url': product_in_stock.get_absolute_url()}
+ response = client.get(reverse('django.contrib.sitemaps.views.sitemap'))
+ assert response.context['urlset'][0]['location'] == url