mirror of
https://github.com/kyverno/kyverno.git
synced 2025-03-06 16:06:56 +00:00
24 lines
586 B
Go
24 lines
586 B
Go
|
package event
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"testing"
|
||
|
|
||
|
"gotest.tools/assert"
|
||
|
)
|
||
|
|
||
|
func TestPositive(t *testing.T) {
|
||
|
resourceName := "test_resource"
|
||
|
expectedMsg := fmt.Sprintf("Policy applied successfully on the resource %s", resourceName)
|
||
|
msg, err := getEventMsg(SPolicyApply, resourceName)
|
||
|
assert.NilError(t, err)
|
||
|
assert.Equal(t, expectedMsg, msg)
|
||
|
}
|
||
|
|
||
|
// passing incorrect args
|
||
|
func TestIncorrectArgs(t *testing.T) {
|
||
|
resourceName := "test_resource"
|
||
|
_, err := getEventMsg(SPolicyApply, resourceName, "extra_args")
|
||
|
assert.Error(t, err, "message expects 1 arguments, but 2 arguments passed")
|
||
|
}
|