Bug 704642 - Support handling of repository searches against stub server; r=rnewman

This commit is contained in:
Gregory Szorc 2011-12-07 10:32:51 -08:00
Родитель ebaef6b791
Коммит 4b34db3a61
2 изменённых файлов: 28 добавлений и 1 удалений

Просмотреть файл

@ -56,7 +56,33 @@ class MozRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def translate_path(self, path):
# It appears that the default path is '/' and os.path.join makes the '/'
o = urlparse(path)
return "%s%s" % ('' if sys.platform == 'win32' else '/', '/'.join([i.strip('/') for i in (DOCROOT, o.path)]))
sep = '/'
if sys.platform == 'win32':
sep = ''
ret = '%s%s' % ( sep, DOCROOT.strip('/') )
# Stub out addons.mozilla.org search API, which is used when installing
# add-ons. The version is hard-coded because we want tests to fail when
# the API updates so we can update our stubbed files with the changes.
if o.path.find('/en-US/firefox/api/1.5/search/guid:') == 0:
ids = urllib.unquote(o.path[len('/en-US/firefox/api/1.5/search/guid:'):])
if ids.count(',') > 0:
raise Exception('Searching for multiple IDs is not supported.')
base = ids
at_loc = ids.find('@')
if at_loc > 0:
base = ids[0:at_loc]
ret += '/%s.xml' % base
else:
ret += '/%s' % o.path.strip('/')
return ret
# I found on my local network that calls to this were timing out
# I believe all of these calls are from log_message

Просмотреть файл

@ -89,6 +89,7 @@ class TPSTestRunner(object):
'XPCOM_DEBUG_BREAK': 'warn',
}
default_preferences = { 'app.update.enabled' : False,
'extensions.getAddons.get.url': 'http://127.0.0.1:4567/en-US/firefox/api/%API_VERSION%/search/guid:%IDS%',
'extensions.update.enabled' : False,
'extensions.update.notifyUser' : False,
'browser.shell.checkDefaultBrowser' : False,