tstor/pkg/qbittorrent/sync_test.go

38 lines
742 B
Go
Raw Normal View History

2024-08-31 23:00:13 +00:00
package qbittorrent
import (
"context"
"encoding/json"
"testing"
"time"
)
func TestClient_MainData(t *testing.T) {
ctx := context.Background()
syncMainData, err := c.Sync().MainData(ctx, 0)
if err != nil {
t.Fatal(err)
}
t.Logf("sync main data: %+v", syncMainData)
time.Sleep(time.Second)
syncMainData, err = c.Sync().MainData(ctx, 0)
if err != nil {
t.Fatal(err)
}
t.Logf("sync main data: %+v", syncMainData)
}
func TestClient_TorrentPeersData(t *testing.T) {
ctx := context.Background()
peersData, err := c.Sync().TorrentPeersData(ctx, "f23daefbe8d24d3dd882b44cb0b4f762bc23b4fc", 0)
if err != nil {
t.Fatal(err)
}
bytes, err := json.Marshal(peersData)
if err != nil {
t.Fatal(err)
}
t.Log(string(bytes))
}