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


Python DotDict.json_dump方法代码示例

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


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

示例1: test_stuff_missing

# 需要导入模块: from socorrolib.lib.util import DotDict [as 别名]
# 或者: from socorrolib.lib.util.DotDict import json_dump [as 别名]
    def test_stuff_missing(self):
        config = self.get_basic_config()

        raw_crash = copy.copy(canonical_standard_raw_crash)

        raw_dumps = {}
        system_info = copy.copy(
            canonical_processed_crash['json_dump']['system_info']
        )
        del system_info['cpu_count']
        processed_crash = DotDict()
        processed_crash.json_dump = {
            'system_info': system_info
        }

        processor_meta = self.get_basic_processor_meta()

        rule = CPUInfoRule(config)

        # the call to be tested
        rule.act(raw_crash, raw_dumps, processed_crash, processor_meta)

        eq_(
            processed_crash.cpu_info,
            "GenuineIntel family 6 model 42 stepping 7"
        )
        eq_(processed_crash.cpu_name, 'x86')

        # raw crash should be unchanged
        eq_(raw_crash, canonical_standard_raw_crash)
开发者ID:4thAce,项目名称:socorro,代码行数:32,代码来源:test_general_transform_rules.py

示例2: test_action_case_2

# 需要导入模块: from socorrolib.lib.util import DotDict [as 别名]
# 或者: from socorrolib.lib.util.DotDict import json_dump [as 别名]
    def test_action_case_2(self):
        """sentinel exsits in stack, plus one secondary"""
        pc = DotDict()
        pc.process_type = 'plugin'
        pijd = copy.deepcopy(cannonical_json_dump)
        pc.json_dump = pijd
        pc.json_dump['crashing_thread']['frames'][2]['function'] = \
            'NtUserSetWindowPos'
        pc.json_dump['crashing_thread']['frames'][4]['function'] = \
            'F_1378698112'
        f2jd = copy.deepcopy(cannonical_json_dump)
        pc.upload_file_minidump_flash2 = DotDict()
        pc.upload_file_minidump_flash2.json_dump = f2jd

        fake_processor = create_basic_fake_processor()

        rc = DotDict()
        rd = {}
        rule = SetWindowPos()
        action_result = rule.action(rc, rd, pc, fake_processor)

        ok_(action_result)
        ok_('classifications' in pc)
        ok_('skunk_works' in pc.classifications)
        eq_(
            pc.classifications.skunk_works.classification,
            'NtUserSetWindowPos | F_1378698112'
        )
开发者ID:4thAce,项目名称:socorro,代码行数:30,代码来源:test_skunk_classifiers.py

示例3: test_windows_action

# 需要导入模块: from socorrolib.lib.util import DotDict [as 别名]
# 或者: from socorrolib.lib.util.DotDict import json_dump [as 别名]
    def test_windows_action(self):
        jd = copy.deepcopy(cannonical_json_dump)
        processed_crash = DotDict()
        processed_crash.json_dump = jd
        raw_crash = DotDict()
        raw_crash.ProductName = 'Firefox'
        raw_crash.Version = '16'
        raw_dumps = {}

        fake_processor = create_basic_fake_processor()

        classifier = OutOfDateClassifier()
        classifier.out_of_date_threshold = ('17',)
        processed_crash.json_dump['system_info']['os'] = 'Windows NT'
        processed_crash.json_dump['system_info']['os_ver'] = \
            '5.1.2600 Service Pack 2'
        ok_(classifier._windows_action(
            raw_crash,
            raw_dumps,
            processed_crash,
            fake_processor
        ))
        eq_(
            processed_crash.classifications.support.classification,
            'firefox-no-longer-works-some-versions-windows-xp'
        )

        classifier = OutOfDateClassifier()
        classifier.out_of_date_threshold = ('17',)
        processed_crash.json_dump['system_info']['os'] = 'Windows NT'
        processed_crash.json_dump['system_info']['os_ver'] = \
            '5.0 Service Pack 23'
        ok_(classifier._windows_action(
            raw_crash,
            raw_dumps,
            processed_crash,
            fake_processor
        ))
        eq_(
            processed_crash.classifications.support.classification,
            'firefox-no-longer-works-windows-2000'
        )

        classifier = OutOfDateClassifier()
        classifier.out_of_date_threshold = ('17',)
        processed_crash.json_dump['system_info']['os'] = 'Windows NT'
        processed_crash.json_dump['system_info']['os_ver'] = \
            '5.1.2600 Service Pack 3'
        ok_(classifier._windows_action(
            raw_crash,
            raw_dumps,
            processed_crash,
            fake_processor
        ))
        eq_(
            processed_crash.classifications.support.classification,
            'update-firefox-latest-version'
        )
