зеркало из https://github.com/mozilla/pjs.git
Bug 704642 - Support handling of repository searches against stub server; r=rnewman
This commit is contained in:
Родитель
ebaef6b791
Коммит
4b34db3a61
|
@ -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,
|
||||
|
|
Загрузка…
Ссылка в новой задаче