Commits

Anonymous committed e3cb78c

[1.2.X] Add `setUp` and `tearDown` methods to the geographic feed and sitemap tests to ensure `Site` exists for tests.

Backport of r15856 from trunk.

  • Participants
  • Parent commits 593ffae
  • Branches releases/1.2.X

Comments (0)

Files changed (2)

File django/contrib/gis/tests/geoapp/test_feeds.py

 from xml.dom import minidom
+from django.conf import settings
+from django.contrib.sites.models import Site
 from django.test import TestCase
 
 from models import City
     
     urls = 'django.contrib.gis.tests.geoapp.urls'
 
+    def setUp(self):
+        Site(id=settings.SITE_ID, domain="example.com", name="example.com").save()
+        self.old_Site_meta_installed = Site._meta.installed
+        Site._meta.installed = True
+
+    def tearDown(self):
+        Site._meta.installed = self.old_Site_meta_installed
+
     def assertChildNodes(self, elem, expected):
         "Taken from regressiontests/syndication/tests.py."
         actual = set([n.nodeName for n in elem.childNodes])

File django/contrib/gis/tests/geoapp/test_sitemaps.py

 import cStringIO
 from xml.dom import minidom
 import zipfile
+from django.conf import settings
+from django.contrib.sites.models import Site
 from django.test import TestCase
 
 from models import City, Country
 
     urls = 'django.contrib.gis.tests.geoapp.urls'
 
+    def setUp(self):
+        Site(id=settings.SITE_ID, domain="example.com", name="example.com").save()
+        self.old_Site_meta_installed = Site._meta.installed
+        Site._meta.installed = True
+
+    def tearDown(self):
+        Site._meta.installed = self.old_Site_meta_installed
+
     def assertChildNodes(self, elem, expected):
         "Taken from regressiontests/syndication/tests.py."
         actual = set([n.nodeName for n in elem.childNodes])