开发者ID:4thAce,项目名称:socorro,代码行数:60,代码来源:test_support_classifiers.py

示例4: test_get_stack

# 需要导入模块: from socorrolib.lib.util import DotDict [as 别名]
# 或者: from socorrolib.lib.util.DotDict import json_dump [as 别名]
    def test_get_stack(self):
        pc = DotDict()
        pc.process_type = 'plugin'
        skunk_rule = SkunkClassificationRule()

        ok_(not skunk_rule._get_stack(pc, 'upload_file_minidump_plugin'))

        pc.json_dump = DotDict()
        pc.json_dump.threads = []
        ok_(not skunk_rule._get_stack(pc, 'upload_file_minidump_plugin'))

        pc.json_dump.crash_info = DotDict()
        pc.json_dump.crash_info.crashing_thread = 1
        ok_(not skunk_rule._get_stack(pc, 'upload_file_minidump_plugin'))

        pc.json_dump = cannonical_json_dump
        eq_(
            skunk_rule._get_stack(pc, 'upload_file_minidump_plugin'),
            cannonical_json_dump['crashing_thread']['frames']
        )
开发者ID:4thAce,项目名称:socorro,代码行数:22,代码来源:test_skunk_classifiers.py

示例5: test_action_fail

# 需要导入模块: from socorrolib.lib.util import DotDict [as 别名]
# 或者: from socorrolib.lib.util.DotDict import json_dump [as 别名]
    def test_action_fail(self):
        jd = copy.deepcopy(cannonical_json_dump)
        pc = DotDict()
        pc.json_dump = jd

        fake_processor = create_basic_fake_processor()

        rc = DotDict()
        rd = {}
        rule = BitguardClassifier()
        action_result = rule.action(rc, rd, pc, fake_processor)

        ok_(not action_result)
        ok_('classifications' not in pc)
开发者ID:4thAce,项目名称:socorro,代码行数:16,代码来源:test_support_classifiers.py

示例6: test_everything_we_hoped_for

# 需要导入模块: from socorrolib.lib.util import DotDict [as 别名]
# 或者: from socorrolib.lib.util.DotDict import json_dump [as 别名]
    def test_everything_we_hoped_for(self):
        config = self.get_basic_config()

        raw_crash = copy.copy(canonical_standard_raw_crash)
        raw_dumps = {}
        processed_crash = DotDict()
        processed_crash.json_dump = copy.copy(cannonical_stackwalker_output)
        processor_meta = self.get_basic_processor_meta()

        rule = CrashingThreadRule(config)

        # the call to be tested
        rule.act(raw_crash, raw_dumps, processed_crash, processor_meta)

        eq_(processed_crash.crashedThread, 0)
开发者ID:4thAce,项目名称:socorro,代码行数:17,代码来源:test_breakpad_transform_rules.py

示例7: test_stuff_missing

# 需要导入模块: from socorrolib.lib.util import DotDict [as 别名]
# 或者: from socorrolib.lib.util.DotDict import json_dump [as 别名]
    def test_stuff_missing(self):
        config = self.get_basic_config()

        raw_crash = copy.copy(canonical_standard_raw_crash)
        raw_dumps = {}
        processed_crash = DotDict()
        processed_crash.json_dump = {}
        processor_meta = self.get_basic_processor_meta()

        rule = CrashingThreadRule(config)

        # the call to be tested
        rule.act(raw_crash, raw_dumps, processed_crash, processor_meta)

        eq_(processed_crash.crashedThread, None)
        eq_(
            processor_meta.processor_notes,
            ['MDSW did not identify the crashing thread']
        )
开发者ID:4thAce,项目名称:socorro,代码行数:21,代码来源:test_breakpad_transform_rules.py

示例8: test_action_success

# 需要导入模块: from socorrolib.lib.util import DotDict [as 别名]
# 或者: from socorrolib.lib.util.DotDict import json_dump [as 别名]
    def test_action_success(self):
        jd = copy.deepcopy(cannonical_json_dump)
        jd['modules'].append({'filename': 'bitguard.dll'})
        pc = DotDict()
        pc.json_dump = jd

        fake_processor = create_basic_fake_processor()

        rc = DotDict()
        rd = {}
        rule = BitguardClassifier()
        action_result = rule.action(rc, rd, pc, fake_processor)

        ok_(action_result)
        ok_('classifications' in pc)
        ok_('support' in pc.classifications)
        eq_(
            'bitguard',
            pc.classifications.support.classification
        )
开发者ID:4thAce,项目名称:socorro,代码行数:22,代码来源:test_support_classifiers.py

示例9: test_action_success

