-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathweb_socket_server.go
More file actions
76 lines (60 loc) · 2.17 KB
/
web_socket_server.go
File metadata and controls
76 lines (60 loc) · 2.17 KB
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
// Code generated by mockery v2.53.6. DO NOT EDIT.
package wsservermocks
import (
context "context"
http "net/http"
mock "github.com/stretchr/testify/mock"
wsserver "github.com/hyperledger/firefly-common/pkg/wsserver"
)
// WebSocketServer is an autogenerated mock type for the WebSocketServer type
type WebSocketServer struct {
mock.Mock
}
// Broadcast provides a mock function with given fields: ctx, stream, payload
func (_m *WebSocketServer) Broadcast(ctx context.Context, stream string, payload interface{}) {
_m.Called(ctx, stream, payload)
}
// Close provides a mock function with no fields
func (_m *WebSocketServer) Close() {
_m.Called()
}
// Handler provides a mock function with given fields: w, r
func (_m *WebSocketServer) Handler(w http.ResponseWriter, r *http.Request) {
_m.Called(w, r)
}
// RoundTrip provides a mock function with given fields: ctx, stream, payload
func (_m *WebSocketServer) RoundTrip(ctx context.Context, stream string, payload wsserver.WSBatch) (*wsserver.WebSocketCommandMessage, error) {
ret := _m.Called(ctx, stream, payload)
if len(ret) == 0 {
panic("no return value specified for RoundTrip")
}
var r0 *wsserver.WebSocketCommandMessage
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, string, wsserver.WSBatch) (*wsserver.WebSocketCommandMessage, error)); ok {
return rf(ctx, stream, payload)
}
if rf, ok := ret.Get(0).(func(context.Context, string, wsserver.WSBatch) *wsserver.WebSocketCommandMessage); ok {
r0 = rf(ctx, stream, payload)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*wsserver.WebSocketCommandMessage)
}
}
if rf, ok := ret.Get(1).(func(context.Context, string, wsserver.WSBatch) error); ok {
r1 = rf(ctx, stream, payload)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// NewWebSocketServer creates a new instance of WebSocketServer. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewWebSocketServer(t interface {
mock.TestingT
Cleanup(func())
}) *WebSocketServer {
mock := &WebSocketServer{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}