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

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

Issue 2506893003: [Findit] After login, redirect to the targeted page for GETs, but original page for others like POS… (Closed)
Patch Set: Fix nits. Created 4 years, 1 month 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') | no next file » | 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 518feaac379a7543f41ffe4cbc077d010a0b824c..083a77157583322bf3ef846415b70cc1bb0501a3 100644
--- a/appengine/findit/common/test/base_handler_test.py
+++ b/appengine/findit/common/test/base_handler_test.py
@@ -109,17 +109,38 @@ class PermissionTest(testing.AppengineTestCase):
PermissionLevelHandler.PERMISSION_LEVEL = 80000 # An unknown permission.
self._VerifyUnauthorizedAccess('test@google.com')
- def testLoginLinkWithReferer(self):
+ def testLoginLinkForGetWithReferer(self):
PermissionLevelHandler.PERMISSION_LEVEL = Permission.CORP_USER
referer_url = 'http://localhost/referer'
login_url = ('https://www.google.com/accounts/Login?continue=%s' %
- urllib.quote(referer_url))
+ 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, '/permission', headers={'referer': referer_url})
+ def testLoginLinkForGetWithoutReferer(self):
+ PermissionLevelHandler.PERMISSION_LEVEL = Permission.CORP_USER
+ 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, '/permission')
+
+ def testLoginLinkForPostWithReferer(self):
+ PermissionLevelHandler.PERMISSION_LEVEL = Permission.CORP_USER
+ 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.post, '/permission', headers={'referer': referer_url})
+
def testLoginLinkWithRequestedUrl(self):
PermissionLevelHandler.PERMISSION_LEVEL = Permission.CORP_USER
request_url = '/permission'
« no previous file with comments | « appengine/findit/common/base_handler.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698