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

Side by Side 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: Fixes, Prettifying canned_data 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 unified diff | Download patch
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 from branch_utility import BranchUtility, ChannelInfo 5 from branch_utility import BranchUtility, ChannelInfo
6 from test_data.canned_data import (CANNED_BRANCHES, CANNED_CHANNELS)
6 7
7 class TestBranchUtility(object): 8 class TestBranchUtility(object):
8 '''Mimics BranchUtility to return valid-ish data without needing omahaproxy 9 '''Mimics BranchUtility to return valid-ish data without needing omahaproxy
9 data. 10 data.
10 ''' 11 '''
not at google - send to devlin 2013/06/21 00:54:11 almost what I meant. except, pass the branches and
epeterson 2013/06/22 01:42:40 Done. I also made a method similar to BranchUtilit
11 def GetAllChannelInfo(self): 12 def GetAllChannelInfo(self):
12 return [self.GetChannelInfo(channel) 13 return [self.GetChannelInfo(channel)
13 for channel in BranchUtility.GetAllChannelNames()] 14 for channel in BranchUtility.GetAllChannelNames()]
14 15
15 def GetChannelInfo(self, channel): 16 def GetChannelInfo(self, channel):
16 return ChannelInfo(channel, 17 version = CANNED_CHANNELS[channel]
17 'fakebranch-%s' % channel, 18 return ChannelInfo(channel, self.GetBranchForVersion(version), version)
18 'fakeversion-%s' % channel)
19 19
20 def GetBranchForVersion(self, version): 20 def GetBranchForVersion(self, version):
21 return 'fakebranch-%s' % version 21 return CANNED_BRANCHES[version]
22
23 def GetChannelForVersion(self, version):
24 for channel in CANNED_CHANNELS.iterkeys():
25 if CANNED_CHANNELS[channel] == version:
26 return channel
epeterson 2013/06/21 00:48:26 Can we reuse dicts from canned_data? This way we d
not at google - send to devlin 2013/06/21 00:54:11 answered above
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698