OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. |
| 5 |
| 6 import unittest |
| 7 import test_urlfetch |
| 8 |
| 9 from branch_utility import BranchUtility |
| 10 |
| 11 class BranchUtilityTest(unittest.TestCase): |
| 12 def testGetChannelNameFromPath(self): |
| 13 b_util = BranchUtility(test_urlfetch) |
| 14 self.assertEquals('dev', b_util.GetChannelNameFromPath( |
| 15 'dev/hello/stuff.html')) |
| 16 self.assertEquals('beta', b_util.GetChannelNameFromPath( |
| 17 'beta/hello/stuff.html')) |
| 18 self.assertEquals('trunk', b_util.GetChannelNameFromPath( |
| 19 'trunk/hello/stuff.html')) |
| 20 self.assertEquals('stable', b_util.GetChannelNameFromPath( |
| 21 'hello/stuff.html')) |
| 22 self.assertEquals('stable', b_util.GetChannelNameFromPath( |
| 23 'hello/dev/stuff.html')) |
| 24 |
| 25 def testGetBranchNumberForChannelName(self): |
| 26 b_util = BranchUtility(test_urlfetch) |
| 27 b_util.SetURL('branch_utility/first.json') |
| 28 self.assertEquals('1132', |
| 29 b_util.GetBranchNumberForChannelName('dev')) |
| 30 self.assertEquals('1084', |
| 31 b_util.GetBranchNumberForChannelName('beta')) |
| 32 self.assertEquals('1234', |
| 33 b_util.GetBranchNumberForChannelName('stable')) |
| 34 self.assertEquals('trunk', |
| 35 b_util.GetBranchNumberForChannelName('trunk')) |
| 36 |
| 37 if __name__ == '__main__': |
| 38 unittest.main() |
OLD | NEW |