• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python util.compare_dict函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_create_consumer_payload

    def test_create_consumer_payload(self):
        local_distributor = YumHTTPDistributor()
        repo = Mock()
        repo.display_name = 'foo'
        repo.id = 'bar'
        config = {'https_ca': 'pear',
                  'gpgkey': 'kiwi',
                  'auth_cert': 'durian',
                  'auth_ca': True,
                  'http': True,
                  'https': True}
        binding_config = {}
        pulp_server_config.set('server', 'server_name', 'apple')
        cert_file = os.path.join(self.working_dir, "orange_file")
        with open(cert_file, 'w') as filewriter:
            filewriter.write("orange")

        pulp_server_config.set('security', 'ssl_ca_certificate', cert_file)

        result = local_distributor.create_consumer_payload(repo, config, binding_config)

        target = {
            'server_name': 'apple',
            'ca_cert': 'orange',
            'relative_path': '/pulp/repos/bar',
            'gpg_keys': {'pulp.key': 'kiwi'},
            'client_cert': 'durian',
            'protocols': ['http', 'https'],
            'repo_name': 'foo'
        }
        compare_dict(result, target)
开发者ID:asmacdo,项目名称:pulp_rpm,代码行数:31,代码来源:test_distributor.py


示例2: test_get_progress_report_description

    def test_get_progress_report_description(self):
        step = PublishStep('bar_step')
        step.description = 'bar'
        step.progress_details = 'baz'
        step.error_details = "foo"
        step.state = reporting_constants.STATE_COMPLETE
        step.total_units = 2
        step.progress_successes = 1
        step.progress_failures = 1
        report = step.get_progress_report()

        target_report = {
            reporting_constants.PROGRESS_STEP_TYPE_KEY: 'bar_step',
            reporting_constants.PROGRESS_NUM_SUCCESSES_KEY: 1,
            reporting_constants.PROGRESS_STATE_KEY: step.state,
            reporting_constants.PROGRESS_ERROR_DETAILS_KEY: step.error_details,
            reporting_constants.PROGRESS_NUM_PROCESSED_KEY: 2,
            reporting_constants.PROGRESS_NUM_FAILURES_KEY: 1,
            reporting_constants.PROGRESS_ITEMS_TOTAL_KEY: 2,
            reporting_constants.PROGRESS_DESCRIPTION_KEY: 'bar',
            reporting_constants.PROGRESS_DETAILS_KEY: 'baz',
            reporting_constants.PROGRESS_STEP_UUID: step.uuid
        }

        compare_dict(report[0], target_report)
开发者ID:hgschmie,项目名称:pulp,代码行数:25,代码来源:test_publish_step.py


示例3: test_describe_distributors

 def test_describe_distributors(self):
     command = cudl.CreateDebRepositoryCommand(Mock())
     user_input = {cudl.OPT_AUTO_PUBLISH.keyword: True}
     result = command._describe_distributors(user_input)
     target_result = {'distributor_id': constants.CLI_WEB_DISTRIBUTOR_ID,
                      'distributor_type_id': constants.WEB_DISTRIBUTOR_TYPE_ID,
                      'distributor_config': {},
                      'auto_publish': True}
     compare_dict(result[0], target_result)
开发者ID:bowlofeggs,项目名称:pulp_deb,代码行数:9,代码来源:test_cudl.py


示例4: test_describe_distributors

 def test_describe_distributors(self):
     command = TestPythonRespositoryOptions.MixinTestClass()
     user_input = {}
     result = command._describe_distributors(user_input)
     target_result = {'distributor_id': constants.CLI_DISTRIBUTOR_ID,
                      'distributor_type_id': constants.DISTRIBUTOR_TYPE_ID,
                      'distributor_config': {},
                      'auto_publish': True}
     compare_dict(result[0], target_result)
开发者ID:bmbouter,项目名称:pulp_python,代码行数:9,代码来源:test_cudl.py


示例5: test_get_publish_tasks

 def test_get_publish_tasks(self):
     context = mock.Mock()
     resource_id = "foo"
     export._get_publish_tasks(resource_id, context)
     tags = ['pulp:repository_group:foo', 'pulp:action:publish']
     criteria = {'filters': {'state': {'$nin': COMPLETED_STATES}, 'tags': {'$all': tags}}}
     self.assertTrue(context.server.tasks_search.search.called)
     created_criteria = context.server.tasks_search.search.call_args[1]
     compare_dict(criteria, created_criteria)
开发者ID:skarmark,项目名称:pulp_rpm,代码行数:9,代码来源:test_export.py


示例6: test_to_dict

    def test_to_dict(self):
        test_exception = exceptions.PulpException("foo_msg")
        test_exception.error_data = {"foo": "bar"}

        result = test_exception.to_dict()

        compare_dict(result, {'code': test_exception.error_code.code,
                              'description': str(test_exception),
                              'data': {"foo": "bar"},
                              'sub_errors': []})
开发者ID:aweiteka,项目名称:pulp,代码行数:10,代码来源:test_exceptions.py


