Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/fastapi_cloud_cli/commands/env.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging
from pathlib import Path
from typing import Annotated, Any, Union
from typing import Annotated, Any, Optional, Union

import typer
from pydantic import BaseModel
Expand All @@ -16,7 +16,7 @@

class EnvironmentVariable(BaseModel):
name: str
value: str
value: Optional[str] = None


class EnvironmentVariableResponse(BaseModel):
Expand Down
29 changes: 29 additions & 0 deletions tests/test_env_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,32 @@ def test_shows_environment_variables_names(
assert result.exit_code == 0
assert "SECRET_KEY" in result.output
assert "API_KEY" in result.output


@pytest.mark.respx(base_url=settings.base_api_url)
def test_shows_secret_environment_variables_without_value(
logged_in_cli: None, respx_mock: respx.MockRouter, configured_app: ConfiguredApp
) -> None:
"""Test that secret env vars without a value field are handled correctly."""
respx_mock.get(f"/apps/{configured_app.app_id}/environment-variables/").mock(
return_value=Response(
200,
json={
"data": [
{
"name": "SECRET_KEY",
"is_secret": True,
"created_at": "2026-01-13T19:01:07.408378Z",
"updated_at": "2026-01-13T19:01:07.408389Z",
"connected_resource": None,
},
]
},
)
)

with changing_dir(configured_app.path):
result = runner.invoke(app, ["env", "list"])

assert result.exit_code == 0
assert "SECRET_KEY" in result.output
Loading