diff --git a/test/io/test_io.py b/test/io/test_io.py index 9b551b693..76fe83399 100644 --- a/test/io/test_io.py +++ b/test/io/test_io.py @@ -15,12 +15,6 @@ from util import * from postgrest import * -def test_port_connection(defaultenv): - "Connections via a port on localhost should work." - with run(env=defaultenv, port=freeport()): - pass - - @pytest.mark.parametrize( "secretpath", [path for path in (BASEDIR / "secrets").iterdir() if path.suffix != ".jwt"], diff --git a/test/io/test_sanity.py b/test/io/test_sanity.py new file mode 100644 index 000000000..6bbd8e3aa --- /dev/null +++ b/test/io/test_sanity.py @@ -0,0 +1,36 @@ +"Sanity checks for the PostgREST black box testing infrastructure." + +from datetime import datetime +from operator import attrgetter +import os +import re +import signal +import socket +import time + +import pytest + +from config import * +from util import * +from postgrest import * + + +def test_port_connection(defaultenv): + "Connections via a port on localhost should work." + with run(env=defaultenv, port=freeport()): + pass + + +def test_plain_get(defaultenv): + "run() should give a working PostgREST." + with run(env=defaultenv) as postgrest: + response = postgrest.session.get("/projects") + assert response.status_code == 200 + + +@pytest.mark.xfail(reason="option is broken, issue #2456") +def test_no_pool_connection_available(defaultenv): + "no_pool_connection_available option is functional" + with run(env=defaultenv, no_pool_connection_available=True) as postgrest: + with pytest.raises(Exception) as e: + postgrest.session.get("/projects", timeout=1)