-
Notifications
You must be signed in to change notification settings - Fork 13
/
s3.go
58 lines (43 loc) · 1.78 KB
/
s3.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
package mocks
import (
"time"
s3 "github.com/coretrix/hitrix/service/component/amazon/storage"
"github.com/latolukasz/beeorm"
"github.com/stretchr/testify/mock"
)
type FakeS3Client struct {
mock.Mock
}
func (t *FakeS3Client) GetObjectCachedURL(bucket string, object *s3.Object) string {
return t.Called(bucket, object).String(0)
}
func (t *FakeS3Client) GetObjectSignedURL(bucket string, object *s3.Object, expires time.Duration) string {
return t.Called(bucket, object, expires).String(0)
}
func (t *FakeS3Client) UploadObjectFromFile(_ *beeorm.Engine, bucket, localFile string) s3.Object {
return t.Called(bucket, localFile).Get(0).(s3.Object)
}
func (t *FakeS3Client) UploadObjectFromBase64(_ *beeorm.Engine, bucket, content, extension string) s3.Object {
return t.Called(bucket, content, extension).Get(0).(s3.Object)
}
func (t *FakeS3Client) UploadObjectFromByte(_ *beeorm.Engine, bucket string, byteData []byte, extension string) s3.Object {
return t.Called(bucket, byteData, extension).Get(0).(s3.Object)
}
func (t *FakeS3Client) UploadImageFromFile(_ *beeorm.Engine, bucket, localFile string) s3.Object {
return t.Called(bucket, localFile).Get(0).(s3.Object)
}
func (t *FakeS3Client) UploadImageFromBase64(_ *beeorm.Engine, bucket, image, extension string) s3.Object {
return t.Called(bucket, image, extension).Get(0).(s3.Object)
}
func (t *FakeS3Client) DeleteObject(bucket string, objects ...*s3.Object) bool {
return t.Called(bucket, objects).Get(0).(bool)
}
func (t *FakeS3Client) GetClient() interface{} {
return t.Called().Get(0)
}
func (t *FakeS3Client) CreateObjectFromKey(_ *beeorm.Engine, bucket, key string) s3.Object {
return t.Called(bucket, key).Get(0).(s3.Object)
}
func (t *FakeS3Client) GetBucketName(bucket string) string {
return t.Called(bucket).Get(0).(string)
}