mirror of
https://github.com/django/django.git
synced 2025-12-04 00:55:36 +00:00
Improved test isolation of the admin tests and assigned custom admin sites to
prevent test order dependant failures. This involves introducing usage of `TestCase.urls` and implementing proper admin.py modules for some of the test apps. Thanks Florian Apolloner for finding the issue and contributing the patch. Refs #15294 (it solves these problems so the fix for that ticket we are going to commit doesn't introduce obscure and hard to reproduce test failures when running the Django test suite.) git-svn-id: http://code.djangoproject.com/svn/django/trunk@16856 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
fc06ec0daf
commit
7b21bfc074
18 changed files with 904 additions and 630 deletions
|
|
@ -10,10 +10,12 @@ from django.test import TestCase
|
|||
|
||||
# local test models
|
||||
from models import (Episode, EpisodeExtra, EpisodeMaxNum, Media,
|
||||
MediaInline, EpisodePermanent, MediaPermanentInline, Category)
|
||||
EpisodePermanent, Category)
|
||||
from admin import MediaInline, MediaPermanentInline
|
||||
|
||||
|
||||
class GenericAdminViewTest(TestCase):
|
||||
urls = "regressiontests.generic_inline_admin.urls"
|
||||
fixtures = ['users.xml']
|
||||
|
||||
def setUp(self):
|
||||
|
|
@ -125,6 +127,7 @@ class GenericAdminViewTest(TestCase):
|
|||
self.assertTrue(formset.get_queryset().ordered)
|
||||
|
||||
class GenericInlineAdminParametersTest(TestCase):
|
||||
urls = "regressiontests.generic_inline_admin.urls"
|
||||
fixtures = ['users.xml']
|
||||
|
||||
def setUp(self):
|
||||
|
|
@ -177,6 +180,7 @@ class GenericInlineAdminParametersTest(TestCase):
|
|||
|
||||
|
||||
class GenericInlineAdminWithUniqueTogetherTest(TestCase):
|
||||
urls = "regressiontests.generic_inline_admin.urls"
|
||||
fixtures = ['users.xml']
|
||||
|
||||
def setUp(self):
|
||||
|
|
@ -203,6 +207,8 @@ class GenericInlineAdminWithUniqueTogetherTest(TestCase):
|
|||
self.assertEqual(response.status_code, 302) # redirect somewhere
|
||||
|
||||
class NoInlineDeletionTest(TestCase):
|
||||
urls = "regressiontests.generic_inline_admin.urls"
|
||||
|
||||
def test_no_deletion(self):
|
||||
fake_site = object()
|
||||
inline = MediaPermanentInline(EpisodePermanent, fake_site)
|
||||
|
|
@ -211,6 +217,7 @@ class NoInlineDeletionTest(TestCase):
|
|||
self.assertFalse(formset.can_delete)
|
||||
|
||||
class GenericInlineModelAdminTest(TestCase):
|
||||
urls = "regressiontests.generic_inline_admin.urls"
|
||||
|
||||
def setUp(self):
|
||||
self.site = AdminSite()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue