| 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'
|
|
|