(t *testing.T)
| 163 | } |
| 164 | |
| 165 | func TestEnrollNodeIDMismatch(t *testing.T) { |
| 166 | ca := newTestCA(t) |
| 167 | store := enrolltokens.NewMemoryStore() |
| 168 | ctx := context.Background() |
| 169 | tok := enrolltokens.Token{Token: "tk-mm", NodeID: "node-A", ExpiresAt: time.Now().Add(time.Hour)} |
| 170 | _ = store.Insert(ctx, tok) |
| 171 | |
| 172 | mux := http.NewServeMux() |
| 173 | RegisterEnrollEndpoint(mux, ca, store, "") |
| 174 | w := doEnroll(t, mux, enrollRequest{NodeID: "node-B", CSRPem: newTestCSR(t, "node-B"), Token: tok.Token}) |
| 175 | if w.Code != http.StatusUnauthorized { |
| 176 | t.Fatalf("status=%d body=%s", w.Code, w.Body.String()) |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | func TestEnrollInvalidCSR(t *testing.T) { |
| 181 | ca := newTestCA(t) |
nothing calls this directly
no test coverage detected