def test_is_public(self, mock_request): uri = Uri('xxx', 'rpm-md') assert uri.is_public() is False uri = Uri('https://example.com', 'rpm-md') assert uri.is_public() is True uri = Uri('obs://openSUSE:Leap:42.2/standard', 'yast2') self.runtime_config.is_obs_public = mock.Mock(return_value=False) uri.runtime_config = self.runtime_config assert uri.is_public() is False
def test_is_public(self, mock_request): uri = Uri('xxx', 'rpm-md') assert uri.is_public() is False uri = Uri('https://example.com', 'rpm-md') assert uri.is_public() is True uri = Uri('obs://openSUSE:Leap:42.2/standard', 'yast2') self.runtime_config.is_obs_public = mock.Mock( return_value=False ) uri.runtime_config = self.runtime_config assert uri.is_public() is False
def check_image_include_repos_publicly_resolvable(self) -> None: """ Verify that all repos marked with the imageinclude attribute can be resolved into a http based web URL """ message = dedent('''\n The use of imageinclude="true" in the repository definition for the Repository: {0} requires the repository to by publicly available. The source locator of the repository however indicates it is private to your local system. Therefore it can't be included into the system image repository configuration. Please define a publicly available repository in your image XML description. ''') repository_sections = self.xml_state.get_repository_sections() for xml_repo in repository_sections: repo_marked_for_image_include = xml_repo.get_imageinclude() if repo_marked_for_image_include: repo_source = xml_repo.get_source().get_path() repo_type = xml_repo.get_type() uri = Uri(repo_source, repo_type) if not uri.is_public(): raise KiwiRuntimeError( message.format(repo_source) )
def test_is_public(self, mock_request): # unknown uri schema is considered not public uri = Uri('xxx', 'rpm-md') assert uri.is_public() is False # https is public uri = Uri('https://example.com', 'rpm-md') assert uri.is_public() is True # obs is private with obs_public set to false in config uri = Uri('obs://openSUSE:Leap:42.2/standard', 'yast2') self.runtime_config.is_obs_public = mock.Mock(return_value=False) uri.runtime_config = self.runtime_config assert uri.is_public() is False # unknown uri type considered not public uri = Uri('httpx://example.com', 'rpm-md') assert uri.is_public() is False