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


Python distributor.ISODistributor类代码示例

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


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

示例1: test_skip_types_export

 def test_skip_types_export(self):
     repo = mock.Mock(spec=Repository)
     repo.id = "testrepo"
     repo.working_dir = self.repo_working_dir
     distributor = ISODistributor()
     config = distributor_mocks.get_basic_config(http=True, https=False, skip=["rpm", "errata", "packagegroup"])
     publish_conduit = distributor_mocks.get_publish_conduit(existing_units=[], pkg_dir=self.pkg_dir)
     report = distributor.publish_repo(repo, publish_conduit, config)
     print report.summary
     summary_keys = {
         "rpm": ["num_package_units_attempted", "num_package_units_exported", "num_package_units_errors"],
         "distribution": [
             "num_distribution_units_attempted",
             "num_distribution_units_exported",
             "num_distribution_units_errors",
         ],
         "packagegroup": ["num_package_groups_exported", "num_package_categories_exported"],
         "erratum": ["num_errata_units_exported"],
     }
     # check rpm,packagegroup,erratum info is skipped
     for key in summary_keys["rpm"] + summary_keys["packagegroup"] + summary_keys["erratum"]:
         self.assertTrue(key not in report.summary)
     # check distro info is present and not skipped
     for key in summary_keys["distribution"]:
         self.assertTrue(key in report.summary)
开发者ID:ehelms,项目名称:pulp,代码行数:25,代码来源:test_iso_distributor.py

