diff options
author | Justin Bronn <jbronn@gmail.com> | 2011-03-16 18:23:39 +0000 |
---|---|---|
committer | Justin Bronn <jbronn@gmail.com> | 2011-03-16 18:23:39 +0000 |
commit | 28462b693f2af31a30ace5ca4c29274063e0129a (patch) | |
tree | e81af0a6712d1be2902a5446b6dc67b4cc19025c | |
parent | 64c83ac6fb0813a4d74d356a2e11d0ecfee409a3 (diff) | |
download | django-28462b693f2af31a30ace5ca4c29274063e0129a.tar.gz |
[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.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@15857 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r-- | django/contrib/gis/tests/geoapp/test_feeds.py | 10 | ||||
-rw-r--r-- | django/contrib/gis/tests/geoapp/test_sitemaps.py | 10 |
2 files changed, 20 insertions, 0 deletions
diff --git a/django/contrib/gis/tests/geoapp/test_feeds.py b/django/contrib/gis/tests/geoapp/test_feeds.py index 7ec9a3c7a9..ddd616eb18 100644 --- a/django/contrib/gis/tests/geoapp/test_feeds.py +++ b/django/contrib/gis/tests/geoapp/test_feeds.py @@ -1,4 +1,6 @@ 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 @@ -8,6 +10,14 @@ class GeoFeedTest(TestCase): 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]) diff --git a/django/contrib/gis/tests/geoapp/test_sitemaps.py b/django/contrib/gis/tests/geoapp/test_sitemaps.py index c8c43f41fc..16e04337c6 100644 --- a/django/contrib/gis/tests/geoapp/test_sitemaps.py +++ b/django/contrib/gis/tests/geoapp/test_sitemaps.py @@ -1,6 +1,8 @@ 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 @@ -10,6 +12,14 @@ class GeoSitemapTest(TestCase): 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]) |