示例#1
0
    def configure_with_task_test(self, publisher):
        """Test ConfigureWithTask."""
        self.module.on_storage_changed(Mock())
        self.module.process_kickstart(Mock())
        task_path = self.interface.ConfigureWithTask()

        obj = check_task_creation(self, task_path, publisher, CustomPartitioningTask)

        self.assertEqual(obj.implementation._storage, self.module.storage)
示例#2
0
    def configure_with_task_test(self, publisher):
        """Test ConfigureWithTask."""
        self.module.on_storage_reset(Mock())
        task_path = self.interface.ConfigureWithTask()

        obj = check_task_creation(self, task_path, publisher,
                                  AutomaticPartitioningTask)

        self.assertEqual(obj.implementation._storage, self.module.storage)
示例#3
0
    def validate_with_task_test(self, publisher):
        """Test ValidateWithTask."""
        self.module.on_storage_reset(Mock())
        task_path = self.interface.ValidateWithTask()

        obj = check_task_creation(self, task_path, publisher,
                                  StorageValidateTask)

        self.assertEqual(obj.implementation._storage, self.module.storage)
示例#4
0
 def preconfigure_fips_with_task_test(self, publisher):
     """Test the PreconfigureFIPSWithTask method."""
     task_path = self.security_interface.PreconfigureFIPSWithTask(
         PAYLOAD_TYPE_DNF)
     obj = check_task_creation(self, task_path, publisher,
                               PreconfigureFIPSTask)
     self.assertEqual(obj.implementation._sysroot, "/mnt/sysroot")
     self.assertEqual(obj.implementation._payload_type, PAYLOAD_TYPE_DNF)
     self.assertEqual(obj.implementation._fips_enabled, False)
示例#5
0
 def configure_ntp_service_enablement_default_test(self, publisher):
     """Test ntp service enablement with default module state."""
     ntp_excluded = True
     task_path = self.timezone_interface.ConfigureNTPServiceEnablementWithTask(
         ntp_excluded)
     obj = check_task_creation(self, task_path, publisher,
                               ConfigureNTPServiceEnablementTask)
     self.assertEqual(obj.implementation._ntp_enabled, True)
     self.assertEqual(obj.implementation._ntp_excluded, ntp_excluded)
    def configure_with_task_test(self, publisher):
        """Test ConfigureWithTask."""
        self.module.on_storage_changed(create_storage())
        task_path = self.interface.ConfigureWithTask()

        obj = check_task_creation(self, task_path, publisher,
                                  InteractivePartitioningTask)

        self.assertEqual(obj.implementation._storage, self.module.storage)
示例#7
0
    def populate_missing_keyboard_configuration_with_task_test(self, publisher):
        """Test PopulateMissingKeyboardConfigurationWithTask."""
        self.localization_interface.SetVirtualConsoleKeymap('us')
        self.localization_interface.SetXLayouts(['cz', 'cz (qwerty)'])

        task_path = self.localization_interface.PopulateMissingKeyboardConfigurationWithTask()

        obj = check_task_creation(self, task_path, publisher, GetMissingKeyboardConfigurationTask)
        self.assertEqual(obj.implementation._vc_keymap, 'us')
        self.assertEqual(obj.implementation._x_layouts, ['cz', 'cz (qwerty)'])
示例#8
0
    def realm_discover_default_test(self, publisher):
        """Test module in default state with realm discover task."""
        realm_discover_task_path = self.security_interface.DiscoverRealmWithTask()

        publisher.assert_called()

        # realm discover
        obj = check_task_creation(self, realm_discover_task_path, publisher, RealmDiscoverTask)
        self.assertEqual(obj.implementation._realm_data.name, "")
        self.assertEqual(obj.implementation._realm_data.discover_options, [])
    def install_with_task_test(self, publisher):
        """Test InstallWithTask."""
        storage = Mock()

        self.bootloader_module.on_storage_reset(storage)
        task_path = self.bootloader_interface.InstallWithTask()

        obj = check_task_creation(self, task_path, publisher, InstallBootloaderTask)

        self.assertEqual(obj.implementation._storage, storage)
