|
2 | 2 |
|
3 | 3 | import pytest |
4 | 4 | from fastapi import FastAPI |
| 5 | +from pytest_simcore.helpers.monkeypatch_envs import setenvs_from_dict |
| 6 | +from pytest_simcore.helpers.typing_env import EnvVarsDict |
5 | 7 | from servicelib.rabbitmq import RabbitMQRPCClient |
6 | 8 | from servicelib.rabbitmq.rpc_interfaces.storage import zipping |
7 | 9 | from settings_library.rabbit import RabbitSettings |
| 10 | +from simcore_service_storage.core.settings import ApplicationSettings |
8 | 11 |
|
9 | 12 | pytest_plugins = [ |
10 | 13 | "pytest_simcore.rabbit_service", |
|
18 | 21 |
|
19 | 22 |
|
20 | 23 | @pytest.fixture |
21 | | -async def rpc_client( |
| 24 | +async def app_environment( |
| 25 | + app_environment: EnvVarsDict, |
22 | 26 | rabbit_service: RabbitSettings, |
| 27 | + monkeypatch: pytest.MonkeyPatch, |
| 28 | +): |
| 29 | + new_envs = setenvs_from_dict( |
| 30 | + monkeypatch, |
| 31 | + { |
| 32 | + **app_environment, |
| 33 | + "RABBIT_HOST": rabbit_service.RABBIT_HOST, |
| 34 | + "RABBIT_PORT": f"{rabbit_service.RABBIT_PORT}", |
| 35 | + "RABBIT_USER": rabbit_service.RABBIT_USER, |
| 36 | + "RABBIT_SECURE": f"{rabbit_service.RABBIT_SECURE}", |
| 37 | + "RABBIT_PASSWORD": rabbit_service.RABBIT_PASSWORD.get_secret_value(), |
| 38 | + }, |
| 39 | + ) |
| 40 | + |
| 41 | + settings = ApplicationSettings.create_from_envs() |
| 42 | + assert settings.STORAGE_RABBITMQ |
| 43 | + |
| 44 | + return new_envs |
| 45 | + |
| 46 | + |
| 47 | +@pytest.fixture |
| 48 | +async def rpc_client( |
23 | 49 | initialized_app: FastAPI, |
24 | 50 | rabbitmq_rpc_client: Callable[[str], Awaitable[RabbitMQRPCClient]], |
25 | 51 | ) -> RabbitMQRPCClient: |
|
0 commit comments