示例7: test_get_progress_report_summary

 def test_get_progress_report_summary(self):
     parent_step = publish_step.PluginStep('parent_step')
     step = publish_step.PluginStep('foo_step')
     parent_step.add_child(step)
     step.state = reporting_constants.STATE_COMPLETE
     report = parent_step.get_progress_report_summary()
     target_report = {
         'foo_step': reporting_constants.STATE_COMPLETE
     }
     compare_dict(report, target_report)
开发者ID:goosemania,项目名称:pulp,代码行数:10,代码来源:test_publish_step.py


示例8: test_serialize

    def test_serialize(self):

        async_result = AsyncResult('foo')
        test_exception = PulpException('foo')
        result = tasks.TaskResult('foo', test_exception, [{'task_id': 'baz'}, async_result, "qux"])
        serialized = result.serialize()
        self.assertEquals(serialized.get('result'), 'foo')
        compare_dict(test_exception.to_dict(), serialized.get('error'))
        self.assertEquals(serialized.get('spawned_tasks'), [{'task_id': 'baz'},
                                                            {'task_id': 'foo'},
                                                            {'task_id': 'qux'}])
开发者ID:jbennett7,项目名称:pulp,代码行数:11,代码来源:test_tasks.py


示例9: test_process_dictionary_against_whitelisty_global_and_local_keys

    def test_process_dictionary_against_whitelisty_global_and_local_keys(self):
        test_dictionary = {
            u'_href': u'foo',
            u'_id': u'bar',
            u'_ns': u'baz',
            u'qux': u'quux'
        }

        test_dictionary_before = copy.deepcopy(test_dictionary)
        JSONController.process_dictionary_against_whitelist(test_dictionary, [u'qux'])
        util.compare_dict(test_dictionary_before, test_dictionary)
开发者ID:AndreaGiardini,项目名称:pulp,代码行数:11,代码来源:test_base.py


示例10: test_describe_distributors

 def test_describe_distributors(self):
     command = TestNpmRespositoryOptions.MixinTestClass()
     # by default the value is set to None
     user_input = {
         'auto-publish': None
     }
     result = command._describe_distributors(user_input)
     target_result = {'distributor_id': constants.CLI_DISTRIBUTOR_ID,
                      'distributor_type_id': constants.DISTRIBUTOR_TYPE_ID,
                      'distributor_config': {},
                      'auto_publish': True}
     compare_dict(result[0], target_result)
开发者ID:bmbouter,项目名称:pulp_npm,代码行数:12,代码来源:test_cudl.py


示例11: test_post

    def test_post(self, mock_get_results):
        search_controller = dispatch_controller.SearchTaskCollection()
        mock_get_results.return_value = [self.get_task()]
        processed_tasks_json = search_controller.POST()

        # Mimic the processing
        updated_task = dispatch_controller.task_serializer(self.get_task())
        processed_tasks = json.loads(processed_tasks_json)
        compare_dict(updated_task, processed_tasks[0])

        # validate the permissions
        self.validate_auth(authorization.READ)
开发者ID:hgschmie,项目名称:pulp,代码行数:12,代码来源:test_dispatch.py


示例12: test_to_dict_nested_pulp_exception

    def test_to_dict_nested_pulp_exception(self):
        test_exception = exceptions.PulpException("foo_msg")
        test_exception.error_data = {"foo": "bar"}

        test_exception.add_child_exception(exceptions.PulpCodedException(error_codes.PLP0001))

        result = test_exception.to_dict()
        child_exception = result['sub_errors'][0]
        compare_dict(child_exception, {'code': error_codes.PLP0001.code,
                                       'description': error_codes.PLP0001.message,
                                       'data': {},
                                       'sub_errors': []})
开发者ID:aweiteka,项目名称:pulp,代码行数:12,代码来源:test_exceptions.py


示例13: test_get_with_association_filter

    def test_get_with_association_filter(self, mock_manager_factory):
        step = publish_step.UnitPublishStep("foo", ['bar', 'baz'])
        step.association_filters = {'foo': 'bar'}

        find_by_criteria = mock_manager_factory.repo_unit_association_query_manager.return_value.\
            find_by_criteria
        find_by_criteria.return_value.count.return_value = 5
        total = step._get_total()
        criteria_object = find_by_criteria.call_args[0][0]
        compare_dict(criteria_object.filters, {'foo': 'bar',
                                               'unit_type_id': {'$in': ['bar', 'baz']}})
        self.assertEquals(5, total)
开发者ID:goosemania,项目名称:pulp,代码行数:12,代码来源:test_publish_step.py


示例14: test_process_dictionary_against_whitelist_filter_key

    def test_process_dictionary_against_whitelist_filter_key(self):
        test_dictionary = {
            u'_href': u'foo',
            u'_id': u'bar',
            u'_ns': u'baz',
            u'qux': u'quux'
        }

        target_result = copy.deepcopy(test_dictionary)
        target_result.pop(u'qux', None)

        JSONController.process_dictionary_against_whitelist(test_dictionary, [])
        util.compare_dict(target_result, test_dictionary)