示例2: test_repo_export_isos

    def test_repo_export_isos(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)
        unit_key_a = {'id' : '','name' :'pulp-dot-2.0-test', 'version' :'0.1.2', 'release' : '1.fc11', 'epoch':'0', 'arch' : 'x86_64', 'checksumtype' : 'sha256',
                      'checksum': '435d92e6c09248b501b8d2ae786f92ccfad69fab8b1bc774e2b66ff6c0d83979', 'type_id' : 'rpm'}
        unit_a = Unit(TYPE_ID_RPM, unit_key_a, {}, '')
        unit_a.storage_path = "%s/pulp-dot-2.0-test/0.1.2/1.fc11/x86_64/435d92e6c09248b501b8d2ae786f92ccfad69fab8b1bc774e2b66ff6c0d83979/pulp-dot-2.0-test-0.1.2-1.fc11.x86_64.rpm" % self.pkg_dir
        unit_key_b = {'id' : '', 'name' :'pulp-test-package', 'version' :'0.2.1', 'release' :'1.fc11', 'epoch':'0','arch' : 'x86_64', 'checksumtype' :'sha256',
                      'checksum': '4dbde07b4a8eab57e42ed0c9203083f1d61e0b13935d1a569193ed8efc9ecfd7', 'type_id' : 'rpm', }
        unit_b = Unit(TYPE_ID_RPM, unit_key_b, {}, '')
        unit_b.storage_path = "%s/pulp-test-package/0.2.1/1.fc11/x86_64/4dbde07b4a8eab57e42ed0c9203083f1d61e0b13935d1a569193ed8efc9ecfd7/pulp-test-package-0.2.1-1.fc11.x86_64.rpm" % self.pkg_dir
        unit_key_c = {'id' : '', 'name' :'pulp-test-package', 'version' :'0.3.1', 'release' :'1.fc11', 'epoch':'0','arch' : 'x86_64', 'checksumtype' :'sha256',
                      'checksum': '6bce3f26e1fc0fc52ac996f39c0d0e14fc26fb8077081d5b4dbfb6431b08aa9f', 'type_id' : 'rpm', }
        unit_c = Unit(TYPE_ID_RPM, unit_key_c, {}, '')
        unit_c.storage_path =  "%s/pulp-test-package/0.3.1/1.fc11/x86_64/6bce3f26e1fc0fc52ac996f39c0d0e14fc26fb8077081d5b4dbfb6431b08aa9f/pulp-test-package-0.3.1-1.fc11.x86_64.rpm" % self.pkg_dir
        existing_units = []
        for unit in [unit_a, unit_b, unit_c]:
            existing_units.append(unit)
        sync_conduit = importer_mocks.get_sync_conduit(type_id=TYPE_ID_RPM, existing_units=existing_units, pkg_dir=self.pkg_dir)
        importerErrata = errata.ImporterErrata()
        importerErrata.sync(repo, sync_conduit, config)
        repo.working_dir = "%s/%s" % (self.repo_working_dir, "export")
        iso_distributor = ISODistributor()
        publish_conduit = distributor_mocks.get_publish_conduit(existing_units=existing_units, pkg_dir=self.pkg_dir)
        # test https publish
        config = distributor_mocks.get_basic_config(http_publish_dir=self.http_publish_dir, https_publish_dir=self.https_publish_dir, http=False, https=True, generate_metadata=True)
        report = iso_distributor.publish_repo(repo, publish_conduit, config)
        print report
        self.assertTrue(os.path.exists("%s/%s" % (self.https_publish_dir, repo.id)))
        self.assertEquals(len(os.listdir(self.http_publish_dir)), 0)
        # test http publish
        config = distributor_mocks.get_basic_config(http_publish_dir=self.http_publish_dir, https_publish_dir=self.https_publish_dir, http=True, https=False)
        report = iso_distributor.publish_repo(repo, publish_conduit, config)

        self.assertTrue(os.path.exists("%s/%s" % (self.http_publish_dir, repo.id)))
        self.assertEquals(len(os.listdir(self.https_publish_dir)), 0)
        isos_list = os.listdir("%s/%s" % (self.http_publish_dir, repo.id))
        self.assertEqual(len(isos_list), 1)
        # make sure the iso name defaults to repoid
        self.assertTrue( isos_list[-1].startswith(repo.id))
        # test isoprefix:
        iso_prefix = "mock-iso-prefix"
        config = distributor_mocks.get_basic_config(http_publish_dir=self.http_publish_dir, https_publish_dir=self.https_publish_dir, http=True, https=False, iso_prefix=iso_prefix)
        report = iso_distributor.publish_repo(repo, publish_conduit, config)

        self.assertTrue(os.path.exists("%s/%s" % (self.http_publish_dir, repo.id)))
        self.assertEquals(len(os.listdir(self.https_publish_dir)), 0)
        isos_list = os.listdir("%s/%s" % (self.http_publish_dir, repo.id))
        self.assertEqual(len(isos_list), 2)
        print isos_list
        # make sure the iso name uses the prefix
        self.assertTrue( isos_list[-1].startswith(iso_prefix))
开发者ID:stpierre,项目名称:pulp,代码行数:59,代码来源:test_iso_distributor.py

示例3: test_cancel_publish_repo

    def test_cancel_publish_repo(self, mock_cancel_createrepo):
        """
        Test cancel_publish_repo, which is not currently fully supported
        """
        # Setup
        distributor = ISODistributor()
        distributor.working_dir = '/working/dir'

        # Test
        distributor.cancel_publish_repo('call_request', 'call_report')
        mock_cancel_createrepo.assert_called_once_with(distributor.working_dir)
开发者ID:jdob,项目名称:pulp_rpm,代码行数:11,代码来源:test_export_distributor.py

示例4: TestPublishIsos

