38 lines
742 B
Go
38 lines
742 B
Go
|
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))
|
||
|
}
|