devtools/__init__.py
changeset 3435 84036ad2c82d
parent 3163 edfe43ceaa35
child 3647 2941f4a0aab9
equal deleted inserted replaced
3434:6d0f22f5d31f 3435:84036ad2c82d
   103     def __init__(self, appid, log_threshold=logging.CRITICAL+10):
   103     def __init__(self, appid, log_threshold=logging.CRITICAL+10):
   104         ServerConfiguration.__init__(self, appid)
   104         ServerConfiguration.__init__(self, appid)
   105         self.init_log(log_threshold, force=True)
   105         self.init_log(log_threshold, force=True)
   106         # need this, usually triggered by cubicweb-ctl
   106         # need this, usually triggered by cubicweb-ctl
   107         self.load_cwctl_plugins()
   107         self.load_cwctl_plugins()
       
   108         self.global_set_option('anonymous-user', 'anon')
       
   109         self.global_set_option('anonymous-password', 'anon')
   108 
   110 
   109     anonymous_user = TwistedConfiguration.anonymous_user.im_func
   111     anonymous_user = TwistedConfiguration.anonymous_user.im_func
   110 
   112 
   111     @property
   113     @property
   112     def apphome(self):
   114     def apphome(self):
   113         if exists(self.appid):
   115         if exists(self.appid):
   114             return abspath(self.appid)
   116             return abspath(self.appid)
   115         # cube test
   117         # cube test
   116         return abspath('..')
   118         return abspath('..')
   117     appdatahome = apphome
   119     appdatahome = apphome
       
   120 
       
   121     def load_configuration(self):
       
   122         super(TestServerConfiguration, self).load_configuration()
       
   123         self.global_set_option('anonymous-user', 'anon')
       
   124         self.global_set_option('anonymous-password', 'anon')
   118 
   125 
   119     def main_config_file(self):
   126     def main_config_file(self):
   120         """return instance's control configuration file"""
   127         """return instance's control configuration file"""
   121         return join(self.apphome, '%s.conf' % self.name)
   128         return join(self.apphome, '%s.conf' % self.name)
   122 
   129 
   177 
   184 
   178     def __init__(self, appid, log_threshold=logging.CRITICAL, sourcefile=None):
   185     def __init__(self, appid, log_threshold=logging.CRITICAL, sourcefile=None):
   179         BaseApptestConfiguration.__init__(self, appid, log_threshold=log_threshold)
   186         BaseApptestConfiguration.__init__(self, appid, log_threshold=log_threshold)
   180         self.init_repository = sourcefile is None
   187         self.init_repository = sourcefile is None
   181         self.sourcefile = sourcefile
   188         self.sourcefile = sourcefile
   182         self.global_set_option('anonymous-user', 'anon')
       
   183         self.global_set_option('anonymous-password', 'anon')
       
   184 
       
   185     def load_configuration(self):
       
   186         super(ApptestConfiguration, self).load_configuration()
       
   187         self.global_set_option('anonymous-user', 'anon')
       
   188         self.global_set_option('anonymous-password', 'anon')
       
   189 
   189 
   190 
   190 
   191 # test database handling #######################################################
   191 # test database handling #######################################################
   192 
   192 
   193 def init_test_database(config=None, configdir='data'):
   193 def init_test_database(config=None, configdir='data'):