Fixed #32003 -- Added obj argument to has_perm() methods in tests.
This commit is contained in:
parent
bcc2befd0e
commit
5fab16392f
|
@ -15,7 +15,7 @@ class MockRequest:
|
||||||
|
|
||||||
|
|
||||||
class MockSuperUser:
|
class MockSuperUser:
|
||||||
def has_perm(self, perm):
|
def has_perm(self, perm, obj=None):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def has_module_perms(self, module):
|
def has_module_perms(self, module):
|
||||||
|
|
|
@ -12,7 +12,7 @@ class MockUser:
|
||||||
def has_module_perms(self, perm):
|
def has_module_perms(self, perm):
|
||||||
return perm == 'mockapp'
|
return perm == 'mockapp'
|
||||||
|
|
||||||
def has_perm(self, perm):
|
def has_perm(self, perm, obj=None):
|
||||||
return perm == 'mockapp.someperm'
|
return perm == 'mockapp.someperm'
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -284,7 +284,7 @@ class MockRequest:
|
||||||
|
|
||||||
|
|
||||||
class MockSuperUser:
|
class MockSuperUser:
|
||||||
def has_perm(self, perm):
|
def has_perm(self, perm, obj=None):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ class MockRequest:
|
||||||
|
|
||||||
|
|
||||||
class MockSuperUser:
|
class MockSuperUser:
|
||||||
def has_perm(self, perm):
|
def has_perm(self, perm, obj=None):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -730,19 +730,19 @@ class ModelAdminPermissionTests(SimpleTestCase):
|
||||||
return app_label == 'modeladmin'
|
return app_label == 'modeladmin'
|
||||||
|
|
||||||
class MockViewUser(MockUser):
|
class MockViewUser(MockUser):
|
||||||
def has_perm(self, perm):
|
def has_perm(self, perm, obj=None):
|
||||||
return perm == 'modeladmin.view_band'
|
return perm == 'modeladmin.view_band'
|
||||||
|
|
||||||
class MockAddUser(MockUser):
|
class MockAddUser(MockUser):
|
||||||
def has_perm(self, perm):
|
def has_perm(self, perm, obj=None):
|
||||||
return perm == 'modeladmin.add_band'
|
return perm == 'modeladmin.add_band'
|
||||||
|
|
||||||
class MockChangeUser(MockUser):
|
class MockChangeUser(MockUser):
|
||||||
def has_perm(self, perm):
|
def has_perm(self, perm, obj=None):
|
||||||
return perm == 'modeladmin.change_band'
|
return perm == 'modeladmin.change_band'
|
||||||
|
|
||||||
class MockDeleteUser(MockUser):
|
class MockDeleteUser(MockUser):
|
||||||
def has_perm(self, perm):
|
def has_perm(self, perm, obj=None):
|
||||||
return perm == 'modeladmin.delete_band'
|
return perm == 'modeladmin.delete_band'
|
||||||
|
|
||||||
def test_has_view_permission(self):
|
def test_has_view_permission(self):
|
||||||
|
|
Loading…
Reference in New Issue