Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
alist-org
GitHub Repository: alist-org/alist
Path: blob/main/pkg/aria2/rpc/call_test.go
1562 views
1
package rpc
2
3
import (
4
"context"
5
"testing"
6
"time"
7
)
8
9
func TestWebsocketCaller(t *testing.T) {
10
time.Sleep(time.Second)
11
c, err := newWebsocketCaller(context.Background(), "ws://localhost:6800/jsonrpc", time.Second, &DummyNotifier{})
12
if err != nil {
13
t.Fatal(err.Error())
14
}
15
defer c.Close()
16
17
var info VersionInfo
18
if err := c.Call(aria2GetVersion, []interface{}{}, &info); err != nil {
19
t.Error(err.Error())
20
} else {
21
println(info.Version)
22
}
23
}
24
25