Refs #23947 -- Made a modeladmin test cleanup after itself.
This commit is contained in:
parent
ebfadb8080
commit
d05709821c
|
@ -1625,10 +1625,15 @@ class ModelAdminPermissionTests(TestCase):
|
||||||
self.assertTrue(ma.has_module_permission(request))
|
self.assertTrue(ma.has_module_permission(request))
|
||||||
request.user = self.MockDeleteUser()
|
request.user = self.MockDeleteUser()
|
||||||
self.assertTrue(ma.has_module_permission(request))
|
self.assertTrue(ma.has_module_permission(request))
|
||||||
ma.opts.app_label = "anotherapp"
|
|
||||||
request.user = self.MockAddUser()
|
original_app_label = ma.opts.app_label
|
||||||
self.assertFalse(ma.has_module_permission(request))
|
ma.opts.app_label = 'anotherapp'
|
||||||
request.user = self.MockChangeUser()
|
try:
|
||||||
self.assertFalse(ma.has_module_permission(request))
|
request.user = self.MockAddUser()
|
||||||
request.user = self.MockDeleteUser()
|
self.assertFalse(ma.has_module_permission(request))
|
||||||
self.assertFalse(ma.has_module_permission(request))
|
request.user = self.MockChangeUser()
|
||||||
|
self.assertFalse(ma.has_module_permission(request))
|
||||||
|
request.user = self.MockDeleteUser()
|
||||||
|
self.assertFalse(ma.has_module_permission(request))
|
||||||
|
finally:
|
||||||
|
ma.opts.app_label = original_app_label
|
||||||
|
|
Loading…
Reference in New Issue