def test_gunicorn_gevent_entrypoint(): # this will error in python3.6 without our fix gunicorn = testing.GunicornProcess(app='tests.py36_async_tls:app', gunicorn='talisker.gunicorn.gevent', args=['--worker-class=gevent']) with gunicorn: r = requests.get(gunicorn.url('/')) assert r.status_code == 200
def test_gunicornprocess_success(): id = 'test-id' gunicorn = testing.GunicornProcess('tests.wsgi_app') with gunicorn: r = requests.get(gunicorn.url('/'), headers={'X-Request-Id': id}) assert r.status_code == 200 assert { 'logmsg': 'GET /', 'extra': { 'status': '200', 'method': 'GET', 'ip': '127.0.0.1', 'proto': 'HTTP/1.1', 'request_id': id, } } in gunicorn.log
def test_gunicornprocess_success(): try: import gunicorn # noqa except ImportError: pytest.skip('need gunicorn installed') id = 'test-id' ps = testing.GunicornProcess('tests.wsgi_app') with ps: r = requests.get(ps.url('/'), headers={'X-Request-Id': id}) assert r.status_code == 200 ps.log.assert_log(msg='GET /', extra={ 'status': '200', 'method': 'GET', 'ip': '127.0.0.1', 'proto': 'HTTP/1.1', 'request_id': id, })
def test_gunicornprocess_bad_app(): gunicorn = testing.GunicornProcess('no_app_here') with pytest.raises(testing.ServerProcessError): with gunicorn: pass