ispyb / py-ispyb

ISPyB backend server based on FastAPI
GNU Lesser General Public License v3.0
12 stars 14 forks source link

Fix tests #233

Closed mgaonach closed 1 year ago

mgaonach commented 1 year ago

All tests fail with error

_____________________ ERROR at setup of test_token_expired _____________________

    @pytest.fixture()
    def client():
>       return TestClient(_app)

tests/conftest.py:14: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <starlette.testclient.TestClient object at 0x7f6f9d396710>
app = <fastapi.applications.FastAPI object at 0x7f6f9e563760>
base_url = 'http://testserver', raise_server_exceptions = True, root_path = ''
backend = 'asyncio', backend_options = None, cookies = None

    def __init__(
        self,
        app: ASGIApp,
        base_url: str = "http://testserver",
        raise_server_exceptions: bool = True,
        root_path: str = "",
        backend: str = "asyncio",
        backend_options: typing.Optional[typing.Dict[str, typing.Any]] = None,
        cookies: httpx._client.CookieTypes = None,
    ) -> None:
        self.async_backend = _AsyncBackend(
            backend=backend, backend_options=backend_options or {}
        )
        if _is_asgi3(app):
            app = typing.cast(ASGI3App, app)
            asgi_app = app
        else:
            app = typing.cast(ASGI2App, app)  # type: ignore[assignment]
            asgi_app = _WrapASGI2(app)  # type: ignore[arg-type]
        self.app = asgi_app
        transport = _TestClientTransport(
            self.app,
            portal_factory=self._portal_factory,
            raise_server_exceptions=raise_server_exceptions,
            root_path=root_path,
        )
>       super().__init__(
            app=self.app,
            base_url=base_url,
            headers={"user-agent": "testclient"},
            transport=transport,
            follow_redirects=True,
            cookies=cookies,
        )
E       TypeError: Client.__init__() got an unexpected keyword argument 'follow_redirects'

/opt/hostedtoolcache/Python/3.10.8/x64/lib/python3.10/site-packages/starlette/testclient.py:384: TypeError