215 def default_base_url(self): |
215 def default_base_url(self): |
216 return BASE_URL |
216 return BASE_URL |
217 |
217 |
218 |
218 |
219 class BaseApptestConfiguration(TestServerConfiguration, TwistedConfiguration): |
219 class BaseApptestConfiguration(TestServerConfiguration, TwistedConfiguration): |
220 repo_method = 'inmemory' |
|
221 name = 'all-in-one' # so it search for all-in-one.conf, not repository.conf |
220 name = 'all-in-one' # so it search for all-in-one.conf, not repository.conf |
222 options = cwconfig.merge_options(TestServerConfiguration.options |
221 options = cwconfig.merge_options(TestServerConfiguration.options |
223 + TwistedConfiguration.options) |
222 + TwistedConfiguration.options) |
224 cubicweb_appobject_path = TestServerConfiguration.cubicweb_appobject_path | TwistedConfiguration.cubicweb_appobject_path |
223 cubicweb_appobject_path = TestServerConfiguration.cubicweb_appobject_path | TwistedConfiguration.cubicweb_appobject_path |
225 cube_appobject_path = TestServerConfiguration.cube_appobject_path | TwistedConfiguration.cube_appobject_path |
224 cube_appobject_path = TestServerConfiguration.cube_appobject_path | TwistedConfiguration.cube_appobject_path |
383 repo._needs_refresh = False |
382 repo._needs_refresh = False |
384 repo.turn_repo_on = partial(turn_repo_on, repo) |
383 repo.turn_repo_on = partial(turn_repo_on, repo) |
385 repo.turn_repo_off = partial(turn_repo_off, repo) |
384 repo.turn_repo_off = partial(turn_repo_off, repo) |
386 return repo |
385 return repo |
387 |
386 |
388 |
|
389 def get_cnx(self): |
387 def get_cnx(self): |
390 """return Connection object on the current repository""" |
388 """return Connection object on the current repository""" |
391 from cubicweb.dbapi import in_memory_cnx |
389 from cubicweb.dbapi import repo_connect |
392 repo = self.get_repo() |
390 repo = self.get_repo() |
393 sources = self.config.sources() |
391 sources = self.config.sources() |
394 login = unicode(sources['admin']['login']) |
392 login = unicode(sources['admin']['login']) |
395 password = sources['admin']['password'] or 'xxx' |
393 password = sources['admin']['password'] or 'xxx' |
396 cnx = in_memory_cnx(repo, login, password=password) |
394 cnx = repo_connect(repo, login, password=password) |
397 return cnx |
395 return cnx |
398 |
396 |
399 def get_repo_and_cnx(self, db_id=DEFAULT_EMPTY_DB_ID): |
397 def get_repo_and_cnx(self, db_id=DEFAULT_EMPTY_DB_ID): |
400 """Reset database with the current db_id and return (repo, cnx) |
398 """Reset database with the current db_id and return (repo, cnx) |
401 |
399 |