26 lines
444 B
Go
26 lines
444 B
Go
|
package coach_client
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestCNClient(t *testing.T) {
|
||
|
cli, err := CNClient()
|
||
|
if err != nil {
|
||
|
t.Fatal(err)
|
||
|
}
|
||
|
var page, total int
|
||
|
var resp ItemListData
|
||
|
var items []CNItem
|
||
|
for ; page <= total; page++ {
|
||
|
if resp, err = cli.ListItems(context.Background(), page, 50); err != nil {
|
||
|
t.Fatal(err)
|
||
|
}
|
||
|
total = resp.TotalPages
|
||
|
items = append(items, resp.Items...)
|
||
|
}
|
||
|
t.Logf("共%d个", len(items))
|
||
|
|
||
|
}
|