wahandler peer 파일 분리
This commit is contained in:
@ -90,22 +90,18 @@ func (dsc *dummySessionConsumer) Touch(string) (session.Authorization, error) {
|
||||
|
||||
func TestPeerApiBroker(t *testing.T) {
|
||||
handler := MakeWebsocketPeerApiHandler[peerHandler]("test")
|
||||
ws, err := NewWebsocketPeerHandler(&dummySessionConsumer{}, "redis://192.168.8.94:6380/4")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
ws := NewWebsocketPeerHandler(&dummySessionConsumer{})
|
||||
ws.AddHandler(handler)
|
||||
|
||||
peer := &peerHandler{
|
||||
id: "onlyone",
|
||||
}
|
||||
func1args, _ := json.Marshal([]any{string("arg1"), int(100)})
|
||||
ws.Call(peer, "test.ApiFunc1", func1args)
|
||||
ws.Call(peer, "test.ApiFunc1", bytes.NewBuffer(func1args))
|
||||
|
||||
func1args, _ = json.Marshal([]any{string("arg1"), map[string]int{"arg2.key": 99}})
|
||||
ws.Call(peer, "test.ApiFunc2", func1args)
|
||||
ws.Call(peer, "test.ApiFunc2", bytes.NewBuffer(func1args))
|
||||
|
||||
func1args, _ = json.Marshal([]any{float64(111.1), []int{99, 98}})
|
||||
ws.Call(peer, "test.ApiFunc3", func1args)
|
||||
ws.Call(peer, "test.ApiFunc3", bytes.NewBuffer(func1args))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user