示例#10
0
 def configure_ntp_service_enablement_configured_test(self, publisher):
     """Test ntp service enablement with configured module state."""
     ntp_excluded = False
     self.timezone_interface.SetNTPEnabled(False)
     task_path = self.timezone_interface.ConfigureNTPServiceEnablementWithTask(
         ntp_excluded)
     obj = check_task_creation(self, task_path, publisher,
                               ConfigureNTPServiceEnablementTask)
     self.assertEqual(obj.implementation._ntp_enabled, False)
     self.assertEqual(obj.implementation._ntp_excluded, ntp_excluded)
示例#11
0
    def discover_with_task_test(self, publisher):
        """Test the discover task."""
        task_path = self.zfcp_interface.DiscoverWithTask(
            "0.0.fc00", "0x5105074308c212e9", "0x401040a000000000")

        obj = check_task_creation(self, task_path, publisher, ZFCPDiscoverTask)

        self.assertEqual(obj.implementation._device_number, "0.0.fc00")
        self.assertEqual(obj.implementation._wwpn, "0x5105074308c212e9")
        self.assertEqual(obj.implementation._lun, "0x401040a000000000")
示例#12
0
    def mount_existing_system_with_task_test(self, publisher):
        """Test MountExistingSystemWithTask."""
        self._add_device(StorageDevice("dev1", fmt=get_format("ext4")))

        task_path = self.interface.MountExistingSystemWithTask("dev1", True)

        obj = check_task_creation(self, task_path, publisher, MountExistingSystemTask)

        self.assertEqual(obj.implementation._storage, self.module.storage)
        self.assertEqual(obj.implementation._device.name, "dev1")
        self.assertEqual(obj.implementation._read_only, True)
示例#13
0
    def fix_zipl_with_task_test(self, publisher):
        """Test FixZIPLWithTask."""
        storage = Mock()

        self.bootloader_module.on_storage_changed(storage)
        task_path = self.bootloader_interface.FixZIPLWithTask()

        obj = check_task_creation(self, task_path, publisher,
                                  FixZIPLBootloaderTask)
        self.assertEqual(obj.implementation._mode,
                         self.bootloader_module.bootloader_mode)
示例#14
0
    def dump_missing_ifcfg_files_with_task_test(self, publisher):
        """Test DumpMissingIfcfgFilesWithTask."""
        task_path = self.network_interface.DumpMissingIfcfgFilesWithTask()

        obj = check_task_creation(self, task_path, publisher,
                                  DumpMissingIfcfgFilesTask)

        self.network_module.log_task_result = Mock()

        obj.implementation.succeeded_signal.emit()
        self.network_module.log_task_result.assert_called_once()
    def configure_hostname_with_task_test(self, publisher):
        """Test ConfigureHostnameWithTask."""
        self.network_module._hostname = "my_hostname"

        task_path = self.network_interface.ConfigureHostnameWithTask(False)

        obj = check_task_creation(self, task_path, publisher,
                                  HostnameConfigurationTask)

        self.assertEqual(obj.implementation._overwrite, False)
        self.assertEqual(obj.implementation._hostname, "my_hostname")
示例#16
0
    def find_existing_systems_with_task_test(self, publisher):
        """Test FindExistingSystemsWithTask."""
        task_path = self.interface.FindExistingSystemsWithTask()

        obj = check_task_creation(self, task_path, publisher, FindExistingSystemsTask)

        self.assertEqual(obj.implementation._devicetree, self.module.storage.devicetree)

        roots = [Root(name="My Linux")]
        obj.implementation._set_result(roots)
        obj.implementation.succeeded_signal.emit()
        self.assertEqual(self.storage.roots, roots)
    def configure_with_task_test(self, publisher):
        """Test ConfigureWithTask."""
        storage = Mock()
        version = "4.17.7-200.fc28.x86_64"

        self.bootloader_module.on_storage_reset(storage)
        task_path = self.bootloader_interface.ConfigureWithTask([version])

        obj = check_task_creation(self, task_path, publisher, ConfigureBootloaderTask)

        self.assertEqual(obj.implementation._storage, storage)
        self.assertEqual(obj.implementation._versions, [version])
