~bigbes/core-go

293ca65a4fa5d0d699ae107be3b89910bfbcd168 — Conrad Hoffmann 1 year, 5 months ago 038ec76
auth: fix middleware tests

They got broken with 6eae2199 because the tests cannot use
`config.LoadConfig`, so the list of internal IP nets never gets
populated.
1 files changed, 7 insertions(+), 0 deletions(-)

M auth/middleware_test.go
M auth/middleware_test.go => auth/middleware_test.go +7 -0
@@ 3,6 3,7 @@ package auth
import (
	"context"
	"encoding/json"
	"net"
	"net/http"
	"strings"
	"testing"


@@ 165,6 166,12 @@ internal-ipnet=127.0.0.1/24,::1/64`))
		panic(err)
	}
	crypto.InitCrypto(conf)

	// This doesn't get populated because we can't use config.LoadFile
	_, local4, _ := net.ParseCIDR("127.0.0.1/8")
	_, local6, _ := net.ParseCIDR("::1/64")
	config.InternalIPNet = append(config.InternalIPNet, *local4)
	config.InternalIPNet = append(config.InternalIPNet, *local6)
}

func middleware() (http.HandlerFunc, *context.Context, *bool) {