def test_user_info_without_auth_middleware_django_2(django_elasticapm_client, client):
with override_settings(MIDDLEWARE_CLASSES=None, MIDDLEWARE=[
m for m in settings.MIDDLEWARE
if m != 'django.contrib.auth.middleware.AuthenticationMiddleware'
]):
with pytest.raises(Exception):
client.get(reverse('elasticapm-raise-exc'))
assert len(django_elasticapm_client.events) == 1
event = django_elasticapm_client.events.pop(0)['errors'][0]
assert event['context']['user'] == {}
评论列表
文章目录