示例#18
0
    def consolidate_initramfs_connections_with_task_test(self, publisher):
        """Test ConsolidateInitramfsConnectionsWithTask."""
        task_path = self.network_interface.ConsolidateInitramfsConnectionsWithTask(
        )

        obj = check_task_creation(self, task_path, publisher,
                                  ConsolidateInitramfsConnectionsTask)

        self.network_module.log_task_result = Mock()

        obj.implementation.succeeded_signal.emit()
        self.network_module.log_task_result.assert_called_once()
示例#19
0
    def apply_keyboard_with_task_test(self, publisher):
        """Test ApplyKeyboardWithTask."""
        self.localization_interface.SetVirtualConsoleKeymap('us')
        self.localization_interface.SetXLayouts(['cz', 'cz (qwerty)'])
        self.localization_interface.SetLayoutSwitchOptions(["grp:alt_shift_toggle"])

        task_path = self.localization_interface.ApplyKeyboardWithTask()

        obj = check_task_creation(self, task_path, publisher, ApplyKeyboardTask)
        self.assertEqual(obj.implementation._vc_keymap, 'us')
        self.assertEqual(obj.implementation._x_layouts, ['cz', 'cz (qwerty)'])
        self.assertEqual(obj.implementation._switch_options, ["grp:alt_shift_toggle"])
示例#20
0
    def apply_kickstart_with_task_test(self, publisher):
        """Test ApplyKickstartWithTask."""
        self._mock_supported_devices([("ens3", "", 0)])
        task_path = self.network_interface.ApplyKickstartWithTask()

        obj = check_task_creation(self, task_path, publisher,
                                  ApplyKickstartTask)

        self.network_module.log_task_result = Mock()

        obj.implementation.succeeded_signal.emit()
        self.network_module.log_task_result.assert_called_once()
示例#21
0
    def fix_btrfs_with_task_test(self, publisher):
        """Test FixBTRFSWithTask."""
        storage = Mock()
        version = "4.17.7-200.fc28.x86_64"

        self.bootloader_module.on_storage_changed(storage)
        task_path = self.bootloader_interface.FixBTRFSWithTask([version])

        obj = check_task_creation(self, task_path, publisher,
                                  FixBTRFSBootloaderTask)
        self.assertEqual(obj.implementation._storage, storage)
        self.assertEqual(obj.implementation._versions, [version])
示例#22
0
    def firewall_config_task_basic_test(self, publisher):
        """Test the Firewall configuration task - basic."""
        task_path = self.firewall_interface.InstallWithTask()

        obj = check_task_creation(self, task_path, publisher,
                                  ConfigureFirewallTask)

        self.assertEqual(obj.implementation._firewall_mode,
                         FirewallMode.DEFAULT)
        self.assertEqual(obj.implementation._enabled_services, [])
        self.assertEqual(obj.implementation._disabled_services, [])
        self.assertEqual(obj.implementation._enabled_ports, [])
        self.assertEqual(obj.implementation._trusts, [])
示例#23
0
    def set_real_onboot_values_from_kickstart_with_task_test(self, publisher):
        """Test SetRealOnbootValuesFromKickstartWithTask."""
        self._mock_supported_devices([("ens3", "", 0)])
        task_path = self.network_interface.SetRealOnbootValuesFromKickstartWithTask(
        )

        obj = check_task_creation(self, task_path, publisher,
                                  SetRealOnbootValuesFromKickstartTask)

        self.network_module.log_task_result = Mock()

        obj.implementation.succeeded_signal.emit()
        self.network_module.log_task_result.assert_called_once()
示例#24
0
    def discover_with_task_test(self, publisher):
        """Test the discover task."""
        task_path = self.fcoe_interface.DiscoverWithTask(
            "eth0",  # nic
            False,  # dcb
            True  # auto_vlan
        )

        obj = check_task_creation(self, task_path, publisher, FCOEDiscoverTask)

        self.assertEqual(obj.implementation._nic, "eth0")
        self.assertEqual(obj.implementation._dcb, False)
        self.assertEqual(obj.implementation._auto_vlan, True)
