Files
nova-platform/tests/test_environment_check.py
T
CIAgent 97691fd752 docs(P01): complete contract-surface-schemas-resolver phase
---ci---
project: nova-platform
phase: 1
milestone: v1.0
status: complete
phase_role: execution
---/ci---

P1 complete: contract schema, stack schema, environment schema,
resolver, env_check, 10 sample contracts, 36 tests. REQ-01..06,
23..28 covered.
2026-08-24 17:31:00 +00:00

34 lines
1.2 KiB
Python

"""Tests for core/environment_check.py — REQ-24."""
from pathlib import Path
import pytest
from core.environment_check import check, EnvironmentNotFoundError
class TestCheckHappyPath:
def test_dev_returns_dict(self, repo_root):
env = check("dev", repo_root / "core" / "environments")
assert env["name"] == "dev"
assert env["region"] == "us-east-1"
assert env["state_backend"]["bucket"] == "nova-tfstate-dev-us-east-1"
assert env["state_backend"]["lock_table"] == "nova-tfstate-locks"
def test_returns_all_required_fields(self, repo_root):
env = check("dev", repo_root / "core" / "environments")
for f in ("name", "account_id", "region", "state_backend", "network"):
assert f in env, f"missing {f}"
class TestCheckErrors:
def test_missing_env_raises(self, repo_root, tmp_path):
with pytest.raises(EnvironmentNotFoundError):
check("nonexistent", tmp_path)
def test_missing_env_message_names_env(self, repo_root, tmp_path):
try:
check("qa", tmp_path)
assert False, "should have raised"
except EnvironmentNotFoundError as e:
assert "qa" in str(e)