Add Pagination
This commit is contained in:
parent
759ce4a331
commit
d32c4d4ed1
12 changed files with 217 additions and 254 deletions
|
@ -25,11 +25,11 @@ func TestGetAccount(t *testing.T) {
|
|||
ClientSecret: "bar",
|
||||
AccessToken: "zoo",
|
||||
})
|
||||
a, err := client.GetAccount(context.Background(), 1)
|
||||
_, err := client.GetAccount(context.Background(), 1)
|
||||
if err == nil {
|
||||
t.Fatalf("should be fail: %v", err)
|
||||
}
|
||||
a, err = client.GetAccount(context.Background(), 1234567)
|
||||
a, err := client.GetAccount(context.Background(), 1234567)
|
||||
if err != nil {
|
||||
t.Fatalf("should not be fail: %v", err)
|
||||
}
|
||||
|
@ -113,6 +113,7 @@ func TestGetAccountStatuses(t *testing.T) {
|
|||
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
|
||||
return
|
||||
}
|
||||
//w.Header().Set("Link", `<http://example.com/api/v1/accounts/1234567/statuses?max_id=123>; rel="next", <http://example.com/api/v1/accounts/1234567/statuses?since_id=789>; rel="prev"`)
|
||||
fmt.Fprintln(w, `[{"content": "foo"}, {"content": "bar"}]`)
|
||||
return
|
||||
}))
|
||||
|
@ -124,11 +125,11 @@ func TestGetAccountStatuses(t *testing.T) {
|
|||
ClientSecret: "bar",
|
||||
AccessToken: "zoo",
|
||||
})
|
||||
_, err := client.GetAccountStatuses(context.Background(), 123)
|
||||
_, _, err := client.GetAccountStatuses(context.Background(), 123, nil)
|
||||
if err == nil {
|
||||
t.Fatalf("should be fail: %v", err)
|
||||
}
|
||||
ss, err := client.GetAccountStatuses(context.Background(), 1234567)
|
||||
ss, _, err := client.GetAccountStatuses(context.Background(), 1234567, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("should not be fail: %v", err)
|
||||
}
|
||||
|
@ -157,11 +158,11 @@ func TestGetAccountFollowers(t *testing.T) {
|
|||
ClientSecret: "bar",
|
||||
AccessToken: "zoo",
|
||||
})
|
||||
_, err := client.GetAccountFollowers(context.Background(), 123)
|
||||
_, _, err := client.GetAccountFollowers(context.Background(), 123, nil)
|
||||
if err == nil {
|
||||
t.Fatalf("should be fail: %v", err)
|
||||
}
|
||||
fl, err := client.GetAccountFollowers(context.Background(), 1234567)
|
||||
fl, _, err := client.GetAccountFollowers(context.Background(), 1234567, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("should not be fail: %v", err)
|
||||
}
|
||||
|
@ -193,11 +194,11 @@ func TestGetAccountFollowing(t *testing.T) {
|
|||
ClientSecret: "bar",
|
||||
AccessToken: "zoo",
|
||||
})
|
||||
_, err := client.GetAccountFollowing(context.Background(), 123)
|
||||
_, _, err := client.GetAccountFollowing(context.Background(), 123, nil)
|
||||
if err == nil {
|
||||
t.Fatalf("should be fail: %v", err)
|
||||
}
|
||||
fl, err := client.GetAccountFollowing(context.Background(), 1234567)
|
||||
fl, _, err := client.GetAccountFollowing(context.Background(), 1234567, nil)
|
||||
if err != nil {
|
||||
t.Fatalf("should not be fail: %v", err)
|
||||
}
|
||||
|
@ -231,11 +232,11 @@ func TestGetBlocks(t *testing.T) {
|
|||
ClientSecret: "bar",
|
||||
AccessToken: "zoo",
|
||||
})
|
||||
_, err := client.GetBlocks(context.Background())
|
||||
_, _, err := client.GetBlocks(context.Background(), nil)
|
||||
if err == nil {
|
||||
t.Fatalf("should be fail: %v", err)
|
||||
}
|
||||
bl, err := client.GetBlocks(context.Background())
|
||||
bl, _, err := client.GetBlocks(context.Background(), nil)
|
||||
if err != nil {
|
||||
t.Fatalf("should not be fail: %v", err)
|
||||
}
|
||||
|
@ -566,11 +567,11 @@ func TestGetFollowRequests(t *testing.T) {
|
|||
ClientSecret: "bar",
|
||||
AccessToken: "zoo",
|
||||
})
|
||||
_, err := client.GetFollowRequests(context.Background())
|
||||
_, _, err := client.GetFollowRequests(context.Background(), nil)
|
||||
if err == nil {
|
||||
t.Fatalf("should be fail: %v", err)
|
||||
}
|
||||
fReqs, err := client.GetFollowRequests(context.Background())
|
||||
fReqs, _, err := client.GetFollowRequests(context.Background(), nil)
|
||||
if err != nil {
|
||||
t.Fatalf("should not be fail: %v", err)
|
||||
}
|
||||
|
@ -652,11 +653,11 @@ func TestGetMutes(t *testing.T) {
|
|||
ClientSecret: "bar",
|
||||
AccessToken: "zoo",
|
||||
})
|
||||
_, err := client.GetMutes(context.Background())
|
||||
_, _, err := client.GetMutes(context.Background(), nil)
|
||||
if err == nil {
|
||||
t.Fatalf("should be fail: %v", err)
|
||||
}
|
||||
mutes, err := client.GetMutes(context.Background())
|
||||
mutes, _, err := client.GetMutes(context.Background(), nil)
|
||||
if err != nil {
|
||||
t.Fatalf("should not be fail: %v", err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue