Skip to content

Commit a605f2f

Browse files
fix envs
1 parent b323706 commit a605f2f

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

services/web/server/tests/unit/isolated/conftest.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ def mock_webserver_service_environment(
178178
mock_env_devel_environment: EnvVarsDict, # pylint: disable=redefined-outer-name
179179
mock_env_dockerfile_build: EnvVarsDict, # pylint: disable=redefined-outer-name
180180
mock_env_deployer_pipeline: EnvVarsDict, # pylint: disable=redefined-outer-name
181+
faker: Faker
181182
) -> EnvVarsDict:
182183
"""
183184
Mocks environment produce in the docker compose config with a .env (.env-devel)
@@ -219,6 +220,24 @@ def mock_webserver_service_environment(
219220
"SWARM_STACK_NAME": os.environ.get("SWARM_STACK_NAME", "simcore"),
220221
"WEBSERVER_LOGLEVEL": os.environ.get("LOG_LEVEL", "WARNING"),
221222
"SESSION_COOKIE_MAX_AGE": str(7 * 24 * 60 * 60),
223+
"WEBSERVER_EMAIL": json.dumps({
224+
"SMTP_HOST": faker.url(),
225+
"SMTP_PORT": faker.port_number()
226+
}),
227+
"WEBSERVER_LOGIN": json.dumps({
228+
"LOGIN_REGISTRATION_INVITATION_REQUIRED": True
229+
}),
230+
"WEBSERVER_PAYMENTS": json.dumps({
231+
"PAYMENTS_USERNAME": faker.user_name(),
232+
"PAYMENTS_PASSWORD": faker.password()
233+
}),
234+
"WEBSERVER_SCICRUNCH": json.dumps({
235+
"SCICRUNCH_API_KEY": faker.pystr()
236+
}),
237+
"WEBSERVER_TRACING": json.dumps({
238+
"TRACING_OPENTELEMETRY_COLLECTOR_ENDPOINT": faker.url(),
239+
"TRACING_OPENTELEMETRY_COLLECTOR_PORT": faker.port_number()
240+
})
222241
},
223242
)
224243

services/web/server/tests/unit/isolated/test_application_settings.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ def app_settings(
2222
) -> ApplicationSettings:
2323
app = web.Application()
2424

25+
print("envs\n", json.dumps(mock_webserver_service_environment, indent=1))
26+
2527
# init and validation happens here
2628
settings = setup_settings(app)
27-
print("envs\n", json.dumps(mock_webserver_service_environment, indent=1))
2829
print("settings:\n", settings.model_dump_json(indent=1))
2930

3031
assert APP_SETTINGS_KEY in app

0 commit comments

Comments
 (0)