164
164
mock_ssh_config_commands.assert_called_once_with()
167
@mock.patch('ubuntu_system_tests.host.commands._validate_ppas',
168
return_value=[commands.Ppa(
170
'http://ppa.launchpad.net/owner/name/dist/dists')])
167
171
class SetupCommandTestCase(ConfigBaseTestCase):
171
175
self.config_stack = config.UbuntuSystemTestsConfig()
173
def test_ppa_setup_commands_set_image_readwrite(self):
177
def test_ppa_setup_commands_set_image_readwrite(
178
self, mock_validate_ppas):
174
179
self.set_config_values()
176
181
'mount -o remount,rw /',
178
183
self.config_stack, config.KEY_DEFAULT))
181
def test_ppa_setup_commands_used_in_adt_setup(self):
186
def test_ppa_setup_commands_used_in_adt_setup(
187
self, mock_validate_ppas):
182
188
self.set_config_values()
183
189
command = commands.build_adt_run_setup_command(
184
190
self.config_stack, config.KEY_DEFAULT)
185
191
command = ' '.join(command)
187
193
run_arguments, _ = command.split('---')
189
'apt-add-repository -y ppa:canonical-platform-qa',
194
ppa_cmd = 'apt-add-repository -y {}'.format(
195
mock_validate_ppas.return_value[0].id)
196
self.assertIn(ppa_cmd, run_arguments)
193
def test_setup_commands_install_testability_libs(self):
198
def test_setup_commands_install_testability_libs(
199
self, mock_validate_ppas):
194
200
self.set_config_values()
195
201
command = commands.build_adt_run_setup_command(
196
202
self.config_stack, config.KEY_DEFAULT)
201
207
'qttestability-autopilot')
204
def test_setting_fs_rw_is_conditional_on_current_state(self):
210
def test_setting_fs_rw_is_conditional_on_current_state(
211
self, mock_validate_ppas):
206
213
commands._get_is_fs_ro_command(), commands._get_fs_rw_command())
208
def test_setting_fs_ro_is_conditional_on_current_state(self):
215
def test_setting_fs_ro_is_conditional_on_current_state(
216
self, mock_validate_ppas):
209
217
command = commands._get_fs_ro_setup_command()
210
218
check_any_item_in_list_contains_value(
211
219
command, commands._get_is_fs_rw_command())
213
def test_enabling_verbose_option(self):
221
def test_enabling_verbose_option(self, mock_validate_ppas):
214
222
self.set_config_values()
215
223
command = commands.build_adt_run_setup_command(
216
224
self.config_stack, config.KEY_DEFAULT, verbose=True)
217
225
self.assertTrue(check_any_item_in_list_contains_value(command, '-ddd'))
219
def test_verbose_disabled_by_default(self):
227
def test_verbose_disabled_by_default(self, mock_validate_ppas):
220
228
self.set_config_values()
221
229
command = commands.build_adt_run_setup_command(
222
230
self.config_stack, config.KEY_DEFAULT)
226
234
@mock.patch('ubuntu_system_tests.host.debian.get_dependencies',
227
235
return_value=['dep1'])
228
def test_cache_deps_installs_apt_cacher(self, mock_get_dependencies):
236
def test_cache_deps_installs_apt_cacher(
237
self, mock_get_dependencies, mock_validate_ppas):
229
238
self.set_config_values()
230
239
command = commands.build_adt_run_setup_command(
231
240
self.config_stack, config.KEY_DEFAULT, cache_deps=True)
236
245
mock_get_dependencies.assert_called_once_with(
237
246
commands.TESTS_UST_DEFAULT)
239
def test_default_no_apt_cacher_install(self):
248
def test_default_no_apt_cacher_install(self, mock_validate_ppas):
240
249
self.set_config_values()
241
250
command = commands.build_adt_run_setup_command(
242
251
self.config_stack, config.KEY_DEFAULT)
246
255
@mock.patch('ubuntu_system_tests.host.debian.get_dependencies')
247
256
def test_install_tests_adds_extra_dependencies(
248
self, mock_get_dependencies):
257
self, mock_get_dependencies, mock_validate_ppas):
249
258
self.set_config_values()
250
259
mock_get_dependencies.return_value = ['test-dep-1', 'test-dep-2']
251
260
command = commands.build_adt_run_setup_command(