| Index: chrome/common/extensions/docs/server2/integration_test.py
|
| diff --git a/chrome/common/extensions/docs/server2/integration_test.py b/chrome/common/extensions/docs/server2/integration_test.py
|
| index 392337d28dc610a1fa66d7b2c3dd8bf621a679ec..4e20b84fff0f5d57780a5a52d2df9f21ac576ddd 100755
|
| --- a/chrome/common/extensions/docs/server2/integration_test.py
|
| +++ b/chrome/common/extensions/docs/server2/integration_test.py
|
| @@ -4,16 +4,49 @@
|
| # found in the LICENSE file.
|
|
|
| import os
|
| +import re
|
| from StringIO import StringIO
|
| import unittest
|
|
|
| import appengine_memcache as memcache
|
| +import appengine_wrappers
|
| import handler
|
| from handler import Handler
|
|
|
| KNOWN_FAILURES = [
|
| ]
|
|
|
| +def _ReadFile(path):
|
| + with open(path, 'r') as f:
|
| + return f.read()
|
| +
|
| +class FakeOmahaProxy(object):
|
| + def fetch(self, url):
|
| + return _ReadFile(os.path.join('test_data', 'branch_utility', 'first.json'))
|
| +
|
| +class FakeSubversionServer(object):
|
| + def __init__(self):
|
| + self._base_pattern = re.compile(r'.*chrome/common/extensions/(.*)')
|
| +
|
| + def fetch(self, url):
|
| + path = os.path.join(
|
| + os.pardir, os.pardir, self._base_pattern.match(url).group(1))
|
| + if os.path.isdir(path):
|
| + html = ['<html>Revision 000000']
|
| + for f in os.listdir(path):
|
| + if os.path.isdir(os.path.join(path, f)):
|
| + html.append('<a>' + f + '/</a>')
|
| + else:
|
| + html.append('<a>' + f + '</a>')
|
| + html.append('</html>')
|
| + return '\n'.join(html)
|
| + return _ReadFile(path)
|
| +
|
| +appengine_wrappers.ConfigureFakeUrlFetch({
|
| + handler.OMAHA_PROXY_URL: FakeOmahaProxy(),
|
| + '%s/.*' % handler.SVN_URL: FakeSubversionServer()
|
| +})
|
| +
|
| class _MockResponse(object):
|
| def __init__(self):
|
| self.status = 200
|
| @@ -59,11 +92,6 @@ class IntegrationTest(unittest.TestCase):
|
| self.assertTrue(response.out.getvalue())
|
|
|
| def testWarmupRequest(self):
|
| - for branch in ['dev', 'trunk', 'beta', 'stable']:
|
| - handler.BRANCH_UTILITY_MEMCACHE.Set(
|
| - branch + '.' + handler.OMAHA_PROXY_URL,
|
| - 'local',
|
| - memcache.MEMCACHE_BRANCH_UTILITY)
|
| request = _MockRequest('_ah/warmup')
|
| response = _MockResponse()
|
| Handler(request, response, local_path='../..').get()
|
|
|