From dbe18ce542618b38b7e2461696b4c2d0ba776668 Mon Sep 17 00:00:00 2001 From: Karen Tracey Date: Fri, 14 Nov 2008 14:52:55 +0000 Subject: [PATCH] [1.0.X] 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. r9438 from trunk. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@9439 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- .../generic_inline_admin/fixtures/model-data.xml | 11 ----------- tests/regressiontests/generic_inline_admin/tests.py | 9 ++++++++- 2 files changed, 8 insertions(+), 12 deletions(-) delete mode 100644 tests/regressiontests/generic_inline_admin/fixtures/model-data.xml diff --git a/tests/regressiontests/generic_inline_admin/fixtures/model-data.xml b/tests/regressiontests/generic_inline_admin/fixtures/model-data.xml deleted file mode 100644 index a629208d2d..0000000000 --- a/tests/regressiontests/generic_inline_admin/fixtures/model-data.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - This Week in Django - - - 13 - 1 - http://example.com/podcast.mp3 - - \ No newline at end of file diff --git a/tests/regressiontests/generic_inline_admin/tests.py b/tests/regressiontests/generic_inline_admin/tests.py index f2953fee54..e03cc1f2f4 100644 --- a/tests/regressiontests/generic_inline_admin/tests.py +++ b/tests/regressiontests/generic_inline_admin/tests.py @@ -7,7 +7,7 @@ from django.conf import settings from models import Episode, Media class GenericAdminViewTest(TestCase): - fixtures = ['users.xml', 'model-data.xml'] + fixtures = ['users.xml'] def setUp(self): # set TEMPLATE_DEBUG to True to ensure {% include %} will raise @@ -16,6 +16,13 @@ class GenericAdminViewTest(TestCase): self.original_template_debug = settings.TEMPLATE_DEBUG settings.TEMPLATE_DEBUG = True 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): self.client.logout()