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

Function TestEnrollInvalidCSR

internal/serverapi/enroll_test.go:180–193  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

178}
179
180func TestEnrollInvalidCSR(t *testing.T) {
181 ca := newTestCA(t)
182 store := enrolltokens.NewMemoryStore()
183 ctx := context.Background()
184 tok := enrolltokens.Token{Token: "tk-bad-csr", NodeID: "n", ExpiresAt: time.Now().Add(time.Hour)}
185 _ = store.Insert(ctx, tok)
186
187 mux := http.NewServeMux()
188 RegisterEnrollEndpoint(mux, ca, store, "")
189 w := doEnroll(t, mux, enrollRequest{NodeID: "n", CSRPem: "not a csr", Token: tok.Token})
190 if w.Code != http.StatusBadRequest {
191 t.Fatalf("status=%d", w.Code)
192 }
193}
194
195func TestEnrollMissingFields(t *testing.T) {
196 ca := newTestCA(t)

Callers

nothing calls this directly

Calls 6

InsertMethod · 0.95
NewMemoryStoreFunction · 0.92
RegisterEnrollEndpointFunction · 0.85
doEnrollFunction · 0.85
AddMethod · 0.80
newTestCAFunction · 0.70

Tested by

no test coverage detected