Configuration test

master
Caj Larsson 3 years ago
parent 9858c52960
commit 6945646cd7

@ -0,0 +1,43 @@
package application
import (
"time"
"testing"
)
func TestConfiguration(t *testing.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"`,
)
if c.Server.Port != 8002 {
t.Errorf("port parsing failed")
}
if c.Server.Host != "127.0.0.1" {
t.Errorf("host parsing failed")
}
if c.Quota.ParsedSizeBytes() != 1024 * 1024 {
t.Errorf("quota size parsing failed")
}
if c.Quota.ParsedDuration() != time.Duration(time.Hour * 72) {
t.Errorf("quota size parsing failed")
}
}
Loading…
Cancel
Save