From 5fab16392fc00702a5d0288378892ec48fe67dc6 Mon Sep 17 00:00:00 2001 From: Alexander Todorov Date: Mon, 14 Sep 2020 13:28:17 +0300 Subject: [PATCH] Fixed #32003 -- Added obj argument to has_perm() methods in tests. --- tests/admin_ordering/tests.py | 2 +- tests/auth_tests/test_context_processors.py | 2 +- tests/generic_inline_admin/tests.py | 2 +- tests/modeladmin/tests.py | 10 +++++----- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/admin_ordering/tests.py b/tests/admin_ordering/tests.py index f68b64ae70..d47cf16d46 100644 --- a/tests/admin_ordering/tests.py +++ b/tests/admin_ordering/tests.py @@ -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): diff --git a/tests/auth_tests/test_context_processors.py b/tests/auth_tests/test_context_processors.py index 281ea744d8..e492050bcb 100644 --- a/tests/auth_tests/test_context_processors.py +++ b/tests/auth_tests/test_context_processors.py @@ -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' diff --git a/tests/generic_inline_admin/tests.py b/tests/generic_inline_admin/tests.py index 0ce6eea1e4..fc17b9de74 100644 --- a/tests/generic_inline_admin/tests.py +++ b/tests/generic_inline_admin/tests.py @@ -284,7 +284,7 @@ class MockRequest: class MockSuperUser: - def has_perm(self, perm): + def has_perm(self, perm, obj=None): return True diff --git a/tests/modeladmin/tests.py b/tests/modeladmin/tests.py index 74db14d5ac..00de9f7523 100644 --- a/tests/modeladmin/tests.py +++ b/tests/modeladmin/tests.py @@ -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):