Fixed #9592 -- Create data for the generic_inline_admin test during setup instead of via a fixutre since it uses a content type id which will vary depending on what other tests have been run.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@9438 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
64b56447f3
commit
02e67bba47
|
@ -1,11 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<django-objects version="1.0">
|
|
||||||
<object pk="1" model="generic_inline_admin.Episode">
|
|
||||||
<field type="CharField" name="name">This Week in Django</field>
|
|
||||||
</object>
|
|
||||||
<object pk="1" model="generic_inline_admin.Media">
|
|
||||||
<field type="ForeignKey" name="content_type">13</field>
|
|
||||||
<field type="PositiveIntegerField" name="object_id">1</field>
|
|
||||||
<field type="URLField" name="url">http://example.com/podcast.mp3</field>
|
|
||||||
</object>
|
|
||||||
</django-objects>
|
|
|
@ -7,7 +7,7 @@ from django.conf import settings
|
||||||
from models import Episode, Media
|
from models import Episode, Media
|
||||||
|
|
||||||
class GenericAdminViewTest(TestCase):
|
class GenericAdminViewTest(TestCase):
|
||||||
fixtures = ['users.xml', 'model-data.xml']
|
fixtures = ['users.xml']
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
# set TEMPLATE_DEBUG to True to ensure {% include %} will raise
|
# set TEMPLATE_DEBUG to True to ensure {% include %} will raise
|
||||||
|
@ -17,6 +17,13 @@ class GenericAdminViewTest(TestCase):
|
||||||
settings.TEMPLATE_DEBUG = True
|
settings.TEMPLATE_DEBUG = True
|
||||||
self.client.login(username='super', password='secret')
|
self.client.login(username='super', password='secret')
|
||||||
|
|
||||||
|
# Can't load content via a fixture (since the GenericForeignKey
|
||||||
|
# relies on content type IDs, which will vary depending on what
|
||||||
|
# other tests have been run), thus we do it here.
|
||||||
|
e = Episode.objects.create(name='This Week in Django')
|
||||||
|
m = Media(content_object=e, url='http://example.com/podcast.mp3')
|
||||||
|
m.save()
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
self.client.logout()
|
self.client.logout()
|
||||||
settings.TEMPLATE_DEBUG = self.original_template_debug
|
settings.TEMPLATE_DEBUG = self.original_template_debug
|
||||||
|
|
Loading…
Reference in New Issue