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


Python upload.upload函数代码示例

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


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

示例1: test_unsupported

    def test_unsupported(self):
        # Test
        report = upload.upload(None, "foo", self.unit_key, self.metadata, self.file_path, self.conduit, self.config)

        # Verify
        self.assertTrue(report is not None)
        self.assertFalse(report["success_flag"])
        self.assertTrue("errors" in report["details"])
        self.assertTrue("foo" in report["details"]["errors"][0])
开发者ID:hjensas,项目名称:pulp_rpm,代码行数:9,代码来源:test_upload.py

示例2: test_unsupported

    def test_unsupported(self):
        # Test
        report = upload.upload(None, 'foo', self.unit_key, self.metadata,
                               self.file_path, self.conduit, self.config)

        # Verify
        self.assertTrue(report is not None)
        self.assertFalse(report['success_flag'])
        self.assertTrue('errors' in report['details'])
        self.assertTrue('foo' in report['details']['errors'][0])
开发者ID:dkliban,项目名称:pulp_rpm,代码行数:10,代码来源:test_upload.py

示例3: test_srpm

    def test_srpm(self, mock_handle):
        # Test
        report = upload.upload(None, models.SRPM.TYPE, self.unit_key, self.metadata,
                               self.file_path, self.conduit, self.config)

        # Verify
        mock_handle.assert_called_once_with(None, models.SRPM.TYPE, self.unit_key, self.metadata,
                                            self.file_path, self.conduit, self.config)

        self.assertTrue(report is not None)
        self.assertTrue(report['success_flag'])
开发者ID:dkliban,项目名称:pulp_rpm,代码行数:11,代码来源:test_upload.py

示例4: test_unexpected

    def test_unexpected(self, mock_handle):
        # Setup
        mock_handle.side_effect = Exception()

        # Test
        report = upload.upload(None, models.RPM.TYPE, self.unit_key, self.metadata,
                               self.file_path, self.conduit, self.config)

        # Verify
        self.assertFalse(report['success_flag'])
        self.assertTrue('errors' in report['details'])
        self.assertTrue('unexpected' in report['details']['errors'][0])
开发者ID:dkliban,项目名称:pulp_rpm,代码行数:12,代码来源:test_upload.py

示例5: test_store_file_error

    def test_store_file_error(self, mock_handle):
        # Setup
        mock_handle.side_effect = upload.StoreFileError()

        # Test
        report = upload.upload(None, models.RPM.TYPE, self.unit_key, self.metadata,
                               self.file_path, self.conduit, self.config)

        # Verify
        self.assertFalse(report['success_flag'])
        self.assertTrue('errors' in report['details'])
        self.assertTrue('storage' in report['details']['errors'][0])
开发者ID:dkliban,项目名称:pulp_rpm,代码行数:12,代码来源:test_upload.py

示例6: test_model_instantiation_error

    def test_model_instantiation_error(self, mock_handle):
        # Setup
        mock_handle.side_effect = upload.ModelInstantiationError()

        # Test
        report = upload.upload(None, models.RPM.TYPE, self.unit_key, self.metadata,
                               self.file_path, self.conduit, self.config)

        # Verify
        self.assertTrue(not report['success_flag'])
        self.assertTrue('errors' in report['details'])
        self.assertTrue('invalid' in report['details']['errors'][0])
开发者ID:dkliban,项目名称:pulp_rpm,代码行数:12,代码来源:test_upload.py

示例7: test_drpm

    def test_drpm(self, mock_handle):
        """Test if upload function choose correct function to handle DRPM."""
        # Test
        report = upload.upload(None, models.DRPM.TYPE, self.unit_key, self.metadata,
                               self.file_path, self.conduit, self.config)

        # Verify
        mock_handle.assert_called_once_with(None, models.DRPM.TYPE, self.unit_key, self.metadata,
                                            self.file_path, self.conduit, self.config)

        self.assertTrue(report is not None)
        self.assertTrue(report['success_flag'])
开发者ID:ulif,项目名称:pulp_rpm,代码行数:12,代码来源:test_upload.py

