Fixed #32003 -- Added obj argument to has_perm() methods in tests.

This commit is contained in:
Alexander Todorov 2020-09-14 13:28:17 +03:00 committed by GitHub
parent bcc2befd0e
commit 5fab16392f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 8 deletions

View File

@ -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):

View File

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

View File

@ -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

View File

@ -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):