-
Notifications
You must be signed in to change notification settings - Fork 14
/
oss.go
46 lines (34 loc) · 1.46 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
package mocks
import (
"time"
"github.com/coretrix/hitrix/service/component/oss"
"github.com/latolukasz/beeorm"
"github.com/stretchr/testify/mock"
)
type FakeOSSClient struct {
mock.Mock
}
func (t *FakeOSSClient) GetObjectURL(bucket string, object *oss.Object) string {
return t.Called(bucket, object).String(0)
}
func (t *FakeOSSClient) GetObjectCachedURL(bucket string, object *oss.Object) string {
return t.Called(bucket, object).String(0)
}
func (t *FakeOSSClient) GetObjectSignedURL(bucket string, object *oss.Object, expires time.Time) string {
return t.Called(bucket, object, expires).String(0)
}
func (t *FakeOSSClient) UploadObjectFromFile(_ *beeorm.Engine, bucket, localFile string) oss.Object {
return t.Called(bucket, localFile).Get(0).(oss.Object)
}
func (t *FakeOSSClient) UploadObjectFromBase64(_ *beeorm.Engine, bucket, content, extension string) oss.Object {
return t.Called(bucket, content, extension).Get(0).(oss.Object)
}
func (t *FakeOSSClient) UploadImageFromFile(_ *beeorm.Engine, bucket, localFile string) oss.Object {
return t.Called(bucket, localFile).Get(0).(oss.Object)
}
func (t *FakeOSSClient) UploadImageFromBase64(_ *beeorm.Engine, bucket, image, extension string) oss.Object {
return t.Called(bucket, image, extension).Get(0).(oss.Object)
}
func (t *FakeOSSClient) GetObjectBase64Content(bucket string, object *oss.Object) (string, error) {
return t.Called(bucket, object).Get(0).(string), t.Called(bucket, object).Get(0).(error)
}