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

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

Issue 14125010: Docserver: Add support for viewing docs with a codereview patch applied (Closed) Base URL: https://src.chromium.org/svn/trunk/src/
Patch Set: Created 7 years, 7 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
Property Changes:
Added: svn:eol-style
+ LF
Added: svn:executable
+ *
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2013 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 sys
8 import unittest
9 from appengine_url_fetcher import AppEngineUrlFetcher
10 from appengine_wrappers import files
11 from fake_fetchers import ConfigureFakeFetchers
12 from fake_url_fetcher import FakeUrlFetcher
13 from file_system import FileNotFoundError
14 from object_store_creator import ObjectStoreCreator
15 from patched_file_system import PatchedFileSystem
16 from patch_servlet import PatchData
17 from rietveld_file_system import RietveldFileSystem
18 from subversion_file_system import SubversionFileSystem
19 import url_constants
20
21 class PatchedFileSystemTest(unittest.TestCase):
22 def setUp(self):
23 ConfigureFakeFetchers(os.path.join(sys.path[0], os.pardir))
24 self._patch_data = PatchData('14463009', '1', [
25 'test1.txt',
26 'test2.txt',
27 'test3.txt',
28 'test4.txt',
29 ])
30 self._rietveld_file_system = RietveldFileSystem(
31 None,
32 self._patch_data,
33 AppEngineUrlFetcher(url_constants.CODEREVIEW_SERVER),
34 ObjectStoreCreator.Factory('1-0', 'test', persistent=False))
35 self._base_path = os.path.join(sys.path[0], 'test_data', 'file_system')
36 fetcher = FakeUrlFetcher(self._base_path)
37 self._svn_file_system = SubversionFileSystem(fetcher, fetcher)
38 self._file_system = PatchedFileSystem(self._patch_data.files,
39 self._svn_file_system,
40 self._rietveld_file_system)
41
42
43 def testRead(self):
44 expected = {
45 'test1.txt': 'Test1 is patched.\n',
46 'test2.txt': 'Test2 is also patched.\n',
47 'test4.txt': 'Test4 is added.\n',
48 }
49 self.assertEqual(
50 expected,
51 self._file_system.Read(['test1.txt', 'test2.txt', 'test4.txt']).Get())
52 self.assertRaises(FileNotFoundError, self._file_system.ReadSingle,
53 'test3.txt')
54
not at google - send to devlin 2013/04/29 16:38:49 See comment in PatchedFileSystem. If we can remove
55 if __name__ == '__main__':
56 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698