# 需要导入模块: from socorrolib.lib.util import DotDict [as 别名]
# 或者: from socorrolib.lib.util.DotDict import json_dump [as 别名]
    def test_action_success(self):
        jd = copy.deepcopy(cannonical_json_dump)
        jd['crashing_thread']['frames'][1]['function'] = \
            "F_1152915508___________________________________"
        jd['crashing_thread']['frames'][3]['function'] = \
            "mozilla::plugins::PluginInstanceChild::UpdateWindowAttributes" \
                "(bool)"
        jd['crashing_thread']['frames'][5]['function'] = \
            "mozilla::ipc::RPCChannel::Call(IPC::Message*, IPC::Message*)"
        pc = DotDict()
        pc.process_type = 'plugin'
        pc.json_dump = jd

        fake_processor = create_basic_fake_processor()

        rc = DotDict()
        rd = {}
        rule = UpdateWindowAttributes()
        action_result = rule.action(rc, rd, pc, fake_processor)

        ok_(action_result)
        ok_('classifications' in pc)
        ok_('skunk_works' in pc['classifications'])
开发者ID:4thAce,项目名称:socorro,代码行数:25,代码来源:test_skunk_classifiers.py

示例10: _execute_external_process

# 需要导入模块: from socorrolib.lib.util import DotDict [as 别名]
# 或者: from socorrolib.lib.util.DotDict import json_dump [as 别名]
    def _execute_external_process(self, command_line, processor_meta):
        stackwalker_output, return_code = super(
            BreakpadStackwalkerRule2015,
            self
        )._execute_external_process(command_line, processor_meta)

        if not isinstance(stackwalker_output, Mapping):
            processor_meta.processor_notes.append(
                "MDSW produced unexpected output: %s..." %
                str(stackwalker_output)[:10]
            )
            stackwalker_output = {}

        stackwalker_data = DotDict()
        stackwalker_data.json_dump = stackwalker_output
        stackwalker_data.mdsw_return_code = return_code

        stackwalker_data.mdsw_status_string = stackwalker_output.get(
            'status',
            'unknown error'
        )
        stackwalker_data.success = stackwalker_data.mdsw_status_string == 'OK'

        if return_code == 124:
            processor_meta.processor_notes.append(
                "MDSW terminated with SIGKILL due to timeout"
            )
        elif return_code != 0 or not stackwalker_data.success:
            processor_meta.processor_notes.append(
                "MDSW failed on '%s': %s" % (
                    command_line,
                    stackwalker_data.mdsw_status_string
                )
            )

        return stackwalker_data, return_code
开发者ID:4thAce,项目名称:socorro,代码行数:38,代码来源:breakpad_transform_rules.py

示例11: test_predicate

# 需要导入模块: from socorrolib.lib.util import DotDict [as 别名]
# 或者: from socorrolib.lib.util.DotDict import json_dump [as 别名]
    def test_predicate(self):
        jd = copy.deepcopy(cannonical_json_dump)
        processed_crash = DotDict()
        processed_crash.json_dump = jd
        raw_crash = DotDict()
        raw_crash.ProductName = 'Firefox'
        raw_crash.Version = '16'
        raw_dumps = {}

        fake_processor = create_basic_fake_processor()
        fake_processor.config.firefox_out_of_date_version = '17'

        classifier = OutOfDateClassifier()
        ok_(classifier._predicate(
            raw_crash,
            raw_dumps,
            processed_crash,
            fake_processor
        ))

        raw_crash.Version = '19'
        ok_(not classifier._predicate(
            raw_crash,
            raw_dumps,
            processed_crash,
            fake_processor
        ))

        raw_crash.Version = '12'
        raw_crash.ProductName = 'NotFireFox'
        ok_(not classifier._predicate(
            raw_crash,
            raw_dumps,
            processed_crash,
            fake_processor
        ))
开发者ID:4thAce,项目名称:socorro,代码行数:38,代码来源:test_support_classifiers.py

示例12: test_osx_action

