27 lines
400 B
Go
27 lines
400 B
Go
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)
|
|
}
|
|
|
|
}
|