grim/convey

Clean up convey.yml a bit

2020-03-02, Gary Kramlich
029768cfe81d
Clean up convey.yml a bit
// Convey
// Copyright 2016-2018 Gary Kramlich <grim@reaperworld.com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package docker
import (
"testing"
"github.com/go-yaml/yaml"
"github.com/stretchr/testify/assert"
cYaml "hg.sr.ht/~grim/convey/yaml"
)
func TestEnvironmentSimple(t *testing.T) {
i := &Environment{Files: cYaml.StringOrSlice{"foo"}}
assert.Nil(t, i.Valid())
}
func TestEnvironmentFilesRequired(t *testing.T) {
i := &Environment{}
assert.EqualError(t, i.Valid(), errNoFilesEnvironment.Error())
}
func TestEnvironmentUnmarshalString(t *testing.T) {
data := `from-files: filename`
imp := Environment{}
err := yaml.Unmarshal([]byte(data), &imp)
assert.Nil(t, err)
assert.Equal(t, imp.Files, cYaml.StringOrSlice{"filename"})
}
func TestEnvironmentUnmarshalStringSlice(t *testing.T) {
data := `from-files:
- filename1
- filename2`
imp := Environment{}
err := yaml.Unmarshal([]byte(data), &imp)
assert.Nil(t, err)
assert.Equal(t, imp.Files, cYaml.StringOrSlice{"filename1", "filename2"})
}