class TestPublishIsos(unittest.TestCase):
    """
    Tests the _publish_isos method in GroupISODistributor. This method decides what the publishing
    directories should be, cleans them up, and hands everything off to the publish_iso method in
    export_utils.
    """
    def setUp(self):
        self.distributor = ISODistributor()
        self.repo = Repository('repo_id', working_dir='/working/dir')
        self.config = {PUBLISH_HTTP_KEYWORD: True, PUBLISH_HTTPS_KEYWORD: True}

        self.publish_iso = export_utils.publish_isos
        export_utils.publish_isos = mock.Mock()

    def tearDown(self):
        export_utils.publish_isos = self.publish_iso

    @mock.patch('shutil.rmtree', autospec=True)
    def test_publish_isos(self, mock_rmtree):
        """
        Test that publish_isos is called with the expected arguments
        """
        # Setup
        http_publish_dir = os.path.join(EXPORT_HTTP_DIR, self.repo.id)
        https_publish_dir = os.path.join(EXPORT_HTTPS_DIR, self.repo.id)

        # Test
        self.distributor._publish_isos(self.repo, PluginCallConfiguration({}, self.config))
        self.assertEqual(2, mock_rmtree.call_count)
        self.assertEqual(http_publish_dir, mock_rmtree.call_args_list[0][0][0])
        self.assertEqual(https_publish_dir, mock_rmtree.call_args_list[1][0][0])
        export_utils.publish_isos.assert_called_once_with(self.repo.working_dir, self.repo.id,
                                                          http_publish_dir, https_publish_dir, None,
                                                          None)

    @mock.patch('shutil.rmtree', autospec=True)
    def test_publish_http_https_false(self, mock_rmtree):
        """
        Test that when the config has publishing http and https set to false, publish_isos is called
        with None for https_dir and http_dir
        """
        # Setup
        self.config[PUBLISH_HTTPS_KEYWORD] = False
        self.config[PUBLISH_HTTP_KEYWORD] = False
        self.distributor._publish_isos(self.repo, PluginCallConfiguration({}, self.config))
        http_publish_dir = os.path.join(EXPORT_HTTP_DIR, self.repo.id)
        https_publish_dir = os.path.join(EXPORT_HTTPS_DIR, self.repo.id)

        # Test
        self.assertEqual(2, mock_rmtree.call_count)
        self.assertEqual(http_publish_dir, mock_rmtree.call_args_list[0][0][0])
        self.assertEqual(https_publish_dir, mock_rmtree.call_args_list[1][0][0])
        export_utils.publish_isos.assert_called_once_with(self.repo.working_dir, self.repo.id, None,
                                                          None, None, None)
开发者ID:jdob,项目名称:pulp_rpm,代码行数:54,代码来源:test_export_distributor.py

示例5: test_set_progress

    def test_set_progress(self):
        """
        Test set_progress, which simply checks if the progress_callback is None before calling it
        """
        # Setup
        mock_callback = mock.Mock()
        distributor = ISODistributor()

        # Test
        distributor.set_progress('id', 'status', mock_callback)
        mock_callback.assert_called_once_with('id', 'status')
开发者ID:jdob,项目名称:pulp_rpm,代码行数:11,代码来源:test_export_distributor.py

示例6: test_set_progress_no_callback

    def test_set_progress_no_callback(self):
        """
        Assert that set_progress don't not attempt to call the callback when it is None
        """
        # Setup
        distributor = ISODistributor()

        # Test
        try:
            distributor.set_progress('id', 'status', None)
        except AttributeError:
            self.fail('set_progress should not try to call None')
开发者ID:jdob,项目名称:pulp_rpm,代码行数:12,代码来源:test_export_distributor.py

示例7: test_validate_config_iso_prefix

 def test_validate_config_iso_prefix(self):
     repo = mock.Mock(spec=Repository)
     repo.id = "testrepo"
     distributor = ISODistributor()
     # test invalid iso prefix
     config = distributor_mocks.get_basic_config(http=True, https=False, iso_prefix="my_iso*_name_/")
     state, msg = distributor.validate_config(repo, config, [])
     self.assertFalse(state)
     # test valid iso prefix
     config = distributor_mocks.get_basic_config(http=True, https=False, iso_prefix="My_iso_name-01")
     state, msg = distributor.validate_config(repo, config, [])
     self.assertTrue(state)
开发者ID:jlsherrill,项目名称:pulp,代码行数:12,代码来源:test_iso_distributor.py

