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

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

Issue 12996003: Dynamically generate a heading for Extension Docs API pages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing comments - Patch currently being broken up Created 7 years, 6 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
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 local_file_system import LocalFileSystem 10 from local_file_system import LocalFileSystem
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_util import DisableLogging 16 from test_util import DisableLogging
16 17
17 _ALLOWED_HOST = 'https://chrome-apps-doc.appspot.com' 18 _ALLOWED_HOST = 'https://chrome-apps-doc.appspot.com'
18 19
19 class _RenderServletDelegate(RenderServlet.Delegate): 20 class _RenderServletDelegate(RenderServlet.Delegate):
20 def CreateServerInstanceForChannel(self, channel): 21 def CreateServerInstanceForChannel(self, channel):
21 return ServerInstance.ForLocal() 22 return ServerInstance.ForLocal()
22 23
23 class _PatchServletDelegate(RenderServlet.Delegate): 24 class _PatchServletDelegate(RenderServlet.Delegate):
24 def CreateAppSamplesFileSystem(self, object_store_creator): 25 def CreateAppSamplesFileSystem(self, object_store_creator):
25 return EmptyDirFileSystem() 26 return EmptyDirFileSystem()
26 27
28 def CreateBranchUtility(self, object_store_creator):
29 return TestBranchUtility()
30
27 def CreateHostFileSystemForBranch(self, channel): 31 def CreateHostFileSystemForBranch(self, channel):
28 return LocalFileSystem.Create() 32 return LocalFileSystem.Create()
29 33
30 class PatchServletTest(unittest.TestCase): 34 class PatchServletTest(unittest.TestCase):
31 def setUp(self): 35 def setUp(self):
32 ConfigureFakeFetchers() 36 ConfigureFakeFetchers()
33 37
34 def _RenderWithPatch(self, path, issue): 38 def _RenderWithPatch(self, path, issue):
35 real_path = '%s/%s' % (issue, path) 39 real_path = '%s/%s' % (issue, path)
36 return PatchServlet(Request.ForTest(real_path, host=_ALLOWED_HOST), 40 return PatchServlet(Request.ForTest(real_path, host=_ALLOWED_HOST),
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 '%s/_patch/12345' % _ALLOWED_HOST)) 121 '%s/_patch/12345' % _ALLOWED_HOST))
118 self.assertTrue(*is_redirect('http://developers.google.com', '12345', 122 self.assertTrue(*is_redirect('http://developers.google.com', '12345',
119 '%s/_patch/12345' % _ALLOWED_HOST)) 123 '%s/_patch/12345' % _ALLOWED_HOST))
120 self.assertFalse(*is_redirect('http://chrome-apps-doc.appspot.com', '12345', 124 self.assertFalse(*is_redirect('http://chrome-apps-doc.appspot.com', '12345',
121 None)) 125 None))
122 self.assertFalse(*is_redirect('http://some-other-app.appspot.com', '12345', 126 self.assertFalse(*is_redirect('http://some-other-app.appspot.com', '12345',
123 None)) 127 None))
124 128
125 if __name__ == '__main__': 129 if __name__ == '__main__':
126 unittest.main() 130 unittest.main()
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/patch_servlet.py ('k') | chrome/common/extensions/docs/server2/path_canonicalizer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698