Skip to content

Commit 9e2c051

Browse files
committed
Fix failing test due to mokey patching
An earlier test monkey-patched the permission checks which subsequently failed in another test.
1 parent cf13b22 commit 9e2c051

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

test/test_cgi.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,9 +1035,11 @@ def load_template(x):
10351035
def hasPermission(s, p, classname=None, d=None, e=None, **kw):
10361036
return True
10371037
actions.Action.hasPermission = hasPermission
1038+
orig_HTMLItem_is_edit_ok = _HTMLItem.is_edit_ok
10381039
e1 = _HTMLItem.is_edit_ok
10391040
_HTMLItem.is_edit_ok = lambda x : True
10401041
e2 = HTMLProperty.is_edit_ok
1042+
orig_HTMLProperty_is_edit_ok = HTMLProperty.is_edit_ok
10411043
HTMLProperty.is_edit_ok = lambda x : True
10421044

10431045
# test with no headers. Default config requires that 1 header
@@ -1227,6 +1229,9 @@ def hasPermission(s, p, classname=None, d=None, e=None, **kw):
12271229
if os.path.exists(SENDMAILDEBUG):
12281230
os.remove(SENDMAILDEBUG)
12291231
#raise ValueError
1232+
# Undo monkey patching
1233+
_HTMLItem.is_edit_ok = orig_HTMLItem_is_edit_ok
1234+
HTMLProperty.is_edit_ok = orig_HTMLProperty_is_edit_ok
12301235

12311236
def testRestOriginValidationCredentials(self):
12321237
import json

test/test_liveserver.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1292,7 +1292,6 @@ def test__generic_item_template_editok(self, user="admin"):
12921292
f = session.get(self.url_base()+'/?@action=logout')
12931293
self.assertIn(b"Remember me?", f.content)
12941294

1295-
@pytest.mark.xfail
12961295
def test__generic_item_template_editbad(self, user="fred"):
12971296
self.test__generic_item_template_editok(user=user)
12981297

0 commit comments

Comments
 (0)