mirror of
https://github.com/crazy-max/diun.git
synced 2025-12-21 21:33:22 +01:00
Configuration file not required anymore DIUN_DB env var renamed DIUN_DB_PATH Only accept duration as timeout value (10 becomes 10s) Add getting started doc Enhanced documentation Add note about test notifications (#79) Improve configuration management Fix telegram init All fields in configuration now camelCased Improve configuration validation Update doc Update FAQ Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
44 lines
625 B
Go
44 lines
625 B
Go
package file
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestDecode_YAML(t *testing.T) {
|
|
f, err := ioutil.TempFile("", "traefik-config-*.yaml")
|
|
require.NoError(t, err)
|
|
defer func() {
|
|
_ = os.Remove(f.Name())
|
|
}()
|
|
|
|
_, err = f.Write([]byte(`
|
|
foo: bar
|
|
fii: bir
|
|
yi: {}
|
|
`))
|
|
require.NoError(t, err)
|
|
|
|
element := &Yo{
|
|
Fuu: "test",
|
|
}
|
|
|
|
err = Decode(f.Name(), element)
|
|
require.NoError(t, err)
|
|
|
|
expected := &Yo{
|
|
Foo: "bar",
|
|
Fii: "bir",
|
|
Fuu: "test",
|
|
Yi: &Yi{
|
|
Foo: "foo",
|
|
Fii: "fii",
|
|
},
|
|
}
|
|
assert.Equal(t, expected, element)
|
|
}
|