示例#25
0
    def start_modules_with_task_test(self, publisher):
        """Test StartModulesWithTask."""
        task_path = self.interface.StartModulesWithTask()
        task_proxy = check_task_creation(self, task_path, publisher, StartModulesTask)
        task = task_proxy.implementation

        callback = Mock()
        self.module._module_manager.module_observers_changed.connect(callback)

        observers = [Mock(), Mock(), Mock()]
        task._set_result(observers)
        task.succeeded_signal.emit()
        callback.assert_called_once_with(observers)
示例#26
0
    def create_with_task_test(self, publisher):
        """Test CreateWithTask."""
        with self.assertRaises(UnavailableStorageError):
            self.interface.CreateWithTask(SNAPSHOT_WHEN_PRE_INSTALL)

        self.module.on_storage_changed(Mock())
        task_path = self.interface.CreateWithTask(SNAPSHOT_WHEN_PRE_INSTALL)

        obj = check_task_creation(self, task_path, publisher, SnapshotCreateTask)

        self.assertEqual(obj.implementation._storage, self.module.storage)
        self.assertEqual(obj.implementation._requests, [])
        self.assertEqual(obj.implementation._when, SNAPSHOT_WHEN_PRE_INSTALL)
示例#27
0
    def login_with_task_test(self, publisher):
        """Test the login task."""
        task_path = self.iscsi_interface.LoginWithTask(
            Portal.to_structure(self._portal),
            Credentials.to_structure(self._credentials),
            Node.to_structure(self._node),
        )

        obj = check_task_creation(self, task_path, publisher, ISCSILoginTask)

        self.assertEqual(obj.implementation._portal, self._portal)
        self.assertEqual(obj.implementation._credentials, self._credentials)
        self.assertEqual(obj.implementation._node, self._node)
示例#28
0
    def schedule_partitions_with_task_test(self, publisher):
        """Test SchedulePartitionsWithTask."""
        self.module.on_storage_changed(Mock())

        request = PartitioningRequest()
        request.partitioning_scheme = AUTOPART_TYPE_PLAIN

        task_path = self.interface.SchedulePartitionsWithTask(
            PartitioningRequest.to_structure(request))

        obj = check_task_creation(self, task_path, publisher,
                                  InteractiveAutoPartitioningTask)
        self.assertEqual(obj.implementation._storage, self.module.storage)
        self.assertTrue(compare_data(obj.implementation._request, request))
示例#29
0
    def realm_discover_configured_test(self, publisher):
        """Test module in configured state with realm discover task."""
        realm = RealmData()
        realm.name = "domain.example.com"
        realm.discover_options = ["--client-software=sssd"]

        self.security_interface.SetRealm(RealmData.to_structure(realm))
        realm_discover_task_path = self.security_interface.DiscoverRealmWithTask(
        )

        obj = check_task_creation(self, realm_discover_task_path, publisher,
                                  RealmDiscoverTask)
        self.assertEqual(obj.implementation._realm_data.name,
                         "domain.example.com")
        self.assertEqual(obj.implementation._realm_data.discover_options,
                         ["--client-software=sssd"])
示例#30
0
    def discover_with_task_test(self, publisher):
        """Test the discover task."""
        interfaces_mode = "default"
        task_path = self.iscsi_interface.DiscoverWithTask(
            Portal.to_structure(self._portal),
            Credentials.to_structure(self._credentials), interfaces_mode)

        obj = check_task_creation(self, task_path, publisher,
                                  ISCSIDiscoverTask)

        self.assertIsInstance(obj, ISCSIDiscoverTaskInterface)

        self.assertEqual(obj.implementation._portal, self._portal)
        self.assertEqual(obj.implementation._credentials, self._credentials)
        self.assertEqual(obj.implementation._interfaces_mode,
                         IscsiInterfacesMode.DEFAULT)