1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-06 16:06:56 +00:00
kyverno/pkg/engine/utils/utils_test.go
Pooja Singh 7195b20e90
Feature/print mutated policy (#1014)
* added printing mutation policy

* added mutated method in common

* improved yaml print

* updated readme

* small fix

* small fix
2020-07-29 09:11:58 -07:00

29 lines
535 B
Go

package utils
import (
"encoding/json"
"testing"
"gotest.tools/assert"
)
func TestGetAnchorsFromMap_ThereAreNoAnchors(t *testing.T) {
rawMap := []byte(`{
"name":"nirmata-*",
"notAnchor1":123,
"namespace":"kube-?olicy",
"notAnchor2":"sample-text",
"object":{
"key1":"value1",
"(key2)":"value2"
}
}`)
var unmarshalled map[string]interface{}
err := json.Unmarshal(rawMap, &unmarshalled)
if err != nil {
t.Error(err)
}
actualMap := GetAnchorsFromMap(unmarshalled)
assert.Assert(t, len(actualMap) == 0)
}