MCPcopy Create free account
hub / github.com/cloudflare/cfssl / TestInsertInvalidSerial

Function TestInsertInvalidSerial

api/certadd/insert_test.go:307–330  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

305}
306
307func TestInsertInvalidSerial(t *testing.T) {
308 dbAccessor, err := prepDB()
309 if err != nil {
310 t.Fatal(err)
311 }
312
313 _, cert, pemBytes, signer, err := makeCertificate()
314
315 if err != nil {
316 t.Fatal(err)
317 }
318
319 resp, body := makeRequest(t, dbAccessor, signer, map[string]interface{}{
320 "serial_number": "this is not a serial number",
321 "authority_key_identifier": hex.EncodeToString(cert.AuthorityKeyId),
322 "status": "good",
323 "pem": string(pemBytes),
324 "expiry": cert.NotAfter.UTC().Format(time.RFC3339),
325 })
326
327 if resp.StatusCode != http.StatusBadRequest {
328 t.Fatal("Expected HTTP Bad Request", resp.StatusCode, string(body))
329 }
330}
331
332func TestInsertInvalidAKI(t *testing.T) {
333 dbAccessor, err := prepDB()

Callers

nothing calls this directly

Calls 3

makeCertificateFunction · 0.85
makeRequestFunction · 0.85
prepDBFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…