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

Unified 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, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/server2/patched_file_system_test.py
===================================================================
--- chrome/common/extensions/docs/server2/patched_file_system_test.py (revision 0)
+++ chrome/common/extensions/docs/server2/patched_file_system_test.py (revision 0)
@@ -0,0 +1,56 @@
+#!/usr/bin/env python
+# Copyright 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import os
+import sys
+import unittest
+from appengine_url_fetcher import AppEngineUrlFetcher
+from appengine_wrappers import files
+from fake_fetchers import ConfigureFakeFetchers
+from fake_url_fetcher import FakeUrlFetcher
+from file_system import FileNotFoundError
+from object_store_creator import ObjectStoreCreator
+from patched_file_system import PatchedFileSystem
+from patch_servlet import PatchData
+from rietveld_file_system import RietveldFileSystem
+from subversion_file_system import SubversionFileSystem
+import url_constants
+
+class PatchedFileSystemTest(unittest.TestCase):
+ def setUp(self):
+ ConfigureFakeFetchers(os.path.join(sys.path[0], os.pardir))
+ self._patch_data = PatchData('14463009', '1', [
+ 'test1.txt',
+ 'test2.txt',
+ 'test3.txt',
+ 'test4.txt',
+ ])
+ self._rietveld_file_system = RietveldFileSystem(
+ None,
+ self._patch_data,
+ AppEngineUrlFetcher(url_constants.CODEREVIEW_SERVER),
+ ObjectStoreCreator.Factory('1-0', 'test', persistent=False))
+ self._base_path = os.path.join(sys.path[0], 'test_data', 'file_system')
+ fetcher = FakeUrlFetcher(self._base_path)
+ self._svn_file_system = SubversionFileSystem(fetcher, fetcher)
+ self._file_system = PatchedFileSystem(self._patch_data.files,
+ self._svn_file_system,
+ self._rietveld_file_system)
+
+
+ def testRead(self):
+ expected = {
+ 'test1.txt': 'Test1 is patched.\n',
+ 'test2.txt': 'Test2 is also patched.\n',
+ 'test4.txt': 'Test4 is added.\n',
+ }
+ self.assertEqual(
+ expected,
+ self._file_system.Read(['test1.txt', 'test2.txt', 'test4.txt']).Get())
+ self.assertRaises(FileNotFoundError, self._file_system.ReadSingle,
+ 'test3.txt')
+
not at google - send to devlin 2013/04/29 16:38:49 See comment in PatchedFileSystem. If we can remove
+if __name__ == '__main__':
+ unittest.main()
Property changes on: chrome/common/extensions/docs/server2/patched_file_system_test.py
___________________________________________________________________
Added: svn:eol-style
+ LF
Added: svn:executable
+ *

Powered by Google App Engine
This is Rietveld 408576698