0001-tests-skip-logs-added-by-charset-normalizer-upgrade-.patch
tests/test_mdph13.py | ||
---|---|---|
502 | 502 | |
503 | 503 | |
504 | 504 |
def test_dossier_http_error(app, mdph13, mock_http, caplog): |
505 | 505 |
url = '/mdph13/test1/link/?NameID=%s&numero_dossier=%s&date_de_naissance=%s&secret=%s&email=%s&ip=%s' |
506 | 506 |
url = url % (NAME_ID, FILE_NUMBER, DOB, SECRET, EMAIL, IP) |
507 | 507 |
mock_http.add_response({'status_code': 401, 'content': 'wtf', 'reason': 'Authentication required'}) |
508 | 508 |
response = app.post(url, status=500) |
509 | 509 |
assert response.json['err_class'] == 'requests.exceptions.HTTPError' |
510 |
assert caplog.records[2].levelno == logging.ERROR
|
|
511 |
assert caplog.records[2].getMessage() == 'GET http://cd13.fr/situation/dossier/1234 (=> 401)'
|
|
512 |
assert hasattr(caplog.records[2].request, 'META')
|
|
510 |
assert caplog.records[4].levelno == logging.ERROR
|
|
511 |
assert caplog.records[4].getMessage() == 'GET http://cd13.fr/situation/dossier/1234 (=> 401)'
|
|
512 |
assert hasattr(caplog.records[4].request, 'META')
|
|
513 | 513 | |
514 | 514 |
def raise_ssl_error(url, request): |
515 | 515 |
raise requests.exceptions.SSLError(request=request) |
516 | 516 | |
517 | 517 |
idx = len(caplog.records) |
518 | 518 |
mock_http.add_response(raise_ssl_error) |
519 | 519 |
response = app.post(url, status=500) |
520 | 520 |
assert response.json['err_class'] == 'requests.exceptions.SSLError' |
521 |
- |