MCPcopy Create free account
hub / github.com/0xUnixIO/pulse / doEnrollToken

Function doEnrollToken

internal/serverapi/node_enroll_token_test.go:32–47  ·  view source on GitHub ↗
(t *testing.T, mux *http.ServeMux, nodeID string, body any)

Source from the content-addressed store, hash-verified

30}
31
32func doEnrollToken(t *testing.T, mux *http.ServeMux, nodeID string, body any) *httptest.ResponseRecorder {
33 t.Helper()
34 var r *http.Request
35 path := "/v1/nodes/" + nodeID + "/enroll-token"
36 if body == nil {
37 r = httptest.NewRequest(http.MethodPost, path, nil)
38 } else {
39 buf, _ := json.Marshal(body)
40 r = httptest.NewRequest(http.MethodPost, path, bytes.NewReader(buf))
41 r.Header.Set("Content-Type", "application/json")
42 }
43 r.Host = "panel.example.com"
44 w := httptest.NewRecorder()
45 mux.ServeHTTP(w, r)
46 return w
47}
48
49func TestNodeEnrollToken_DefaultTTL(t *testing.T) {
50 store := enrolltokens.NewMemoryStore()

Calls 1

ServeHTTPMethod · 0.80

Tested by

no test coverage detected