-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: Add pagination to Repository/Organization Rules Get methods #3236
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -281,6 +281,7 @@ func TestRepositoriesService_GetRulesForBranch(t *testing.T) { | |
|
||
mux.HandleFunc("/repos/o/repo/rules/branches/branch", func(w http.ResponseWriter, r *http.Request) { | ||
testMethod(t, r, "GET") | ||
testFormValues(t, r, values{"per_page": "2", "page": "2"}) | ||
fmt.Fprint(w, `[ | ||
{ | ||
"ruleset_id": 42069, | ||
|
@@ -301,7 +302,7 @@ func TestRepositoriesService_GetRulesForBranch(t *testing.T) { | |
}) | ||
|
||
ctx := context.Background() | ||
rules, _, err := client.Repositories.GetRulesForBranch(ctx, "o", "repo", "branch") | ||
rules, _, err := client.Repositories.GetRulesForBranch(ctx, "o", "repo", "branch", &ListOptions{Page: 2, PerPage: 2}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After line 329 below, please add:
|
||
if err != nil { | ||
t.Errorf("Repositories.GetRulesForBranch returned error: %v", err) | ||
} | ||
|
@@ -328,7 +329,7 @@ func TestRepositoriesService_GetRulesForBranch(t *testing.T) { | |
const methodName = "GetRulesForBranch" | ||
|
||
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { | ||
got, resp, err := client.Repositories.GetRulesForBranch(ctx, "o", "repo", "branch") | ||
got, resp, err := client.Repositories.GetRulesForBranch(ctx, "o", "repo", "branch", nil) | ||
if got != nil { | ||
t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) | ||
} | ||
|
@@ -342,6 +343,7 @@ func TestRepositoriesService_GetRulesForBranchEmptyUpdateRule(t *testing.T) { | |
|
||
mux.HandleFunc("/repos/o/repo/rules/branches/branch", func(w http.ResponseWriter, r *http.Request) { | ||
testMethod(t, r, "GET") | ||
testFormValues(t, r, values{"per_page": "2", "page": "2"}) | ||
fmt.Fprint(w, `[ | ||
{ | ||
"type": "update" | ||
|
@@ -350,7 +352,7 @@ func TestRepositoriesService_GetRulesForBranchEmptyUpdateRule(t *testing.T) { | |
}) | ||
|
||
ctx := context.Background() | ||
rules, _, err := client.Repositories.GetRulesForBranch(ctx, "o", "repo", "branch") | ||
rules, _, err := client.Repositories.GetRulesForBranch(ctx, "o", "repo", "branch", &ListOptions{Page: 2, PerPage: 2}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After line 369 below, please add:
|
||
if err != nil { | ||
t.Errorf("Repositories.GetRulesForBranch returned error: %v", err) | ||
} | ||
|
@@ -367,7 +369,7 @@ func TestRepositoriesService_GetRulesForBranchEmptyUpdateRule(t *testing.T) { | |
const methodName = "GetRulesForBranch" | ||
|
||
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { | ||
got, resp, err := client.Repositories.GetRulesForBranch(ctx, "o", "repo", "branch") | ||
got, resp, err := client.Repositories.GetRulesForBranch(ctx, "o", "repo", "branch", nil) | ||
if got != nil { | ||
t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) | ||
} | ||
|
@@ -381,6 +383,7 @@ func TestRepositoriesService_GetAllRulesets(t *testing.T) { | |
|
||
mux.HandleFunc("/repos/o/repo/rulesets", func(w http.ResponseWriter, r *http.Request) { | ||
testMethod(t, r, "GET") | ||
testFormValues(t, r, values{"per_page": "2", "page": "2"}) | ||
fmt.Fprint(w, `[ | ||
{ | ||
"id": 42, | ||
|
@@ -400,7 +403,7 @@ func TestRepositoriesService_GetAllRulesets(t *testing.T) { | |
}) | ||
|
||
ctx := context.Background() | ||
ruleSet, _, err := client.Repositories.GetAllRulesets(ctx, "o", "repo", false) | ||
ruleSet, _, err := client.Repositories.GetAllRulesets(ctx, "o", "repo", false, &ListOptions{Page: 2, PerPage: 2}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After line 431 below, please add:
|
||
if err != nil { | ||
t.Errorf("Repositories.GetAllRulesets returned error: %v", err) | ||
} | ||
|
@@ -428,7 +431,7 @@ func TestRepositoriesService_GetAllRulesets(t *testing.T) { | |
const methodName = "GetAllRulesets" | ||
|
||
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) { | ||
got, resp, err := client.Repositories.GetAllRulesets(ctx, "o", "repo", false) | ||
got, resp, err := client.Repositories.GetAllRulesets(ctx, "o", "repo", false, nil) | ||
if got != nil { | ||
t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After line 63 below, please add: