package server import ( "github.com/matryer/is" "testing" "time" ) func TestConfiguration(t *testing.T) { is := is.New(t) c, _ := ConfigFromToml(` [server] port = 8002 host = "127.0.0.1" [admin] port = 8001 host = "127.0.0.1" [file] path = "/tmp/datta2" [database] backend = "sqlite" connection = "sql.db" [quota] default_size = "1MB" default_duration = "72h"`, ) is.Equal(c.Server.Port, int64(8002)) is.Equal(c.Server.Host, "127.0.0.1") is.Equal(c.Quota.ParsedSizeBytes(), int64(1024*1024)) is.Equal(c.Quota.ParsedDuration(), time.Duration(time.Hour*72)) }