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.
44 lines
665 B
Go
44 lines
665 B
Go
3 years ago
|
package server
|
||
3 years ago
|
|
||
|
|
||
|
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")
|
||
|
}
|
||
|
}
|