From 1bb08c0c642ac25e8741fa78efb7037f936cf046 Mon Sep 17 00:00:00 2001 From: dwertent Date: Thu, 14 Oct 2021 17:00:52 +0300 Subject: [PATCH] append failed controls --- reporthandling/datastructuresmethods_test.go | 7 ++++++- reporthandling/resultshandling.go | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/reporthandling/datastructuresmethods_test.go b/reporthandling/datastructuresmethods_test.go index 64feed99..16161f6e 100644 --- a/reporthandling/datastructuresmethods_test.go +++ b/reporthandling/datastructuresmethods_test.go @@ -30,7 +30,6 @@ func TestControlsResults(t *testing.T) { assert.Equal(t, len(framework.ControlReports), 21) SetUniqueResourcesCounter(framework) - assert.Equal(t, 24, framework.GetNumberOfFailedResources(), "framework.GetNumberOfFailedResources") assert.Equal(t, 37, framework.GetNumberOfWarningResources(), "framework.GetNumberOfWarningResources") @@ -88,6 +87,12 @@ func TestControlsResults(t *testing.T) { assert.False(t, control.Passed(), "C-0035: Passed") assert.False(t, control.Warning(), "C-0035: Warning") assert.True(t, control.Failed(), "C-0035: Failed") + case "C-0016": + assert.Equal(t, 0, control.GetNumberOfFailedResources(), "C-0016: GetNumberOfFailedResources") + assert.Equal(t, 0, control.GetNumberOfWarningResources(), "C-0016: GetNumberOfWarningResources") + assert.True(t, control.Passed(), "C-0016: Passed") + assert.False(t, control.Warning(), "C-0016: Warning") + assert.False(t, control.Failed(), "C-0016: Failed") } } } diff --git a/reporthandling/resultshandling.go b/reporthandling/resultshandling.go index e8831a83..0f30c893 100644 --- a/reporthandling/resultshandling.go +++ b/reporthandling/resultshandling.go @@ -40,7 +40,7 @@ func SetUniqueResourcesCounter(frameworkReport *FrameworkReport) { // Append uniqueAllControls = append(uniqueAllControls, uniqueAll...) uniqueWarningControls = append(uniqueWarningControls, uniqueWarning...) - uniqueFailedControls = append(uniqueAllControls, uniqueFailed...) + uniqueFailedControls = append(uniqueFailedControls, uniqueFailed...) } uniqueAllControls = GetUniqueResources(uniqueAllControls) uniqueWarningControls = GetUniqueResources(uniqueWarningControls)