Skip to content

Commit

Permalink
Make fake tenant parametrizable by fixture in tests (#424)
Browse files Browse the repository at this point in the history
  • Loading branch information
KonstantAnxiety authored Apr 12, 2024
1 parent 8ff9a8a commit e4aa472
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/dl_api_lib_testing/dl_api_lib_testing/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from dl_api_commons.base_models import (
RequestContextInfo,
TenantCommon,
TenantDef,
)
from dl_api_lib.app.control_api.app import ControlApiAppFactory
from dl_api_lib.app_common_settings import ConnOptionsMutatorsFactory
Expand Down Expand Up @@ -143,18 +144,23 @@ def ca_data(self) -> bytes:
def control_api_app_factory(self, control_api_app_settings: ControlApiAppSettings) -> ControlApiAppFactory:
return TestingControlApiAppFactory(settings=control_api_app_settings)

@pytest.fixture(scope="function")
def fake_tenant(self) -> TenantDef:
return TenantCommon()

@pytest.fixture(scope="function")
def control_api_app(
self,
environment_readiness: None,
control_api_app_factory: ControlApiAppFactory,
connectors_settings: dict[ConnectionType, ConnectorSettingsBase],
fake_tenant: TenantDef,
) -> Generator[Flask, None, None]:
"""Session-wide test `Flask` application."""

app = control_api_app_factory.create_app(
connectors_settings=connectors_settings,
testing_app_settings=ControlApiAppTestingsSettings(fake_tenant=TenantCommon()),
testing_app_settings=ControlApiAppTestingsSettings(fake_tenant=fake_tenant),
close_loop_after_request=False,
)

Expand Down

0 comments on commit e4aa472

Please sign in to comment.