当前位置: 首页>>代码示例>>Python>>正文


Python uri.Uri类代码示例

本文整理汇总了Python中kiwi.system.uri.Uri的典型用法代码示例。如果您正苦于以下问题:Python Uri类的具体用法?Python Uri怎么用?Python Uri使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Uri类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_translate_obs_project

 def test_translate_obs_project(self, mock_request_get):
     uri = Uri('obs://openSUSE:Leap:42.2/standard', 'yast2')
     uri.runtime_config = self.runtime_config
     uri.translate()
     mock_request_get.assert_called_once_with(
         'obs_server/openSUSE:/Leap:/42.2/standard'
     )
开发者ID:AdamMajer,项目名称:kiwi-ng,代码行数:7,代码来源:system_uri_test.py

示例2: test_translate_obs_uri_inside_buildservice

 def test_translate_obs_uri_inside_buildservice(
         self, mock_buildservice, mock_warn
 ):
     mock_buildservice.return_value = True
     uri = Uri('obs://openSUSE:Leap:42.2/standard', 'rpm-md')
     uri.runtime_config = self.runtime_config
     assert uri.translate(False) == \
         'obs_server/openSUSE:/Leap:/42.2/standard'
     assert mock_warn.called
开发者ID:AdamMajer,项目名称:kiwi-ng,代码行数:9,代码来源:system_uri_test.py

示例3: test_translate_buildservice_obsrepositories_container_path

 def test_translate_buildservice_obsrepositories_container_path(
     self, mock_buildservice
 ):
     mock_buildservice.return_value = True
     uri = Uri('obsrepositories:/container#latest', 'container')
     assert uri.translate() == ''.join(
         [
             '/usr/src/packages/SOURCES/containers/',
             '_obsrepositories/container#latest'
         ]
     )
开发者ID:AdamMajer,项目名称:kiwi-ng,代码行数:11,代码来源:system_uri_test.py

示例4: test_destructor

 def test_destructor(self, mock_wipe, mock_mkdtemp, mock_manager):
     mock_mkdtemp.return_value = 'tmpdir'
     manager = mock.Mock()
     manager.mountpoint = mock_mkdtemp.return_value
     manager.is_mounted = mock.Mock(
         return_value=True
     )
     mock_manager.return_value = manager
     uri = Uri('iso:///image/CDs/openSUSE-13.2-DVD-x86_64.iso', 'yast2')
     result = uri.translate()
     uri.__del__()
     manager.umount.assert_called_once_with()
     mock_wipe.assert_called_once_with(manager.mountpoint)
开发者ID:ChrisBr,项目名称:kiwi,代码行数:13,代码来源:system_uri_test.py

示例5: test_translate_iso_path

 def test_translate_iso_path(self, mock_mkdtemp, mock_manager):
     mock_mkdtemp.return_value = 'tmpdir'
     manager = mock.Mock()
     manager.mountpoint = mock_mkdtemp.return_value
     mock_manager.return_value = manager
     uri = Uri('iso:///image/CDs/openSUSE-13.2-DVD-x86_64.iso', 'yast2')
     result = uri.translate()
     mock_manager.assert_called_once_with(
         device='/image/CDs/openSUSE-13.2-DVD-x86_64.iso',
         mountpoint='tmpdir'
     )
     manager.mount.assert_called_once_with()
     assert result == 'tmpdir'
     uri.mount_stack = []
开发者ID:ChrisBr,项目名称:kiwi,代码行数:14,代码来源:system_uri_test.py

