| OLD | NEW |
| 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_provider import HostFileSystemProvider | 10 from host_file_system_provider import HostFileSystemProvider |
| (...skipping 11 matching lines...) Expand all Loading... |
| 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 CreateHostFileSystemProvider(self, object_store_creator, **optargs): | 31 def CreateHostFileSystemProvider(self, object_store_creator, **optargs): |
| 32 return HostFileSystemProvider.ForLocal(object_store_creator) | 32 return HostFileSystemProvider.ForLocal(object_store_creator, **optargs) |
| 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 Loading... |
| 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() |
| OLD | NEW |