示例8: test_category

    def test_category(self, mock_handle):
        # Test
        report = upload.upload(
            None, models.PackageCategory.TYPE, self.unit_key, self.metadata, self.file_path, self.conduit, self.config
        )

        # Verify
        mock_handle.assert_called_once_with(
            models.PackageCategory.TYPE, self.unit_key, self.metadata, self.file_path, self.conduit, self.config
        )

        self.assertTrue(report is not None)
        self.assertTrue(report["success_flag"])
开发者ID:hjensas,项目名称:pulp_rpm,代码行数:13,代码来源:test_upload.py

示例9: test_package_metadata_error

    def test_package_metadata_error(self, mock_handle):
        # Setup
        mock_handle.side_effect = upload.PackageMetadataError()

        # Test
        report = upload.upload(
            None, models.RPM.TYPE, self.unit_key, self.metadata, self.file_path, self.conduit, self.config
        )

        # Verify
        self.assertFalse(report["success_flag"])
        self.assertTrue("errors" in report["details"])
        self.assertTrue("extracted" in report["details"]["errors"][0])
开发者ID:hjensas,项目名称:pulp_rpm,代码行数:13,代码来源:test_upload.py

示例10: test_upload

    def test_upload(self):
        self.conduit.init_unit = mock.MagicMock(spec_set=self.conduit.init_unit)
        self.conduit.save_unit = mock.MagicMock(spec_set=self.conduit.save_unit)
        unit_key = {'id': 'group1', 'repo_id': self.repo.id}

        report = upload.upload(self.repo, models.PackageGroup.TYPE, unit_key,
                               self.metadata, '', self.conduit,
                               PluginCallConfiguration({}, {}))

        self.conduit.init_unit.assert_called_once_with(models.PackageGroup.TYPE,
                                                       unit_key, self.metadata, '')
        self.conduit.save_unit.assert_called_once_with(self.conduit.init_unit.return_value)
        self.assertTrue(isinstance(report, dict))
        self.assertEqual(report['success_flag'], True)
开发者ID:jdob,项目名称:pulp_rpm,代码行数:14,代码来源:test_upload.py

示例11: test_location_in_repodata

    def test_location_in_repodata(self, mock_copy, mock_get_xml):
        """This is in response to BZ 993452"""
        mock_get_xml.side_effect = self.wrap_get_package_xml
        unit = Unit(self.model.TYPE, self.model.unit_key, self.model.metadata,
                    self.model.relative_path)
        self.conduit.init_unit = mock.MagicMock(spec_set=self.conduit.init_unit,
                                                return_value=unit)
        self.conduit.save_unit = mock.MagicMock(spec_set=self.conduit.save_unit)

        report = upload.upload(self.repo, models.RPM.TYPE, self.model.unit_key,
                               self.model.metadata, self.file_path, self.conduit, {})

        self.assertEqual(report['success_flag'], True)
        # now make sure the correct location tag exists
        saved_unit = self.conduit.save_unit.call_args[0][0]
        primary = saved_unit.metadata['repodata']['primary']
        regex = r'<location href="%s"/>' % os.path.basename(self.file_path)
        self.assertTrue(re.search(regex, primary) is not None)
开发者ID:jdob,项目名称:pulp_rpm,代码行数:18,代码来源:test_upload.py

示例12: upload_unit

 def upload_unit(self, repo, type_id, unit_key, metadata, file_path, conduit, config):
     return upload.upload(repo, type_id, unit_key, metadata, file_path, conduit, config)
开发者ID:AndreaGiardini,项目名称:pulp_rpm,代码行数:2,代码来源:importer.py

示例13: upload_unit

 def upload_unit(self, transfer_repo, type_id, unit_key, metadata, file_path, conduit, config):
     repo = transfer_repo.repo_obj
     conduit.repo = repo
     return upload.upload(repo, type_id, unit_key, metadata, file_path, conduit, config)
开发者ID:ATIX-AG,项目名称:pulp_rpm,代码行数:4,代码来源:importer.py


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