-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_bootstrap_cli.py
More file actions
58 lines (46 loc) · 1.67 KB
/
test_bootstrap_cli.py
File metadata and controls
58 lines (46 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# SPDX-FileCopyrightText: 2026 KustoKing / SecM8
# SPDX-License-Identifier: Apache-2.0
"""Unit tests for the `contentops bootstrap` CLI.
Live API call paths are not covered here — they're exercised by the
integration suite. The dry-run path is enough to verify the command
resolves its options correctly and constructs the right config-file
target path per env slug.
"""
from __future__ import annotations
from pathlib import Path
from click.testing import CliRunner
from contentops.cli import cli
def test_bootstrap_dry_run_no_env() -> None:
result = CliRunner().invoke(
cli,
[
"bootstrap",
"--subscription", "11111111-1111-1111-1111-111111111111",
"--resource-group", "rg-x",
"--workspace", "ws-x",
"--dry-run",
],
)
assert result.exit_code == 0, result.output
assert "config/tenant.yml" in result.output
assert "Sentinel" in result.output
def test_bootstrap_dry_run_with_env_slug() -> None:
result = CliRunner().invoke(
cli,
[
"bootstrap",
"--subscription", "11111111-1111-1111-1111-111111111111",
"--resource-group", "rg-x",
"--workspace", "ws-x",
"--location", "eastus",
"--env", "dev",
"--dry-run",
],
)
assert result.exit_code == 0, result.output
assert "config/tenant.dev.yml" in result.output
assert "eastus" in result.output
def test_bootstrap_required_flags_enforced() -> None:
result = CliRunner().invoke(cli, ["bootstrap", "--dry-run"])
assert result.exit_code != 0
assert "Missing option" in result.output or "Error" in result.output