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


Python database.clean函数代码示例

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


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

示例1: init_types

 def init_types(self):
     database.clean()
     fp = open(self.TYPES_PATH)
     td = TypeDescriptor(os.path.basename(self.TYPES_PATH), fp.read())
     fp.close()
     definitions = parser.parse([td])
     database.update_database(definitions)
开发者ID:bechtoldt,项目名称:pulp_rpm,代码行数:7,代码来源:test_errata.py

示例2: clean

 def clean(self):
     Bind.get_collection().remove()
     Repo.get_collection().remove()
     RepoDistributor.get_collection().remove()
     RepoImporter.get_collection().remove()
     RepoContentUnit.get_collection().remove()
     unit_db.clean()
开发者ID:juwu,项目名称:pulp,代码行数:7,代码来源:test_plugins.py

示例3: test_types

    def test_types(self):
        """
        Tests retrieving all types in the database.
        """

        # Setup
        types_db.clean()
        type_def_1 = TypeDefinition('type-1', 'Type 1', 'Type 1', [], [], [])
        type_def_2 = TypeDefinition('type-2', 'Type 2', 'Type 2', [], [], [])

        types_db._create_or_update_type(type_def_1)
        types_db._create_or_update_type(type_def_2)

        # Test
        found_defs = self.manager.types()

        # Verify
        self.assertEqual(2, len(found_defs))

        for type_def in [type_def_1, type_def_2]:
            found_def = [t for t in found_defs if t['id'] == type_def.id][0]

            self.assertEqual(found_def['id'], type_def.id)
            self.assertEqual(found_def['display_name'], type_def.display_name)
            self.assertEqual(found_def['description'], type_def.description)
            self.assertEqual(found_def['unit_key'], type_def.unit_key)
            self.assertEqual(found_def['search_indexes'], type_def.search_indexes)
            self.assertEqual(found_def['referenced_types'], type_def.referenced_types)
开发者ID:alanoe,项目名称:pulp,代码行数:28,代码来源:test_plugin.py

示例4: setUp

 def setUp(self):
     super(QueryTests, self).setUp()
     RepoContentUnit.get_collection().remove()
     unit_db.clean()
     self.define_plugins()
     plugin_api._create_manager()
     plugin_api._MANAGER.importers.add_plugin(constants.HTTP_IMPORTER, NodesHttpImporter, {})
开发者ID:BrnoPCmaniak,项目名称:pulp,代码行数:7,代码来源:test_conduit.py

示例5: test_import_cached_manifest_missing_units

 def test_import_cached_manifest_missing_units(self, *unused):
     # Setup
     self.populate()
     with mock_config.patch({'server': {'storage_dir': self.parentfs}}):
         dist = NodesHttpDistributor()
         working_dir = os.path.join(self.childfs, 'working_dir')
         os.makedirs(working_dir)
         repo = Repository(self.REPO_ID, working_dir)
         configuration = self.dist_conf()
         conduit = RepoPublishConduit(self.REPO_ID, constants.HTTP_DISTRIBUTOR)
         dist.publish_repo(repo, conduit, configuration)
         model.Distributor.objects.delete()
         RepoContentUnit.get_collection().remove()
         unit_db.clean()
         self.define_plugins()
         publisher = dist.publisher(repo, configuration)
         manifest_path = publisher.manifest_path()
         manifest = Manifest(manifest_path)
         manifest.read()
         shutil.copy(manifest_path, os.path.join(working_dir, MANIFEST_FILE_NAME))
         # Test
         importer = NodesHttpImporter()
         manifest_url = pathlib.url_join(publisher.base_url, manifest_path)
         configuration = {
             constants.MANIFEST_URL_KEYWORD: manifest_url,
             constants.STRATEGY_KEYWORD: constants.MIRROR_STRATEGY,
         }
         configuration = PluginCallConfiguration(configuration, {})
         conduit = RepoSyncConduit(self.REPO_ID, constants.HTTP_IMPORTER, Mock())
     with mock_config.patch({'server': {'storage_dir': self.childfs}}):
         with patch('pulp_node.constants.CONTENT_PATH', self.parentfs):
             importer.sync_repo(repo, conduit, configuration)
         # Verify
         units = conduit.get_units()
         self.assertEquals(len(units), self.NUM_UNITS)
开发者ID:maxamillion,项目名称:pulp,代码行数:35,代码来源:test_plugins.py

示例6: clean

    def clean(self):
        super(RepoSyncConduitTests, self).clean()
        types_database.clean()
        mock_plugins.reset()

        RepoContentUnit.get_collection().remove()
        Repo.get_collection().remove()
开发者ID:stpierre,项目名称:pulp,代码行数:7,代码来源:test_repo_sync_conduit.py

