def test_install_with_tasks(self, publisher): """Test InstallWithTasks.""" task_classes = [ CreateGroupsTask, CreateUsersTask, SetRootPasswordTask, SetSshKeysTask, ConfigureRootPasswordSSHLoginTask ] task_paths = self.users_interface.InstallWithTasks() check_task_creation_list(self, task_paths, publisher, task_classes)
def test_post_install_with_tasks(self, publisher): """Test the PostInstallWithTasks method.""" assert self.payload_interface.PostInstallWithTasks() == [] payload = self.payload_module.create_payload(PayloadType.DNF) self.payload_module.activate_payload(payload) tasks_paths = self.payload_interface.PostInstallWithTasks() check_task_creation_list(tasks_paths, publisher, [CopyDriverDisksFilesTask])
def test_install_with_tasks(self, publisher): """Test the InstallWithTasks method.""" assert self.payload_interface.InstallWithTasks() == [] payload = self.payload_module.create_payload(PayloadType.DNF) self.payload_module.activate_payload(payload) tasks_paths = self.payload_interface.InstallWithTasks() check_task_creation_list(tasks_paths, publisher, [PrepareSystemForInstallationTask])
def test_tear_down_with_tasks(self, publisher): """Test the TeardownWithTasks method.""" assert self.payload_interface.TeardownWithTasks() == [] payload = self.payload_module.create_payload(PayloadType.DNF) self.payload_module.activate_payload(payload) source = self.payload_module.create_source(SourceType.CDROM) payload.set_sources([source]) publisher.reset_mock() task_paths = self.payload_interface.TeardownWithTasks() check_task_creation_list(task_paths, publisher, [TearDownSourcesTask])
def test_install_with_tasks_configured(self, publisher): """Test install tasks - module in configured state.""" realm = RealmData() realm.name = "domain.example.com" realm.discover_options = ["--client-software=sssd"] realm.join_options = ["--one-time-password=password"] realm.discovered = True authselect = ['select', 'sssd'] fingerprint = True self.security_interface.SetRealm(RealmData.to_structure(realm)) self.security_interface.SetSELinux(SELINUX_PERMISSIVE) self.security_interface.SetAuthselect(authselect) self.security_interface.SetFingerprintAuthEnabled(fingerprint) task_classes = [ ConfigureSELinuxTask, ConfigureFingerprintAuthTask, ConfigureAuthselectTask, ] task_paths = self.security_interface.InstallWithTasks() task_objs = check_task_creation_list(task_paths, publisher, task_classes) # ConfigureSELinuxTask obj = task_objs[0] assert obj.implementation._selinux_mode == SELinuxMode.PERMISSIVE # ConfigureFingerprintAuthTask obj = task_objs[1] assert obj.implementation._fingerprint_auth_enabled == fingerprint # ConfigureAuthselectTask obj = task_objs[2] assert obj.implementation._authselect_options == authselect
def test_install_bootloader_with_tasks(self, publisher): """Test InstallBootloaderWithTasks.""" storage = Mock() version = "4.17.7-200.fc28.x86_64" self.bootloader_module.on_storage_changed(storage) task_classes = [ CreateRescueImagesTask, ConfigureBootloaderTask, InstallBootloaderTask, CreateBLSEntriesTask ] task_paths = self.bootloader_interface.InstallBootloaderWithTasks( PAYLOAD_TYPE_LIVE_IMAGE, [version]) check_task_creation_list(task_paths, publisher, task_classes)
def test_generate_initramfs_with_tasks(self, publisher): """Test GenerateInitramfsWithTasks.""" storage = Mock() version = "4.17.7-200.fc28.x86_64" self.bootloader_module.on_storage_changed(storage) task_classes = [ RecreateInitrdsTask, FixBTRFSBootloaderTask, FixZIPLBootloaderTask, ] task_paths = self.bootloader_interface.GenerateInitramfsWithTasks( PAYLOAD_TYPE_LIVE_IMAGE, [version]) check_task_creation_list(task_paths, publisher, task_classes)
def test_install_with_tasks(self, proxy_getter, publisher): """Test InstallWithTasks.""" task_paths = self.interface.InstallWithTasks() task_proxies = check_task_creation_list(task_paths, publisher, [RunInstallationTask]) task = task_proxies[0].implementation assert isinstance(task._payload, ActiveDBusPayload) assert isinstance(task._ksdata, KickstartHandler)
def test_configure_bootloader_with_tasks(self, publisher): """Test the ConfigureBootloaderWithTasks method.""" class Task1(Task): @property def name(self): """The name of the task.""" return "Task 1" def run(self): """Nothing to do.""" class Service(KickstartService): def configure_bootloader_with_tasks(self, kernel_versions): """Return a list of installation tasks.""" return [Task1()] service = Service() interface = KickstartModuleInterface(service) tasks = interface.ConfigureBootloaderWithTasks(["1", "2", "3"]) check_task_creation_list(self, tasks, publisher, [Task1])
def test_install_with_tasks_configured(self, publisher): """Test install tasks - module in configured state.""" self.timezone_interface.SetIsUTC(True) self.timezone_interface.SetTimezone("Asia/Tokyo") self.timezone_interface.SetNTPEnabled(False) # --nontp and --ntpservers are mutually exclusive in kicstart but # there is no such enforcement in the module so for testing this is ok server = TimeSourceData() server.type = TIME_SOURCE_SERVER server.hostname = "clock1.example.com" server.options = ["iburst"] pool = TimeSourceData() pool.type = TIME_SOURCE_POOL pool.hostname = "clock2.example.com" self.timezone_interface.SetTimeSources( TimeSourceData.to_structure_list([server, pool]) ) task_classes = [ ConfigureHardwareClockTask, ConfigureTimezoneTask, ConfigureNTPTask, ] task_paths = self.timezone_interface.InstallWithTasks() task_objs = check_task_creation_list(task_paths, publisher, task_classes) # ConfigureHardwareClockTask obj = task_objs[0] assert obj.implementation._is_utc is True # ConfigureTimezoneTask obj = task_objs[1] assert obj.implementation._timezone == "Asia/Tokyo" assert obj.implementation._is_utc is True # ConfigureNTPTask obj = task_objs[2] assert obj.implementation._ntp_enabled is False assert len(obj.implementation._ntp_servers) == 2 assert compare_data(obj.implementation._ntp_servers[0], server) assert compare_data(obj.implementation._ntp_servers[1], pool)
def test_install_with_tasks_default(self, publisher): """Test install tasks - module in default state.""" task_classes = [ ConfigureTimezoneTask, ConfigureNTPTask, ] task_paths = self.timezone_interface.InstallWithTasks() task_objs = check_task_creation_list(self, task_paths, publisher, task_classes) # ConfigureTimezoneTask obj = task_objs[0] self.assertEqual(obj.implementation._timezone, "America/New_York") self.assertEqual(obj.implementation._is_utc, False) # ConfigureNTPTask obj = task_objs[1] self.assertEqual(obj.implementation._ntp_enabled, True) self.assertEqual(obj.implementation._ntp_servers, [])
def test_install_with_tasks_default(self, publisher): """Test InstallWithTasks.""" task_classes = [ ConfigureSELinuxTask, ConfigureFingerprintAuthTask, ConfigureAuthselectTask, ] task_paths = self.security_interface.InstallWithTasks() task_objs = check_task_creation_list(task_paths, publisher, task_classes) # ConfigureSELinuxTask obj = task_objs[0] assert obj.implementation._selinux_mode == SELinuxMode.DEFAULT # ConfigureFingerprintAuthTask obj = task_objs[1] assert obj.implementation._fingerprint_auth_enabled is False # ConfigureAuthselectTask obj = task_objs[2] assert obj.implementation._authselect_options == []
def test_install_with_tasks_default(self, publisher): """Test install tasks - module in default state.""" task_classes = [ ConfigureHardwareClockTask, ConfigureTimezoneTask, ConfigureNTPTask, ] task_paths = self.timezone_interface.InstallWithTasks() task_objs = check_task_creation_list(task_paths, publisher, task_classes) # ConfigureHardwareClockTask obj = task_objs[0] assert obj.implementation._is_utc is False # ConfigureTimezoneTask obj = task_objs[1] assert obj.implementation._timezone == "America/New_York" assert obj.implementation._is_utc is False # ConfigureNTPTask obj = task_objs[2] assert obj.implementation._ntp_enabled is True assert obj.implementation._ntp_servers == []