| 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 from common.findit_testcase import FinditTestCase | 9 from common.findit_testcase import FinditTestCase |
| 10 from model.wf_config import FinditConfig | 10 from model.wf_config import FinditConfig |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 'server_host': 'chromium-swarm.appspot.com', | 83 'server_host': 'chromium-swarm.appspot.com', |
| 84 'default_request_priority': 150, | 84 'default_request_priority': 150, |
| 85 'request_expiration_hours': 20, | 85 'request_expiration_hours': 20, |
| 86 'server_query_interval_seconds': 60, | 86 'server_query_interval_seconds': 60, |
| 87 'task_timeout_hours': 23, | 87 'task_timeout_hours': 23, |
| 88 'isolated_server': 'https://isolateserver.appspot.com', | 88 'isolated_server': 'https://isolateserver.appspot.com', |
| 89 'isolated_storage_url': 'isolateserver.storage.googleapis.com', | 89 'isolated_storage_url': 'isolateserver.storage.googleapis.com', |
| 90 'iterations_to_rerun': 10 | 90 'iterations_to_rerun': 10 |
| 91 } | 91 } |
| 92 | 92 |
| 93 _DEFAULT_DOWNLOAD_BUILD_DATA_SETTINGS = { |
| 94 'download_interval_seconds': 10, |
| 95 'memcache_master_download_expiration_seconds': 3600, |
| 96 'use_chrome_build_extract': True |
| 97 } |
| 93 | 98 |
| 94 DEFAULT_CONFIG_DATA = { | 99 DEFAULT_CONFIG_DATA = { |
| 95 'steps_for_masters_rules': _DEFAULT_STEPS_FOR_MASTERS_RULES, | 100 'steps_for_masters_rules': _DEFAULT_STEPS_FOR_MASTERS_RULES, |
| 96 'builders_to_trybots': _DEFAULT_TRY_BOT_MAPPING, | 101 'builders_to_trybots': _DEFAULT_TRY_BOT_MAPPING, |
| 97 'try_job_settings': _DEFAULT_TRY_JOB_SETTINGS, | 102 'try_job_settings': _DEFAULT_TRY_JOB_SETTINGS, |
| 98 'swarming_settings': _DEFAULT_SWARMING_SETTINGS | 103 'swarming_settings': _DEFAULT_SWARMING_SETTINGS, |
| 104 'download_build_data_settings': _DEFAULT_DOWNLOAD_BUILD_DATA_SETTINGS |
| 99 } | 105 } |
| 100 | 106 |
| 101 | 107 |
| 102 class WaterfallTestCase(FinditTestCase): # pragma: no cover. | 108 class WaterfallTestCase(FinditTestCase): # pragma: no cover. |
| 103 | 109 |
| 104 def UpdateUnitTestConfigSettings(self, config_property=None, | 110 def UpdateUnitTestConfigSettings(self, config_property=None, |
| 105 override_data=None): | 111 override_data=None): |
| 106 """Sets up Findit's config for unit tests. | 112 """Sets up Findit's config for unit tests. |
| 107 | 113 |
| 108 Args: | 114 Args: |
| 109 config_property: The name of the config property to update. | 115 config_property: The name of the config property to update. |
| 110 override_data: A dict to override any default settings. | 116 override_data: A dict to override any default settings. |
| 111 """ | 117 """ |
| 112 config_data = DEFAULT_CONFIG_DATA | 118 config_data = DEFAULT_CONFIG_DATA |
| 113 | 119 |
| 114 if config_property and override_data: | 120 if config_property and override_data: |
| 115 config_data = copy.deepcopy(DEFAULT_CONFIG_DATA) | 121 config_data = copy.deepcopy(DEFAULT_CONFIG_DATA) |
| 116 config_data[config_property].update(override_data) | 122 config_data[config_property].update(override_data) |
| 117 | 123 |
| 118 FinditConfig.Get().Update(users.User(email='admin@chromium.org'), True, | 124 FinditConfig.Get().Update(users.User(email='admin@chromium.org'), True, |
| 119 **config_data) | 125 **config_data) |
| 120 | 126 |
| 121 def setUp(self): | 127 def setUp(self): |
| 122 super(WaterfallTestCase, self).setUp() | 128 super(WaterfallTestCase, self).setUp() |
| 123 self.UpdateUnitTestConfigSettings() | 129 self.UpdateUnitTestConfigSettings() |
| 124 | 130 |
| 125 | 131 |
| OLD | NEW |