mirror of
https://github.com/spf13/viper
synced 2024-12-22 19:47:01 +00:00
existing tests pass
This commit is contained in:
parent
a28bee1fba
commit
f8939d9229
2 changed files with 6 additions and 6 deletions
2
viper.go
2
viper.go
|
@ -519,7 +519,7 @@ func getRemoteConfig(provider *remoteProvider) (map[string]interface{}, error) {
|
||||||
case "etcd":
|
case "etcd":
|
||||||
return getEtcdConfig(provider)
|
return getEtcdConfig(provider)
|
||||||
case "consul":
|
case "consul":
|
||||||
// do something
|
// not implemented yet
|
||||||
|
|
||||||
}
|
}
|
||||||
return config, nil
|
return config, nil
|
||||||
|
|
|
@ -65,7 +65,7 @@ func TestMarshalling(t *testing.T) {
|
||||||
SetConfigType("yaml")
|
SetConfigType("yaml")
|
||||||
r := bytes.NewReader(yamlExample)
|
r := bytes.NewReader(yamlExample)
|
||||||
|
|
||||||
MarshallReader(r)
|
MarshallReader(r, config)
|
||||||
assert.True(t, InConfig("name"))
|
assert.True(t, InConfig("name"))
|
||||||
assert.False(t, InConfig("state"))
|
assert.False(t, InConfig("state"))
|
||||||
assert.Equal(t, "steve", Get("name"))
|
assert.Equal(t, "steve", Get("name"))
|
||||||
|
@ -106,7 +106,7 @@ func TestYML(t *testing.T) {
|
||||||
SetConfigType("yml")
|
SetConfigType("yml")
|
||||||
r := bytes.NewReader(yamlExample)
|
r := bytes.NewReader(yamlExample)
|
||||||
|
|
||||||
MarshallReader(r)
|
MarshallReader(r, config)
|
||||||
assert.Equal(t, "steve", Get("name"))
|
assert.Equal(t, "steve", Get("name"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ func TestJSON(t *testing.T) {
|
||||||
SetConfigType("json")
|
SetConfigType("json")
|
||||||
r := bytes.NewReader(jsonExample)
|
r := bytes.NewReader(jsonExample)
|
||||||
|
|
||||||
MarshallReader(r)
|
MarshallReader(r, config)
|
||||||
assert.Equal(t, "0001", Get("id"))
|
assert.Equal(t, "0001", Get("id"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,14 +122,14 @@ func TestTOML(t *testing.T) {
|
||||||
SetConfigType("toml")
|
SetConfigType("toml")
|
||||||
r := bytes.NewReader(tomlExample)
|
r := bytes.NewReader(tomlExample)
|
||||||
|
|
||||||
MarshallReader(r)
|
MarshallReader(r, config)
|
||||||
assert.Equal(t, "TOML Example", Get("title"))
|
assert.Equal(t, "TOML Example", Get("title"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestEnv(t *testing.T) {
|
func TestEnv(t *testing.T) {
|
||||||
SetConfigType("json")
|
SetConfigType("json")
|
||||||
r := bytes.NewReader(jsonExample)
|
r := bytes.NewReader(jsonExample)
|
||||||
MarshallReader(r)
|
MarshallReader(r, config)
|
||||||
BindEnv("id")
|
BindEnv("id")
|
||||||
BindEnv("f", "FOOD")
|
BindEnv("f", "FOOD")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue