[server] fix anonymous_user predicate in tests
authorJulien Cristau <julien.cristau@logilab.fr>
Fri, 12 Sep 2014 09:49:01 +0200
changeset 9979 9ccdb3751fbe
parent 9978 8f4b15e5b300
child 9984 793377697c81
[server] fix anonymous_user predicate in tests devtools' TestServerConfiguration overrides the anonymous_user method, but not the anonymous-user config option, so testing for the latter would give the wrong result. Closes #3996664.
server/session.py
--- a/server/session.py	Mon Jul 28 16:05:19 2014 +0200
+++ b/server/session.py	Fri Sep 12 09:49:01 2014 +0200
@@ -1711,10 +1711,13 @@
 
     @property
     def anonymous_session(self):
-        # XXX for now, anonymous-user is a web side option.
+        # XXX for now, anonymous_user only exists in webconfig (and testconfig).
         # It will only be present inside all-in-one instance.
         # there is plan to move it down to global config.
-        return self.user.login == self.repo.config.get('anonymous-user')
+        if not hasattr(self.repo.config, 'anonymous_user'):
+            # not a web or test config, no anonymous user
+            return False
+        return self.user.login == self.repo.config.anonymous_user()[0]
 
     @deprecated('[3.13] use getattr(session.rtype_eids_rdef(rtype, eidfrom, eidto), prop)')
     def schema_rproperty(self, rtype, eidfrom, eidto, rprop):