forked from TrueCloudLab/certificates
Add test case for ACME Revoke to Authority
This commit is contained in:
parent
06bb97c91e
commit
47a8a3c463
3 changed files with 19 additions and 0 deletions
|
@ -360,6 +360,7 @@ func (a *Authority) Revoke(ctx context.Context, revokeOpts *RevokeOptions) error
|
||||||
ReasonCode: revokeOpts.ReasonCode,
|
ReasonCode: revokeOpts.ReasonCode,
|
||||||
Reason: revokeOpts.Reason,
|
Reason: revokeOpts.Reason,
|
||||||
MTLS: revokeOpts.MTLS,
|
MTLS: revokeOpts.MTLS,
|
||||||
|
ACME: revokeOpts.ACME,
|
||||||
RevokedAt: time.Now().UTC(),
|
RevokedAt: time.Now().UTC(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
for name, f := range tests {
|
||||||
tc := f()
|
tc := f()
|
||||||
|
|
1
db/db.go
1
db/db.go
|
@ -104,6 +104,7 @@ type RevokedCertificateInfo struct {
|
||||||
RevokedAt time.Time
|
RevokedAt time.Time
|
||||||
TokenID string
|
TokenID string
|
||||||
MTLS bool
|
MTLS bool
|
||||||
|
ACME bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// IsRevoked returns whether or not a certificate with the given identifier
|
// IsRevoked returns whether or not a certificate with the given identifier
|
||||||
|
|
Loading…
Reference in a new issue