2017-11-08 11:55:16 -05:00
|
|
|
package service
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2018-06-08 12:24:26 -04:00
|
|
|
"gotest.tools/assert"
|
|
|
|
is "gotest.tools/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
|
|
|
}
|
|
|
|
}
|