30 lines
846 B
Go
30 lines
846 B
Go
package rocsp
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
)
|
|
|
|
// MockWriteClient is a mock
|
|
type MockWriteClient struct {
|
|
StoreReponseReturnError error
|
|
}
|
|
|
|
// StoreResponse mocks a rocsp.StoreResponse method and returns nil or an
|
|
// error depending on the desired state.
|
|
func (r MockWriteClient) StoreResponse(ctx context.Context, respBytes []byte, shortIssuerID byte) error {
|
|
return r.StoreReponseReturnError
|
|
}
|
|
|
|
// NewMockWriteSucceedClient returns a mock MockWriteClient with a
|
|
// StoreResponse method that will always succeed.
|
|
func NewMockWriteSucceedClient() MockWriteClient {
|
|
return MockWriteClient{nil}
|
|
}
|
|
|
|
// NewMockWriteFailClient returns a mock MockWriteClient with a
|
|
// StoreResponse method that will always fail.
|
|
func NewMockWriteFailClient() MockWriteClient {
|
|
return MockWriteClient{StoreReponseReturnError: fmt.Errorf("could not store response")}
|
|
}
|