| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 import os | 6 import os |
| 7 import sys | 7 import sys |
| 8 import unittest | 8 import unittest |
| 9 | 9 |
| 10 from branch_utility import BranchUtility | 10 from branch_utility import BranchUtility |
| 11 from fake_url_fetcher import FakeUrlFetcher | 11 from fake_url_fetcher import FakeUrlFetcher |
| 12 from object_store_creator import ObjectStoreCreator |
| 12 from test_object_store import TestObjectStore | 13 from test_object_store import TestObjectStore |
| 13 | 14 |
| 14 class BranchUtilityTest(unittest.TestCase): | 15 class BranchUtilityTest(unittest.TestCase): |
| 15 def setUp(self): | 16 def setUp(self): |
| 16 self._branch_util = BranchUtility( | 17 self._branch_util = BranchUtility( |
| 17 os.path.join('branch_utility', 'first.json'), | 18 os.path.join('branch_utility', 'first.json'), |
| 18 FakeUrlFetcher(os.path.join(sys.path[0], 'test_data')), | 19 FakeUrlFetcher(os.path.join(sys.path[0], 'test_data')), |
| 19 object_store=TestObjectStore('test')) | 20 ObjectStoreCreator.TestFactory()) |
| 20 | 21 |
| 21 def testSplitChannelNameFromPath(self): | 22 def testSplitChannelNameFromPath(self): |
| 22 self.assertEquals(('stable', 'extensions/stuff.html'), | 23 self.assertEquals(('stable', 'extensions/stuff.html'), |
| 23 self._branch_util.SplitChannelNameFromPath( | 24 self._branch_util.SplitChannelNameFromPath( |
| 24 'stable/extensions/stuff.html')) | 25 'stable/extensions/stuff.html')) |
| 25 self.assertEquals(('dev', 'extensions/stuff.html'), | 26 self.assertEquals(('dev', 'extensions/stuff.html'), |
| 26 self._branch_util.SplitChannelNameFromPath( | 27 self._branch_util.SplitChannelNameFromPath( |
| 27 'dev/extensions/stuff.html')) | 28 'dev/extensions/stuff.html')) |
| 28 self.assertEquals(('beta', 'extensions/stuff.html'), | 29 self.assertEquals(('beta', 'extensions/stuff.html'), |
| 29 self._branch_util.SplitChannelNameFromPath( | 30 self._branch_util.SplitChannelNameFromPath( |
| (...skipping 19 matching lines...) Expand all Loading... |
| 49 self._branch_util.GetBranchNumberForChannelName('dev')) | 50 self._branch_util.GetBranchNumberForChannelName('dev')) |
| 50 self.assertEquals('1084', | 51 self.assertEquals('1084', |
| 51 self._branch_util.GetBranchNumberForChannelName('beta')) | 52 self._branch_util.GetBranchNumberForChannelName('beta')) |
| 52 self.assertEquals('1084', | 53 self.assertEquals('1084', |
| 53 self._branch_util.GetBranchNumberForChannelName('stable')) | 54 self._branch_util.GetBranchNumberForChannelName('stable')) |
| 54 self.assertEquals('trunk', | 55 self.assertEquals('trunk', |
| 55 self._branch_util.GetBranchNumberForChannelName('trunk')) | 56 self._branch_util.GetBranchNumberForChannelName('trunk')) |
| 56 | 57 |
| 57 if __name__ == '__main__': | 58 if __name__ == '__main__': |
| 58 unittest.main() | 59 unittest.main() |
| OLD | NEW |