-
Notifications
You must be signed in to change notification settings - Fork 8
/
app_mock.go
126 lines (103 loc) · 2.79 KB
/
app_mock.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
package application
import (
"github.com/PolarPanda611/trinitygo/conf"
"github.com/PolarPanda611/trinitygo/keyword"
truntime "github.com/PolarPanda611/trinitygo/runtime"
"github.com/casbin/casbin/v2"
"github.com/gin-gonic/gin"
"github.com/jinzhu/gorm"
"github.com/kataras/golog"
"github.com/stretchr/testify/mock"
"google.golang.org/grpc"
)
// AppMock for application mock
type AppMock struct {
mock.Mock
}
// IsLogSelfCheck mock
func (a *AppMock) IsLogSelfCheck() bool {
args := a.Called()
return args.Get(0).(bool)
}
// Logger mock
func (a *AppMock) Logger() *golog.Logger {
args := a.Called()
return args.Get(0).(*golog.Logger)
}
// RuntimeKeys mock
func (a *AppMock) RuntimeKeys() []truntime.RuntimeKey {
args := a.Called()
return args.Get(0).([]truntime.RuntimeKey)
}
// Conf mock
func (a *AppMock) Conf() conf.Conf {
args := a.Called()
return args.Get(0).(conf.Conf)
}
// Keyword mock
func (a *AppMock) Keyword() keyword.Keyword {
args := a.Called()
return args.Get(0).(keyword.Keyword)
}
// ContextPool mock
func (a *AppMock) ContextPool() *ContextPool {
args := a.Called()
return args.Get(0).(*ContextPool)
}
// DB mock
func (a *AppMock) DB() *gorm.DB {
args := a.Called()
return args.Get(0).(*gorm.DB)
}
// Enforcer mock
func (a *AppMock) Enforcer() *casbin.Enforcer {
args := a.Called()
return args.Get(0).(*casbin.Enforcer)
}
// InstallDB mock
func (a *AppMock) InstallDB(f func() *gorm.DB) {}
// ControllerPool mock
func (a *AppMock) ControllerPool() *ControllerPool {
args := a.Called()
return args.Get(0).(*ControllerPool)
}
// InstancePool mock
func (a *AppMock) InstancePool() *InstancePool {
args := a.Called()
return args.Get(0).(*InstancePool)
}
// UseInterceptor mock
func (a *AppMock) UseInterceptor(interceptor ...grpc.UnaryServerInterceptor) Application {
args := a.Called(interceptor)
return args.Get(0).(Application)
}
// UseMiddleware mock
func (a *AppMock) UseMiddleware(middleware ...gin.HandlerFunc) Application {
args := a.Called(middleware)
return args.Get(0).(Application)
}
// RegRuntimeKey mock
func (a *AppMock) RegRuntimeKey(runtime ...truntime.RuntimeKey) Application {
args := a.Called(runtime)
return args.Get(0).(Application)
}
// InitGRPC mock
func (a *AppMock) InitGRPC() {}
// InitHTTP mock
func (a *AppMock) InitHTTP() {}
// InitRouter mock
func (a *AppMock) InitRouter() {}
// GetGRPCServer mock
func (a *AppMock) GetGRPCServer() *grpc.Server {
args := a.Called()
return args.Get(0).(*grpc.Server)
}
// ServeGRPC mock
func (a *AppMock) ServeGRPC() {}
// ServeHTTP mock
func (a *AppMock) ServeHTTP() {}
// ResponseFactory mock
func (a *AppMock) ResponseFactory() func(status int, res interface{}, runtime map[string]string) interface{} {
args := a.Called()
return args.Get(0).(func(status int, res interface{}, runtime map[string]string) interface{})
}