def collect_platform_requirements_test(self, execute): """Test the function collect_platform_requirements.""" g1 = self._create_group("platform-vmware") g2 = self._create_group("platform-kvm") g3 = self._create_group("network-server") g4 = self._create_group("virtualization") base = Mock() base.comps.groups_iter.return_value = [g1, g2, g3, g4] # No platform is detected. execute.return_value = None requirements = collect_platform_requirements(base) self.assertEqual(requirements, []) # Unsupported platform is detected. execute.return_value = "qemu" requirements = collect_platform_requirements(base) self.assertEqual(requirements, []) # Supported platform is detected. execute.return_value = "vmware" requirements = collect_platform_requirements(base) r1 = self._create_requirement( name="platform-vmware", reason="Required for the vmware platform.", req_type=REQUIREMENT_TYPE_GROUP) self._compare_requirements(requirements, [r1])
def test_collect_platform_requirements(self, execute): """Test the function collect_platform_requirements.""" dnf_manager = Mock(spec=DNFManager) dnf_manager.groups = [ "platform-vmware", "platform-kvm", "network-server", "virtualization" ] # No platform is detected. execute.return_value = None requirements = collect_platform_requirements(dnf_manager) assert requirements == [] # Unsupported platform is detected. execute.return_value = "qemu" requirements = collect_platform_requirements(dnf_manager) assert requirements == [] # Supported platform is detected. execute.return_value = "vmware" requirements = collect_platform_requirements(dnf_manager) r1 = self._create_requirement( name="platform-vmware", reason="Required for the vmware platform.", req_type=REQUIREMENT_TYPE_GROUP) self._compare_requirements(requirements, [r1])
def _requirements(self): """Requirements for installing packages and groups. :return: a list of requirements """ return collect_remote_requirements() \ + collect_language_requirements(self._dnf_manager) \ + collect_platform_requirements(self._dnf_manager) \ + collect_driver_disk_requirements()