Skip to content

Commit 00edca6

Browse files
committed
ruff
1 parent 693fa90 commit 00edca6

File tree

1 file changed

+5
-28
lines changed

1 file changed

+5
-28
lines changed

services/efs-guardian/tests/unit/conftest.py

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from asgi_lifespan import LifespanManager
1818
from faker import Faker
1919
from fastapi import FastAPI
20-
from httpx._transports.asgi import ASGITransport
2120
from pytest_mock import MockerFixture
2221
from pytest_simcore.helpers.typing_env import EnvVarsDict
2322
from servicelib.rabbitmq import RabbitMQRPCClient
@@ -119,38 +118,17 @@ async def client(app: FastAPI) -> AsyncIterator[httpx.AsyncClient]:
119118
# - Needed for app to trigger start/stop event handlers
120119
# - Prefer this client instead of fastapi.testclient.TestClient
121120
async with httpx.AsyncClient(
122-
app=app,
123-
base_url="http://efs-guardian.testserver.io",
121+
transport=httpx.ASGITransport(app=app),
122+
base_url=f"http://{app.title}.testserver.io",
124123
headers={"Content-Type": "application/json"},
125124
) as client:
126-
assert isinstance(
127-
client._transport, ASGITransport # pylint: disable=protected-access
128-
)
129125
yield client
130126

131127

132-
#
133-
# Redis
134-
#
135-
136-
137-
@pytest.fixture
138-
def disable_redis_and_background_tasks_setup(mocker: MockerFixture) -> Callable:
139-
def _():
140-
# The following services are affected if redis is not in place
141-
mocker.patch("simcore_service_efs_guardian.core.application.setup_redis")
142-
mocker.patch(
143-
"simcore_service_efs_guardian.core.application.setup_background_tasks"
144-
)
145-
146-
return _
147-
148-
149128
@pytest.fixture
150-
def with_disabled_redis_and_background_tasks(
151-
disable_redis_and_background_tasks_setup: Callable,
152-
):
153-
disable_redis_and_background_tasks_setup()
129+
def with_disabled_redis_and_background_tasks(mocker: MockerFixture) -> None:
130+
mocker.patch("simcore_service_efs_guardian.core.application.setup_redis")
131+
mocker.patch("simcore_service_efs_guardian.core.application.setup_background_tasks")
154132

155133

156134
#
@@ -160,7 +138,6 @@ def with_disabled_redis_and_background_tasks(
160138

161139
@pytest.fixture
162140
async def efs_cleanup(app: FastAPI):
163-
164141
yield
165142

166143
aws_efs_settings: AwsEfsSettings = app.state.settings.EFS_GUARDIAN_AWS_EFS_SETTINGS

0 commit comments

Comments
 (0)