This commit is contained in:
dwertent
2021-12-30 17:48:42 +02:00
parent fde437312f
commit 3f58d68d2a
7 changed files with 81 additions and 3 deletions

View File

@@ -19,7 +19,8 @@ Please note we have a code of conduct, please follow it in all your interactions
build.
2. Update the README.md with details of changes to the interface, this includes new environment
variables, exposed ports, useful file locations and container parameters.
3. We will merge the Pull Request in once you have the sign-off.
3. Open Pull Request to `dev` branch - we test the component before merging into the `master` branch
4. We will merge the Pull Request in once you have the sign-off.
## Code of Conduct

View File

@@ -42,6 +42,7 @@ func NewOPASessionObjMock() *OPASessionObj {
K8SResources: nil,
AllResources: make(map[string]workloadinterface.IMetadata),
ResourcesResult: make(map[string]resourcesresults.Result),
Report: &reporthandlingv2.PostureReport{},
PostureReport: &reporthandling.PostureReport{
ClusterName: "",
CustomerGUID: "",

View File

@@ -0,0 +1,20 @@
package getter
import (
"os"
"path/filepath"
"testing"
)
var mockFrameworkBasePath = filepath.Join("examples", "mocks", "frameworks")
func MockNewLoadPolicy() *LoadPolicy {
return &LoadPolicy{
filePaths: []string{""},
}
}
func TestBla(t *testing.T) {
dir, _ := os.Getwd()
t.Error(dir)
}

36
mocks/loadmocks.go Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,18 @@
package opaprocessor
import (
"testing"
"github.com/armosec/kubescape/mocks"
"github.com/stretchr/testify/assert"
"github.com/armosec/opa-utils/reporthandling"
)
func TestConvertFrameworksToPolicies(t *testing.T) {
fw0 := mocks.MockFramework_0006_0013()
fw1 := mocks.MockFramework_0044()
policies := ConvertFrameworksToPolicies([]reporthandling.Framework{*fw0, *fw1}, "")
assert.Equal(t, 2, len(policies.Frameworks))
assert.Equal(t, 3, len(policies.Controls))
}

View File

@@ -123,8 +123,6 @@ func (resultsHandler *ResultsHandler) reportV2ToV1(opaSessionObj *cautils.OPASes
}
}
// rulev1.ListInputKinds
}
fwv1.ControlReports = append(fwv1.ControlReports, crv1)

File diff suppressed because one or more lines are too long