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:
Riccardo Magliocchetti 2015-05-14 14:14:34 +02:00 committed by Tim Graham
parent 4157c502a5
commit adf5d75af1
3 changed files with 56 additions and 51 deletions

View file

@ -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.',