File
Blob: spec/mocks/pki.go
| 1 | //go:build !no_mocks |
| 2 | |
| 3 | package mocks |
| 4 | |
| 5 | import ( |
| 6 | "context" |
| 7 | |
| 8 | "go.miragespace.co/specter/spec/protocol" |
| 9 | |
| 10 | "github.com/stretchr/testify/mock" |
| 11 | ) |
| 12 | |
| 13 | type PKIClient struct { |
| 14 | mock.Mock |
| 15 | } |
| 16 | |
| 17 | func (p *PKIClient) RequestCertificate(ctx context.Context, req *protocol.CertificateRequest) (*protocol.CertificateResponse, error) { |
| 18 | args := p.Called(ctx, req) |
| 19 | r := args.Get(0) |
| 20 | e := args.Error(1) |
| 21 | if e != nil { |
| 22 | return nil, e |
| 23 | } |
| 24 | return r.(*protocol.CertificateResponse), nil |
| 25 | } |
| 26 | |
| 27 | func (p *PKIClient) RenewCertificate(ctx context.Context, req *protocol.CertificateRenewalRequest) (*protocol.CertificateResponse, error) { |
| 28 | args := p.Called(ctx, req) |
| 29 | r := args.Get(0) |
| 30 | e := args.Error(1) |
| 31 | if e != nil { |
| 32 | return nil, e |
| 33 | } |
| 34 | return r.(*protocol.CertificateResponse), nil |
| 35 | } |
| 36 | |
| 37 | var _ protocol.PKIService = (*PKIClient)(nil) |