summaryrefslogtreecommitdiff
path: root/tests/sitemaps_tests
diff options
context:
space:
mode:
authorDavid Smith <smithdc@gmail.com>2021-02-17 19:19:27 +0000
committerCarlton Gibson <carlton.gibson@noumenal.es>2021-10-21 15:26:22 +0200
commit2ce03a2bac9f41b803196a45dcd07cc342838e58 (patch)
treeb47610291fc3cd61c3e0a5fbabef8ee28573ecf0 /tests/sitemaps_tests
parent2ccc0b22db6730ba0950b10bbc5238ae575e4a45 (diff)
downloaddjango-2ce03a2bac9f41b803196a45dcd07cc342838e58.tar.gz
Refs #25916 -- Isolated sitemap.test_utils tests
Diffstat (limited to 'tests/sitemaps_tests')
-rw-r--r--tests/sitemaps_tests/test_utils.py2
-rw-r--r--tests/sitemaps_tests/urls/sitemap_only.py9
2 files changed, 11 insertions, 0 deletions
diff --git a/tests/sitemaps_tests/test_utils.py b/tests/sitemaps_tests/test_utils.py
index 34f46c45b3..d230e1a358 100644
--- a/tests/sitemaps_tests/test_utils.py
+++ b/tests/sitemaps_tests/test_utils.py
@@ -12,6 +12,7 @@ from .base import SitemapTestsBase
class PingGoogleTests(SitemapTestsBase):
+ @override_settings(ROOT_URLCONF='sitemaps_tests.urls.sitemap_only')
@mock.patch('django.contrib.sitemaps.urlopen')
def test_something(self, urlopen):
ping_google()
@@ -19,6 +20,7 @@ class PingGoogleTests(SitemapTestsBase):
full_url = 'https://www.google.com/webmasters/tools/ping?%s' % params
urlopen.assert_called_with(full_url)
+ @override_settings(ROOT_URLCONF='sitemaps_tests.urls.sitemap_only')
def test_get_sitemap_full_url_global(self):
self.assertEqual(_get_sitemap_full_url(None), 'https://example.com/sitemap-without-entries/sitemap.xml')
diff --git a/tests/sitemaps_tests/urls/sitemap_only.py b/tests/sitemaps_tests/urls/sitemap_only.py
new file mode 100644
index 0000000000..3831fe4787
--- /dev/null
+++ b/tests/sitemaps_tests/urls/sitemap_only.py
@@ -0,0 +1,9 @@
+from django.contrib.sitemaps import views
+from django.urls import path
+
+urlpatterns = [
+ path(
+ 'sitemap-without-entries/sitemap.xml', views.sitemap,
+ {'sitemaps': {}}, name='django.contrib.sitemaps.views.sitemap',
+ ),
+]