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


Python ISODistributor._export_distributions方法代码示例

本文整理汇总了Python中iso_distributor.distributor.ISODistributor._export_distributions方法的典型用法代码示例。如果您正苦于以下问题:Python ISODistributor._export_distributions方法的具体用法?Python ISODistributor._export_distributions怎么用?Python ISODistributor._export_distributions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在iso_distributor.distributor.ISODistributor的用法示例。


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

示例1: test_distribution_exports

# 需要导入模块: from iso_distributor.distributor import ISODistributor [as 别名]
# 或者: from iso_distributor.distributor.ISODistributor import _export_distributions [as 别名]
 def test_distribution_exports(self):
     feed_url = "file://%s/pulp_unittest/" % self.data_dir
     repo = mock.Mock(spec=Repository)
     repo.working_dir = self.repo_working_dir
     repo.id = "pulp_unittest"
     repo.checksumtype = 'sha'
     sync_conduit = importer_mocks.get_sync_conduit(type_id=TYPE_ID_RPM, existing_units=[], pkg_dir=self.pkg_dir)
     config = importer_mocks.get_basic_config(feed_url=feed_url)
     importerRPM = importer_rpm.ImporterRPM()
     status, summary, details = importerRPM.sync(repo, sync_conduit, config)
     dunit_key = {}
     dunit_key['id'] = "ks-TestFamily-TestVariant-16-x86_64"
     dunit_key['version'] = "16"
     dunit_key['arch'] = "x86_64"
     dunit_key['family'] = "TestFamily"
     dunit_key['variant'] = "TestVariant"
     metadata = { "files" : [{"checksumtype" : "sha256", 	"relativepath" : "images/fileA.txt", 	"fileName" : "fileA.txt",
                 "downloadurl" : "http://repos.fedorapeople.org/repos/pulp/pulp/demo_repos/pulp_unittest//images/fileA.txt",
                 "item_type" : "tree_file",
                 "savepath" : "%s/testr1/images" % self.repo_working_dir,
                 "checksum" : "22603a94360ee24b7034c74fa13d70dd122aa8c4be2010fc1361e1e6b0b410ab",
                 "filename" : "fileA.txt",
                 "pkgpath" : "%s/ks-TestFamily-TestVariant-16-x86_64/images" % self.pkg_dir,
                 "size" : 0 },
             { 	"checksumtype" : "sha256", 	"relativepath" : "images/fileB.txt", 	"fileName" : "fileB.txt",
                 "downloadurl" : "http://repos.fedorapeople.org/repos/pulp/pulp/demo_repos/pulp_unittest//images/fileB.txt",
                 "item_type" : "tree_file",
                 "savepath" : "%s/testr1/images" % self.repo_working_dir,
                 "checksum" : "8dc89e9883c098443f6616e60a8e489254bf239eeade6e4b4943b7c8c0c345a4",
                 "filename" : "fileB.txt",
                 "pkgpath" : "%s/ks-TestFamily-TestVariant-16-x86_64/images" % self.pkg_dir, 	"size" : 0 },
             { 	"checksumtype" : "sha256", 	"relativepath" : "images/fileC.iso", 	"fileName" : "fileC.iso",
                 "downloadurl" : "http://repos.fedorapeople.org/repos/pulp/pulp/demo_repos/pulp_unittest//images/fileC.iso",
                 "item_type" : "tree_file",
                 "savepath" : "%s/testr1/images" % self.repo_working_dir,
                 "checksum" : "099f2bafd533e97dcfee778bc24138c40f114323785ac1987a0db66e07086f74",
                 "filename" : "fileC.iso",
                 "pkgpath" : "%s/ks-TestFamily-TestVariant-16-x86_64/images" % self.pkg_dir, 	"size" : 0 } ],}
     distro_unit = Unit(distribution.TYPE_ID_DISTRO, dunit_key, metadata, '')
     distro_unit.storage_path = "%s/ks-TestFamily-TestVariant-16-x86_64" % self.pkg_dir
     symlink_dir = "%s/%s" % (self.repo_working_dir, "isos")
     iso_distributor = ISODistributor()
     publish_conduit = distributor_mocks.get_publish_conduit(existing_units=[distro_unit], pkg_dir=self.pkg_dir)
     config = distributor_mocks.get_basic_config(https_publish_dir=self.https_publish_dir, http=False, https=True)
     status, errors = iso_distributor._export_distributions([distro_unit], symlink_dir)
     print status, errors
     self.assertTrue(status)
     for file in metadata['files']:
         print os.path.isfile("%s/%s" % (symlink_dir, file['relativepath']))
         self.assertTrue(os.path.isfile("%s/%s" % (symlink_dir, file['relativepath'])))
开发者ID:stpierre,项目名称:pulp,代码行数:52,代码来源:test_iso_distributor.py


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