This repository has been archived by the owner on Feb 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
/
secret_version.go
103 lines (85 loc) · 3.26 KB
/
secret_version.go
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// +build !production
package fakeclient
import "github.com/secrethub/secrethub-go/internals/api"
// SecretVersionService can be used to mock a SecretVersionService.
type SecretVersionService struct {
Deleter SecretVersionDeleter
WithDataGetter WithDataGetter
WithoutDataGetter WithoutDataGetter
WithDataLister WithDataLister
WithoutDataLister WithoutDataLister
}
// Delete implements the SecretVersionService interface Delete function.
func (s *SecretVersionService) Delete(path string) error {
return s.Deleter.Delete(path)
}
// GetWithData implements the SecretVersionService interface GetWithData function.
func (s *SecretVersionService) GetWithData(path string) (*api.SecretVersion, error) {
return s.WithDataGetter.GetWithData(path)
}
// GetWithoutData implements the SecretVersionService interface GetWithoutData function.
func (s *SecretVersionService) GetWithoutData(path string) (*api.SecretVersion, error) {
return s.WithoutDataGetter.GetWithoutData(path)
}
// ListWithData implements the SecretVersionService interface ListWithData function.
func (s *SecretVersionService) ListWithData(path string) ([]*api.SecretVersion, error) {
return s.WithDataLister.ListWithData(path)
}
// ListWithoutData implements the SecretVersionService interface ListWithoutData function.
func (s *SecretVersionService) ListWithoutData(path string) ([]*api.SecretVersion, error) {
return s.WithoutDataLister.ListWithoutData(path)
}
// SecretVersionDeleter mocks the Delete function.
type SecretVersionDeleter struct {
ArgPath string
Err error
}
// Delete saves the arguments it was called with and returns the mocked response.
func (d *SecretVersionDeleter) Delete(path string) error {
d.ArgPath = path
return d.Err
}
// WithDataGetter mocks the GetWithData function.
type WithDataGetter struct {
ArgPath string
ReturnsVersion *api.SecretVersion
Err error
}
// GetWithData saves the arguments it was called with and returns the mocked response.
func (g *WithDataGetter) GetWithData(path string) (*api.SecretVersion, error) {
g.ArgPath = path
return g.ReturnsVersion, g.Err
}
// WithoutDataGetter mocks the GetWithoutData function.
type WithoutDataGetter struct {
ArgPath string
ReturnsVersion *api.SecretVersion
Err error
}
// GetWithoutData saves the arguments it was called with and returns the mocked response.
func (g *WithoutDataGetter) GetWithoutData(path string) (*api.SecretVersion, error) {
g.ArgPath = path
return g.ReturnsVersion, g.Err
}
// WithDataLister mocks the ListWithData function.
type WithDataLister struct {
ArgPath string
ReturnsVersions []*api.SecretVersion
Err error
}
// ListWithData saves the arguments it was called with and returns the mocked response.
func (l *WithDataLister) ListWithData(path string) ([]*api.SecretVersion, error) {
l.ArgPath = path
return l.ReturnsVersions, l.Err
}
// WithoutDataLister mocks the ListWithoutData function.
type WithoutDataLister struct {
ArgPath string
ReturnsVersions []*api.SecretVersion
Err error
}
// ListWithoutData saves the arguments it was called with and returns the mocked response.
func (l *WithoutDataLister) ListWithoutData(path string) ([]*api.SecretVersion, error) {
l.ArgPath = path
return l.ReturnsVersions, l.Err
}