Project

General

Profile

Bug #73655

test test_endpoint_cookies qui interroge vraiment httpbin.org

Added by Thomas Noël about 2 months ago. Updated about 2 months ago.

Status:
Nouveau
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
20 January 2023
Due date:
% Done:

0%

Estimated time:
Patch proposed:
No
Planning:
No

Description

Vu sur un crash de test pendant que httpbin.org était HS :

    def test_endpoint_cookies(app, db, monkeypatch, httpbin):
        @endpoint(methods=['get'])
        def httpcall(obj, request):
            response = obj.requests.get(httpbin.url + '/cookies/set?foo=bar', allow_redirects=False)
            cookie1 = response.request.headers.get('Cookie')
            response = obj.requests.get(httpbin.url + '/get')
            cookie2 = response.request.headers.get('Cookie')
            return {'cookie1': cookie1, 'cookie2': cookie2}

        monkeypatch.setattr(StubInvoicesConnector, 'httpcall', httpcall, raising=False)

        connector = StubInvoicesConnector(slug='fake')
        connector.save()

>       json_res = app.get('/stub-invoices/fake/httpcall').json

tests/test_generic_endpoint.py:700: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/tmp/tox-jenkins/passerelle/wip/73540-add-pdf-cat/py3-django22-xmlschema10/lib/python3.9/site-packages/django_webtest/__init__.py:124: in get
    response = super(DjangoTestApp, self).get(url, **kwargs)
/tmp/tox-jenkins/passerelle/wip/73540-add-pdf-cat/py3-django22-xmlschema10/lib/python3.9/site-packages/webtest/app.py:324: in get
    return self.do_request(req, status=status,
/tmp/tox-jenkins/passerelle/wip/73540-add-pdf-cat/py3-django22-xmlschema10/lib/python3.9/site-packages/django_webtest/__init__.py:86: in do_request
    response = super(DjangoTestApp, self).do_request(req, status,
/tmp/tox-jenkins/passerelle/wip/73540-add-pdf-cat/py3-django22-xmlschema10/lib/python3.9/site-packages/webtest/app.py:646: in do_request
    self._check_status(status, res)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <django_webtest.DjangoTestApp object at 0x7f117a3bd460>, status = None
res = <500 Internal Server Error application/json body=b'{"err": ...ull}'/170>

    def _check_status(self, status, res):
...
E           webtest.app.AppError: Bad response: 500 Internal Server Error (not 200 OK or 3xx redirect for http://testserver/stub-invoices/fake/httpcall)
E           {"err": 1, "err_class": "requests.exceptions.ReadTimeout", "err_desc": "HTTPConnectionPool(host='httpbin.org', port=80): Read timed out. (read timeout=25)", "data": null}

Et de fait quand on ajoute un "192.168.0.0 httpbin.org" dans son /etc/hosts on voit le même pépin.

Also available in: Atom PDF