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

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

Issue 10704252: Extensions Docs Server: Internal file system (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed up 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
(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 os
7 import unittest
8 import test_urlfetch
9
10 from subversion_fetcher import SubversionFetcher
11
12 class TestSubversionFetcher(SubversionFetcher):
13 def _GetURLFromBranch(self, branch):
14 return os.path.join('subversion_fetcher', branch)
15
16 class SubversionFetcherTest(unittest.TestCase):
17 def testFetchResource(self):
18 fetcher_t = TestSubversionFetcher('trunk', '', test_urlfetch)
19 fetcher_b1 = TestSubversionFetcher('branch1', '', test_urlfetch)
20 fetcher_b2 = TestSubversionFetcher('branch2', '', test_urlfetch)
21 self.assertEquals('trunk test\n',
22 fetcher_t.FetchResource('/test.txt').content)
23 self.assertEquals('branch1 test\n',
24 fetcher_b1.FetchResource('/test.txt').content)
25 self.assertEquals('branch2 test\n',
26 fetcher_b2.FetchResource('/test.txt').content)
27
28 def testListDirectory(self):
29 fetcher = TestSubversionFetcher('trunk', '', test_urlfetch)
30 expected = ['file%d.html' % i for i in range(7)]
31 self.assertEquals(
32 expected,
33 fetcher.ListDirectory('recursive_list/list').content)
34 expected2 = ['recursive_list.html/' + x for x in expected]
35 expected2.extend(['recursive_list.html/list/' + x for x in expected])
36 self.assertEquals(
37 expected2,
38 fetcher.ListDirectory('recursive_list.html', recursive=True).content)
39
40 if __name__ == '__main__':
41 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698