You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
bog/server/configuration_test.go

33 lines
565 B
Go

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"
[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))
}