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

Unified Diff: chrome/common/extensions/docs/server2/patch_servlet_test.py

Issue 15087006: Docserver: there is only one. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: epic rebase Created 7 years, 5 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/patch_servlet_test.py
diff --git a/chrome/common/extensions/docs/server2/patch_servlet_test.py b/chrome/common/extensions/docs/server2/patch_servlet_test.py
index 1c38732183fc63648861a5c55da5c4ae7f366ece..70a6f2fd069e0bc4d6f2f80ffdd8e9be0c6a47b4 100755
--- a/chrome/common/extensions/docs/server2/patch_servlet_test.py
+++ b/chrome/common/extensions/docs/server2/patch_servlet_test.py
@@ -18,7 +18,7 @@ from test_util import DisableLogging
_ALLOWED_HOST = 'https://chrome-apps-doc.appspot.com'
class _RenderServletDelegate(RenderServlet.Delegate):
- def CreateServerInstanceForChannel(self, channel):
+ def CreateServerInstance(self):
return ServerInstance.ForLocal()
class _PatchServletDelegate(RenderServlet.Delegate):
@@ -36,8 +36,8 @@ class PatchServletTest(unittest.TestCase):
ConfigureFakeFetchers()
def _RenderWithPatch(self, path, issue):
- real_path = '%s/%s' % (issue, path)
- return PatchServlet(Request.ForTest(real_path, host=_ALLOWED_HOST),
+ path_with_issue = '%s/%s' % (issue, path)
+ return PatchServlet(Request.ForTest(path_with_issue, host=_ALLOWED_HOST),
_PatchServletDelegate()).Get()
def _RenderWithoutPatch(self, path):
@@ -68,8 +68,10 @@ class PatchServletTest(unittest.TestCase):
@DisableLogging('warning')
def _AssertNotFound(self, path, issue):
- self.assertEqual(self._RenderWithPatch(path, issue).status, 404,
- 'Path %s with issue %s should have been removed.' % (path, issue))
+ response = self._RenderWithPatch(path, issue)
+ self.assertEqual(response.status, 404,
+ 'Path %s with issue %s should have been removed for %s.' % (
+ path, issue, response))
def _AssertOk(self, path, issue):
response = self._RenderWithPatch(path, issue)
@@ -79,17 +81,27 @@ class PatchServletTest(unittest.TestCase):
'Rendered result for path %s with issue %s should not be empty.' %
(path, issue))
+ def _AssertRedirect(self, path, issue, redirect_path):
+ response = self._RenderWithPatch(path, issue)
+ self.assertEqual(302, response.status)
+ self.assertEqual('/_patch/%s/%s' % (issue, redirect_path),
+ response.headers['Location'])
+
def testRender(self):
# '_patch' is not included in paths below because it's stripped by Handler.
issue = '14096030'
# extensions_sidenav.json is modified in the patch.
self._RenderAndAssertNotEqual('extensions/index.html', issue)
+
# apps_sidenav.json is not patched.
self._RenderAndAssertEqual('apps/about_apps.html', issue)
- # extensions/runtime.html is removed in the patch.
- self._AssertNotFound('extensions/runtime.html', issue)
+ # extensions/runtime.html is removed in the patch, should redirect to the
+ # apps version.
+ self._AssertRedirect('extensions/runtime.html', issue,
+ 'apps/runtime.html')
+
# apps/runtime.html is not removed.
self._RenderAndAssertEqual('apps/runtime.html', issue)
« 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