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

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

Issue 17397010: Adding AvailabilityFinder to Doc Server (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Second Round of Smaller Fixes Created 7 years, 6 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/test_branch_utility.py
diff --git a/chrome/common/extensions/docs/server2/test_branch_utility.py b/chrome/common/extensions/docs/server2/test_branch_utility.py
index aaabdcac36886148ec84f1909c8b078433c06501..5dec4767ec57fa8755b86a82279ecadfb2d67184 100644
--- a/chrome/common/extensions/docs/server2/test_branch_utility.py
+++ b/chrome/common/extensions/docs/server2/test_branch_utility.py
@@ -3,19 +3,38 @@
# found in the LICENSE file.
from branch_utility import BranchUtility, ChannelInfo
+from test_data.canned_data import (CANNED_BRANCHES, CANNED_CHANNELS)
class TestBranchUtility(object):
'''Mimics BranchUtility to return valid-ish data without needing omahaproxy
data.
'''
+ def __init__(self, branches, channels):
+ ''' Parameters: |branches| is a mapping of versions to branches, and
+ |channels| is a mapping of channels to versions.
+ '''
+ self._branches = branches
+ self._channels = channels
+
+ @staticmethod
+ def CreateWithCannedData():
+ '''Returns a TestBranchUtility that uses 'canned' test data pulled from
+ older branches of SVN data.
+ '''
+ return TestBranchUtility(CANNED_BRANCHES, CANNED_CHANNELS)
+
def GetAllChannelInfo(self):
return [self.GetChannelInfo(channel)
for channel in BranchUtility.GetAllChannelNames()]
def GetChannelInfo(self, channel):
- return ChannelInfo(channel,
- 'fakebranch-%s' % channel,
- 'fakeversion-%s' % channel)
+ version = self._channels[channel]
+ return ChannelInfo(channel, self.GetBranchForVersion(version), version)
def GetBranchForVersion(self, version):
- return 'fakebranch-%s' % version
+ return self._branches[version]
+
+ def GetChannelForVersion(self, version):
+ for channel in self._channels.iterkeys():
+ if self._channels[channel] == version:
+ return channel

Powered by Google App Engine
This is Rietveld 408576698