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

Side by Side Diff: chrome/common/extensions/docs/server2/branch_utility_test.py

Issue 10704252: Extensions Docs Server: Internal file system (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tests Created 8 years, 5 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 | Annotate | Revision Log
OLDNEW
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 branch_utility 6 import branch_utility
7 from fake_url_fetcher import FakeUrlFetcher
7 import unittest 8 import unittest
8 import test_urlfetch
9 9
10 class BranchUtilityTest(unittest.TestCase): 10 class BranchUtilityTest(unittest.TestCase):
11 def setUp(self):
12 self._fetcher = FakeUrlFetcher('test_data')
13
11 def testSplitChannelNameFromPath(self): 14 def testSplitChannelNameFromPath(self):
12 self.assertEquals(('dev', 'hello/stuff.html'), 15 self.assertEquals(('dev', 'hello/stuff.html'),
13 branch_utility.SplitChannelNameFromPath( 16 branch_utility.SplitChannelNameFromPath(
14 'dev/hello/stuff.html')) 17 'dev/hello/stuff.html'))
15 self.assertEquals(('beta', 'hello/stuff.html'), 18 self.assertEquals(('beta', 'hello/stuff.html'),
16 branch_utility.SplitChannelNameFromPath( 19 branch_utility.SplitChannelNameFromPath(
17 'beta/hello/stuff.html')) 20 'beta/hello/stuff.html'))
18 self.assertEquals(('trunk', 'hello/stuff.html'), 21 self.assertEquals(('trunk', 'hello/stuff.html'),
19 branch_utility.SplitChannelNameFromPath( 22 branch_utility.SplitChannelNameFromPath(
20 'trunk/hello/stuff.html')) 23 'trunk/hello/stuff.html'))
21 self.assertEquals(('stable', 'hello/stuff.html'), 24 self.assertEquals(('stable', 'hello/stuff.html'),
22 branch_utility.SplitChannelNameFromPath( 25 branch_utility.SplitChannelNameFromPath(
23 'hello/stuff.html')) 26 'hello/stuff.html'))
24 self.assertEquals(('stable', 'hello/dev/stuff.html'), 27 self.assertEquals(('stable', 'hello/dev/stuff.html'),
25 branch_utility.SplitChannelNameFromPath( 28 branch_utility.SplitChannelNameFromPath(
26 'hello/dev/stuff.html')) 29 'hello/dev/stuff.html'))
27 30
28 def testGetBranchNumberForChannelName(self): 31 def testGetBranchNumberForChannelName(self):
29 base_path = 'branch_utility/first.json' 32 base_path = 'branch_utility/first.json'
30 self.assertEquals('1132', 33 self.assertEquals('1132',
31 branch_utility.GetBranchNumberForChannelName('dev', 34 branch_utility.GetBranchNumberForChannelName('dev',
32 test_urlfetch, 35 self._fetcher,
33 base_path)) 36 base_path))
34 self.assertEquals('1084', 37 self.assertEquals('1084',
35 branch_utility.GetBranchNumberForChannelName('beta', 38 branch_utility.GetBranchNumberForChannelName('beta',
36 test_urlfetch, 39 self._fetcher,
37 base_path)) 40 base_path))
38 self.assertEquals('1234', 41 self.assertEquals('1234',
39 branch_utility.GetBranchNumberForChannelName('stable', 42 branch_utility.GetBranchNumberForChannelName('stable',
40 test_urlfetch, 43 self._fetcher,
41 base_path)) 44 base_path))
42 self.assertEquals('trunk', 45 self.assertEquals('trunk',
43 branch_utility.GetBranchNumberForChannelName('trunk', 46 branch_utility.GetBranchNumberForChannelName('trunk',
44 test_urlfetch, 47 self._fetcher,
45 base_path)) 48 base_path))
46 49
47 if __name__ == '__main__': 50 if __name__ == '__main__':
48 unittest.main() 51 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698