devtools/__init__.py
branchstable
changeset 7065 6a6ea9966931
parent 7056 51f88f13d6f3
child 7071 db7608cb32bc
--- a/devtools/__init__.py	Wed Mar 09 13:42:55 2011 +0100
+++ b/devtools/__init__.py	Tue Dec 07 12:18:20 2010 +0100
@@ -89,8 +89,11 @@
         ServerConfiguration.options +
         tuple((opt, optdict) for opt, optdict in TwistedConfiguration.options
               if opt in ('anonymous-user', 'anonymous-password')))
+    # By default anonymous login are allow but some test need to deny of to
+    # change the default user. Set it to None to prevent anonymous login.
+    anonymous_credential = ('anon', 'anon')
 
-    def __init__(self, appid, apphome=None, log_threshold=logging.CRITICAL+10):
+    def __init__(self, appid='data', apphome=None, log_threshold=logging.CRITICAL+10):
         # must be set before calling parent __init__
         if apphome is None:
             if exists(appid):
@@ -112,8 +115,10 @@
 
     def load_configuration(self):
         super(TestServerConfiguration, self).load_configuration()
-        self.global_set_option('anonymous-user', 'anon')
-        self.global_set_option('anonymous-password', 'anon')
+        if self.anonymous_credential:
+            user, password = self.anonymous_credential
+            self.global_set_option('anonymous-user', user)
+            self.global_set_option('anonymous-password', password)
         # no undo support in tests
         self.global_set_option('undo-support', '')