| OLD | NEW |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 # These are fake fetchers that are used for testing and the preview server. | 5 # These are fake fetchers that are used for testing and the preview server. |
| 6 # They return canned responses for URLs. appengine_wrappers.py uses the fake | 6 # They return canned responses for URLs. appengine_wrappers.py uses the fake |
| 7 # fetchers if the App Engine imports fail. | 7 # fetchers if the App Engine imports fail. |
| 8 | 8 |
| 9 import os | 9 import os |
| 10 import re | 10 import re |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 def _Stat(self, path): | 31 def _Stat(self, path): |
| 32 return int(os.stat(os.path.join(self._base_path, path)).st_mtime) | 32 return int(os.stat(os.path.join(self._base_path, path)).st_mtime) |
| 33 | 33 |
| 34 class FakeOmahaProxy(_FakeFetcher): | 34 class FakeOmahaProxy(_FakeFetcher): |
| 35 def fetch(self, url): | 35 def fetch(self, url): |
| 36 return self._ReadFile(os.path.join('server2', | 36 return self._ReadFile(os.path.join('server2', |
| 37 'test_data', | 37 'test_data', |
| 38 'branch_utility', | 38 'branch_utility', |
| 39 'first.json')) | 39 'first.json')) |
| 40 |
| 40 class FakeOmahaHistory(_FakeFetcher): | 41 class FakeOmahaHistory(_FakeFetcher): |
| 41 def fetch(self, url): | 42 def fetch(self, url): |
| 42 return self._ReadFile(os.path.join('server2', | 43 return self._ReadFile(os.path.join('server2', |
| 43 'test_data', | 44 'test_data', |
| 44 'branch_utility', | 45 'branch_utility', |
| 45 'second.json')) | 46 'second.json')) |
| 46 | 47 |
| 47 class FakeSubversionServer(_FakeFetcher): | 48 class FakeSubversionServer(_FakeFetcher): |
| 48 def __init__(self, base_path): | 49 def __init__(self, base_path): |
| 49 _FakeFetcher.__init__(self, base_path) | 50 _FakeFetcher.__init__(self, base_path) |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 url_constants.OMAHA_PROXY_URL: FakeOmahaProxy(docs), | 153 url_constants.OMAHA_PROXY_URL: FakeOmahaProxy(docs), |
| 153 re.escape(url_constants.OMAHA_DEV_HISTORY): FakeOmahaHistory(docs), | 154 re.escape(url_constants.OMAHA_DEV_HISTORY): FakeOmahaHistory(docs), |
| 154 '%s/.*' % url_constants.SVN_URL: FakeSubversionServer(docs), | 155 '%s/.*' % url_constants.SVN_URL: FakeSubversionServer(docs), |
| 155 '%s/.*' % url_constants.VIEWVC_URL: FakeViewvcServer(docs), | 156 '%s/.*' % url_constants.VIEWVC_URL: FakeViewvcServer(docs), |
| 156 '%s/commits/.*' % url_constants.GITHUB_URL: FakeGithubStat(docs), | 157 '%s/commits/.*' % url_constants.GITHUB_URL: FakeGithubStat(docs), |
| 157 '%s/zipball' % url_constants.GITHUB_URL: FakeGithubZip(docs), | 158 '%s/zipball' % url_constants.GITHUB_URL: FakeGithubZip(docs), |
| 158 '%s/api/.*' % url_constants.CODEREVIEW_SERVER: FakeRietveldAPI(docs), | 159 '%s/api/.*' % url_constants.CODEREVIEW_SERVER: FakeRietveldAPI(docs), |
| 159 '%s/tarball/.*' % url_constants.CODEREVIEW_SERVER: | 160 '%s/tarball/.*' % url_constants.CODEREVIEW_SERVER: |
| 160 FakeRietveldTarball(docs), | 161 FakeRietveldTarball(docs), |
| 161 }) | 162 }) |
| OLD | NEW |