Add test case for ACME Revoke to Authority

This commit is contained in:
Herman Slatman 2021-12-02 17:11:36 +01:00
parent 06bb97c91e
commit 47a8a3c463
No known key found for this signature in database
GPG key ID: F4D8A44EA0A75A4F
3 changed files with 19 additions and 0 deletions

View file

@ -360,6 +360,7 @@ func (a *Authority) Revoke(ctx context.Context, revokeOpts *RevokeOptions) error
ReasonCode: revokeOpts.ReasonCode,
Reason: revokeOpts.Reason,
MTLS: revokeOpts.MTLS,
ACME: revokeOpts.ACME,
RevokedAt: time.Now().UTC(),
}

View file

@ -1267,6 +1267,23 @@ func TestAuthority_Revoke(t *testing.T) {
},
}
},
"ok/ACME": func() test {
_a := testAuthority(t, WithDatabase(&db.MockAuthDB{}))
crt, err := pemutil.ReadCertificate("./testdata/certs/foo.crt")
assert.FatalError(t, err)
return test{
auth: _a,
opts: &RevokeOptions{
Crt: crt,
Serial: "102012593071130646873265215610956555026",
ReasonCode: reasonCode,
Reason: reason,
ACME: true,
},
}
},
}
for name, f := range tests {
tc := f()

View file

@ -104,6 +104,7 @@ type RevokedCertificateInfo struct {
RevokedAt time.Time
TokenID string
MTLS bool
ACME bool
}
// IsRevoked returns whether or not a certificate with the given identifier