diff test/test_cgi.py @ 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 e44b65651012
children e84d4585b16d
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

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