示例7: test_import

 def test_import(self):
     # Setup
     self.populate()
     pulp_conf.set('server', 'storage_dir', self.parentfs)
     dist = NodesHttpDistributor()
     repo = Repository(self.REPO_ID)
     cfg = {
         'protocol':'file',
         'http':{'alias':self.alias},
         'https':{'alias':self.alias},
         'file':{'alias':self.alias},
     }
     conduit = RepoPublishConduit(self.REPO_ID, constants.HTTP_DISTRIBUTOR)
     dist.publish_repo(repo, conduit, cfg)
     Repo.get_collection().remove()
     RepoDistributor.get_collection().remove()
     RepoContentUnit.get_collection().remove()
     unit_db.clean()
     # Test
     importer = NodesHttpImporter()
     publisher = dist.publisher(repo, cfg)
     manifest_url = 'file://' + publisher.manifest_path()
     cfg = dict(manifest_url=manifest_url, strategy=constants.MIRROR_STRATEGY)
     conduit = RepoSyncConduit(
         self.REPO_ID,
         constants.HTTP_IMPORTER,
         RepoContentUnit.OWNER_TYPE_IMPORTER,
         constants.HTTP_IMPORTER)
     importer.sync_repo(repo, conduit, cfg)
     # Verify
     units = conduit.get_units()
     self.assertEquals(len(units), self.NUM_UNITS)
开发者ID:bartwo,项目名称:pulp,代码行数:32,代码来源:test_plugins.py

示例8: tearDown

 def tearDown(self):
     PulpRPMTests.tearDown(self)
     Consumer.get_collection().remove()
     Repo.get_collection().remove()
     RepoContentUnit.get_collection().remove()
     RepoDistributor.get_collection().remove()
     database.clean()
     plugins.finalize()
开发者ID:bechtoldt,项目名称:pulp_rpm,代码行数:8,代码来源:test_errata.py

示例9: tearDown

    def tearDown(self):
        super(Migration0004Tests, self).tearDown()

        # Delete any sample data added for the test
        types_db.clean()

        RepoContentUnit.get_collection().remove()
        RepoImporter.get_collection().remove()
        Repo.get_collection().remove()
开发者ID:asmacdo,项目名称:pulp_rpm,代码行数:9,代码来源:test_0004_migrate.py

示例10: setUp

    def setUp(self):
        super(PluginControllerTests, self).setUp()

        plugin_api._create_manager()
        types_db.clean()

        # Configure content manager
        plugin_api._MANAGER.importers.add_plugin('MockImporter', MockImporter, {})
        plugin_api._MANAGER.distributors.add_plugin('MockDistributor', MockDistributor, {})
开发者ID:AndreaGiardini,项目名称:pulp,代码行数:9,代码来源:test_plugin_controller.py

示例11: tearDown

    def tearDown(self):
        super(Migration0004Tests, self).tearDown()

        # Delete any sample data added for the test
        types_db.clean()

        RepoContentUnit.get_collection().remove()
        get_collection('repo_importers').remove()
        model.Repository.drop_collection()
开发者ID:FlorianHeigl,项目名称:pulp_rpm,代码行数:9,代码来源:test_0004_migrate.py

示例12: tearDown

 def tearDown(self):
     super(BaseProfilerConduitTests, self).tearDown()
     Consumer.get_collection().remove()
     Repo.get_collection().remove()
     RepoDistributor.get_collection().remove()
     Bind.get_collection().remove()
     RepoContentUnit.get_collection().remove()
     UnitProfile.get_collection().remove()
     typedb.clean()
     factory.reset()
开发者ID:fdammeke,项目名称:pulp,代码行数:10,代码来源:test_profiler_conduit.py

示例13: clean

    def clean(self):
        super(DependencyManagerTests, self).clean()

        database.clean()

        Repo.get_collection().remove()
        RepoImporter.get_collection().remove()
        RepoContentUnit.get_collection().remove()

        mock_plugins.MOCK_IMPORTER.resolve_dependencies.return_value = None
开发者ID:AndreaGiardini,项目名称:pulp,代码行数:10,代码来源:test_dependency_manager.py

示例14: setUp

 def setUp(self):
     super(QueryTests, self).setUp()
     Repo.get_collection().remove()
     RepoContentUnit.get_collection().remove()
     unit_db.clean()
     for type_id in ALL_TYPES:
         unit_db.type_definition = Mock(return_value=dict(id=type_id, unit_key=UNIT_METADATA))
     unit_db.type_units_unit_key = Mock(return_value=['A', 'B', 'C', 'N'])
     plugin_api._create_manager()
     plugin_api._MANAGER.importers.add_plugin(constants.HTTP_IMPORTER, NodesHttpImporter, {})
开发者ID:cliffy94,项目名称:pulp,代码行数:10,代码来源:test_conduit.py

示例15: clean

 def clean(self, units_only=False, plugins=False):
     RepoContentUnit.get_collection().remove()
     unit_db.clean()
     if units_only:
         return
     Bind.get_collection().remove()
     Repo.get_collection().remove()
     RepoDistributor.get_collection().remove()
     RepoImporter.get_collection().remove()
     if plugins:
         plugin_api._MANAGER.distributors.plugins = {}
开发者ID:msurovcak,项目名称:pulp,代码行数:11,代码来源:test_plugins.py


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