Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2684)

Unified Diff: chrome/common/extensions/docs/server2/fake_fetchers.py

Issue 14125010: Docserver: Add support for viewing docs with a codereview patch applied (Closed) Base URL: https://src.chromium.org/svn/trunk/src/
Patch Set: add executable bits for tests Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/server2/fake_fetchers.py
diff --git a/chrome/common/extensions/docs/server2/fake_fetchers.py b/chrome/common/extensions/docs/server2/fake_fetchers.py
index 4e66e4aaed16817b9025efd323dcab7ac316d8f2..45d12eeaa783e5d3a55cda9184c06e57a8e009ee 100644
--- a/chrome/common/extensions/docs/server2/fake_fetchers.py
+++ b/chrome/common/extensions/docs/server2/fake_fetchers.py
@@ -107,9 +107,36 @@ class FakeGithubZip(_FakeFetcher):
except IOError:
return None
-class FakeIssuesFetcher(_FakeFetcher):
+class FakeRietveldAPI(_FakeFetcher):
+ def __init__(self, base_path):
+ _FakeFetcher.__init__(self, base_path)
+ self._base_pattern = re.compile(r'.*/(api/.*)')
+
+ def fetch(self, url):
+ try:
+ return self._ReadFile(
+ os.path.join('server2',
+ 'test_data',
+ 'rietveld_patcher',
+ self._base_pattern.match(url).group(1),
+ 'json'))
+ except IOError:
+ return None
+
+class FakeRietveldTarball(_FakeFetcher):
+ def __init__(self, base_path):
+ _FakeFetcher.__init__(self, base_path)
+ self._base_pattern = re.compile(r'.*/(tarball/\d+/\d+)')
+
def fetch(self, url):
- return 'Status,Summary,ID'
+ try:
+ return self._ReadFile(
+ os.path.join('server2',
+ 'test_data',
+ 'rietveld_patcher',
+ self._base_pattern.match(url).group(1) + '.tar.bz2'))
+ except IOError:
+ return None
def ConfigureFakeFetchers():
'''Configure the fake fetcher paths relative to the docs directory.
@@ -121,6 +148,7 @@ def ConfigureFakeFetchers():
'%s/.*' % url_constants.VIEWVC_URL: FakeViewvcServer(docs),
'%s/commits/.*' % url_constants.GITHUB_URL: FakeGithubStat(docs),
'%s/zipball' % url_constants.GITHUB_URL: FakeGithubZip(docs),
- re.escape(url_constants.OPEN_ISSUES_CSV_URL): FakeIssuesFetcher(docs),
- re.escape(url_constants.CLOSED_ISSUES_CSV_URL): FakeIssuesFetcher(docs)
+ '%s/api/.*' % url_constants.CODEREVIEW_SERVER: FakeRietveldAPI(docs),
+ '%s/tarball/.*' % url_constants.CODEREVIEW_SERVER:
+ FakeRietveldTarball(docs),
})
« no previous file with comments | « chrome/common/extensions/docs/server2/cron_servlet.py ('k') | chrome/common/extensions/docs/server2/handler.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698