示例8: test_generate_isos

    def test_generate_isos(self):
        repo = mock.Mock(spec=Repository)
        repo.id = "test_repo_for_export"
        repo.working_dir = self.repo_iso_working_dir + "/" + repo.id
        unit_key_a = {'id' : '','name' :'pulp-dot-2.0-test', 'version' :'0.1.2', 'release' : '1.fc11', 'epoch':'0', 'arch' : 'x86_64', 'checksumtype' : 'sha256',
                      'checksum': '435d92e6c09248b501b8d2ae786f92ccfad69fab8b1bc774e2b66ff6c0d83979', 'type_id' : 'rpm'}
        unit_a = Unit(TYPE_ID_RPM, unit_key_a, {'updated' : ''}, '')
        unit_a.storage_path = "%s/pulp-dot-2.0-test/0.1.2/1.fc11/x86_64/435d92e6c09248b501b8d2ae786f92ccfad69fab8b1bc774e2b66ff6c0d83979/pulp-dot-2.0-test-0.1.2-1.fc11.x86_64.rpm" % self.pkg_dir
        unit_key_b = {'id' : '', 'name' :'pulp-test-package', 'version' :'0.2.1', 'release' :'1.fc11', 'epoch':'0','arch' : 'x86_64', 'checksumtype' :'sha256',
                      'checksum': '4dbde07b4a8eab57e42ed0c9203083f1d61e0b13935d1a569193ed8efc9ecfd7', 'type_id' : 'rpm', }
        unit_b = Unit(TYPE_ID_RPM, unit_key_b, {'updated' : ''}, '')
        unit_b.storage_path = "%s/pulp-test-package/0.2.1/1.fc11/x86_64/4dbde07b4a8eab57e42ed0c9203083f1d61e0b13935d1a569193ed8efc9ecfd7/pulp-test-package-0.2.1-1.fc11.x86_64.rpm" % self.pkg_dir
        unit_key_c = {'id' : '', 'name' :'pulp-test-package', 'version' :'0.3.1', 'release' :'1.fc11', 'epoch':'0','arch' : 'x86_64', 'checksumtype' :'sha256',
                      'checksum': '6bce3f26e1fc0fc52ac996f39c0d0e14fc26fb8077081d5b4dbfb6431b08aa9f', 'type_id' : 'rpm', }
        unit_c = Unit(TYPE_ID_RPM, unit_key_c, {'updated' : ''}, '')
        unit_c.storage_path =  "%s/pulp-test-package/0.3.1/1.fc11/x86_64/6bce3f26e1fc0fc52ac996f39c0d0e14fc26fb8077081d5b4dbfb6431b08aa9f/pulp-test-package-0.3.1-1.fc11.x86_64.rpm" % self.pkg_dir
        existing_units = []
        for unit in [unit_a, unit_b, unit_c]:
            existing_units.append(unit)
        global progress_status
        progress_status = None
        def set_progress(progress):
            global progress_status
            progress_status = progress
        publish_conduit = distributor_mocks.get_publish_conduit(pkg_dir=self.pkg_dir, existing_units=existing_units)
        config = distributor_mocks.get_basic_config(https_publish_dir=self.https_publish_dir, http_publish_dir=self.http_publish_dir,
            generate_metadata=True, http=True, https=False, iso_prefix="test-isos")
        distributor = ISODistributor()
        def cleanup(repo_working_dir):
            return
        iso_util.cleanup_working_dir = mock.Mock()
        iso_util.cleanup_working_dir.side_effect = cleanup
        publish_conduit.set_progress = mock.Mock()
        publish_conduit.set_progress.side_effect = set_progress
        progress_status = distributor.init_progress()
        distributor.publish_repo(repo, publish_conduit, config)
        self.assertTrue("isos" in progress_status)
        self.assertTrue(progress_status["isos"].has_key("state"))
        self.assertEqual(progress_status["isos"]["state"], "FINISHED")
        self.assertEqual(progress_status["isos"]["num_success"], 1)
        self.assertTrue(progress_status["isos"]["size_total"] is not None)
        self.assertEqual(progress_status["isos"]["size_left"], 0)
        self.assertEqual(progress_status["isos"]["items_total"], 1)
        self.assertEqual(progress_status["isos"]["items_left"], 0)

        self.assertTrue(os.path.exists("%s/%s" % (self.http_publish_dir, repo.id)))
        self.assertEquals(len(os.listdir(self.https_publish_dir)), 0)
        isos_list = os.listdir("%s/%s" % (self.http_publish_dir, repo.id))
        self.assertEqual(len(isos_list), 1)
        # make sure the iso name defaults to repoid
        self.assertTrue( isos_list[0].startswith("test-isos"))
