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

Unified Diff: appengine/findit/common/test/base_handler_test.py

Issue 2537143003: [Findit] Redirect to original page after login for triage. (Closed)
Patch Set: Fix test failures & rename var. Created 4 years 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
« no previous file with comments | « appengine/findit/common/base_handler.py ('k') | appengine/findit/handlers/flake/triage_flake_analysis.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: appengine/findit/common/test/base_handler_test.py
diff --git a/appengine/findit/common/test/base_handler_test.py b/appengine/findit/common/test/base_handler_test.py
index 083a77157583322bf3ef846415b70cc1bb0501a3..27f377678939bd654eba61d7dc7c596e74cc7841 100644
--- a/appengine/findit/common/test/base_handler_test.py
+++ b/appengine/findit/common/test/base_handler_test.py
@@ -109,8 +109,21 @@ class PermissionTest(testing.AppengineTestCase):
PermissionLevelHandler.PERMISSION_LEVEL = 80000 # An unknown permission.
self._VerifyUnauthorizedAccess('test@google.com')
+ def testLoginLinkForGetButForceToUseReferer(self):
+ PermissionLevelHandler.PERMISSION_LEVEL = Permission.CORP_USER
+ PermissionLevelHandler.LOGIN_REDIRECT_TO_DISTINATION_PAGE_FOR_GET = False
+ referer_url = 'http://localhost/referer'
+ login_url = ('https://www.google.com/accounts/Login?continue=%s' %
+ urllib.quote(referer_url))
+ self.assertRaisesRegexp(
+ webtest.app.AppError,
+ re.compile('.*401 Unauthorized.*%s.*' % re.escape(login_url),
+ re.MULTILINE | re.DOTALL),
+ self.test_app.get, '/permission', headers={'referer': referer_url})
+
def testLoginLinkForGetWithReferer(self):
PermissionLevelHandler.PERMISSION_LEVEL = Permission.CORP_USER
+ PermissionLevelHandler.LOGIN_REDIRECT_TO_DISTINATION_PAGE_FOR_GET = True
referer_url = 'http://localhost/referer'
login_url = ('https://www.google.com/accounts/Login?continue=%s' %
urllib.quote('http://localhost/permission'))
@@ -122,6 +135,7 @@ class PermissionTest(testing.AppengineTestCase):
def testLoginLinkForGetWithoutReferer(self):
PermissionLevelHandler.PERMISSION_LEVEL = Permission.CORP_USER
+ PermissionLevelHandler.LOGIN_REDIRECT_TO_DISTINATION_PAGE_FOR_GET = True
login_url = ('https://www.google.com/accounts/Login?continue=%s' %
urllib.quote('http://localhost/permission'))
self.assertRaisesRegexp(
@@ -132,6 +146,7 @@ class PermissionTest(testing.AppengineTestCase):
def testLoginLinkForPostWithReferer(self):
PermissionLevelHandler.PERMISSION_LEVEL = Permission.CORP_USER
+ PermissionLevelHandler.LOGIN_REDIRECT_TO_DISTINATION_PAGE_FOR_GET = True
referer_url = 'http://localhost/referer'
login_url = ('https://www.google.com/accounts/Login?continue=%s' %
urllib.quote(referer_url))
@@ -141,17 +156,6 @@ class PermissionTest(testing.AppengineTestCase):
re.MULTILINE | re.DOTALL),
self.test_app.post, '/permission', headers={'referer': referer_url})
- def testLoginLinkWithRequestedUrl(self):
- PermissionLevelHandler.PERMISSION_LEVEL = Permission.CORP_USER
- request_url = '/permission'
- login_url = ('https://www.google.com/accounts/Login?continue=%s' %
- urllib.quote('http://localhost/permission'))
- self.assertRaisesRegexp(
- webtest.app.AppError,
- re.compile('.*401 Unauthorized.*%s.*' % re.escape(login_url),
- re.MULTILINE | re.DOTALL),
- self.test_app.get, request_url)
-
class UnImplementedHandler(BaseHandler):
PERMISSION_LEVEL = Permission.ANYONE
« no previous file with comments | « appengine/findit/common/base_handler.py ('k') | appengine/findit/handlers/flake/triage_flake_analysis.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698