commit - 87154adc3ffe738b0e1223d666c0ae63e1926399
commit + 62bf235cf08fdde3e89d389bdc78b8602069b28c
blob - 1f48b98148f9c7834c9e516cdfa9238b4c297c99
blob + 0efdde60577820a6358e4b75bb865e043efa2199
--- icinga_test.go
+++ icinga_test.go
"encoding/json"
"errors"
"fmt"
- "io"
"math/rand"
"net/http"
"net/http/httptest"
- "os"
"path"
"reflect"
"sort"
}
func (f *fakeServer) Permissions(w http.ResponseWriter) {
- file, err := os.Open("testdata/permissions.json")
- if err != nil {
- panic(err)
- }
- defer file.Close()
- io.Copy(w, file)
+ fmt.Fprint(w, `{"results": [{
+ "info": "Fake Icinga2 server",
+ "permissions": ["*"],
+ "user": "icinga",
+ "version": "fake"
+ }]}`)
+
}
type apiResponse struct {
}
type apiResult struct {
- Name string `json:"name"`
- Type string `json:"type"`
+ Name string `json:"name"`
+ Type string `json:"type"`
Attrs attributes `json:"attrs"`
}
resp := apiResponse{
Results: []apiResult{
apiResult{
- Name: path.Base(req.URL.Path),
- Type: objType(req.URL.Path),
+ Name: path.Base(req.URL.Path),
+ Type: objType(req.URL.Path),
Attrs: attrs,
},
},