# 需要导入模块: from socorrolib.lib.util import DotDict [as 别名]
# 或者: from socorrolib.lib.util.DotDict import json_dump [as 别名]
    def test_osx_action(self):
        jd = copy.deepcopy(cannonical_json_dump)
        processed_crash = DotDict()
        processed_crash.json_dump = jd
        raw_crash = DotDict()
        raw_crash.ProductName = 'Firefox'
        raw_crash.Version = '16'
        raw_dumps = {}

        fake_processor = create_basic_fake_processor()

        classifier = OutOfDateClassifier()
        classifier.out_of_date_threshold = ('17',)
        processed_crash.json_dump['system_info']['os'] = 'Mac OS X'
        processed_crash.json_dump['system_info']['os_ver'] = '10.1'
        processed_crash.json_dump['system_info']['cpu_arch'] = 'ppc'
        ok_(classifier._osx_action(
            raw_crash,
            raw_dumps,
            processed_crash,
            fake_processor
        ))
        eq_(
            processed_crash.classifications.support.classification,
            'firefox-no-longer-works-mac-os-10-4-or-powerpc'
        )

        classifier = OutOfDateClassifier()
        classifier.out_of_date_threshold = ('17',)
        processed_crash.json_dump['system_info']['os'] = 'Mac OS X'
        processed_crash.json_dump['system_info']['os_ver'] = '10.5'
        processed_crash.json_dump['system_info']['cpu_arch'] = 'ppc'
        ok_(classifier._osx_action(
            raw_crash,
            raw_dumps,
            processed_crash,
            fake_processor
        ))
        eq_(
            processed_crash.classifications.support.classification,
            'firefox-no-longer-works-mac-os-10-4-or-powerpc'
        )

        classifier = OutOfDateClassifier()
        classifier.out_of_date_threshold = ('17',)
        processed_crash.json_dump['system_info']['os'] = 'Mac OS X'
        processed_crash.json_dump['system_info']['os_ver'] = '10.5'
        processed_crash.json_dump['system_info']['cpu_arch'] = 'x86'
        ok_(classifier._osx_action(
            raw_crash,
            raw_dumps,
            processed_crash,
            fake_processor
        ))
        eq_(
            processed_crash.classifications.support.classification,
            'firefox-no-longer-works-mac-os-x-10-5'
        )

        classifier = OutOfDateClassifier()
        classifier.out_of_date_threshold = ('17',)
        processed_crash.json_dump['system_info']['os'] = 'Mac OS X'
        processed_crash.json_dump['system_info']['os_ver'] = '10.99'
        ok_(classifier._osx_action(
            raw_crash,
            raw_dumps,
            processed_crash,
            fake_processor
        ))
        eq_(
            processed_crash.classifications.support.classification,
            'update-firefox-latest-version'
        )
开发者ID:4thAce,项目名称:socorro,代码行数:75,代码来源:test_support_classifiers.py

示例13: test_action_predicate_accept

# 需要导入模块: from socorrolib.lib.util import DotDict [as 别名]
# 或者: from socorrolib.lib.util.DotDict import json_dump [as 别名]

#.........这里部分代码省略.........
        test_raw_crash.PluginHang = '1'
        test_raw_crash.ProductName = "Firefox"
        test_raw_crash.Version = '17'
        test_raw_crash.BuildID = '20121015'
        ok_(filter_rule.predicate(
            test_raw_crash,
            test_raw_dumps,
            DotDict(),
            fake_processor
        ))

        # find crashes with no default dump
        test_raw_crash = DotDict()
        test_raw_crash.PluginHang = '1'
        test_raw_crash.ProductName = "Firefox"
        test_raw_crash.Version = '19'
        test_raw_crash.BuildID = '20121031'
        test_processed_crash = DotDict()
        ok_(filter_rule.predicate(
            test_raw_crash,
            test_raw_dumps,
            test_processed_crash,
            fake_processor
        ))

        # find crashes with no architecture info
        test_raw_crash = DotDict()
        test_raw_crash.PluginHang = '1'
        test_raw_crash.ProductName = "Firefox"
        test_raw_crash.Version = '19'
        test_raw_crash.BuildID = '20121031'
        test_processed_crash = DotDict()
        test_processed_crash.dump = 'fake dump'
        test_processed_crash.json_dump = DotDict()
        ok_(filter_rule.predicate(
            test_raw_crash,
            test_raw_dumps,
            test_processed_crash,
            fake_processor
        ))

        # find crashes with amd64 architecture info
        test_raw_crash = DotDict()
        test_raw_crash.PluginHang = '1'
        test_raw_crash.ProductName = "Firefox"
        test_raw_crash.Version = '19'
        test_raw_crash.BuildID = '20121031'
        test_processed_crash = DotDict()
        test_processed_crash.dump = 'fake dump'
        test_processed_crash.json_dump = DotDict()
        test_processed_crash.json_dump.system_info = DotDict()
        test_processed_crash.json_dump.cpu_arch = 'amd64'
        ok_(filter_rule.predicate(
            test_raw_crash,
            test_raw_dumps,
            test_processed_crash,
            fake_processor
        ))

        # find crashes with main dump processing errors
        test_raw_crash = DotDict()
        test_raw_crash.PluginHang = '1'
        test_raw_crash.ProductName = "Firefox"
        test_raw_crash.Version = '19'
        test_raw_crash.BuildID = '20121031'
        test_processed_crash = DotDict()
开发者ID:4thAce,项目名称:socorro,代码行数:70,代码来源:test_skunk_classifiers.py


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