-
Notifications
You must be signed in to change notification settings - Fork 13
/
oss.go
85 lines (66 loc) · 2.87 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
package mocks
import (
"time"
"github.com/latolukasz/beeorm"
"github.com/stretchr/testify/mock"
"github.com/coretrix/hitrix/pkg/entity"
"github.com/coretrix/hitrix/service/component/oss"
)
type FakeOSSClient struct {
mock.Mock
}
func (t *FakeOSSClient) GetClient() interface{} {
return nil
}
func (t *FakeOSSClient) GetObjectURL(namespace oss.Namespace, object *entity.FileObject) (string, error) {
return t.Called(namespace, object).Get(0).(string), nil
}
func (t *FakeOSSClient) GetObjectOSSURL(namespace oss.Namespace, object *entity.FileObject) (string, error) {
return t.Called(namespace, object).Get(0).(string), nil
}
func (t *FakeOSSClient) GetObjectCDNURL(namespace oss.Namespace, object *entity.FileObject) (string, error) {
return t.Called(namespace, object).Get(0).(string), nil
}
func (t *FakeOSSClient) GetObjectSignedURL(namespace oss.Namespace, object *entity.FileObject, expires time.Time) (string, error) {
return t.Called(namespace, object, expires).Get(0).(string), nil
}
func (t *FakeOSSClient) GetObjectBase64Content(namespace oss.Namespace, object *entity.FileObject) (string, error) {
return t.Called(namespace, object).Get(0).(string), nil
}
func (t *FakeOSSClient) UploadObjectFromFile(_ *beeorm.Engine, namespace oss.Namespace, localFile string) (entity.FileObject, error) {
return t.Called(namespace, localFile).Get(0).(entity.FileObject), nil
}
func (t *FakeOSSClient) UploadObjectFromBase64(
_ *beeorm.Engine,
namespace oss.Namespace,
content string,
extension string,
) (entity.FileObject, error) {
return t.Called(namespace, content, extension).Get(0).(entity.FileObject), nil
}
func (t *FakeOSSClient) UploadObjectFromByte(
_ *beeorm.Engine,
namespace oss.Namespace,
content []byte,
extension string,
) (entity.FileObject, error) {
return t.Called(namespace, content, extension).Get(0).(entity.FileObject), nil
}
func (t *FakeOSSClient) UploadImageFromFile(_ *beeorm.Engine, namespace oss.Namespace, localFile string) (entity.FileObject, error) {
return t.Called(namespace, localFile).Get(0).(entity.FileObject), nil
}
func (t *FakeOSSClient) UploadImageFromBase64(_ *beeorm.Engine, namespace oss.Namespace, image, extension string) (entity.FileObject, error) {
return t.Called(namespace, image, extension).Get(0).(entity.FileObject), nil
}
func (t *FakeOSSClient) DeleteObject(namespace oss.Namespace, object *entity.FileObject) error {
return t.Called(namespace, object).Error(0)
}
func (t *FakeOSSClient) CreateObjectFromKey(_ *beeorm.Engine, namespace oss.Namespace, key string) entity.FileObject {
return t.Called(namespace, key).Get(0).(entity.FileObject)
}
func (t *FakeOSSClient) GetBucketConfig(bucket oss.Bucket) *oss.BucketConfig {
return t.Called(bucket).Get(0).(*oss.BucketConfig)
}
func (t *FakeOSSClient) GetNamespaceBucketConfig(namespace oss.Namespace) (*oss.BucketConfig, error) {
return t.Called(namespace).Get(0).(*oss.BucketConfig), nil
}