Ejemplo n.º 1
0
    def test_log_request(self, request, current_app):
        request.url = '/foo/bar?token=1734768e-caf6'

        log_request(sentinel)

        current_app.logger.info.assert_called_once_with(
            ANY, request.remote_addr, request.method, request.url, sentinel.status_code)
    def test_log_request(self, request, current_app):
        request.url = '/foo/bar?token=1734768e-caf6'
        response = Mock(data=None, status_code=200)

        log_request(response)

        current_app.logger.info.assert_called_once_with(
            ANY, request.remote_addr, request.method, request.url, 200
        )
Ejemplo n.º 3
0
def after_request(response):
    commit_database()
    flush_sysconfd()
    flush_bus()
    return http_helpers.log_request(response)
Ejemplo n.º 4
0
 def per_request_callbacks(response):
     for func in getattr(g, 'call_after_request', ()):
         response = func(response)
     return http_helpers.log_request(response)