def install_with_tasks(self): """Return the installation tasks of this module. :returns: list of installation tasks """ return [ LanguageInstallationTask(sysroot=conf.target.system_root, lang=self.language), KeyboardInstallationTask(sysroot=conf.target.system_root, localed_wrapper=self.localed_wrapper, x_layouts=self.x_layouts, switch_options=self.switch_options, vc_keymap=self.vc_keymap) ]
def test_keyboard_installation_task(self, write_vc_mock, write_x_mock, get_missing_mock): localed = Mock() sysroot = "/mnt/sysimage" x_layouts = ["cz (qwerty)"] switch_options = ["grp:alt_shift_toggle"] vc_keymap = "us" task = KeyboardInstallationTask(localed_wrapper=localed, sysroot=sysroot, x_layouts=x_layouts, switch_options=switch_options, vc_keymap=vc_keymap) task.run() get_missing_mock.assert_not_called() write_x_mock.assert_called_once_with(localed, x_layouts, switch_options, X_CONF_DIR, sysroot) write_vc_mock.assert_called_once_with(vc_keymap, sysroot) x_layouts = ["cz (qwerty)"] vc_keymap = "" vc_keymap_from_conversion = "cz-qwerty" write_x_mock.reset_mock() write_vc_mock.reset_mock() get_missing_mock.reset_mock() get_missing_mock.return_value = (x_layouts, vc_keymap_from_conversion) task = KeyboardInstallationTask(localed_wrapper=localed, sysroot=sysroot, x_layouts=x_layouts, switch_options=switch_options, vc_keymap=vc_keymap) task.run() get_missing_mock.assert_called_once_with(localed, x_layouts, vc_keymap) write_x_mock.assert_called_once_with(localed, x_layouts, switch_options, X_CONF_DIR, sysroot) write_vc_mock.assert_called_once_with(vc_keymap_from_conversion, sysroot) x_layouts = [] x_layouts_from_conversion = ["us"] vc_keymap = "us" write_x_mock.reset_mock() write_vc_mock.reset_mock() get_missing_mock.reset_mock() get_missing_mock.return_value = (x_layouts_from_conversion, vc_keymap) task = KeyboardInstallationTask(localed_wrapper=localed, sysroot=sysroot, x_layouts=x_layouts, switch_options=switch_options, vc_keymap=vc_keymap) task.run() get_missing_mock.assert_called_once_with(localed, x_layouts, vc_keymap) write_x_mock.assert_called_once_with(localed, x_layouts_from_conversion, switch_options, X_CONF_DIR, sysroot) write_vc_mock.assert_called_once_with(vc_keymap, sysroot) x_layouts = [] vc_keymap = "" vc_keymap_default = DEFAULT_KEYBOARD x_layouts_from_conversion = [DEFAULT_KEYBOARD] write_x_mock.reset_mock() write_vc_mock.reset_mock() get_missing_mock.reset_mock() get_missing_mock.return_value = (x_layouts_from_conversion, vc_keymap_default) task = KeyboardInstallationTask(localed_wrapper=localed, sysroot=sysroot, x_layouts=x_layouts, switch_options=switch_options, vc_keymap=vc_keymap) task.run() get_missing_mock.assert_called_once_with(localed, x_layouts, vc_keymap) write_x_mock.assert_called_once_with(localed, x_layouts_from_conversion, switch_options, X_CONF_DIR, sysroot) write_vc_mock.assert_called_once_with(vc_keymap_default, sysroot)