From 3043d671ae8720fe7fb7b1a30d91b52dd6af0a00 Mon Sep 17 00:00:00 2001 From: ale-rt Date: Wed, 3 Oct 2018 17:08:23 +0200 Subject: [PATCH] [fc] Repository: plone.autoform Branch: refs/heads/master Date: 2018-10-03T13:37:00+02:00 Author: ale-rt (ale-rt) Commit: https://github.com/plone/plone.autoform/commit/d37bf2a9485471ced0737f8c962f8cd20e24cb5e Remove the dummy security manager on test tear down Refs. https://github.com/plone/Products.CMFPlone/issues/2560 Files changed: M CHANGES.rst M plone/autoform/tests/test_utils.py Repository: plone.autoform Branch: refs/heads/master Date: 2018-10-03T13:42:02+02:00 Author: ale-rt (ale-rt) Commit: https://github.com/plone/plone.autoform/commit/d8e74cd682e4fbf2de2c729ff7f9c6e923e0fb1b Instead of removing the security manager reset the previously existing one Files changed: M plone/autoform/tests/test_utils.py Repository: plone.autoform Branch: refs/heads/master Date: 2018-10-03T17:08:23+02:00 Author: Alessandro Pisa (ale-rt) Commit: https://github.com/plone/plone.autoform/commit/6b39d44c66fc0ef168365275e54f81ef95592c5a Merge pull request #36 from plone/python3 Remove the dummy security manager on test tear down Files changed: M CHANGES.rst M plone/autoform/tests/test_utils.py --- last_commit.txt | 49 ++++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/last_commit.txt b/last_commit.txt index 1013d7ab3c..b85b3a71af 100644 --- a/last_commit.txt +++ b/last_commit.txt @@ -1,48 +1,51 @@ -Repository: Products.CMFFormController +Repository: plone.autoform Branch: refs/heads/master -Date: 2018-10-03T13:46:40+02:00 -Author: Peter Mathis (petschki) -Commit: https://github.com/plone/Products.CMFFormController/commit/0b22727d8b50a8bf385e3c67e5d3c0e0018d8752 +Date: 2018-10-03T13:37:00+02:00 +Author: ale-rt (ale-rt) +Commit: https://github.com/plone/plone.autoform/commit/d37bf2a9485471ced0737f8c962f8cd20e24cb5e -add tearDown method to avoid isolation errors +Remove the dummy security manager on test tear down + +Refs. https://github.com/plone/Products.CMFPlone/issues/2560 Files changed: -M Products/CMFFormController/tests/testRedirectTo.py +M CHANGES.rst +M plone/autoform/tests/test_utils.py -b"diff --git a/Products/CMFFormController/tests/testRedirectTo.py b/Products/CMFFormController/tests/testRedirectTo.py\nindex b969fad..4424014 100644\n--- a/Products/CMFFormController/tests/testRedirectTo.py\n+++ b/Products/CMFFormController/tests/testRedirectTo.py\n@@ -67,6 +67,14 @@ def setUp(self):\n 'Authorization', 'Basic {0}:{1}'.format(\n TEST_USER_NAME, TEST_USER_PASSWORD))\n \n+ def tearDown(self):\n+ # still have to delete the created pages manually\n+ # because of test isolation problems\n+ del self.portal['page']\n+ del self.portal['front-page']\n+ transaction.commit()\n+ super(TestRedirectToFunctional, self).tearDown()\n+\n def test_regression(self):\n csrf_token = createToken()\n target = 'front-page'\n" +b'diff --git a/CHANGES.rst b/CHANGES.rst\nindex 94707d7..2a6fe6d 100644\n--- a/CHANGES.rst\n+++ b/CHANGES.rst\n@@ -14,7 +14,8 @@ New features:\n \n Bug fixes:\n \n-- *add item here*\n+- Remove the dummy security manager on test tear down\n+ [ale-rt]\n \n \n 1.8.0 (2018-09-26)\ndiff --git a/plone/autoform/tests/test_utils.py b/plone/autoform/tests/test_utils.py\nindex 5121e24..5fd9df0 100644\n--- a/plone/autoform/tests/test_utils.py\n+++ b/plone/autoform/tests/test_utils.py\n@@ -41,6 +41,9 @@ def checkPermission(self, perm, context):\n self.secman = DummySecurityManager()\n setSecurityManager(self.secman)\n \n+ def tearDown(self):\n+ noSecurityManager()\n+\n def test_processFields_permissionChecks_no_prefix(self):\n form = Form(None, None)\n form.groups = ()\n' -Repository: Products.CMFFormController +Repository: plone.autoform Branch: refs/heads/master -Date: 2018-10-03T16:00:33+02:00 -Author: Peter Mathis (petschki) -Commit: https://github.com/plone/Products.CMFFormController/commit/646de392e725f7db01ce8f0900e8b8edcbb76c0e +Date: 2018-10-03T13:42:02+02:00 +Author: ale-rt (ale-rt) +Commit: https://github.com/plone/plone.autoform/commit/d8e74cd682e4fbf2de2c729ff7f9c6e923e0fb1b -add changenote +Instead of removing the security manager reset the previously existing one Files changed: -A news/18.bugfix +M plone/autoform/tests/test_utils.py -b'diff --git a/news/18.bugfix b/news/18.bugfix\nnew file mode 100644\nindex 0000000..f7466a7\n--- /dev/null\n+++ b/news/18.bugfix\n@@ -0,0 +1,3 @@\n+fix testisolation problems\n+\n+[petschki]\n\\ No newline at end of file\n' +b'diff --git a/plone/autoform/tests/test_utils.py b/plone/autoform/tests/test_utils.py\nindex 5fd9df0..c5538ad 100644\n--- a/plone/autoform/tests/test_utils.py\n+++ b/plone/autoform/tests/test_utils.py\n@@ -1,6 +1,6 @@\n # -*- coding: utf-8 -*-\n-from AccessControl.SecurityManagement import noSecurityManager\n from AccessControl.SecurityManagement import setSecurityManager\n+from AccessControl.SecurityManagement import getSecurityManager\n from plone.autoform.interfaces import WRITE_PERMISSIONS_KEY\n from plone.autoform.utils import processFields\n from plone.supermodel.interfaces import FIELDSETS_KEY\n@@ -38,11 +38,12 @@ def checkPermission(self, perm, context):\n self.checks.append(perm)\n return False\n \n+ self.oldsecman = getSecurityManager()\n self.secman = DummySecurityManager()\n setSecurityManager(self.secman)\n \n def tearDown(self):\n- noSecurityManager()\n+ setSecurityManager(self.oldsecman)\n \n def test_processFields_permissionChecks_no_prefix(self):\n form = Form(None, None)\n' -Repository: Products.CMFFormController +Repository: plone.autoform Branch: refs/heads/master -Date: 2018-10-03T17:07:21+02:00 -Author: Peter Mathis (petschki) -Commit: https://github.com/plone/Products.CMFFormController/commit/f1d39e0dfd903b7d218ef20a1fef441bb646c4be +Date: 2018-10-03T17:08:23+02:00 +Author: Alessandro Pisa (ale-rt) +Commit: https://github.com/plone/plone.autoform/commit/6b39d44c66fc0ef168365275e54f81ef95592c5a -Merge pull request #18 from plone/testisolation-fix +Merge pull request #36 from plone/python3 -testisolation fixes +Remove the dummy security manager on test tear down Files changed: -A news/18.bugfix -M Products/CMFFormController/tests/testRedirectTo.py +M CHANGES.rst +M plone/autoform/tests/test_utils.py -b"diff --git a/Products/CMFFormController/tests/testRedirectTo.py b/Products/CMFFormController/tests/testRedirectTo.py\nindex b969fad..4424014 100644\n--- a/Products/CMFFormController/tests/testRedirectTo.py\n+++ b/Products/CMFFormController/tests/testRedirectTo.py\n@@ -67,6 +67,14 @@ def setUp(self):\n 'Authorization', 'Basic {0}:{1}'.format(\n TEST_USER_NAME, TEST_USER_PASSWORD))\n \n+ def tearDown(self):\n+ # still have to delete the created pages manually\n+ # because of test isolation problems\n+ del self.portal['page']\n+ del self.portal['front-page']\n+ transaction.commit()\n+ super(TestRedirectToFunctional, self).tearDown()\n+\n def test_regression(self):\n csrf_token = createToken()\n target = 'front-page'\ndiff --git a/news/18.bugfix b/news/18.bugfix\nnew file mode 100644\nindex 0000000..f7466a7\n--- /dev/null\n+++ b/news/18.bugfix\n@@ -0,0 +1,3 @@\n+fix testisolation problems\n+\n+[petschki]\n\\ No newline at end of file\n" +b'diff --git a/CHANGES.rst b/CHANGES.rst\nindex 94707d7..2a6fe6d 100644\n--- a/CHANGES.rst\n+++ b/CHANGES.rst\n@@ -14,7 +14,8 @@ New features:\n \n Bug fixes:\n \n-- *add item here*\n+- Remove the dummy security manager on test tear down\n+ [ale-rt]\n \n \n 1.8.0 (2018-09-26)\ndiff --git a/plone/autoform/tests/test_utils.py b/plone/autoform/tests/test_utils.py\nindex 5121e24..c5538ad 100644\n--- a/plone/autoform/tests/test_utils.py\n+++ b/plone/autoform/tests/test_utils.py\n@@ -1,6 +1,6 @@\n # -*- coding: utf-8 -*-\n-from AccessControl.SecurityManagement import noSecurityManager\n from AccessControl.SecurityManagement import setSecurityManager\n+from AccessControl.SecurityManagement import getSecurityManager\n from plone.autoform.interfaces import WRITE_PERMISSIONS_KEY\n from plone.autoform.utils import processFields\n from plone.supermodel.interfaces import FIELDSETS_KEY\n@@ -38,9 +38,13 @@ def checkPermission(self, perm, context):\n self.checks.append(perm)\n return False\n \n+ self.oldsecman = getSecurityManager()\n self.secman = DummySecurityManager()\n setSecurityManager(self.secman)\n \n+ def tearDown(self):\n+ setSecurityManager(self.oldsecman)\n+\n def test_processFields_permissionChecks_no_prefix(self):\n form = Form(None, None)\n form.groups = ()\n'