| 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 from appengine_memcache import AppEngineMemcache | 6 from in_memory_object_store import InMemoryObjectStore |
| 7 from branch_utility import BranchUtility | 7 from branch_utility import BranchUtility |
| 8 from fake_url_fetcher import FakeUrlFetcher | 8 from fake_url_fetcher import FakeUrlFetcher |
| 9 import unittest | 9 import unittest |
| 10 | 10 |
| 11 class BranchUtilityTest(unittest.TestCase): | 11 class BranchUtilityTest(unittest.TestCase): |
| 12 def setUp(self): | 12 def setUp(self): |
| 13 self._branch_util = BranchUtility('branch_utility/first.json', | 13 self._branch_util = BranchUtility('branch_utility/first.json', |
| 14 'stable', | 14 'stable', |
| 15 FakeUrlFetcher('test_data'), | 15 FakeUrlFetcher('test_data'), |
| 16 AppEngineMemcache('')) | 16 InMemoryObjectStore('')) |
| 17 | 17 |
| 18 def testSplitChannelNameFromPath(self): | 18 def testSplitChannelNameFromPath(self): |
| 19 self.assertEquals(('dev', 'hello/stuff.html'), | 19 self.assertEquals(('dev', 'hello/stuff.html'), |
| 20 self._branch_util.SplitChannelNameFromPath( | 20 self._branch_util.SplitChannelNameFromPath( |
| 21 'dev/hello/stuff.html')) | 21 'dev/hello/stuff.html')) |
| 22 self.assertEquals(('beta', 'hello/stuff.html'), | 22 self.assertEquals(('beta', 'hello/stuff.html'), |
| 23 self._branch_util.SplitChannelNameFromPath( | 23 self._branch_util.SplitChannelNameFromPath( |
| 24 'beta/hello/stuff.html')) | 24 'beta/hello/stuff.html')) |
| 25 self.assertEquals(('trunk', 'hello/stuff.html'), | 25 self.assertEquals(('trunk', 'hello/stuff.html'), |
| 26 self._branch_util.SplitChannelNameFromPath( | 26 self._branch_util.SplitChannelNameFromPath( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 37 self._branch_util.GetBranchNumberForChannelName('dev')) | 37 self._branch_util.GetBranchNumberForChannelName('dev')) |
| 38 self.assertEquals('1084', | 38 self.assertEquals('1084', |
| 39 self._branch_util.GetBranchNumberForChannelName('beta')) | 39 self._branch_util.GetBranchNumberForChannelName('beta')) |
| 40 self.assertEquals('1234', | 40 self.assertEquals('1234', |
| 41 self._branch_util.GetBranchNumberForChannelName('stable')) | 41 self._branch_util.GetBranchNumberForChannelName('stable')) |
| 42 self.assertEquals('trunk', | 42 self.assertEquals('trunk', |
| 43 self._branch_util.GetBranchNumberForChannelName('trunk')) | 43 self._branch_util.GetBranchNumberForChannelName('trunk')) |
| 44 | 44 |
| 45 if __name__ == '__main__': | 45 if __name__ == '__main__': |
| 46 unittest.main() | 46 unittest.main() |
| OLD | NEW |