Skip to content

Commit

Permalink
fix: add a value for the rule parameter in tests
Browse files Browse the repository at this point in the history
Signed-off-by: Alejandro Jose Leiva Palomo <[email protected]>
  • Loading branch information
AleJo2995 committed Feb 8, 2024
1 parent 908e0b9 commit 014643d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/data/json/comp_def_more_params.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
{
"name": "Parameter_Value_Alternatives2",
"ns": "http://oscal-compass.github.io/compliance-trestle/schemas/oscal/cd",
"value": "20",
"value": "[\"20\", \"30\"]",
"remarks": "rule_1"
}
],
Expand Down
9 changes: 8 additions & 1 deletion tests/trestle/core/commands/author/ssp_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1060,11 +1060,18 @@ def test_ssp_gen_and_assemble_more_than_one_param(tmp_trestle_dir: pathlib.Path,
assert md_path.exists()

md_api = MarkdownAPI()
header, _ = md_api.processor.process_markdown(md_path)
header, tree = md_api.processor.process_markdown(md_path)
rule_parameters = header['x-trestle-comp-def-rules-param-vals']['comp_aa']
rule_parameters.append({'name': 'allowed_admins_per_account2', 'values': ['20']})

md_api.write_markdown_with_header(md_path, header, tree.content.raw_text)

# verifies a second parameter has beend added to the top shared rule
assert header['x-trestle-rules-params']['comp_aa'][1]['name'] == 'allowed_admins_per_account2'

# verifies the parameter value for the rule has been written down correctly in the markdown file
assert header['x-trestle-comp-def-rules-param-vals']['comp_aa'][2]['values'] == ['20']

# now assemble controls into json ssp
ssp_assemble = SSPAssemble()
args = argparse.Namespace(
Expand Down

0 comments on commit 014643d

Please sign in to comment.