Skip to content

Commit 529eb79

Browse files
committed
Added tests for ListOptions in ListCredentialAuthorizations
1 parent 756d7b4 commit 529eb79

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

github/orgs_credential_authorizations_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ func TestOrganizationsService_ListCredentialAuthorizations(t *testing.T) {
2121

2222
mux.HandleFunc("/orgs/o/credential-authorizations", func(w http.ResponseWriter, r *http.Request) {
2323
testMethod(t, r, http.MethodGet)
24+
testFormValues(t, r, values{"per_page": "2", "page": "2"})
2425
fmt.Fprint(w, `[
2526
{
2627
"login": "l",
@@ -33,8 +34,9 @@ func TestOrganizationsService_ListCredentialAuthorizations(t *testing.T) {
3334
]`)
3435
})
3536

37+
opts := &ListOptions{Page: 2, PerPage: 2}
3638
ctx := context.Background()
37-
creds, _, err := client.Organizations.ListCredentialAuthorizations(ctx, "o", nil)
39+
creds, _, err := client.Organizations.ListCredentialAuthorizations(ctx, "o", opts)
3840
if err != nil {
3941
t.Errorf("Organizations.ListCredentialAuthorizations returned error: %v", err)
4042
}
@@ -56,12 +58,12 @@ func TestOrganizationsService_ListCredentialAuthorizations(t *testing.T) {
5658

5759
const methodName = "ListCredentialAuthorizations"
5860
testBadOptions(t, methodName, func() (err error) {
59-
_, _, err = client.Organizations.ListCredentialAuthorizations(ctx, "\n", nil)
61+
_, _, err = client.Organizations.ListCredentialAuthorizations(ctx, "\n", opts)
6062
return err
6163
})
6264

6365
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
64-
_, resp, err := client.Organizations.ListCredentialAuthorizations(ctx, "o", nil)
66+
_, resp, err := client.Organizations.ListCredentialAuthorizations(ctx, "o", opts)
6567
return resp, err
6668
})
6769
}

0 commit comments

Comments
 (0)