forked from adamlaska/boulder
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmocks.go
More file actions
30 lines (25 loc) · 873 Bytes
/
mocks.go
File metadata and controls
30 lines (25 loc) · 873 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package rocsp
import (
"context"
"fmt"
"time"
)
// 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, ttl time.Duration) 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")}
}