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

Function doEnroll

internal/serverapi/enroll_test.go:48–62  ·  view source on GitHub ↗
(t *testing.T, mux *http.ServeMux, body any)

Source from the content-addressed store, hash-verified

46}
47
48func doEnroll(t *testing.T, mux *http.ServeMux, body any) *httptest.ResponseRecorder {
49 t.Helper()
50 var r *http.Request
51 switch v := body.(type) {
52 case string:
53 r = httptest.NewRequest(http.MethodPost, "/v1/node-enroll", strings.NewReader(v))
54 default:
55 buf, _ := json.Marshal(v)
56 r = httptest.NewRequest(http.MethodPost, "/v1/node-enroll", bytes.NewReader(buf))
57 }
58 r.Header.Set("Content-Type", "application/json")
59 w := httptest.NewRecorder()
60 mux.ServeHTTP(w, r)
61 return w
62}
63
64func TestEnrollSuccess(t *testing.T) {
65 ca := newTestCA(t)

Callers 7

TestEnrollSuccessFunction · 0.85
TestEnrollTokenNotFoundFunction · 0.85
TestEnrollTokenExpiredFunction · 0.85
TestEnrollNodeIDMismatchFunction · 0.85
TestEnrollInvalidCSRFunction · 0.85
TestEnrollMissingFieldsFunction · 0.85

Calls 1

ServeHTTPMethod · 0.80

Tested by

no test coverage detected