summaryrefslogtreecommitdiff
path: root/tests/sitemaps_tests/base.py
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2015-02-10 08:11:25 -0500
committerTim Graham <timograham@gmail.com>2015-02-11 10:19:22 -0500
commitfbc467c26bc0adb9867b97d0bb5642b2a85eb357 (patch)
treec8185ba55a2790f0a9ce16cd2d2c30938b05f312 /tests/sitemaps_tests/base.py
parentd8341bf02444e58ff62afe04f15d9679a1b5b8f8 (diff)
Moved contrib.sitemaps tests out of contrib.
Diffstat (limited to 'tests/sitemaps_tests/base.py')
-rw-r--r--tests/sitemaps_tests/base.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/sitemaps_tests/base.py b/tests/sitemaps_tests/base.py
new file mode 100644
index 0000000000..c3476cf08e
--- /dev/null
+++ b/tests/sitemaps_tests/base.py
@@ -0,0 +1,20 @@
+from django.apps import apps
+from django.core.cache import cache
+from django.test import TestCase, modify_settings, override_settings
+
+from .models import I18nTestModel, TestModel
+
+
+@modify_settings(INSTALLED_APPS={'append': 'django.contrib.sitemaps'})
+@override_settings(ROOT_URLCONF='sitemaps_tests.urls.http')
+class SitemapTestsBase(TestCase):
+ protocol = 'http'
+ sites_installed = apps.is_installed('django.contrib.sites')
+ domain = 'example.com' if sites_installed else 'testserver'
+
+ def setUp(self):
+ self.base_url = '%s://%s' % (self.protocol, self.domain)
+ cache.clear()
+ # Create an object for sitemap content.
+ TestModel.objects.create(name='Test Object')
+ self.i18n_model = I18nTestModel.objects.create(name='Test Object')