changeset 8132:603aa730b067 permission-performance

Fix failing test due to mokey patching An earlier test monkey-patched the permission checks which subsequently failed in another test.
author Ralf Schlatterbeck <rsc@runtux.com>
date Tue, 22 Oct 2024 16:10:29 +0200
parents 8e9181dfc9fa
children 7b6615fb37fc
files test/test_cgi.py test/test_liveserver.py
diffstat 2 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/test/test_cgi.py	Tue Oct 22 15:03:36 2024 +0200
+++ b/test/test_cgi.py	Tue Oct 22 16:10:29 2024 +0200
@@ -1035,9 +1035,11 @@
         def hasPermission(s, p, classname=None, d=None, e=None, **kw):
             return True
         actions.Action.hasPermission = hasPermission
+        orig_HTMLItem_is_edit_ok = _HTMLItem.is_edit_ok
         e1 = _HTMLItem.is_edit_ok
         _HTMLItem.is_edit_ok = lambda x : True
         e2 = HTMLProperty.is_edit_ok
+        orig_HTMLProperty_is_edit_ok = HTMLProperty.is_edit_ok
         HTMLProperty.is_edit_ok = lambda x : True
 
         # test with no headers. Default config requires that 1 header
@@ -1227,6 +1229,9 @@
         if os.path.exists(SENDMAILDEBUG):
             os.remove(SENDMAILDEBUG)
         #raise ValueError
+        # Undo monkey patching
+        _HTMLItem.is_edit_ok = orig_HTMLItem_is_edit_ok
+        HTMLProperty.is_edit_ok = orig_HTMLProperty_is_edit_ok
 
     def testRestOriginValidationCredentials(self):
         import json
--- a/test/test_liveserver.py	Tue Oct 22 15:03:36 2024 +0200
+++ b/test/test_liveserver.py	Tue Oct 22 16:10:29 2024 +0200
@@ -1292,7 +1292,6 @@
         f = session.get(self.url_base()+'/?@action=logout')
         self.assertIn(b"Remember me?", f.content)
 
-    @pytest.mark.xfail
     def test__generic_item_template_editbad(self, user="fred"):
         self.test__generic_item_template_editok(user=user)
 

Roundup Issue Tracker: http://roundup-tracker.org/