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

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

Issue 26418002: Docserver: Pull knowledge of host file systems into a single (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: correct similarity Created 7 years, 2 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 2013 The Chromium Authors. All rights reserved. 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 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 unittest 6 import unittest
7 7
8 from empty_dir_file_system import EmptyDirFileSystem 8 from empty_dir_file_system import EmptyDirFileSystem
9 from fake_fetchers import ConfigureFakeFetchers 9 from fake_fetchers import ConfigureFakeFetchers
10 from host_file_system_creator import HostFileSystemCreator 10 from host_file_system_provider import HostFileSystemProvider
11 from patch_servlet import PatchServlet 11 from patch_servlet import PatchServlet
12 from render_servlet import RenderServlet 12 from render_servlet import RenderServlet
13 from server_instance import ServerInstance 13 from server_instance import ServerInstance
14 from servlet import Request 14 from servlet import Request
15 from test_branch_utility import TestBranchUtility 15 from test_branch_utility import TestBranchUtility
16 from test_util import DisableLogging 16 from test_util import DisableLogging
17 17
18 _ALLOWED_HOST = 'https://chrome-apps-doc.appspot.com' 18 _ALLOWED_HOST = 'https://chrome-apps-doc.appspot.com'
19 19
20 class _RenderServletDelegate(RenderServlet.Delegate): 20 class _RenderServletDelegate(RenderServlet.Delegate):
21 def CreateServerInstance(self): 21 def CreateServerInstance(self):
22 return ServerInstance.ForLocal() 22 return ServerInstance.ForLocal()
23 23
24 class _PatchServletDelegate(RenderServlet.Delegate): 24 class _PatchServletDelegate(RenderServlet.Delegate):
25 def CreateAppSamplesFileSystem(self, object_store_creator): 25 def CreateAppSamplesFileSystem(self, object_store_creator):
26 return EmptyDirFileSystem() 26 return EmptyDirFileSystem()
27 27
28 def CreateBranchUtility(self, object_store_creator): 28 def CreateBranchUtility(self, object_store_creator):
29 return TestBranchUtility.CreateWithCannedData() 29 return TestBranchUtility.CreateWithCannedData()
30 30
31 def CreateHostFileSystemCreator(self, object_store_creator): 31 def CreateHostFileSystemProvider(self, object_store_creator, **optargs):
32 return HostFileSystemCreator.ForLocal(object_store_creator) 32 return HostFileSystemProvider.ForLocal(object_store_creator)
33 33
34 class PatchServletTest(unittest.TestCase): 34 class PatchServletTest(unittest.TestCase):
35 def setUp(self): 35 def setUp(self):
36 ConfigureFakeFetchers() 36 ConfigureFakeFetchers()
37 37
38 def _RenderWithPatch(self, path, issue): 38 def _RenderWithPatch(self, path, issue):
39 path_with_issue = '%s/%s' % (issue, path) 39 path_with_issue = '%s/%s' % (issue, path)
40 return PatchServlet(Request.ForTest(path_with_issue, host=_ALLOWED_HOST), 40 return PatchServlet(Request.ForTest(path_with_issue, host=_ALLOWED_HOST),
41 _PatchServletDelegate()).Get() 41 _PatchServletDelegate()).Get()
42 42
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 '%s/_patch/12345' % _ALLOWED_HOST)) 132 '%s/_patch/12345' % _ALLOWED_HOST))
133 self.assertTrue(*is_redirect('http://developers.google.com', '12345', 133 self.assertTrue(*is_redirect('http://developers.google.com', '12345',
134 '%s/_patch/12345' % _ALLOWED_HOST)) 134 '%s/_patch/12345' % _ALLOWED_HOST))
135 self.assertFalse(*is_redirect('http://chrome-apps-doc.appspot.com', '12345', 135 self.assertFalse(*is_redirect('http://chrome-apps-doc.appspot.com', '12345',
136 None)) 136 None))
137 self.assertFalse(*is_redirect('http://some-other-app.appspot.com', '12345', 137 self.assertFalse(*is_redirect('http://some-other-app.appspot.com', '12345',
138 None)) 138 None))
139 139
140 if __name__ == '__main__': 140 if __name__ == '__main__':
141 unittest.main() 141 unittest.main()
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/patch_servlet.py ('k') | chrome/common/extensions/docs/server2/patched_file_system.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698