| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 from google.appengine.api import users | 5 from google.appengine.api import users |
| 6 | 6 |
| 7 import copy | 7 import copy |
| 8 | 8 |
| 9 import gae_ts_mon | 9 import gae_ts_mon |
| 10 | 10 |
| 11 from common.findit_testcase import FinditTestCase | 11 from libs.testcase import TestCase |
| 12 from model.wf_config import FinditConfig | 12 from model.wf_config import FinditConfig |
| 13 | 13 |
| 14 | 14 |
| 15 _DEFAULT_STEPS_FOR_MASTERS_RULES = { | 15 _DEFAULT_STEPS_FOR_MASTERS_RULES = { |
| 16 'supported_masters': { | 16 'supported_masters': { |
| 17 'm': { | 17 'm': { |
| 18 'check_global': True, | 18 'check_global': True, |
| 19 }, | 19 }, |
| 20 'm3': { | 20 'm3': { |
| 21 'check_global': True, | 21 'check_global': True, |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 'steps_for_masters_rules': _DEFAULT_STEPS_FOR_MASTERS_RULES, | 124 'steps_for_masters_rules': _DEFAULT_STEPS_FOR_MASTERS_RULES, |
| 125 'builders_to_trybots': _DEFAULT_TRY_BOT_MAPPING, | 125 'builders_to_trybots': _DEFAULT_TRY_BOT_MAPPING, |
| 126 'try_job_settings': _DEFAULT_TRY_JOB_SETTINGS, | 126 'try_job_settings': _DEFAULT_TRY_JOB_SETTINGS, |
| 127 'swarming_settings': _DEFAULT_SWARMING_SETTINGS, | 127 'swarming_settings': _DEFAULT_SWARMING_SETTINGS, |
| 128 'download_build_data_settings': _DEFAULT_DOWNLOAD_BUILD_DATA_SETTINGS, | 128 'download_build_data_settings': _DEFAULT_DOWNLOAD_BUILD_DATA_SETTINGS, |
| 129 'action_settings': _DEFAULT_ACTION_SETTINGS, | 129 'action_settings': _DEFAULT_ACTION_SETTINGS, |
| 130 'check_flake_settings': _DEFAULT_CHECK_FLAKE_SETTINGS, | 130 'check_flake_settings': _DEFAULT_CHECK_FLAKE_SETTINGS, |
| 131 } | 131 } |
| 132 | 132 |
| 133 | 133 |
| 134 class WaterfallTestCase(FinditTestCase): # pragma: no cover. | 134 class WaterfallTestCase(TestCase): # pragma: no cover. |
| 135 | 135 |
| 136 def UpdateUnitTestConfigSettings(self, config_property=None, | 136 def UpdateUnitTestConfigSettings(self, config_property=None, |
| 137 override_data=None): | 137 override_data=None): |
| 138 """Sets up Findit's config for unit tests. | 138 """Sets up Findit's config for unit tests. |
| 139 | 139 |
| 140 Args: | 140 Args: |
| 141 config_property: The name of the config property to update. | 141 config_property: The name of the config property to update. |
| 142 override_data: A dict to override any default settings. | 142 override_data: A dict to override any default settings. |
| 143 """ | 143 """ |
| 144 config_data = DEFAULT_CONFIG_DATA | 144 config_data = DEFAULT_CONFIG_DATA |
| 145 | 145 |
| 146 if config_property and override_data: | 146 if config_property and override_data: |
| 147 config_data = copy.deepcopy(DEFAULT_CONFIG_DATA) | 147 config_data = copy.deepcopy(DEFAULT_CONFIG_DATA) |
| 148 config_data[config_property].update(override_data) | 148 config_data[config_property].update(override_data) |
| 149 | 149 |
| 150 FinditConfig.Get().Update(users.User(email='admin@chromium.org'), True, | 150 FinditConfig.Get().Update(users.User(email='admin@chromium.org'), True, |
| 151 **config_data) | 151 **config_data) |
| 152 | 152 |
| 153 def setUp(self): | 153 def setUp(self): |
| 154 super(WaterfallTestCase, self).setUp() | 154 super(WaterfallTestCase, self).setUp() |
| 155 self.UpdateUnitTestConfigSettings() | 155 self.UpdateUnitTestConfigSettings() |
| 156 self.maxDiff = None | 156 self.maxDiff = None |
| 157 gae_ts_mon.reset_for_unittest(disable=True) | 157 gae_ts_mon.reset_for_unittest(disable=True) |
| OLD | NEW |