开发者ID:jessegonzalez,项目名称:pulp_rpm,代码行数:51,代码来源:test_iso_distributor.py

示例9: test_distribution_exports

 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,代码行数:50,代码来源:test_iso_distributor.py

示例10: test_publish_progress

    def test_publish_progress(self):
        global progress_status
        progress_status = None

        def set_progress(progress):
            global progress_status
            progress_status = progress

        PROGRESS_FIELDS = ["num_success", "num_error", "items_left", "items_total", "error_details"]
        publish_conduit = distributor_mocks.get_publish_conduit(pkg_dir=self.pkg_dir)
        config = distributor_mocks.get_basic_config(
            https_publish_dir=self.https_publish_dir,
            http_publish_dir=self.http_publish_dir,
            generate_metadata=True,
            http=True,
            https=False,
        )
        distributor = ISODistributor()
        repo = mock.Mock(spec=Repository)
        repo.working_dir = self.repo_working_dir
        repo.id = "test_progress_sync"
        publish_conduit.set_progress = mock.Mock()
        publish_conduit.set_progress.side_effect = set_progress
        distributor.publish_repo(repo, publish_conduit, config)

        self.assertTrue(progress_status is not None)
        self.assertTrue("rpms" in progress_status)
        self.assertTrue(progress_status["rpms"].has_key("state"))
        self.assertEqual(progress_status["rpms"]["state"], "FINISHED")
        for field in PROGRESS_FIELDS:
            self.assertTrue(field in progress_status["rpms"])

        self.assertTrue("distribution" in progress_status)
        self.assertTrue(progress_status["distribution"].has_key("state"))
        self.assertEqual(progress_status["distribution"]["state"], "FINISHED")
        for field in PROGRESS_FIELDS:
            self.assertTrue(field in progress_status["distribution"])

        self.assertTrue("errata" in progress_status)
        self.assertTrue(progress_status["errata"].has_key("state"))
        self.assertEqual(progress_status["errata"]["state"], "FINISHED")

        self.assertTrue("isos" in progress_status)
        self.assertTrue(progress_status["isos"].has_key("state"))
        self.assertEqual(progress_status["isos"]["state"], "FINISHED")

        self.assertTrue("publish_http" in progress_status)
        self.assertEqual(progress_status["publish_http"]["state"], "FINISHED")
        self.assertTrue("publish_https" in progress_status)
        self.assertEqual(progress_status["publish_https"]["state"], "SKIPPED")
开发者ID:ehelms,项目名称:pulp,代码行数:50,代码来源:test_iso_distributor.py

