-
Notifications
You must be signed in to change notification settings - Fork 14
/
oss.go
70 lines (52 loc) · 2.29 KB
/
oss.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
package mocks
import (
"time"
"github.com/latolukasz/beeorm"
"github.com/stretchr/testify/mock"
"github.com/coretrix/hitrix/service/component/oss"
)
type FakeOSSClient struct {
mock.Mock
}
func (t *FakeOSSClient) GetClient() interface{} {
return nil
}
func (t *FakeOSSClient) GetObjectURL(bucket string, object *oss.Object) (string, error) {
return t.Called(bucket, object).Get(0).(string), nil
}
func (t *FakeOSSClient) GetObjectOSSURL(bucket string, object *oss.Object) (string, error) {
return t.Called(bucket, object).Get(0).(string), nil
}
func (t *FakeOSSClient) GetObjectCDNURL(bucket string, object *oss.Object) (string, error) {
return t.Called(bucket, object).Get(0).(string), nil
}
func (t *FakeOSSClient) GetObjectSignedURL(bucket string, object *oss.Object, expires time.Time) (string, error) {
return t.Called(bucket, object, expires).Get(0).(string), nil
}
func (t *FakeOSSClient) GetObjectBase64Content(bucket string, object *oss.Object) (string, error) {
return t.Called(bucket, object).Get(0).(string), nil
}
func (t *FakeOSSClient) UploadObjectFromFile(_ *beeorm.Engine, bucket, path, localFile string) (oss.Object, error) {
return t.Called(bucket, path, localFile).Get(0).(oss.Object), nil
}
func (t *FakeOSSClient) UploadObjectFromBase64(_ *beeorm.Engine, bucket, path, content, extension string) (oss.Object, error) {
return t.Called(bucket, path, content, extension).Get(0).(oss.Object), nil
}
func (t *FakeOSSClient) UploadObjectFromByte(_ *beeorm.Engine, bucket, path string, content []byte, extension string) (oss.Object, error) {
return t.Called(bucket, path, content, extension).Get(0).(oss.Object), nil
}
func (t *FakeOSSClient) UploadImageFromFile(_ *beeorm.Engine, bucket, path, localFile string) (oss.Object, error) {
return t.Called(bucket, path, localFile).Get(0).(oss.Object), nil
}
func (t *FakeOSSClient) UploadImageFromBase64(_ *beeorm.Engine, bucket, path, image, extension string) (oss.Object, error) {
return t.Called(bucket, path, image, extension).Get(0).(oss.Object), nil
}
func (t *FakeOSSClient) DeleteObject(_ string, _ *oss.Object) error {
return nil
}
func (t *FakeOSSClient) CreateObjectFromKey(_ *beeorm.Engine, _, _ string) oss.Object {
return oss.Object{}
}
func (t *FakeOSSClient) GetUploaderBucketConfig() *oss.BucketConfig {
return &oss.BucketConfig{}
}