diff --git a/rest_tools/client/utils.py b/rest_tools/client/utils.py index 739f9b8f..c319c9e2 100644 --- a/rest_tools/client/utils.py +++ b/rest_tools/client/utils.py @@ -29,6 +29,8 @@ async def request_and_validate( """Make request and validate the response against a given OpenAPI spec. Useful for testing and debugging. + + NOTE: this essentially mimics RestClient.request() with added features. """ url, kwargs = rc._prepare(method, path, args=args) diff --git a/tests/integrate_openapi/conftest.py b/tests/integrate_openapi/conftest.py index bb603835..3c58fd24 100644 --- a/tests/integrate_openapi/conftest.py +++ b/tests/integrate_openapi/conftest.py @@ -1,14 +1,8 @@ """Integration test fixtures.""" import socket -from typing import AsyncIterator, Callable import pytest -import pytest_asyncio -import tornado - -from rest_tools.client import RestClient -from rest_tools.server import RestServer, RestHandler @pytest.fixture @@ -21,28 +15,3 @@ def port() -> int: ephemeral_port = addr[1] s.close() return ephemeral_port - - -@pytest_asyncio.fixture -async def server(port: int) -> AsyncIterator[Callable[[], RestClient]]: - """Start up REST server and attach handlers.""" - rs = RestServer(debug=True) - - class TestHandler(RestHandler): - ROUTE = "/echo/this" - - async def post(self) -> None: - if self.get_argument("raise", None): - raise tornado.web.HTTPError(400, self.get_argument("raise")) - self.write(self.get_argument("echo", {})) - - rs.add_route(TestHandler.ROUTE, TestHandler) - rs.startup(address="localhost", port=port) - - def client() -> RestClient: - return RestClient(f"http://localhost:{port}", retries=0) - - try: - yield client - finally: - await rs.stop()