开发者ID:AndreaGiardini,项目名称:pulp,代码行数:13,代码来源:test_base.py


示例15: test_distributor_update_no_bindings

    def test_distributor_update_no_bindings(self, mock_dist_manager, mock_bind_manager):
        config = {'configvalue': 'baz'}
        generated_distributor = {'foo': 'bar'}
        mock_dist_manager.return_value.update_distributor_config.return_value = \
            generated_distributor

        #Use None for the delta value to ensure it doesn't throw an exception
        result = repository.distributor_update('foo-id', 'bar-id', config, None)

        mock_dist_manager.return_value.update_distributor_config. \
            assert_called_with('foo-id', 'bar-id', config, None)
        self.assertTrue(isinstance(result, TaskResult))
        util.compare_dict(generated_distributor, result.return_value)
        self.assertEquals(None, result.error)
开发者ID:preethit,项目名称:pulp-1,代码行数:14,代码来源:test_repository.py


示例16: test__parse_importer_config_no_input

    def test__parse_importer_config_no_input(self, parse_user_input):
        """
        Assert correct behavior from _parse_importer_config when there is no special user input to
        parse.
        """
        command = TestPythonRespositoryOptions.MixinTestClass()
        user_input = {}
        parse_user_input.return_value = {}

        result = command._parse_importer_config(user_input)

        parse_user_input.assert_called_once_with({})
        expected_result = {}
        compare_dict(result, expected_result)
开发者ID:jortel,项目名称:pulp_python,代码行数:14,代码来源:test_cudl.py


示例17: test_describe_distributors

 def test_describe_distributors(self):
     command = cudl.CreateDockerRepositoryCommand(Mock())
     user_input = {'redirect-url': 'foo',
                   'protected': False,
                   'repo-registry-id': 'bar'}
     result = command._describe_distributors(user_input)
     target_result = {
         'distributor_type_id': constants.DISTRIBUTOR_WEB_TYPE_ID,
         'distributor_config': {
             'redirect-url': 'foo', 'repo-registry-id': 'bar', 'protected': False},
         'auto_publish': True,
         'distributor_id': constants.CLI_WEB_DISTRIBUTOR_ID
     }
     compare_dict(result[0], target_result)
开发者ID:shubham90,项目名称:pulp_docker,代码行数:14,代码来源:test_cudl.py


示例18: test_describe_distributors

 def test_describe_distributors(self):
     command = cudl.CreateOSTreeRepositoryCommand(Mock())
     relative_path = '7/x86/standard'
     user_input = {
         cudl.OPT_RELATIVE_PATH.keyword: relative_path
     }
     result = command._describe_distributors(user_input)
     target_result = {'distributor_id': constants.CLI_WEB_DISTRIBUTOR_ID,
                      'distributor_type_id': constants.WEB_DISTRIBUTOR_TYPE_ID,
                      'distributor_config': {
                          constants.DISTRIBUTOR_CONFIG_KEY_RELATIVE_PATH: relative_path
                      },
                      'auto_publish': True}
     compare_dict(result[0], target_result)
开发者ID:bowlofeggs,项目名称:pulp_ostree,代码行数:14,代码来源:test_cudl.py


示例19: test__parse_importer_config_with_package_names

    def test__parse_importer_config_with_package_names(self, parse_user_input):
        """
        Assert correct behavior from _parse_importer_config when there is no special user input to
        parse.
        """
        command = TestPythonRespositoryOptions.MixinTestClass()
        user_input = {'some': 'input', cudl.OPT_PACKAGE_NAMES.keyword: 'django,numpy,scipy'}
        parse_user_input.return_value = {'some': 'input'}

        result = command._parse_importer_config(user_input)

        parse_user_input.assert_called_once_with(user_input)
        expected_result = {constants.CONFIG_KEY_PACKAGE_NAMES: 'django,numpy,scipy',
                           'some': 'input'}
        compare_dict(result, expected_result)
开发者ID:jortel,项目名称:pulp_python,代码行数:15,代码来源:test_cudl.py


示例20: test_describe_distributors_using_feed

 def test_describe_distributors_using_feed(self):
     command = cudl.CreateOSTreeRepositoryCommand(Mock())
     relative_path = '/7/x86/standard'
     feed_url = 'http://planet.com%s' % relative_path
     user_input = {
         command.options_bundle.opt_feed.keyword: feed_url
     }
     result = command._describe_distributors(user_input)
     target_result = {'distributor_id': constants.CLI_WEB_DISTRIBUTOR_ID,
                      'distributor_type_id': constants.WEB_DISTRIBUTOR_TYPE_ID,
                      'distributor_config': {
                          constants.DISTRIBUTOR_CONFIG_KEY_RELATIVE_PATH: relative_path
                      },
                      'auto_publish': True}
     compare_dict(result[0], target_result)
开发者ID:bowlofeggs,项目名称:pulp_ostree,代码行数:15,代码来源:test_cudl.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python util.touch函数代码示例发布时间:2022-05-25
下一篇:
Python task_simulator.TaskSimulator类代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap