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

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

Issue 1497783003: [Findit] Use Findit's own versioned config. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@versioned_model
Patch Set: Created 5 years 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/handlers/config.py ('k') | appengine/findit/model/wf_config.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 b07262a0c95f71ad2bc51124118ccbda09f7d75c..966cdada3ab4ef5e54d6724838939c599a7b0a52 100644
--- a/appengine/findit/handlers/test/config_test.py
+++ b/appengine/findit/handlers/test/config_test.py
@@ -34,27 +34,21 @@ class ConfigTest(testing.AppengineTestCase):
], debug=True)
def testGetConfigurationSettings(self):
- class MockFinditConfig():
- masters_to_blacklisted_steps = _MOCK_MASTERS_TO_BLACKLISTED_STEPS
- builders_to_trybots = _MOCK_BUILDERS_TO_TRYBOTS
-
- @property
- def VersionNumber(self):
- return _MOCK_VERSION_NUMBER
-
- def MockSettings():
- return MockFinditConfig()
-
- self.mock(wf_config, 'Settings', MockSettings)
self.mock_current_user(user_email='test@chromium.org', is_admin=True)
+ config_data = {
+ 'masters_to_blacklisted_steps': _MOCK_MASTERS_TO_BLACKLISTED_STEPS,
+ 'builders_to_trybots': _MOCK_BUILDERS_TO_TRYBOTS,
+ }
+ wf_config.FinditConfig.Get().Update(**config_data)
+
response = self.test_app.get('/config', params={'format': 'json'})
self.assertEquals(response.status_int, 200)
expected_response = {
'masters': _MOCK_MASTERS_TO_BLACKLISTED_STEPS,
'builders': _MOCK_BUILDERS_TO_TRYBOTS,
- 'version': _MOCK_VERSION_NUMBER,
+ 'version': 1,
}
self.assertEquals(expected_response, response.json_body)
@@ -101,36 +95,14 @@ class ConfigTest(testing.AppengineTestCase):
}))
def testPostConfigurationSettings(self):
-
- class MockFinditConfig():
- masters_to_blacklisted_steps = {
- 'a': [],
- }
- builders_to_trybots = {}
-
- def modify(self, **kwargs):
- for k, v in kwargs.iteritems():
- setattr(self, k, v)
-
- @property
- def VersionNumber(self):
- return _MOCK_VERSION_NUMBER
-
- mock_config = MockFinditConfig()
-
- def MockSettings():
- return mock_config
-
self.mock_current_user(user_email='test@chromium.org', is_admin=True)
- self.mock(wf_config, 'FinditConfig', MockFinditConfig)
- self.mock(wf_config, 'Settings', MockSettings)
params = {
'format': 'json',
'data': json.dumps({
'masters_to_blacklisted_steps': {
'a': ['1', '2', '3'],
- 'b': []
+ 'b': [],
},
'builders_to_trybots': _MOCK_BUILDERS_TO_TRYBOTS,
})
@@ -142,7 +114,7 @@ class ConfigTest(testing.AppengineTestCase):
'b': []
},
'builders': _MOCK_BUILDERS_TO_TRYBOTS,
- 'version': _MOCK_VERSION_NUMBER,
+ 'version': 1,
}
response = self.test_app.post('/config', params=params)
« no previous file with comments | « appengine/findit/handlers/config.py ('k') | appengine/findit/model/wf_config.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698