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

Function TestInsertWrongSerial

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

Source from the content-addressed store, hash-verified

430}
431
432func TestInsertWrongSerial(t *testing.T) {
433 dbAccessor, err := prepDB()
434 if err != nil {
435 t.Fatal(err)
436 }
437
438 _, cert, pemBytes, signer, err := makeCertificate()
439
440 if err != nil {
441 t.Fatal(err)
442 }
443
444 resp, body := makeRequest(t, dbAccessor, signer, map[string]interface{}{
445 "serial_number": big.NewInt(1).Text(10),
446 "authority_key_identifier": hex.EncodeToString(cert.AuthorityKeyId),
447 "status": "good",
448 "pem": string(pemBytes),
449 "expiry": cert.NotAfter.UTC().Format(time.RFC3339),
450 })
451
452 if resp.StatusCode != http.StatusBadRequest {
453 t.Fatal("Expected HTTP Bad Request", resp.StatusCode, string(body))
454 }
455}
456
457func TestInsertWrongAKI(t *testing.T) {
458 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…