/
Engine.go
200 lines (162 loc) · 5.29 KB
/
Engine.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
// Code generated by mockery v2.14.0. DO NOT EDIT.
package mocks
import (
http "github.com/chenyuIT/framework/contracts/http"
mock "github.com/stretchr/testify/mock"
nethttp "net/http"
route "github.com/chenyuIT/framework/contracts/route"
)
// Engine is an autogenerated mock type for the Engine type
type Engine struct {
mock.Mock
}
// Any provides a mock function with given fields: relativePath, handler
func (_m *Engine) Any(relativePath string, handler http.HandlerFunc) {
_m.Called(relativePath, handler)
}
// Delete provides a mock function with given fields: relativePath, handler
func (_m *Engine) Delete(relativePath string, handler http.HandlerFunc) {
_m.Called(relativePath, handler)
}
// Fallback provides a mock function with given fields: handler
func (_m *Engine) Fallback(handler http.HandlerFunc) {
_m.Called(handler)
}
// Get provides a mock function with given fields: relativePath, handler
func (_m *Engine) Get(relativePath string, handler http.HandlerFunc) {
_m.Called(relativePath, handler)
}
// GlobalMiddleware provides a mock function with given fields: middlewares
func (_m *Engine) GlobalMiddleware(middlewares ...http.Middleware) {
_va := make([]interface{}, len(middlewares))
for _i := range middlewares {
_va[_i] = middlewares[_i]
}
var _ca []interface{}
_ca = append(_ca, _va...)
_m.Called(_ca...)
}
// Group provides a mock function with given fields: handler
func (_m *Engine) Group(handler route.GroupFunc) {
_m.Called(handler)
}
// Middleware provides a mock function with given fields: middlewares
func (_m *Engine) Middleware(middlewares ...http.Middleware) route.Route {
_va := make([]interface{}, len(middlewares))
for _i := range middlewares {
_va[_i] = middlewares[_i]
}
var _ca []interface{}
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 route.Route
if rf, ok := ret.Get(0).(func(...http.Middleware) route.Route); ok {
r0 = rf(middlewares...)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(route.Route)
}
}
return r0
}
// Options provides a mock function with given fields: relativePath, handler
func (_m *Engine) Options(relativePath string, handler http.HandlerFunc) {
_m.Called(relativePath, handler)
}
// Patch provides a mock function with given fields: relativePath, handler
func (_m *Engine) Patch(relativePath string, handler http.HandlerFunc) {
_m.Called(relativePath, handler)
}
// Post provides a mock function with given fields: relativePath, handler
func (_m *Engine) Post(relativePath string, handler http.HandlerFunc) {
_m.Called(relativePath, handler)
}
// Prefix provides a mock function with given fields: addr
func (_m *Engine) Prefix(addr string) route.Route {
ret := _m.Called(addr)
var r0 route.Route
if rf, ok := ret.Get(0).(func(string) route.Route); ok {
r0 = rf(addr)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(route.Route)
}
}
return r0
}
// Put provides a mock function with given fields: relativePath, handler
func (_m *Engine) Put(relativePath string, handler http.HandlerFunc) {
_m.Called(relativePath, handler)
}
// Run provides a mock function with given fields: host
func (_m *Engine) Run(host ...string) error {
_va := make([]interface{}, len(host))
for _i := range host {
_va[_i] = host[_i]
}
var _ca []interface{}
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 error
if rf, ok := ret.Get(0).(func(...string) error); ok {
r0 = rf(host...)
} else {
r0 = ret.Error(0)
}
return r0
}
// RunTLS provides a mock function with given fields: host
func (_m *Engine) RunTLS(host ...string) error {
_va := make([]interface{}, len(host))
for _i := range host {
_va[_i] = host[_i]
}
var _ca []interface{}
_ca = append(_ca, _va...)
ret := _m.Called(_ca...)
var r0 error
if rf, ok := ret.Get(0).(func(...string) error); ok {
r0 = rf(host...)
} else {
r0 = ret.Error(0)
}
return r0
}
// RunTLSWithCert provides a mock function with given fields: host, certFile, keyFile
func (_m *Engine) RunTLSWithCert(host string, certFile string, keyFile string) error {
ret := _m.Called(host, certFile, keyFile)
var r0 error
if rf, ok := ret.Get(0).(func(string, string, string) error); ok {
r0 = rf(host, certFile, keyFile)
} else {
r0 = ret.Error(0)
}
return r0
}
// ServeHTTP provides a mock function with given fields: writer, request
func (_m *Engine) ServeHTTP(writer nethttp.ResponseWriter, request *nethttp.Request) {
_m.Called(writer, request)
}
// Static provides a mock function with given fields: relativePath, root
func (_m *Engine) Static(relativePath string, root string) {
_m.Called(relativePath, root)
}
// StaticFS provides a mock function with given fields: relativePath, fs
func (_m *Engine) StaticFS(relativePath string, fs nethttp.FileSystem) {
_m.Called(relativePath, fs)
}
// StaticFile provides a mock function with given fields: relativePath, filepath
func (_m *Engine) StaticFile(relativePath string, filepath string) {
_m.Called(relativePath, filepath)
}
type mockConstructorTestingTNewEngine interface {
mock.TestingT
Cleanup(func())
}
// NewEngine creates a new instance of Engine. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
func NewEngine(t mockConstructorTestingTNewEngine) *Engine {
mock := &Engine{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}