WFE2: Implement badOrderState err type
This commit is contained in:
parent
c85d4b097b
commit
6008202357
|
@ -21,6 +21,7 @@ const (
|
|||
CAAProblem = ProblemType("caa")
|
||||
DNSProblem = ProblemType("dns")
|
||||
AlreadyRevokedProblem = ProblemType("alreadyRevoked")
|
||||
OrderNotReadyProblem = ProblemType("orderNotReady")
|
||||
|
||||
V1ErrorNS = "urn:acme:error:"
|
||||
V2ErrorNS = "urn:ietf:params:acme:error:"
|
||||
|
@ -262,3 +263,12 @@ func DNS(detail string, a ...interface{}) *ProblemDetails {
|
|||
HTTPStatus: http.StatusBadRequest,
|
||||
}
|
||||
}
|
||||
|
||||
// OrderNotReady returns a ProblemDetails representing a OrderNotReadyProblem
|
||||
func OrderNotReady(detail string, a ...interface{}) *ProblemDetails {
|
||||
return &ProblemDetails{
|
||||
Type: OrderNotReadyProblem,
|
||||
Detail: fmt.Sprintf(detail, a...),
|
||||
HTTPStatus: http.StatusForbidden,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1808,7 +1808,7 @@ func (wfe *WebFrontEndImpl) FinalizeOrder(ctx context.Context, logEvent *web.Req
|
|||
// Only ready orders can be finalized.
|
||||
if *order.Status != string(core.StatusReady) {
|
||||
wfe.sendError(response, logEvent,
|
||||
probs.Malformed(
|
||||
probs.OrderNotReady(
|
||||
"Order's status (%q) is not acceptable for finalization",
|
||||
*order.Status),
|
||||
nil)
|
||||
|
|
|
@ -2165,7 +2165,7 @@ func TestFinalizeOrder(t *testing.T) {
|
|||
Name: "Order is already finalized",
|
||||
// mocks/mocks.go's StorageAuthority's GetOrder mock treats ID 1 as an Order with a Serial
|
||||
Request: signAndPost(t, "1/1", "http://localhost/1/1", goodCertCSRPayload, 1, wfe.nonceService),
|
||||
ExpectedBody: `{"type":"` + probs.V2ErrorNS + `malformed","detail":"Order's status (\"valid\") is not acceptable for finalization","status":400}`,
|
||||
ExpectedBody: `{"type":"` + probs.V2ErrorNS + `orderNotReady","detail":"Order's status (\"valid\") is not acceptable for finalization","status":403}`,
|
||||
},
|
||||
{
|
||||
Name: "Order is expired",
|
||||
|
@ -2176,7 +2176,7 @@ func TestFinalizeOrder(t *testing.T) {
|
|||
{
|
||||
Name: "Good CSR, Pending Order",
|
||||
Request: signAndPost(t, "1/4", "http://localhost/1/4", goodCertCSRPayload, 1, wfe.nonceService),
|
||||
ExpectedBody: `{"type":"` + probs.V2ErrorNS + `malformed","detail":"Order's status (\"pending\") is not acceptable for finalization","status":400}`,
|
||||
ExpectedBody: `{"type":"` + probs.V2ErrorNS + `orderNotReady","detail":"Order's status (\"pending\") is not acceptable for finalization","status":403}`,
|
||||
},
|
||||
{
|
||||
Name: "Good CSR, Ready Order",
|
||||
|
|
Loading…
Reference in New Issue