Projet

Général

Profil

0001-improved-logged-requests-response-content-type-filte.patch

Josué Kouka, 21 mars 2017 11:09

Télécharger (1,89 ko)

Voir les différences:

Subject: [PATCH] improved logged requests response content-type filtering
 (#15524)

 passerelle/settings.py       | 2 +-
 tests/test_loggedrequests.py | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)
passerelle/settings.py
168 168

  
169 169
# List of LoggedRequest Response Content-Type to log
170 170
LOGGED_CONTENT_TYPES_MESSAGES = (
171
    r'text/*', r'application/(json|xml)'
171
    r'text/', r'application/(json|xml)'
172 172
)
173 173

  
174 174
# Max size of the response to log
tests/test_loggedrequests.py
63 63
                assert record.requests_response_content == response.content
64 64

  
65 65

  
66
@pytest.fixture(params=['xml', 'jpeg', 'pdf'])
66
@pytest.fixture(params=['xml', 'whatever', 'jpeg', 'pdf'])
67 67
def endpoint_response(request):
68 68
    response_request = mock.Mock(
69 69
        headers={'Accept': '*/*', 'Authorization': 'Basic dG9rZW46dG9rZW4='}, body=None)
......
71 71
        headers={'Content-Type': 'application/xml; charset=charset=utf-8'}, status_code=200,
72 72
        content='<tests><test>xml test</test></tests>', request=response_request)
73 73

  
74
    whatever = FakedResponse(
75
        headers={'Content-Type': 'texto/csv'}, status_code=200,
76
        content='username;age\ntoken;10\ncartman:10', request=response_request)
77

  
74 78
    jpeg = FakedResponse(
75 79
        headers={'Content-Type': 'image/jpeg'}, status_code=200,
76 80
        content='binary content to be ignored', request=response_request)
77
-