Refs #25916 -- Isolated sitemap.test_utils tests

This commit is contained in:
David Smith 2021-02-17 19:19:27 +00:00 committed by Carlton Gibson
parent 2ccc0b22db
commit 2ce03a2bac
2 changed files with 11 additions and 0 deletions

View File

@ -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')

View File

@ -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',
),
]