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

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

Issue 2416303002: [Findit] Adding support for triaging suspected builds from flake analysis (Closed)
Patch Set: Rebase Created 4 years, 2 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
« no previous file with comments | « appengine/findit/common/base_handler.py ('k') | appengine/findit/handlers/build_failure.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 874d1cf50dd7e8a33a199cd4a7fd33da7a29b8ca..24bc7ec2e8c2912287bc3bc01c47472fd613ca50 100644
--- a/appengine/findit/common/test/base_handler_test.py
+++ b/appengine/findit/common/test/base_handler_test.py
@@ -2,12 +2,15 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import mock
import re
import urllib
import webapp2
import webtest
+from google.appengine.api import users
+
from testing_utils import testing
from common import base_handler
@@ -78,6 +81,22 @@ class PermissionTest(testing.AppengineTestCase):
self._VerifyAuthorizedAccess('test@google.com')
self._VerifyAuthorizedAccess('test@chromium.org', True)
+ @mock.patch.object(users, 'is_current_user_admin', return_value=True)
+ def testShowDebugInfoForAdmin(self, _):
+ self.assertTrue(BaseHandler()._ShowDebugInfo())
+
+ @mock.patch.object(users, 'is_current_user_admin', return_value=False)
+ def testShowDebugInfoForNonAdmin(self, _):
+ handler = BaseHandler()
+ handler.request = {}
+ self.assertFalse(handler._ShowDebugInfo())
+
+ @mock.patch.object(users, 'is_current_user_admin', return_value=False)
+ def testShowDebugInfoWithDebugFlag(self, _):
+ handler = BaseHandler()
+ handler.request = {'debug': '1'}
+ self.assertTrue(handler._ShowDebugInfo())
+
def testAccessByTaskQueue(self):
for permission in (Permission.ANYONE, Permission.CORP_USER,
Permission.ADMIN):
@@ -225,6 +244,7 @@ class ResultFormatTest(testing.AppengineTestCase):
def testToJson(self):
self.assertEqual('{}', base_handler.ToJson({}))
+
class InternalExceptionHandler(BaseHandler):
PERMISSION_LEVEL = Permission.ANYONE
« no previous file with comments | « appengine/findit/common/base_handler.py ('k') | appengine/findit/handlers/build_failure.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698