示例6: import_repositories_marked_as_imageinclude

 def import_repositories_marked_as_imageinclude(self):
     """
     Those <repository> sections which are marked with the
     imageinclude attribute should be permanently added to
     the image repository configuration
     """
     repository_sections = \
         self.xml_state.get_repository_sections_used_in_image()
     root = RootInit(
         root_dir=self.root_dir, allow_existing=True
     )
     repo = Repository(
         RootBind(root), self.xml_state.get_package_manager()
     )
     repo.use_default_location()
     for xml_repo in repository_sections:
         repo_type = xml_repo.get_type()
         repo_source = xml_repo.get_source().get_path()
         repo_user = xml_repo.get_username()
         repo_secret = xml_repo.get_password()
         repo_alias = xml_repo.get_alias()
         repo_priority = xml_repo.get_priority()
         repo_dist = xml_repo.get_distribution()
         repo_components = xml_repo.get_components()
         repo_repository_gpgcheck = xml_repo.get_repository_gpgcheck()
         repo_package_gpgcheck = xml_repo.get_package_gpgcheck()
         uri = Uri(repo_source, repo_type)
         repo_source_translated = uri.translate(
             check_build_environment=False
         )
         if not repo_alias:
             repo_alias = uri.alias()
         log.info('Setting up image repository %s', repo_source)
         log.info('--> Type: %s', repo_type)
         log.info('--> Translated: %s', repo_source_translated)
         log.info('--> Alias: %s', repo_alias)
         repo.add_repo(
             repo_alias, repo_source_translated,
             repo_type, repo_priority, repo_dist, repo_components,
             repo_user, repo_secret, uri.credentials_file_name(),
             repo_repository_gpgcheck, repo_package_gpgcheck
         )
开发者ID:AdamMajer,项目名称:kiwi-ng,代码行数:42,代码来源:setup.py

示例7: test_is_public

 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
开发者ID:AdamMajer,项目名称:kiwi-ng,代码行数:11,代码来源:system_uri_test.py

示例8: test_alias

 def test_alias(self):
     uri = Uri('https://example.com', 'rpm-md')
     assert uri.alias() == hashlib.md5(
         'https://example.com'.encode()).hexdigest(
     )
开发者ID:ChrisBr,项目名称:kiwi,代码行数:5,代码来源:system_uri_test.py

示例9: test_is_remote

 def test_is_remote(self):
     uri = Uri('https://example.com', 'rpm-md')
     assert uri.is_remote() is True
     uri = Uri('dir:///path/to/repo', 'rpm-md')
     assert uri.is_remote() is False
开发者ID:ChrisBr,项目名称:kiwi,代码行数:5,代码来源:system_uri_test.py

示例10: test_translate_unsupported_style

 def test_translate_unsupported_style(self):
     uri = Uri('ms://foo', 'rpm-md')
     uri.translate()
开发者ID:ChrisBr,项目名称:kiwi,代码行数:3,代码来源:system_uri_test.py

示例11: test_translate_buildservice_container_path

 def test_translate_buildservice_container_path(self, mock_buildservice):
     mock_buildservice.return_value = True
     uri = Uri('obs://project/repo/container#latest', 'container')
     assert uri.translate() == \
         '/usr/src/packages/SOURCES/containers/project/repo/container#latest'
开发者ID:AdamMajer,项目名称:kiwi-ng,代码行数:5,代码来源:system_uri_test.py

示例12: test_translate_suse_buildservice_path

 def test_translate_suse_buildservice_path(self):
     uri = Uri('suse://openSUSE:13.2/standard', 'yast2')
     assert uri.translate() == \
         '/usr/src/packages/SOURCES/repos/openSUSE:13.2/standard'
开发者ID:ChrisBr,项目名称:kiwi,代码行数:4,代码来源:system_uri_test.py

示例13: test_translate_http_path

 def test_translate_http_path(self):
     uri = Uri('http://example.com/foo', 'rpm-md')
     assert uri.translate() == 'http://example.com/foo'
开发者ID:ChrisBr,项目名称:kiwi,代码行数:3,代码来源:system_uri_test.py

示例14: test_translate_obs_project

 def test_translate_obs_project(self):
     uri = Uri('obs://Virt:Appliances/SLE_12', 'rpm-md')
     assert uri.translate() == \
         'http://download.opensuse.org/repositories/Virt:Appliances/SLE_12'
开发者ID:ChrisBr,项目名称:kiwi,代码行数:4,代码来源:system_uri_test.py

示例15: test_is_remote_in_buildservice

 def test_is_remote_in_buildservice(
     self, mock_buildservice
 ):
     mock_buildservice.return_value = True
     uri = Uri('obs://openSUSE:Leap:42.2/standard', 'yast2')
     assert uri.is_remote() is False
开发者ID:AdamMajer,项目名称:kiwi-ng,代码行数:6,代码来源:system_uri_test.py


注:本文中的kiwi.system.uri.Uri类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。