-
Notifications
You must be signed in to change notification settings - Fork 1
/
s3-crypto.go
183 lines (169 loc) · 6.08 KB
/
s3-crypto.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
// Code generated by moq; DO NOT EDIT.
// github.com/matryer/moq
package mock
import (
"github.com/ONSdigital/dp-s3"
"github.com/aws/aws-sdk-go/service/s3"
"sync"
)
var (
lockS3CryptoClientMockGetObjectWithPSK sync.RWMutex
lockS3CryptoClientMockPutObjectWithPSK sync.RWMutex
lockS3CryptoClientMockUploadPartWithPSK sync.RWMutex
)
// Ensure, that S3CryptoClientMock does implement s3client.S3CryptoClient.
// If this is not the case, regenerate this file with moq.
var _ s3client.S3CryptoClient = &S3CryptoClientMock{}
// Example of how to instantiate a mock for testing - this code is automatically generated
// S3CryptoClientMock is a mock implementation of s3client.S3CryptoClient.
//
// func TestSomethingThatUsesS3CryptoClient(t *testing.T) {
//
// // make and configure a mocked s3client.S3CryptoClient
// mockedS3CryptoClient := &S3CryptoClientMock{
// GetObjectWithPSKFunc: func(in *s3.GetObjectInput, psk []byte) (*s3.GetObjectOutput, error) {
// panic("mock out the GetObjectWithPSK method")
// },
// PutObjectWithPSKFunc: func(in *s3.PutObjectInput, psk []byte) (*s3.PutObjectOutput, error) {
// panic("mock out the PutObjectWithPSK method")
// },
// UploadPartWithPSKFunc: func(in *s3.UploadPartInput, psk []byte) (*s3.UploadPartOutput, error) {
// panic("mock out the UploadPartWithPSK method")
// },
// }
//
// // use mockedS3CryptoClient in code that requires s3client.S3CryptoClient
// // and then make assertions.
//
// }
type S3CryptoClientMock struct {
// GetObjectWithPSKFunc mocks the GetObjectWithPSK method.
GetObjectWithPSKFunc func(in *s3.GetObjectInput, psk []byte) (*s3.GetObjectOutput, error)
// PutObjectWithPSKFunc mocks the PutObjectWithPSK method.
PutObjectWithPSKFunc func(in *s3.PutObjectInput, psk []byte) (*s3.PutObjectOutput, error)
// UploadPartWithPSKFunc mocks the UploadPartWithPSK method.
UploadPartWithPSKFunc func(in *s3.UploadPartInput, psk []byte) (*s3.UploadPartOutput, error)
// calls tracks calls to the methods.
calls struct {
// GetObjectWithPSK holds details about calls to the GetObjectWithPSK method.
GetObjectWithPSK []struct {
// In is the in argument value.
In *s3.GetObjectInput
// Psk is the psk argument value.
Psk []byte
}
// PutObjectWithPSK holds details about calls to the PutObjectWithPSK method.
PutObjectWithPSK []struct {
// In is the in argument value.
In *s3.PutObjectInput
// Psk is the psk argument value.
Psk []byte
}
// UploadPartWithPSK holds details about calls to the UploadPartWithPSK method.
UploadPartWithPSK []struct {
// In is the in argument value.
In *s3.UploadPartInput
// Psk is the psk argument value.
Psk []byte
}
}
}
// GetObjectWithPSK calls GetObjectWithPSKFunc.
func (mock *S3CryptoClientMock) GetObjectWithPSK(in *s3.GetObjectInput, psk []byte) (*s3.GetObjectOutput, error) {
if mock.GetObjectWithPSKFunc == nil {
panic("S3CryptoClientMock.GetObjectWithPSKFunc: method is nil but S3CryptoClient.GetObjectWithPSK was just called")
}
callInfo := struct {
In *s3.GetObjectInput
Psk []byte
}{
In: in,
Psk: psk,
}
lockS3CryptoClientMockGetObjectWithPSK.Lock()
mock.calls.GetObjectWithPSK = append(mock.calls.GetObjectWithPSK, callInfo)
lockS3CryptoClientMockGetObjectWithPSK.Unlock()
return mock.GetObjectWithPSKFunc(in, psk)
}
// GetObjectWithPSKCalls gets all the calls that were made to GetObjectWithPSK.
// Check the length with:
// len(mockedS3CryptoClient.GetObjectWithPSKCalls())
func (mock *S3CryptoClientMock) GetObjectWithPSKCalls() []struct {
In *s3.GetObjectInput
Psk []byte
} {
var calls []struct {
In *s3.GetObjectInput
Psk []byte
}
lockS3CryptoClientMockGetObjectWithPSK.RLock()
calls = mock.calls.GetObjectWithPSK
lockS3CryptoClientMockGetObjectWithPSK.RUnlock()
return calls
}
// PutObjectWithPSK calls PutObjectWithPSKFunc.
func (mock *S3CryptoClientMock) PutObjectWithPSK(in *s3.PutObjectInput, psk []byte) (*s3.PutObjectOutput, error) {
if mock.PutObjectWithPSKFunc == nil {
panic("S3CryptoClientMock.PutObjectWithPSKFunc: method is nil but S3CryptoClient.PutObjectWithPSK was just called")
}
callInfo := struct {
In *s3.PutObjectInput
Psk []byte
}{
In: in,
Psk: psk,
}
lockS3CryptoClientMockPutObjectWithPSK.Lock()
mock.calls.PutObjectWithPSK = append(mock.calls.PutObjectWithPSK, callInfo)
lockS3CryptoClientMockPutObjectWithPSK.Unlock()
return mock.PutObjectWithPSKFunc(in, psk)
}
// PutObjectWithPSKCalls gets all the calls that were made to PutObjectWithPSK.
// Check the length with:
// len(mockedS3CryptoClient.PutObjectWithPSKCalls())
func (mock *S3CryptoClientMock) PutObjectWithPSKCalls() []struct {
In *s3.PutObjectInput
Psk []byte
} {
var calls []struct {
In *s3.PutObjectInput
Psk []byte
}
lockS3CryptoClientMockPutObjectWithPSK.RLock()
calls = mock.calls.PutObjectWithPSK
lockS3CryptoClientMockPutObjectWithPSK.RUnlock()
return calls
}
// UploadPartWithPSK calls UploadPartWithPSKFunc.
func (mock *S3CryptoClientMock) UploadPartWithPSK(in *s3.UploadPartInput, psk []byte) (*s3.UploadPartOutput, error) {
if mock.UploadPartWithPSKFunc == nil {
panic("S3CryptoClientMock.UploadPartWithPSKFunc: method is nil but S3CryptoClient.UploadPartWithPSK was just called")
}
callInfo := struct {
In *s3.UploadPartInput
Psk []byte
}{
In: in,
Psk: psk,
}
lockS3CryptoClientMockUploadPartWithPSK.Lock()
mock.calls.UploadPartWithPSK = append(mock.calls.UploadPartWithPSK, callInfo)
lockS3CryptoClientMockUploadPartWithPSK.Unlock()
return mock.UploadPartWithPSKFunc(in, psk)
}
// UploadPartWithPSKCalls gets all the calls that were made to UploadPartWithPSK.
// Check the length with:
// len(mockedS3CryptoClient.UploadPartWithPSKCalls())
func (mock *S3CryptoClientMock) UploadPartWithPSKCalls() []struct {
In *s3.UploadPartInput
Psk []byte
} {
var calls []struct {
In *s3.UploadPartInput
Psk []byte
}
lockS3CryptoClientMockUploadPartWithPSK.RLock()
calls = mock.calls.UploadPartWithPSK
lockS3CryptoClientMockUploadPartWithPSK.RUnlock()
return calls
}