mirror of
https://github.com/django/django.git
synced 2024-12-23 01:25:58 +00:00
Add setUp
and tearDown
methods to the geographic feed and sitemap tests to ensure Site
exists for tests.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15856 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
127331041e
commit
d60a8777c1
@ -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])
|
||||
|
@ -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])
|
||||
|
Loading…
Reference in New Issue
Block a user