MCPcopy Create free account
hub / github.com/OctopusDeploy/cli / respondToSdkInit

Function respondToSdkInit

pkg/cmd/api/api_test.go:18–25  ·  view source on GitHub ↗

respondToSdkInit handles the two HTTP requests that the Octopus SDK makes when initialising the system client: fetching the root resource and listing spaces to find the default space.

(t *testing.T, api *testutil.MockHttpServer)

Source from the content-addressed store, hash-verified

16// when initialising the system client: fetching the root resource and listing
17// spaces to find the default space.
18func respondToSdkInit(t *testing.T, api *testutil.MockHttpServer) {
19 api.ExpectRequest(t, "GET", "/api/").RespondWith(testutil.NewRootResource())
20 api.ExpectRequest(t, "GET", "/api/spaces").RespondWith(map[string]any{
21 "Items": []any{},
22 "ItemsPerPage": 30,
23 "TotalResults": 0,
24 })
25}
26
27func TestApiCommand(t *testing.T) {
28 tests := []struct {

Callers 1

TestApiCommandFunction · 0.85

Calls 3

NewRootResourceFunction · 0.92
RespondWithMethod · 0.80
ExpectRequestMethod · 0.80

Tested by

no test coverage detected