UI for projects, templates, attributes and maturity (RBT-WP-0008-T08); stop a test from writing runs into the repo
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Assistant: claude-code Assistant-Model: sonnet Assistant-Process: 295952@bnt-lap001 Assistant-Session: e93f64ad-516c-46eb-9666-aad8d300c477
This commit is contained in:
parent
3470552789
commit
eacbf8a21d
9 changed files with 560 additions and 12 deletions
|
|
@ -212,3 +212,26 @@ def test_instantiate_template_records_origin_merges_values_and_lists_needs(repo)
|
|||
J.instantiate(reg, "lighthouse-watch", "harbour-x", "prod")
|
||||
with pytest.raises(R.RunError, match="template is not run"):
|
||||
J.start_run(reg, reg.templates["lighthouse-watch"], "rtut.showcase-lighthouse", "bob")
|
||||
|
||||
|
||||
def test_set_attributes_validates_against_the_consuming_runbooks(repo):
|
||||
reg = project(repo, attributes={})
|
||||
doc = reg.projects["north-watch"]
|
||||
J.set_attributes(reg, doc, {"keeper": "Bea", "logdir": "/tmp/rtut-set-here", "unrelated": "x"})
|
||||
made = yaml.safe_load(doc.path.read_text())["attributes"]
|
||||
assert made["keeper"] == "Bea" and made["logdir"] == "/tmp/rtut-set-here" and made["unrelated"] == "x"
|
||||
with pytest.raises(ValueError, match="rtut-|violates"):
|
||||
J.set_attributes(reg, doc, {"logdir": "/etc"})
|
||||
with pytest.raises(ValueError, match="secret"):
|
||||
J.set_attributes(reg, doc, {"keeper": "hvs.ABCDEFGHIJKLMN"})
|
||||
with pytest.raises(ValueError, match="bad attribute name"):
|
||||
J.set_attributes(reg, doc, {"Bad-Name": "x"})
|
||||
assert yaml.safe_load(doc.path.read_text())["attributes"]["logdir"] == "/tmp/rtut-set-here" # refused values change nothing
|
||||
reg = Registry([repo])
|
||||
with pytest.raises(ValueError, match="template"):
|
||||
J.set_attributes(reg, reg.templates["lighthouse-watch"], {"keeper": "x"})
|
||||
|
||||
|
||||
def test_attribute_notes_survive_resolution(repo):
|
||||
reg = Registry([repo])
|
||||
assert "Who keeps this light" in fold(set_layers(reg, "harbour-defaults"))["keeper"]["note"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue