Files
invertergui/plugins/munin/munin_test.go
Nicholas Thompson fa6fc5fb34 Fix linter issues
Fix all new linter issues that are raised by golanglint-ci 1.56
2024-02-19 20:08:46 +02:00

30 lines
473 B
Go

package munin
import (
"io"
"net/http"
"net/http/httptest"
"testing"
"github.com/diebietse/invertergui/mk2driver"
)
func TestServer(_ *testing.T) {
mockMk2 := mk2driver.NewMk2Mock()
muninServer := NewMunin(mockMk2)
ts := httptest.NewServer(http.HandlerFunc(muninServer.ServeMuninHTTP))
defer ts.Close()
res, err := http.Get(ts.URL)
if err != nil {
log.Fatal(err)
}
_, err = io.ReadAll(res.Body)
res.Body.Close()
if err != nil {
log.Fatal(err)
}
}