This commit is contained in:
Michael Engelhardt 2020-11-21 04:07:38 +01:00
parent 5f10a92c36
commit c791986143

View File

@ -1,6 +1,9 @@
package config
import "testing"
import (
"fmt"
"testing"
)
func TestWebConfig_SocketAddress(t *testing.T) {
web := &webConfig{
@ -52,6 +55,18 @@ func TestWebConfig_ContextRootInvalid(t *testing.T) {
t.Fatal("Should've panicked because the configuration specifies an invalid context root")
}
func TestWebConfig_ContextRootNonParseable(t *testing.T) {
defer func() { recover() }()
web := &webConfig{
ContextRoot: "/invalid" + string([]byte{0x7F}) + "/",
}
web.validateAndSetDefaults()
t.Fatal(fmt.Sprintf("Should've panicked because the configuration specifies an invalid context root %s", web.ContextRoot))
}
func TestWebConfig_ContextRootMultiPath(t *testing.T) {
const expected = "/app/status/"
web := &webConfig{