(t *testing.T, mux *http.ServeMux, body any)
| 46 | } |
| 47 | |
| 48 | func 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 | |
| 64 | func TestEnrollSuccess(t *testing.T) { |
| 65 | ca := newTestCA(t) |
no test coverage detected