Skip to content

Commit

Permalink
[feat] benchmarks include severity in short info (#1803)
Browse files Browse the repository at this point in the history
  • Loading branch information
aquamatthias committed Oct 12, 2023
1 parent 173d92f commit 6304674
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion resotocore/resotocore/web/api.py
Expand Up @@ -660,7 +660,7 @@ async def benchmarks(self, request: Request, deps: TenantDependencies) -> Stream
lookup = {c.id: c for c in await deps.inspector.list_checks()} if with_checks else {}

def to_js_check(c: ReportCheck) -> JsonElement:
return c.id if short else to_js(c, strip_nulls=True)
return dict(id=c.id, severity=c.severity.value) if short else to_js(c, strip_nulls=True)

def to_js_benchmark(b: Benchmark) -> Json:
bj: Json = to_js(b, strip_nulls=True)
Expand Down
4 changes: 4 additions & 0 deletions resotocore/tests/resotocore/web/api_test.py
Expand Up @@ -483,6 +483,10 @@ async def test_report(core_client: ResotoClient, client_session: ClientSession)
benchmark = benchmarks[0]
assert benchmark["id"] == "aws_cis_1_5"
assert len(benchmark["report_checks"]) > 50
assert benchmark["report_checks"][0] == {
"id": "aws_iam_account_maintain_current_contact_details",
"severity": "medium",
}
assert benchmark.get("checks") is None
assert benchmark.get("children") is None
response = await client_session.get(
Expand Down

0 comments on commit 6304674

Please sign in to comment.