This commit is contained in:
@@ -15,7 +15,7 @@ from app.agent import ExecutionEngine
|
||||
from app.recorder import InMemoryRecorder
|
||||
from app.tools.execution import specialist_tools
|
||||
from app.tools.local import mermaid_check
|
||||
from app.workflows.chain import validation_outcome
|
||||
from app.workflows.chain import unimplementable_checks, validation_outcome
|
||||
from app.workflows.deliverables import (
|
||||
DEPENDENCY_GRAPH,
|
||||
DeliverableKind,
|
||||
@@ -327,6 +327,54 @@ def test_deployment_guidance_must_account_for_every_check():
|
||||
)
|
||||
|
||||
|
||||
def test_a_check_that_cannot_be_implemented_is_accounted_for_with_its_reason():
|
||||
args = sample_submission(K.DEPLOYMENT_GUIDANCE).args
|
||||
implementation = json.dumps(
|
||||
[
|
||||
{"check": "K-1", "file": "terraform/main.tf", "address": "a"},
|
||||
{
|
||||
"check": "K-2",
|
||||
"unimplementable": "example_service_account has no such argument",
|
||||
},
|
||||
]
|
||||
)
|
||||
|
||||
missing = check_submission(
|
||||
K.DEPLOYMENT_GUIDANCE,
|
||||
args["content"],
|
||||
{**args["attachments"], "implementation.json": implementation},
|
||||
upstream(*EVERYTHING_BEFORE_CODE),
|
||||
)
|
||||
|
||||
assert missing == ()
|
||||
assert unimplementable_checks(implementation) == [
|
||||
{"check": "K-2", "reason": "example_service_account has no such argument"}
|
||||
]
|
||||
assert unimplementable_checks(SAMPLE_DATA["implementation.json"]) == []
|
||||
|
||||
|
||||
def test_an_unimplementable_entry_needs_its_reason():
|
||||
args = sample_submission(K.DEPLOYMENT_GUIDANCE).args
|
||||
implementation = json.dumps(
|
||||
[
|
||||
{"check": "K-1", "file": "terraform/main.tf", "address": "a"},
|
||||
{"check": "K-2", "unimplementable": ""},
|
||||
]
|
||||
)
|
||||
|
||||
missing = check_submission(
|
||||
K.DEPLOYMENT_GUIDANCE,
|
||||
args["content"],
|
||||
{**args["attachments"], "implementation.json": implementation},
|
||||
upstream(*EVERYTHING_BEFORE_CODE),
|
||||
)
|
||||
|
||||
assert missing == (
|
||||
"implementation.json[0]: needs unimplementable",
|
||||
"implementation.json: Check K-2 is not accounted for",
|
||||
)
|
||||
|
||||
|
||||
def verdicts(**changes) -> str:
|
||||
data = json.loads(SAMPLE_DATA["verdicts.json"])
|
||||
data.update(changes)
|
||||
|
||||
Reference in New Issue
Block a user