Skip to content

Commit

Permalink
Fixed #32003 -- Added obj argument to has_perm() methods in tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
atodorov authored Sep 14, 2020
1 parent bcc2bef commit 5fab163
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tests/admin_ordering/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion tests/auth_tests/test_context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'


Expand Down
2 changes: 1 addition & 1 deletion tests/generic_inline_admin/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ class MockRequest:


class MockSuperUser:
def has_perm(self, perm):
def has_perm(self, perm, obj=None):
return True


Expand Down
10 changes: 5 additions & 5 deletions tests/modeladmin/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class MockRequest:


class MockSuperUser:
def has_perm(self, perm):
def has_perm(self, perm, obj=None):
return True


Expand Down Expand Up @@ -730,19 +730,19 @@ def has_module_perms(self, app_label):
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):
Expand Down

0 comments on commit 5fab163

Please sign in to comment.