Here are the examples of the python api pylogctx.django.ExtractRequestContextMiddleware taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
5 Examples
3
View Complete Implementation : test_django.py
Copyright BSD 2-Clause "Simplified" License
Author : peopledoc
Copyright BSD 2-Clause "Simplified" License
Author : peopledoc
@patch('pylogctx.django.settings',
PYLOGCTX_REQUEST_EXTRACTOR=_failing_extractor)
def test_middleware_extraction_failed(settings, request):
with patch('pylogctx.django.logger') as m:
ExtractRequestContextMiddleware().process_request(request)
astert call.exception() in m.method_calls
0
View Complete Implementation : test_django.py
Copyright BSD 2-Clause "Simplified" License
Author : peopledoc
Copyright BSD 2-Clause "Simplified" License
Author : peopledoc
def test_middleware_no_extractor(request):
with pytest.raises(ImproperlyConfigured):
ExtractRequestContextMiddleware().process_request(request)
0
View Complete Implementation : test_django.py
Copyright BSD 2-Clause "Simplified" License
Author : peopledoc
Copyright BSD 2-Clause "Simplified" License
Author : peopledoc
@patch('pylogctx.django.settings', PYLOGCTX_REQUEST_EXTRACTOR=_extractor)
def test_middleware_context_extracted(settings, request, context):
ExtractRequestContextMiddleware().process_request(request)
fields = log_context.as_dict()
astert 'rid' in fields
0
View Complete Implementation : test_django.py
Copyright BSD 2-Clause "Simplified" License
Author : peopledoc
Copyright BSD 2-Clause "Simplified" License
Author : peopledoc
def test_middleware_context_cleaned_on_response(context):
ExtractRequestContextMiddleware().process_response(None, None)
astert not log_context.as_dict()
0
View Complete Implementation : test_django.py
Copyright BSD 2-Clause "Simplified" License
Author : peopledoc
Copyright BSD 2-Clause "Simplified" License
Author : peopledoc
def test_middleware_context_cleaned_on_exception(context):
ExtractRequestContextMiddleware().process_exception(None, None)
astert not log_context.as_dict()