console: turn authentication into a proper component

This commit is contained in:
Vincent Bernat
2022-06-09 19:55:57 +02:00
parent 9e620f2c91
commit b65d78ab1b
13 changed files with 100 additions and 197 deletions

View File

@@ -7,10 +7,7 @@ import (
"strings"
"testing"
"akvorado/common/daemon"
"akvorado/common/helpers"
"akvorado/common/http"
"akvorado/common/reporter"
)
func TestServeDocs(t *testing.T) {
@@ -28,17 +25,9 @@ func TestServeDocs(t *testing.T) {
}
for _, tc := range cases {
t.Run(fmt.Sprintf("%s-%s", name, tc.Path), func(t *testing.T) {
r := reporter.NewMock(t)
h := http.NewMock(t, r)
conf := DefaultConfiguration()
conf.ServeLiveFS = live
c, err := New(r, conf, Dependencies{
Daemon: daemon.NewMock(t),
HTTP: h,
})
if err != nil {
t.Fatalf("New() error:\n%+v", err)
}
c, h, _, _ := NewMock(t, conf)
helpers.StartStop(t, c)
resp, err := netHTTP.Get(fmt.Sprintf("http://%s/api/v0/console/docs/%s",