WFE2: Add unit tests for draft-12/draft-13 intercompat. (#3816)
The implementation of the `features.ACME13KeyRollover` flag was written with the intent to allow client developers to send both the `"newKey"` and `"oldKey"` and be interoperable between both feature flag states. We should have an explicit unit test for this to be sure it works as intended.
This commit is contained in:
parent
3a8f0bc0be
commit
7de72eede6
|
|
@ -2127,6 +2127,22 @@ func TestKeyRollover(t *testing.T) {
|
||||||
}`,
|
}`,
|
||||||
NewKey: newKeyPriv,
|
NewKey: newKeyPriv,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "Valid key rollover request, added ACME13KeyRollover compat",
|
||||||
|
Payload: `{"newKey":` + string(newJWKJSON) + `, "oldKey":` + test1KeyPublicJSON + `, "account":"http://localhost/acme/acct/1"}`,
|
||||||
|
ExpectedResponse: `{
|
||||||
|
"id": 1,
|
||||||
|
"key": ` + string(newJWKJSON) + `,
|
||||||
|
"contact": [
|
||||||
|
"mailto:person@mail.com"
|
||||||
|
],
|
||||||
|
"agreement": "http://example.invalid/terms",
|
||||||
|
"initialIp": "",
|
||||||
|
"createdAt": "0001-01-01T00:00:00Z",
|
||||||
|
"status": "valid"
|
||||||
|
}`,
|
||||||
|
NewKey: newKeyPriv,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Name: "ACME13KeyRollover, legacy rollover request",
|
Name: "ACME13KeyRollover, legacy rollover request",
|
||||||
ACME13KeyRollover: true,
|
ACME13KeyRollover: true,
|
||||||
|
|
@ -2191,6 +2207,23 @@ func TestKeyRollover(t *testing.T) {
|
||||||
}`,
|
}`,
|
||||||
NewKey: newKeyPriv,
|
NewKey: newKeyPriv,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
Name: "ACME13KeyRollover, Valid key rollover request, legacy compat",
|
||||||
|
ACME13KeyRollover: true,
|
||||||
|
Payload: `{"oldKey":` + test1KeyPublicJSON + `, "newKey":` + string(newJWKJSON) + `, "account":"http://localhost/acme/acct/1"}`,
|
||||||
|
ExpectedResponse: `{
|
||||||
|
"id": 1,
|
||||||
|
"key": ` + string(newJWKJSON) + `,
|
||||||
|
"contact": [
|
||||||
|
"mailto:person@mail.com"
|
||||||
|
],
|
||||||
|
"agreement": "http://example.invalid/terms",
|
||||||
|
"initialIp": "",
|
||||||
|
"createdAt": "0001-01-01T00:00:00Z",
|
||||||
|
"status": "valid"
|
||||||
|
}`,
|
||||||
|
NewKey: newKeyPriv,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range testCases {
|
for _, tc := range testCases {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue