Basic config package to parse NTP Pool system config
This commit is contained in:
26
config/config_test.go
Normal file
26
config/config_test.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestBaseURL(t *testing.T) {
|
||||
|
||||
os.Setenv("web_hostname", "www.ntp.dev, web.ntppool.dev")
|
||||
os.Setenv("web_tls", "yes")
|
||||
|
||||
c := New()
|
||||
if !c.Valid() {
|
||||
t.Fatalf("config not valid")
|
||||
}
|
||||
|
||||
q := url.Values{}
|
||||
q.Set("foo", "bar")
|
||||
u := c.WebURL("/foo", &q)
|
||||
if u != "https://www.ntp.dev/foo?foo=bar" {
|
||||
t.Fatalf("unexpected WebURL: %s", u)
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user