當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。