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

Unified Diff: dashboard/dashboard/testing_common.py

Issue 2350113002: Add request-level caching for privileged queries. (Closed)
Patch Set: Addressed review comments Created 4 years, 3 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 | « dashboard/dashboard/start_try_job_test.py ('k') | dashboard/dashboard/update_test_suites_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dashboard/dashboard/testing_common.py
diff --git a/dashboard/dashboard/testing_common.py b/dashboard/dashboard/testing_common.py
index ae094650856989007241d2357aad3e0db5405be7..f67f5058b9904a1bac8f8ca7c079ff8efef4eb6a 100644
--- a/dashboard/dashboard/testing_common.py
+++ b/dashboard/dashboard/testing_common.py
@@ -11,6 +11,7 @@ import os
import re
import unittest
import urllib
+import webapp2
from google.appengine.api import users
from google.appengine.ext import deferred
@@ -89,6 +90,13 @@ class TestCase(unittest.TestCase):
def SetCurrentUser(self, email, user_id='123456', is_admin=False):
"""Sets the user in the environment in the current testbed."""
+ try:
+ request = webapp2.get_request()
+ if 'privileged_cached' in request.registry:
+ del request.registry['privileged_cached']
+ except AssertionError:
+ # webapp2.get_request() not patched for this test.
+ pass
self.testbed.setup_env(
user_is_admin=('1' if is_admin else '0'),
user_email=email,
« no previous file with comments | « dashboard/dashboard/start_try_job_test.py ('k') | dashboard/dashboard/update_test_suites_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698