[tests] Move 'anonymous_allowed' property from CubicWebServerTC to CubicWebTC
authorChristophe de Vienne <christophe@unlish.com>
Tue, 17 Jun 2014 11:53:35 +0200
changeset 9929 16163ee1cdf9
parent 9919 e013c35067d7
child 9930 d20c2b262f55
[tests] Move 'anonymous_allowed' property from CubicWebServerTC to CubicWebTC The effective set of the property on the config is now done later that before, ie at the end of CubicWebTC.init_config instead of before. It is believed not to have an impact on the test suites that uses `anonymous_allowed`. Related to #4002134
devtools/httptest.py
devtools/testlib.py
--- a/devtools/httptest.py	Tue Jul 08 11:33:32 2014 +0200
+++ b/devtools/httptest.py	Tue Jun 17 11:53:35 2014 +0200
@@ -89,8 +89,6 @@
     * `anonymous_allowed`: flag telling if anonymous browsing should be allowed
     """
     configcls = CubicWebServerConfig
-    # anonymous is logged by default in cubicweb test cases
-    anonymous_allowed = True
 
     def start_server(self):
         # use a semaphore to avoid starting test while the http server isn't
@@ -185,8 +183,3 @@
             # Server could be launched manually
             print err
         super(CubicWebServerTC, self).tearDown()
-
-    @classmethod
-    def init_config(cls, config):
-        config.set_anonymous_allowed(cls.anonymous_allowed)
-        super(CubicWebServerTC, cls).init_config(config)
--- a/devtools/testlib.py	Tue Jul 08 11:33:32 2014 +0200
+++ b/devtools/testlib.py	Tue Jun 17 11:53:35 2014 +0200
@@ -297,6 +297,9 @@
     _cnxs = set() # establised connection
                   # stay on connection for leak detection purpose
 
+    # anonymous is logged by default in cubicweb test cases
+    anonymous_allowed = True
+
     def __init__(self, *args, **kwargs):
         self._admin_session = None
         self._admin_clt_cnx = None
@@ -532,6 +535,7 @@
             config.global_set_option('embed-allowed', re.compile('.*'))
         except Exception: # not in server only configuration
             pass
+        config.set_anonymous_allowed(cls.anonymous_allowed)
 
     @property
     def vreg(self):