示例#1
0
func TestNoneDeleteCert(t *testing.T) {
	if err := cluster.DeleteCert(testCert); err != nil {
		t.Errorf("Failed to DELETE cert - %v", err)
		t.FailNow()
	}

	// don't use cluster.GetCerts()
	certs, err := database.GetCerts()
	if len(certs) != 0 {
		t.Error("Failed to DELETE cert - %v", err)
	}
}
示例#2
0
func deleteCert(rw http.ResponseWriter, req *http.Request) {
	var cert core.CertBundle
	err := parseBody(req, &cert)
	if err != nil {
		writeError(rw, req, err, http.StatusBadRequest)
		return
	}

	// save to cluster
	err = cluster.DeleteCert(cert)
	if err != nil {
		writeError(rw, req, err, http.StatusInternalServerError)
		return
	}

	writeBody(rw, req, apiMsg{"Success"}, http.StatusOK)
}