Skip to content

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

Fix test

Pacu2e1383feccb18
diff --git a/tests/test_sitemap.py b/tests/test_sitemap.py
index 2318141af5..3d6b28c4ea 100644
--- a/tests/test_sitemap.py
+++ b/tests/test_sitemap.py
@@ -5,8 +5,16 @@ 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,
+ domain = Site.objects.get_current().domain
+ product_url = 'http://%(domain)s%(product_url)s' % {
+ 'domain': domain,
'product_url': product_in_stock.get_absolute_url()}
+ category = product_in_stock.categories.first()
+ category_url = 'http://%(domain)s%(category_url)s' % {
+ 'domain': domain,
+ 'category_url': category.get_absolute_url()}
+ expected_links = [product_url, category_url]
+
response = client.get(reverse('django.contrib.sitemaps.views.sitemap'))
- assert response.context['urlset'][0]['location'] == url
+ sitemap_links = [url['location'] for url in response.context['urlset']]
+ assert sorted(sitemap_links) == sorted(expected_links)