Skip to content

Commit

Permalink
Fix config test
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Castell committed Aug 24, 2018
1 parent ab311af commit a96224f
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions cmd/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,19 @@ import (
func TestReadConfigTags(t *testing.T) {
viper.Reset()
viper.SetConfigType("yaml")
var jsonConfig = []byte(`
tags:
- foo: bar
`)
viper.ReadConfig(bytes.NewBuffer(jsonConfig))
config := &dkron.Config{}
var yamlConfig = []byte(`
tags:
- foo: bar
`)
if err := viper.ReadConfig(bytes.NewBuffer(yamlConfig)); err != nil {
t.Fatal(err)
}
config := dkron.DefaultConfig()
viper.Unmarshal(config)
t.Log(config.Tags)
assert.Equal(t, "bar", config.Tags["foo"])

viper.Set("tag", []string{"monthy=python"})
config = dkron.DefaultConfig()
viper.Set("tags", map[string]string{"monthy": "python"})
viper.Unmarshal(config)
assert.NotContains(t, config.Tags, "foo")
assert.Contains(t, config.Tags, "monthy")
Expand Down

0 comments on commit a96224f

Please sign in to comment.