mirror of
https://github.com/django/django.git
synced 2025-08-03 02:23:12 +00:00
Refs #24553 -- Isolated admin_* tests.
This fixes a regression with runtests.py --reverse after
bd53db5eab
We need to avoid leaking model registration in the default AdminSite.
This commit is contained in:
parent
4157c502a5
commit
adf5d75af1
3 changed files with 56 additions and 51 deletions
|
@ -104,6 +104,7 @@ class TestRegistrationDecorator(TestCase):
|
|||
isinstance(self.default_site._registry[Person],
|
||||
admin.options.ModelAdmin)
|
||||
)
|
||||
self.default_site.unregister(Person)
|
||||
|
||||
def test_custom_site_registration(self):
|
||||
register(Person, site=self.custom_site)(NameAdmin)
|
||||
|
@ -118,10 +119,12 @@ class TestRegistrationDecorator(TestCase):
|
|||
isinstance(self.default_site._registry[Traveler],
|
||||
admin.options.ModelAdmin)
|
||||
)
|
||||
self.default_site.unregister(Traveler)
|
||||
self.assertTrue(
|
||||
isinstance(self.default_site._registry[Place],
|
||||
admin.options.ModelAdmin)
|
||||
)
|
||||
self.default_site.unregister(Place)
|
||||
|
||||
def test_wrapped_class_not_a_model_admin(self):
|
||||
self.assertRaisesMessage(ValueError, 'Wrapped class must subclass ModelAdmin.',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue