From 2be4f614e0413b808c5e630e459453159a9bc388 Mon Sep 17 00:00:00 2001
From: Arnaud Fontaine <arnaud.fontaine@nexedi.com>
Date: Wed, 25 Mar 2020 18:58:48 +0900
Subject: [PATCH] runUnitTest: Set `skip-ownership-checking true` as we already
 do for a normal instance through zope.conf.

Related to 58c9f7c3c688854958592590dd396929b5a0c8d4 in slapos.git.
---
 product/ERP5Type/tests/runUnitTest.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/product/ERP5Type/tests/runUnitTest.py b/product/ERP5Type/tests/runUnitTest.py
index a78a20a06e..b48e03e382 100755
--- a/product/ERP5Type/tests/runUnitTest.py
+++ b/product/ERP5Type/tests/runUnitTest.py
@@ -507,6 +507,17 @@ def runUnitTestList(test_list, verbosity=1, debug=0, run_only=None):
   # ZopeTestCase below (Leo: I hate import side-effects with a passion).
   import App.config
   cfg = App.config.getConfiguration()
+  # Zope do not call setDefaultBehaviors() for testing instance as it does for
+  # a normal instance so `cfg.skip_ownership_checking = True` would not work
+  # here...
+  import AccessControl
+  AccessControl.setDefaultBehaviors(
+    # ownerous: ERP5 default (zope.conf: `skip-ownership-checking true`)
+    False,
+    # authenticated: Zope default (zope.conf: `skip_authentication_checking`)
+    True,
+    # verbose: Zope default
+    False)
   cfg.testinghome = instance_home
   cfg.instancehome = instance_home
   from Zope2.Startup.datatypes import DBTab
-- 
2.30.9