Skip to content
Open
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: 3 additions & 1 deletion data_safe_haven/commands/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ def available() -> None:
raise typer.Exit(0)

config_names = [blob.removeprefix("sre-").removesuffix(".yaml") for blob in blobs]
pulumi_config = DSHPulumiConfig.from_remote(context)
pulumi_config = DSHPulumiConfig.from_remote_or_create(
context, encrypted_key=None, projects={}
)
deployed = pulumi_config.project_names

headers = ["SRE Name", "Deployed"]
Expand Down
21 changes: 21 additions & 0 deletions tests/commands/test_config_available_without_pulumi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from data_safe_haven.commands.config import config_command_group
from data_safe_haven.config import ContextManager, DSHPulumiConfig
from data_safe_haven.external import AzureSdk


def test_available_before_first_sre_deployment(
context_manager, mocker, runner
) -> None:
mocker.patch.object(ContextManager, "from_file", return_value=context_manager)
mocker.patch.object(
AzureSdk,
"list_blobs",
return_value=["sre-sandbox.yaml"],
)
mocker.patch.object(DSHPulumiConfig, "remote_exists", return_value=False)

result = runner.invoke(config_command_group, ["available"])

assert result.exit_code == 0
assert "Available SRE configurations" in result.stdout
assert "sandbox" in result.stdout