Review feedback

This commit is contained in:
Roland Shoemaker 2018-11-14 12:17:26 -08:00
parent de07ec2a74
commit 75728ea2b5
2 changed files with 6 additions and 8 deletions

View File

@ -1168,11 +1168,11 @@ func TestChallenge(t *testing.T) {
} }
// MockRAUpdateAuthorizationError is a mock RA that just returns an error on UpdateAuthorization // MockRAUpdateAuthorizationError is a mock RA that just returns an error on UpdateAuthorization
type MockRAStrictUpdateAuthz struct { type MockRAUpdateAuthorizationError struct {
MockRegistrationAuthority MockRegistrationAuthority
} }
func (ra *MockRAStrictUpdateAuthz) UpdateAuthorization(_ context.Context, authz core.Authorization, _ int, _ core.Challenge) (core.Authorization, error) { func (ra *MockRAUpdateAuthorizationError) UpdateAuthorization(_ context.Context, authz core.Authorization, _ int, _ core.Challenge) (core.Authorization, error) {
return core.Authorization{}, errors.New("broken on purpose") return core.Authorization{}, errors.New("broken on purpose")
} }
@ -1181,7 +1181,7 @@ func (ra *MockRAStrictUpdateAuthz) UpdateAuthorization(_ context.Context, authz
// the RA. // the RA.
func TestUpdateChallengeFinalizedAuthz(t *testing.T) { func TestUpdateChallengeFinalizedAuthz(t *testing.T) {
wfe, _ := setupWFE(t) wfe, _ := setupWFE(t)
wfe.RA = &MockRAStrictUpdateAuthz{} wfe.RA = &MockRAUpdateAuthorizationError{}
responseWriter := httptest.NewRecorder() responseWriter := httptest.NewRecorder()
path := "valid/23" path := "valid/23"
@ -1190,7 +1190,6 @@ func TestUpdateChallengeFinalizedAuthz(t *testing.T) {
signRequest(t, `{"resource":"challenge"}`, wfe.nonceService))) signRequest(t, `{"resource":"challenge"}`, wfe.nonceService)))
body := responseWriter.Body.String() body := responseWriter.Body.String()
fmt.Println(body)
test.AssertUnmarshaledEquals(t, body, `{ test.AssertUnmarshaledEquals(t, body, `{
"type": "dns", "type": "dns",
"uri": "http://localhost/acme/challenge/valid/23" "uri": "http://localhost/acme/challenge/valid/23"

View File

@ -1099,11 +1099,11 @@ func TestChallenge(t *testing.T) {
} }
// MockRAUpdateAuthorizationError is a mock RA that just returns an error on UpdateAuthorization // MockRAUpdateAuthorizationError is a mock RA that just returns an error on UpdateAuthorization
type MockRAStrictUpdateAuthz struct { type MockRAUpdateAuthorizationError struct {
MockRegistrationAuthority MockRegistrationAuthority
} }
func (ra *MockRAStrictUpdateAuthz) UpdateAuthorization(_ context.Context, authz core.Authorization, _ int, _ core.Challenge) (core.Authorization, error) { func (ra *MockRAUpdateAuthorizationError) UpdateAuthorization(_ context.Context, authz core.Authorization, _ int, _ core.Challenge) (core.Authorization, error) {
return core.Authorization{}, errors.New("broken on purpose") return core.Authorization{}, errors.New("broken on purpose")
} }
@ -1112,7 +1112,7 @@ func (ra *MockRAStrictUpdateAuthz) UpdateAuthorization(_ context.Context, authz
// the RA. // the RA.
func TestUpdateChallengeFinalizedAuthz(t *testing.T) { func TestUpdateChallengeFinalizedAuthz(t *testing.T) {
wfe, _ := setupWFE(t) wfe, _ := setupWFE(t)
wfe.RA = &MockRAStrictUpdateAuthz{} wfe.RA = &MockRAUpdateAuthorizationError{}
responseWriter := httptest.NewRecorder() responseWriter := httptest.NewRecorder()
signedURL := "http://localhost/valid/23" signedURL := "http://localhost/valid/23"
@ -1121,7 +1121,6 @@ func TestUpdateChallengeFinalizedAuthz(t *testing.T) {
wfe.Challenge(ctx, newRequestEvent(), responseWriter, request) wfe.Challenge(ctx, newRequestEvent(), responseWriter, request)
body := responseWriter.Body.String() body := responseWriter.Body.String()
fmt.Println(body)
test.AssertUnmarshaledEquals(t, body, `{ test.AssertUnmarshaledEquals(t, body, `{
"type": "dns", "type": "dns",
"url": "http://localhost/acme/challenge/valid/23" "url": "http://localhost/acme/challenge/valid/23"