|
|
|
@ -31,11 +31,11 @@ func TestValidateAllowedExtension(t *testing.T) {
|
|
|
|
|
var failTest = []string{"/foo", "/test.yml", "/test.toml", "test.yml"}
|
|
|
|
|
for _, test := range failTest {
|
|
|
|
|
err := validateAllowedExtension(test)
|
|
|
|
|
if err == nil || !strings.Contains(err.Error(), "Valid extensions are .yaml or .tpl") {
|
|
|
|
|
t.Errorf("validateAllowedExtension('%s') to return \"Valid extensions are .yaml or .tpl\", got no error", test)
|
|
|
|
|
if err == nil || !strings.Contains(err.Error(), "Valid extensions are .yaml, .tpl, or .txt") {
|
|
|
|
|
t.Errorf("validateAllowedExtension('%s') to return \"Valid extensions are .yaml, .tpl, or .txt\", got no error", test)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var successTest = []string{"/foo.yaml", "foo.yaml", "foo.tpl", "/foo/bar/baz.yaml"}
|
|
|
|
|
var successTest = []string{"/foo.yaml", "foo.yaml", "foo.tpl", "/foo/bar/baz.yaml", "NOTES.txt"}
|
|
|
|
|
for _, test := range successTest {
|
|
|
|
|
err := validateAllowedExtension(test)
|
|
|
|
|
if err != nil {
|
|
|
|
|