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

Unified Diff: appengine/findit/handlers/test/config_test.py

Issue 1836293002: [Findit] Adding central config test class for unit tests (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Rebase Created 4 years, 8 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
Index: appengine/findit/handlers/test/config_test.py
diff --git a/appengine/findit/handlers/test/config_test.py b/appengine/findit/handlers/test/config_test.py
index bfc90f6483b02b080c0af66f5b62498df428d34b..0482afc32af4c3302a858e85d39e487a79bd93ed 100644
--- a/appengine/findit/handlers/test/config_test.py
+++ b/appengine/findit/handlers/test/config_test.py
@@ -11,7 +11,7 @@ import webtest
from handlers import config
from model import wf_config
from testing_utils import testing
-
+from google.appengine.api import users
_MOCK_STEPS_FOR_MASTERS_RULES_OLD_FORMAT = {
'master1': ['unsupported_step1', 'unsupported_step2'],
@@ -77,15 +77,17 @@ class ConfigTest(testing.AppengineTestCase):
], debug=True)
def testGetConfigurationSettings(self):
- self.mock_current_user(user_email='test@chromium.org', is_admin=True)
-
config_data = {
'steps_for_masters_rules': _MOCK_STEPS_FOR_MASTERS_RULES,
'builders_to_trybots': _MOCK_BUILDERS_TO_TRYBOTS,
'try_job_settings': _MOCK_TRY_JOB_SETTINGS,
'swarming_settings': _MOCK_SWARMING_SETTINGS
}
- wf_config.FinditConfig.Get().Update(**config_data)
+
+ self.mock_current_user(user_email='test@chromium.org', is_admin=True)
+
+ wf_config.FinditConfig.Get().Update(users.GetCurrentUser(), True,
+ **config_data)
response = self.test_app.get('/config', params={'format': 'json'})
self.assertEquals(response.status_int, 200)
@@ -112,7 +114,8 @@ class ConfigTest(testing.AppengineTestCase):
'try_job_settings': _MOCK_TRY_JOB_SETTINGS,
'swarming_settings': _MOCK_SWARMING_SETTINGS
}
- wf_config.FinditConfig.Get().Update(**config_data)
+ wf_config.FinditConfig.Get().Update(users.GetCurrentUser(), True,
+ **config_data)
response = self.test_app.get(
'/config', params={'version': 1, 'format': 'json'})
@@ -132,15 +135,16 @@ class ConfigTest(testing.AppengineTestCase):
self.assertEquals(expected_response, response.json_body)
def testGetOutOfBoundsVersionOfConfigurationSettings(self):
- self.mock_current_user(user_email='test@chromium.org', is_admin=True)
-
config_data = {
'steps_for_masters_rules': _MOCK_STEPS_FOR_MASTERS_RULES,
'builders_to_trybots': _MOCK_BUILDERS_TO_TRYBOTS,
'try_job_settings': _MOCK_TRY_JOB_SETTINGS,
'swarming_settings': _MOCK_SWARMING_SETTINGS
}
- wf_config.FinditConfig.Get().Update(**config_data)
+ self.mock_current_user(user_email='test@chromium.org', is_admin=True)
+
+ wf_config.FinditConfig.Get().Update(users.GetCurrentUser(), True,
+ **config_data)
self.assertRaisesRegexp(
webtest.app.AppError,
« no previous file with comments | « appengine/findit/handlers/test/build_failure_test.py ('k') | appengine/findit/handlers/test/handlers_util_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698