def collect_language_requirements_test(self, proxy_getter): """Test the function collect_language_requirements.""" proxy = LOCALIZATION.get_proxy() proxy.Language = "cs_CZ.UTF-8" proxy.LanguageSupport = ["en_GB.UTF-8", "sr_RS@cyrilic"] p1 = self._create_package("langpacks-cs") p2 = self._create_package("langpacks-core-cs") p3 = self._create_package("langpacks-core-font-cs") p4 = self._create_package("langpacks-en") p5 = self._create_package("langpacks-en_GB") p6 = self._create_package("langpacks-core-en") p7 = self._create_package("langpacks-core-en_GB") p8 = self._create_package("langpacks-core-font-en") base = Mock() base.sack.query.return_value.available.return_value.filter.return_value = [ p1, p2, p3, p4, p5, p6, p7, p8 ] with self.assertLogs(level="WARNING") as cm: requirements = collect_language_requirements(base) r1 = self._create_requirement( "langpacks-cs", "Required to support the locale 'cs_CZ.UTF-8'.") r2 = self._create_requirement( "langpacks-en_GB", "Required to support the locale 'en_GB.UTF-8'.") self._compare_requirements(requirements, [r1, r2]) msg = "Selected locale 'sr_RS@cyrilic' does not match any available langpacks." self.assertTrue(any(map(lambda x: msg in x, cm.output)))
def test_collect_language_requirements(self, proxy_getter): """Test the function collect_language_requirements.""" boss = BOSS.get_proxy() boss.GetModules.return_value = [LOCALIZATION.service_name] proxy = LOCALIZATION.get_proxy() proxy.Language = "cs_CZ.UTF-8" proxy.LanguageSupport = ["en_GB.UTF-8", "sr_RS@cyrilic"] dnf_manager = Mock(spec=DNFManager) dnf_manager.match_available_packages.return_value = [ "langpacks-cs", "langpacks-core-cs", "langpacks-core-font-cs", "langpacks-en", "langpacks-en_GB", "langpacks-core-en", "langpacks-core-en_GB", "langpacks-core-font-en" ] with self.assertLogs(level="WARNING") as cm: requirements = collect_language_requirements(dnf_manager) r1 = self._create_requirement( "langpacks-cs", "Required to support the locale 'cs_CZ.UTF-8'.") r2 = self._create_requirement( "langpacks-en_GB", "Required to support the locale 'en_GB.UTF-8'.") self._compare_requirements(requirements, [r1, r2]) msg = "Selected locale 'sr_RS@cyrilic' does not match any available langpacks." assert any(map(lambda x: msg in x, cm.output))
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()