Skip to content

Commit

Permalink
fixing settings.py
Browse files Browse the repository at this point in the history
  • Loading branch information
pcrespov committed Oct 31, 2024
1 parent 972d87f commit 4e4f94c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ def base_url(self) -> str:
class ApplicationSettings(BaseApplicationSettings, MixinLoggingSettings):
CATALOG_LOG_LEVEL: LogLevel = Field(
LogLevel.INFO.value,
validation_alias=AliasChoices("CATALOG_LOGLEVEL", "LOG_LEVEL", "LOGLEVEL"),
validation_alias=AliasChoices(
"CATALOG_LOG_LEVEL", "CATALOG_LOGLEVEL", "LOG_LEVEL", "LOGLEVEL"
),
)
CATALOG_LOG_FORMAT_LOCAL_DEV_ENABLED: bool = Field(
default=False,
Expand Down
12 changes: 8 additions & 4 deletions services/catalog/tests/unit/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@

import os

from pytest_simcore.helpers.typing_env import EnvVarsDict
from simcore_service_catalog._meta import API_VERSION
from simcore_service_catalog.cli import main
from simcore_service_catalog.core.settings import ApplicationSettings
from typer.testing import CliRunner


Expand All @@ -18,10 +20,12 @@ def test_cli_help_and_version(cli_runner: CliRunner):
assert result.stdout.strip() == API_VERSION


def test_settings(cli_runner: CliRunner):
result = cli_runner.invoke(main, ["settings"])
assert result.exit_code == 0
assert "APP_NAME=simcore-service-autoscaling" in result.stdout
def test_settings(cli_runner: CliRunner, app_environment: EnvVarsDict):
result = cli_runner.invoke(main, ["settings", "--show-secrets", "--as-json"])
assert result.exit_code == os.EX_OK

settings = ApplicationSettings.model_validate_json(result.output)
assert settings.model_dump() == ApplicationSettings.create_from_envs().model_dump()


def test_run(cli_runner: CliRunner):
Expand Down

0 comments on commit 4e4f94c

Please sign in to comment.