示例11: test_generate_isos

    def test_generate_isos(self):
        repo = mock.Mock(spec=Repository)
        repo.id = "test_repo_for_export"
        repo.working_dir = self.repo_iso_working_dir
        global progress_status
        progress_status = None

        def set_progress(progress):
            global progress_status
            progress_status = progress

        publish_conduit = distributor_mocks.get_publish_conduit(pkg_dir=self.pkg_dir)
        config = distributor_mocks.get_basic_config(
            https_publish_dir=self.https_publish_dir,
            http_publish_dir=self.http_publish_dir,
            generate_metadata=True,
            http=True,
            https=False,
            iso_prefix="test-isos",
        )
        distributor = ISODistributor()

        def cleanup(repo_working_dir):
            return

        iso_util.cleanup_working_dir = mock.Mock()
        iso_util.cleanup_working_dir.side_effect = cleanup
        publish_conduit.set_progress = mock.Mock()
        publish_conduit.set_progress.side_effect = set_progress
        progress_status = distributor.init_progress()
        distributor.publish_repo(repo, publish_conduit, config)
        self.assertTrue("isos" in progress_status)
        self.assertTrue(progress_status["isos"].has_key("state"))
        self.assertEqual(progress_status["isos"]["state"], "FINISHED")
        self.assertEqual(progress_status["isos"]["num_success"], 1)
        self.assertTrue(progress_status["isos"]["size_total"] is not None)
        self.assertEqual(progress_status["isos"]["size_left"], 0)
        self.assertEqual(progress_status["isos"]["items_total"], 1)
        self.assertEqual(progress_status["isos"]["items_left"], 0)

        print progress_status
        self.assertTrue(os.path.exists("%s/%s" % (self.http_publish_dir, repo.id)))
        self.assertEquals(len(os.listdir(self.https_publish_dir)), 0)
        isos_list = os.listdir("%s/%s" % (self.http_publish_dir, repo.id))
        print isos_list
        self.assertEqual(len(isos_list), 1)
        # make sure the iso name defaults to repoid
        self.assertTrue(isos_list[0].startswith("test-isos"))
开发者ID:ehelms,项目名称:pulp,代码行数:48,代码来源:test_iso_distributor.py

示例12: setUp

    def setUp(self):
        self.distributor = ISODistributor()
        self.repo = Repository('repo_id', working_dir='/working/dir')
        self.config = {PUBLISH_HTTP_KEYWORD: True, PUBLISH_HTTPS_KEYWORD: True}

        self.publish_iso = export_utils.publish_isos
        export_utils.publish_isos = mock.Mock()
开发者ID:jdob,项目名称:pulp_rpm,代码行数:7,代码来源:test_export_distributor.py

示例13: test_validate_config

    def test_validate_config(self):
        """
        Test the validate_config method in ISODistributor, which just hands the config off to a helper
        method in export_utils
        """
        # Setup
        validate_config = export_utils.validate_export_config
        export_utils.validate_export_config = mock.MagicMock()
        distributor = ISODistributor()

        # Test. All validate_config should do is hand the config argument to the export_utils validator
        distributor.validate_config(None, 'config', None)
        export_utils.validate_export_config.assert_called_once_with('config')

        # Clean up
        export_utils.validate_export_config = validate_config
开发者ID:jdob,项目名称:pulp_rpm,代码行数:16,代码来源:test_export_distributor.py

示例14: test_metadata

 def test_metadata(self):
     """
     Test the overridden metadata method in ISODistributor
     """
     metadata = ISODistributor.metadata()
     expected_types = [TYPE_ID_RPM, TYPE_ID_SRPM, TYPE_ID_DRPM, TYPE_ID_ERRATA,
                       TYPE_ID_DISTRO, TYPE_ID_PKG_CATEGORY, TYPE_ID_PKG_GROUP]
     self.assertEquals(metadata['id'], TYPE_ID_DISTRIBUTOR_EXPORT)
     self.assertEqual(set(expected_types), set(metadata['types']))
开发者ID:jdob,项目名称:pulp_rpm,代码行数:9,代码来源:test_export_distributor.py

示例15: test_metadata

 def test_metadata(self):
     metadata = ISODistributor.metadata()
     self.assertEquals(metadata["id"], TYPE_ID_DISTRIBUTOR_ISO)
     for type in [
         TYPE_ID_RPM,
         TYPE_ID_SRPM,
         TYPE_ID_DRPM,
         TYPE_ID_ERRATA,
         TYPE_ID_DISTRO,
         TYPE_ID_PKG_CATEGORY,
         TYPE_ID_PKG_GROUP,
     ]:
         self.assertTrue(type in metadata["types"])
开发者ID:ehelms,项目名称:pulp,代码行数:13,代码来源:test_iso_distributor.py


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