mirror of
https://github.com/empayre/fleet.git
synced 2024-11-07 01:15:22 +00:00
26dc30bd25
- Add new Apply spec methods for queries and packs - Remove now extraneous datastore/service methods - Remove import service (unused, and had many dependencies that this breaks) - Refactor tests as appropriate
28 lines
688 B
Go
28 lines
688 B
Go
package service
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"testing"
|
|
|
|
"github.com/gorilla/mux"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestDecodeGetScheduledQueriesInPackRequest(t *testing.T) {
|
|
router := mux.NewRouter()
|
|
router.HandleFunc("/api/v1/kolide/packs/{id}/scheduled", func(writer http.ResponseWriter, request *http.Request) {
|
|
r, err := decodeGetScheduledQueriesInPackRequest(context.Background(), request)
|
|
assert.Nil(t, err)
|
|
|
|
params := r.(getScheduledQueriesInPackRequest)
|
|
assert.Equal(t, uint(1), params.ID)
|
|
}).Methods("GET")
|
|
|
|
router.ServeHTTP(
|
|
httptest.NewRecorder(),
|
|
httptest.NewRequest("GET", "/api/v1/kolide/packs/1/scheduled", nil),
|
|
)
|
|
}
|