django_tests.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:apm-agent-python 作者: elastic 项目源码 文件源码
def test_request_metrics_301_prepend_www(django_elasticapm_client, client):
    django_elasticapm_client.instrumentation_store.get_all()  # clear the store

    # enable middleware wrapping
    django_elasticapm_client.config.instrument_django_middleware = True

    from elasticapm.contrib.django.middleware import TracingMiddleware
    TracingMiddleware._elasticapm_instrumented = False

    with override_settings(
        PREPEND_WWW=True,
        **middleware_setting(django.VERSION, [
            'elasticapm.contrib.django.middleware.TracingMiddleware',
            'django.middleware.common.CommonMiddleware',
        ])
    ):
        client.get(reverse('elasticapm-no-error'))
    transactions = django_elasticapm_client.instrumentation_store.get_all()
    assert transactions[0]['name'] == 'GET django.middleware.common.CommonMiddleware.process_request'
    assert transactions[0]['result'] == 'HTTP 3xx'
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号