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

Function TestInsertInvalidPEM

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

Source from the content-addressed store, hash-verified

380}
381
382func TestInsertInvalidPEM(t *testing.T) {
383 dbAccessor, err := prepDB()
384 if err != nil {
385 t.Fatal(err)
386 }
387
388 serialNumber, cert, _, signer, err := makeCertificate()
389
390 if err != nil {
391 t.Fatal(err)
392 }
393
394 resp, body := makeRequest(t, dbAccessor, signer, map[string]interface{}{
395 "serial_number": serialNumber.Text(10),
396 "authority_key_identifier": hex.EncodeToString(cert.AuthorityKeyId),
397 "status": "good",
398 "pem": "this is not a PEM certificate",
399 "expiry": cert.NotAfter.UTC().Format(time.RFC3339),
400 })
401
402 if resp.StatusCode != http.StatusBadRequest {
403 t.Fatal("Expected HTTP Bad Request, got", resp.StatusCode, string(body))
404 }
405}
406
407func TestInsertInvalidExpiry(t *testing.T) {
408 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…