[FIX] db handling being a pain in the ass

On runbot the base url dispatches into a unknown void of no db being
selected and the CMS thus 404s. For human beings there are additional
links to special subdomains setting the right db in the right place
(or maybe the right dbfilter, whatever) but that doesn't work right
for the crawler test suite.

Instead go through /web/ with a forced db selection, this *should* set
the db correctly in the user's session even if he's anonymous and thus
allows us to browse said db.

No idea if this fevered idea is actually going to work.

bzr revid: xmo@openerp.com-20131106115547-0ozlex09svkecrhb
This commit is contained in:
Xavier Morel 2013-11-06 12:55:47 +01:00
parent 2d81712e2c
commit 841a5e7c2d
1 changed files with 16 additions and 11 deletions

View File

@ -61,18 +61,23 @@ class CrawlSuite(unittest2.TestSuite):
]))
def _authenticate(self, user, password):
if user is None: return
url = 'http://localhost:{port}/login?{query}'.format(
# force tools.config['db_name'] in user session so opening `/` doesn't
# blow up in multidb situations
self.opener.open('http://localhost:{port}/web/?db={db}'.format(
port=tools.config['xmlrpc_port'],
query=urllib.urlencode({
'db': tools.config['db_name'],
'login': user,
'key': password,
})
)
auth = self.opener.open(url)
assert auth.getcode() < 400, "Auth failure %d" % auth.getcode()
db=urllib.quote_plus(tools.config['db_name']),
))
if user is not None:
url = 'http://localhost:{port}/login?{query}'.format(
port=tools.config['xmlrpc_port'],
query=urllib.urlencode({
'db': tools.config['db_name'],
'login': user,
'key': password,
})
)
auth = self.opener.open(url)
assert auth.getcode() < 400, "Auth failure %d" % auth.getcode()
def _wrapped_run(self, result, debug=False):
paths = collections.deque(['/'])