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


Python PostgreSQLCrashStorage._save_processed_report方法代码示例

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


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

示例1: test_basic_postgres_save_processed_success_3_truncations

# 需要导入模块: from socorro.external.postgresql.crashstorage import PostgreSQLCrashStorage [as 别名]
# 或者: from socorro.external.postgresql.crashstorage.PostgreSQLCrashStorage import _save_processed_report [as 别名]
    def test_basic_postgres_save_processed_success_3_truncations(self):

        mock_logging = mock.Mock()
        mock_postgres = mock.Mock()
        required_config = PostgreSQLCrashStorage.get_required_config()
        required_config.add_option('logger', default=mock_logging)

        config_manager = ConfigurationManager(
            [required_config],
            app_name='testapp',
            app_version='1.0',
            app_description='app description',
            values_source_list=[{
                'logger': mock_logging,
                'database_class': mock_postgres
            }],
            argv_source=[]
        )

        with config_manager.context() as config:
            crashstorage = PostgreSQLCrashStorage(config)
            with mock.patch(
                'socorro.external.postgresql.crashstorage.single_value_sql'
            ) as mocked_sql_execute:
                fake_connection = mock.Mock(),
                crashstorage._save_processed_report(
                    fake_connection,
                    a_processed_crash_with_everything_too_long
                )
                mocked_sql_execute.assert_called_with(
                    fake_connection,
                    "\n        WITH\n        update_report AS (\n            UPDATE reports_20120402 SET\n                addons_checked = %s, address = %s, app_notes = %s, build = %s, client_crash_date = %s, completed_datetime = %s, cpu_info = %s, cpu_name = %s, date_processed = %s, distributor = %s, distributor_version = %s, email = %s, exploitability = %s, flash_version = %s, hangid = %s, install_age = %s, last_crash = %s, os_name = %s, os_version = %s, processor_notes = %s, process_type = %s, product = %s, productid = %s, reason = %s, release_channel = %s, signature = %s, started_datetime = %s, success = %s, topmost_filenames = %s, truncated = %s, uptime = %s, user_comments = %s, user_id = %s, url = %s, uuid = %s, version = %s\n            WHERE uuid = %s\n            RETURNING id\n        ),\n        insert_report AS (\n            INSERT INTO reports_20120402 (addons_checked, address, app_notes, build, client_crash_date, completed_datetime, cpu_info, cpu_name, date_processed, distributor, distributor_version, email, exploitability, flash_version, hangid, install_age, last_crash, os_name, os_version, processor_notes, process_type, product, productid, reason, release_channel, signature, started_datetime, success, topmost_filenames, truncated, uptime, user_comments, user_id, url, uuid, version)\n            ( SELECT\n                %s as addons_checked, %s as address, %s as app_notes, %s as build, %s as client_crash_date, %s as completed_datetime, %s as cpu_info, %s as cpu_name, %s as date_processed, %s as distributor, %s as distributor_version, %s as email, %s as exploitability, %s as flash_version, %s as hangid, %s as install_age, %s as last_crash, %s as os_name, %s as os_version, %s as processor_notes, %s as process_type, %s as product, %s as productid, %s as reason, %s as release_channel, %s as signature, %s as started_datetime, %s as success, %s as topmost_filenames, %s as truncated, %s as uptime, %s as user_comments, %s as user_id, %s as url, %s as uuid, %s as version\n                WHERE NOT EXISTS (\n                    SELECT uuid from reports_20120402\n                    WHERE\n                        uuid = %s\n                    LIMIT 1\n                )\n            )\n            RETURNING id\n        )\n        SELECT * from update_report\n        UNION ALL\n        SELECT * from insert_report\n        ",
                    a_processed_report_with_everything_truncated * 2
                )
开发者ID:SKY51717,项目名称:socorro,代码行数:36,代码来源:test_crashstorage.py


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