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:
Daniel McCarney 2018-08-10 15:24:45 -04:00 committed by GitHub
parent 3a8f0bc0be
commit 7de72eede6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 33 additions and 0 deletions

View File

@ -2127,6 +2127,22 @@ func TestKeyRollover(t *testing.T) {
}`,
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",
ACME13KeyRollover: true,
@ -2191,6 +2207,23 @@ func TestKeyRollover(t *testing.T) {
}`,
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 {