mirror of https://github.com/django/django.git
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:
|
||||
def has_perm(self, perm):
|
||||
def has_perm(self, perm, obj=None):
|
||||
return True
|
||||
|
||||
def has_module_perms(self, module):
|
||||
|
|
|
@ -12,7 +12,7 @@ class MockUser:
|
|||
def has_module_perms(self, perm):
|
||||
return perm == 'mockapp'
|
||||
|
||||
def has_perm(self, perm):
|
||||
def has_perm(self, perm, obj=None):
|
||||
return perm == 'mockapp.someperm'
|
||||
|
||||
|
||||
|
|
|
@ -284,7 +284,7 @@ class MockRequest:
|
|||
|
||||
|
||||
class MockSuperUser:
|
||||
def has_perm(self, perm):
|
||||
def has_perm(self, perm, obj=None):
|
||||
return True
|
||||
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ class MockRequest:
|
|||
|
||||
|
||||
class MockSuperUser:
|
||||
def has_perm(self, perm):
|
||||
def has_perm(self, perm, obj=None):
|
||||
return True
|
||||
|
||||
|
||||
|
@ -730,19 +730,19 @@ class ModelAdminPermissionTests(SimpleTestCase):
|
|||
return app_label == 'modeladmin'
|
||||
|
||||
class MockViewUser(MockUser):
|
||||
def has_perm(self, perm):
|
||||
def has_perm(self, perm, obj=None):
|
||||
return perm == 'modeladmin.view_band'
|
||||
|
||||
class MockAddUser(MockUser):
|
||||
def has_perm(self, perm):
|
||||
def has_perm(self, perm, obj=None):
|
||||
return perm == 'modeladmin.add_band'
|
||||
|
||||
class MockChangeUser(MockUser):
|
||||
def has_perm(self, perm):
|
||||
def has_perm(self, perm, obj=None):
|
||||
return perm == 'modeladmin.change_band'
|
||||
|
||||
class MockDeleteUser(MockUser):
|
||||
def has_perm(self, perm):
|
||||
def has_perm(self, perm, obj=None):
|
||||
return perm == 'modeladmin.delete_band'
|
||||
|
||||
def test_has_view_permission(self):
|
||||
|
|
Loading…
Reference in New Issue