2017-11-08 11:55:16 -05:00
|
|
|
package service
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2020-02-22 12:12:14 -05:00
|
|
|
"gotest.tools/v3/assert"
|
|
|
|
is "gotest.tools/v3/assert/cmp"
|
2017-11-08 11:55:16 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestValidateSingleGenericResource(t *testing.T) {
|
|
|
|
incorrect := []string{"foo", "fooo-bar"}
|
|
|
|
correct := []string{"foo=bar", "bar=1", "foo=barbar"}
|
|
|
|
|
|
|
|
for _, v := range incorrect {
|
|
|
|
_, err := ValidateSingleGenericResource(v)
|
2018-03-05 18:53:52 -05:00
|
|
|
assert.Check(t, is.ErrorContains(err, ""))
|
2017-11-08 11:55:16 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
for _, v := range correct {
|
|
|
|
_, err := ValidateSingleGenericResource(v)
|
2018-03-06 14:44:13 -05:00
|
|
|
assert.NilError(t, err)
|
2017-11-08 11:55:16 -05:00
|
|
|
}
|
|
|
|
}
|