// Code generated by gen-iterators; DO NOT EDIT.
// Instead, please run "go generate ./..." as described here:
// https://github.com/google/go-github/blob/master/CONTRIBUTING.md#submitting-a-patch

// Copyright 2026 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package github

import (
	"fmt"
	"net/http"
	"testing"
)

func TestActionsService_ListArtifactsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"artifacts": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"artifacts": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"artifacts": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"artifacts": [{},{}]}`)
		}
	})

	iter := client.Actions.ListArtifactsIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Actions.ListArtifactsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListArtifactsOptions{}
	iter = client.Actions.ListArtifactsIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Actions.ListArtifactsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Actions.ListArtifactsIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Actions.ListArtifactsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Actions.ListArtifactsIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Artifact, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Actions.ListArtifactsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActionsService_ListCacheUsageByRepoForOrgIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"repository_cache_usages": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"repository_cache_usages": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"repository_cache_usages": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"repository_cache_usages": [{},{}]}`)
		}
	})

	iter := client.Actions.ListCacheUsageByRepoForOrgIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Actions.ListCacheUsageByRepoForOrgIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Actions.ListCacheUsageByRepoForOrgIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Actions.ListCacheUsageByRepoForOrgIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Actions.ListCacheUsageByRepoForOrgIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Actions.ListCacheUsageByRepoForOrgIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Actions.ListCacheUsageByRepoForOrgIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *ActionsCacheUsage, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Actions.ListCacheUsageByRepoForOrgIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActionsService_ListCachesIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"actions_caches": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"actions_caches": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"actions_caches": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"actions_caches": [{},{}]}`)
		}
	})

	iter := client.Actions.ListCachesIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Actions.ListCachesIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ActionsCacheListOptions{}
	iter = client.Actions.ListCachesIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Actions.ListCachesIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Actions.ListCachesIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Actions.ListCachesIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Actions.ListCachesIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *ActionsCache, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Actions.ListCachesIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActionsService_ListEnabledOrgsInEnterpriseIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"organizations": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"organizations": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"organizations": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"organizations": [{},{}]}`)
		}
	})

	iter := client.Actions.ListEnabledOrgsInEnterpriseIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Actions.ListEnabledOrgsInEnterpriseIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Actions.ListEnabledOrgsInEnterpriseIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Actions.ListEnabledOrgsInEnterpriseIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Actions.ListEnabledOrgsInEnterpriseIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Actions.ListEnabledOrgsInEnterpriseIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Actions.ListEnabledOrgsInEnterpriseIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *Organization, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Actions.ListEnabledOrgsInEnterpriseIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActionsService_ListEnabledReposInOrgIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"repositories": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"repositories": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"repositories": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"repositories": [{},{}]}`)
		}
	})

	iter := client.Actions.ListEnabledReposInOrgIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Actions.ListEnabledReposInOrgIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Actions.ListEnabledReposInOrgIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Actions.ListEnabledReposInOrgIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Actions.ListEnabledReposInOrgIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Actions.ListEnabledReposInOrgIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Actions.ListEnabledReposInOrgIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *Repository, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Actions.ListEnabledReposInOrgIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActionsService_ListEnvSecretsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"secrets": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"secrets": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"secrets": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"secrets": [{},{}]}`)
		}
	})

	iter := client.Actions.ListEnvSecretsIter(t.Context(), 0, "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Actions.ListEnvSecretsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Actions.ListEnvSecretsIter(t.Context(), 0, "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Actions.ListEnvSecretsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Actions.ListEnvSecretsIter(t.Context(), 0, "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Actions.ListEnvSecretsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Actions.ListEnvSecretsIter(t.Context(), 0, "", nil)
	gotItems = 0
	iter(func(item *Secret, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Actions.ListEnvSecretsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActionsService_ListEnvVariablesIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"variables": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"variables": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"variables": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"variables": [{},{}]}`)
		}
	})

	iter := client.Actions.ListEnvVariablesIter(t.Context(), "", "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Actions.ListEnvVariablesIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Actions.ListEnvVariablesIter(t.Context(), "", "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Actions.ListEnvVariablesIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Actions.ListEnvVariablesIter(t.Context(), "", "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Actions.ListEnvVariablesIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Actions.ListEnvVariablesIter(t.Context(), "", "", "", nil)
	gotItems = 0
	iter(func(item *ActionsVariable, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Actions.ListEnvVariablesIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActionsService_ListHostedRunnersIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"runners": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"runners": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"runners": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"runners": [{},{}]}`)
		}
	})

	iter := client.Actions.ListHostedRunnersIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Actions.ListHostedRunnersIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Actions.ListHostedRunnersIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Actions.ListHostedRunnersIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Actions.ListHostedRunnersIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Actions.ListHostedRunnersIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Actions.ListHostedRunnersIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *HostedRunner, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Actions.ListHostedRunnersIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActionsService_ListOrgSecretsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"secrets": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"secrets": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"secrets": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"secrets": [{},{}]}`)
		}
	})

	iter := client.Actions.ListOrgSecretsIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Actions.ListOrgSecretsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Actions.ListOrgSecretsIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Actions.ListOrgSecretsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Actions.ListOrgSecretsIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Actions.ListOrgSecretsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Actions.ListOrgSecretsIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *Secret, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Actions.ListOrgSecretsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActionsService_ListOrgVariablesIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"variables": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"variables": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"variables": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"variables": [{},{}]}`)
		}
	})

	iter := client.Actions.ListOrgVariablesIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Actions.ListOrgVariablesIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Actions.ListOrgVariablesIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Actions.ListOrgVariablesIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Actions.ListOrgVariablesIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Actions.ListOrgVariablesIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Actions.ListOrgVariablesIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *ActionsVariable, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Actions.ListOrgVariablesIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActionsService_ListOrganizationRunnerGroupsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"runner_groups": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"runner_groups": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"runner_groups": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"runner_groups": [{},{}]}`)
		}
	})

	iter := client.Actions.ListOrganizationRunnerGroupsIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Actions.ListOrganizationRunnerGroupsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOrgRunnerGroupOptions{}
	iter = client.Actions.ListOrganizationRunnerGroupsIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Actions.ListOrganizationRunnerGroupsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Actions.ListOrganizationRunnerGroupsIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Actions.ListOrganizationRunnerGroupsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Actions.ListOrganizationRunnerGroupsIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *RunnerGroup, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Actions.ListOrganizationRunnerGroupsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActionsService_ListOrganizationRunnersIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"runners": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"runners": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"runners": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"runners": [{},{}]}`)
		}
	})

	iter := client.Actions.ListOrganizationRunnersIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Actions.ListOrganizationRunnersIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListRunnersOptions{}
	iter = client.Actions.ListOrganizationRunnersIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Actions.ListOrganizationRunnersIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Actions.ListOrganizationRunnersIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Actions.ListOrganizationRunnersIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Actions.ListOrganizationRunnersIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *Runner, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Actions.ListOrganizationRunnersIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActionsService_ListRepoOrgSecretsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"secrets": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"secrets": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"secrets": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"secrets": [{},{}]}`)
		}
	})

	iter := client.Actions.ListRepoOrgSecretsIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Actions.ListRepoOrgSecretsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Actions.ListRepoOrgSecretsIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Actions.ListRepoOrgSecretsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Actions.ListRepoOrgSecretsIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Actions.ListRepoOrgSecretsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Actions.ListRepoOrgSecretsIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Secret, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Actions.ListRepoOrgSecretsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActionsService_ListRepoOrgVariablesIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"variables": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"variables": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"variables": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"variables": [{},{}]}`)
		}
	})

	iter := client.Actions.ListRepoOrgVariablesIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Actions.ListRepoOrgVariablesIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Actions.ListRepoOrgVariablesIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Actions.ListRepoOrgVariablesIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Actions.ListRepoOrgVariablesIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Actions.ListRepoOrgVariablesIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Actions.ListRepoOrgVariablesIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *ActionsVariable, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Actions.ListRepoOrgVariablesIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActionsService_ListRepoSecretsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"secrets": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"secrets": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"secrets": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"secrets": [{},{}]}`)
		}
	})

	iter := client.Actions.ListRepoSecretsIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Actions.ListRepoSecretsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Actions.ListRepoSecretsIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Actions.ListRepoSecretsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Actions.ListRepoSecretsIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Actions.ListRepoSecretsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Actions.ListRepoSecretsIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Secret, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Actions.ListRepoSecretsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActionsService_ListRepoVariablesIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"variables": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"variables": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"variables": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"variables": [{},{}]}`)
		}
	})

	iter := client.Actions.ListRepoVariablesIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Actions.ListRepoVariablesIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Actions.ListRepoVariablesIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Actions.ListRepoVariablesIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Actions.ListRepoVariablesIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Actions.ListRepoVariablesIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Actions.ListRepoVariablesIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *ActionsVariable, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Actions.ListRepoVariablesIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActionsService_ListRepositoriesSelfHostedRunnersAllowedInOrganizationIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"repositories": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"repositories": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"repositories": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"repositories": [{},{}]}`)
		}
	})

	iter := client.Actions.ListRepositoriesSelfHostedRunnersAllowedInOrganizationIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Actions.ListRepositoriesSelfHostedRunnersAllowedInOrganizationIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Actions.ListRepositoriesSelfHostedRunnersAllowedInOrganizationIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Actions.ListRepositoriesSelfHostedRunnersAllowedInOrganizationIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Actions.ListRepositoriesSelfHostedRunnersAllowedInOrganizationIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Actions.ListRepositoriesSelfHostedRunnersAllowedInOrganizationIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Actions.ListRepositoriesSelfHostedRunnersAllowedInOrganizationIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *Repository, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Actions.ListRepositoriesSelfHostedRunnersAllowedInOrganizationIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActionsService_ListRepositoryAccessRunnerGroupIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"repositories": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"repositories": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"repositories": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"repositories": [{},{}]}`)
		}
	})

	iter := client.Actions.ListRepositoryAccessRunnerGroupIter(t.Context(), "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Actions.ListRepositoryAccessRunnerGroupIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Actions.ListRepositoryAccessRunnerGroupIter(t.Context(), "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Actions.ListRepositoryAccessRunnerGroupIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Actions.ListRepositoryAccessRunnerGroupIter(t.Context(), "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Actions.ListRepositoryAccessRunnerGroupIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Actions.ListRepositoryAccessRunnerGroupIter(t.Context(), "", 0, nil)
	gotItems = 0
	iter(func(item *Repository, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Actions.ListRepositoryAccessRunnerGroupIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActionsService_ListRepositoryWorkflowRunsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"workflow_runs": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"workflow_runs": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"workflow_runs": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"workflow_runs": [{},{}]}`)
		}
	})

	iter := client.Actions.ListRepositoryWorkflowRunsIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Actions.ListRepositoryWorkflowRunsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListWorkflowRunsOptions{}
	iter = client.Actions.ListRepositoryWorkflowRunsIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Actions.ListRepositoryWorkflowRunsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Actions.ListRepositoryWorkflowRunsIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Actions.ListRepositoryWorkflowRunsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Actions.ListRepositoryWorkflowRunsIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *WorkflowRun, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Actions.ListRepositoryWorkflowRunsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActionsService_ListRunnerGroupRunnersIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"runners": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"runners": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"runners": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"runners": [{},{}]}`)
		}
	})

	iter := client.Actions.ListRunnerGroupRunnersIter(t.Context(), "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Actions.ListRunnerGroupRunnersIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Actions.ListRunnerGroupRunnersIter(t.Context(), "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Actions.ListRunnerGroupRunnersIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Actions.ListRunnerGroupRunnersIter(t.Context(), "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Actions.ListRunnerGroupRunnersIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Actions.ListRunnerGroupRunnersIter(t.Context(), "", 0, nil)
	gotItems = 0
	iter(func(item *Runner, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Actions.ListRunnerGroupRunnersIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActionsService_ListRunnersIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"runners": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"runners": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"runners": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"runners": [{},{}]}`)
		}
	})

	iter := client.Actions.ListRunnersIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Actions.ListRunnersIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListRunnersOptions{}
	iter = client.Actions.ListRunnersIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Actions.ListRunnersIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Actions.ListRunnersIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Actions.ListRunnersIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Actions.ListRunnersIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Runner, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Actions.ListRunnersIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActionsService_ListSelectedReposForOrgSecretIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"repositories": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"repositories": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"repositories": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"repositories": [{},{}]}`)
		}
	})

	iter := client.Actions.ListSelectedReposForOrgSecretIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Actions.ListSelectedReposForOrgSecretIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Actions.ListSelectedReposForOrgSecretIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Actions.ListSelectedReposForOrgSecretIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Actions.ListSelectedReposForOrgSecretIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Actions.ListSelectedReposForOrgSecretIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Actions.ListSelectedReposForOrgSecretIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Repository, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Actions.ListSelectedReposForOrgSecretIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActionsService_ListSelectedReposForOrgVariableIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"repositories": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"repositories": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"repositories": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"repositories": [{},{}]}`)
		}
	})

	iter := client.Actions.ListSelectedReposForOrgVariableIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Actions.ListSelectedReposForOrgVariableIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Actions.ListSelectedReposForOrgVariableIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Actions.ListSelectedReposForOrgVariableIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Actions.ListSelectedReposForOrgVariableIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Actions.ListSelectedReposForOrgVariableIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Actions.ListSelectedReposForOrgVariableIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Repository, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Actions.ListSelectedReposForOrgVariableIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActionsService_ListWorkflowJobsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"jobs": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"jobs": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"jobs": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"jobs": [{},{}]}`)
		}
	})

	iter := client.Actions.ListWorkflowJobsIter(t.Context(), "", "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Actions.ListWorkflowJobsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListWorkflowJobsOptions{}
	iter = client.Actions.ListWorkflowJobsIter(t.Context(), "", "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Actions.ListWorkflowJobsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Actions.ListWorkflowJobsIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Actions.ListWorkflowJobsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Actions.ListWorkflowJobsIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	iter(func(item *WorkflowJob, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Actions.ListWorkflowJobsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActionsService_ListWorkflowJobsAttemptIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"jobs": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"jobs": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"jobs": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"jobs": [{},{}]}`)
		}
	})

	iter := client.Actions.ListWorkflowJobsAttemptIter(t.Context(), "", "", 0, 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Actions.ListWorkflowJobsAttemptIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Actions.ListWorkflowJobsAttemptIter(t.Context(), "", "", 0, 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Actions.ListWorkflowJobsAttemptIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Actions.ListWorkflowJobsAttemptIter(t.Context(), "", "", 0, 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Actions.ListWorkflowJobsAttemptIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Actions.ListWorkflowJobsAttemptIter(t.Context(), "", "", 0, 0, nil)
	gotItems = 0
	iter(func(item *WorkflowJob, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Actions.ListWorkflowJobsAttemptIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActionsService_ListWorkflowRunArtifactsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"artifacts": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"artifacts": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"artifacts": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"artifacts": [{},{}]}`)
		}
	})

	iter := client.Actions.ListWorkflowRunArtifactsIter(t.Context(), "", "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Actions.ListWorkflowRunArtifactsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Actions.ListWorkflowRunArtifactsIter(t.Context(), "", "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Actions.ListWorkflowRunArtifactsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Actions.ListWorkflowRunArtifactsIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Actions.ListWorkflowRunArtifactsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Actions.ListWorkflowRunArtifactsIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	iter(func(item *Artifact, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Actions.ListWorkflowRunArtifactsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActionsService_ListWorkflowRunsByFileNameIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"workflow_runs": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"workflow_runs": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"workflow_runs": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"workflow_runs": [{},{}]}`)
		}
	})

	iter := client.Actions.ListWorkflowRunsByFileNameIter(t.Context(), "", "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Actions.ListWorkflowRunsByFileNameIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListWorkflowRunsOptions{}
	iter = client.Actions.ListWorkflowRunsByFileNameIter(t.Context(), "", "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Actions.ListWorkflowRunsByFileNameIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Actions.ListWorkflowRunsByFileNameIter(t.Context(), "", "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Actions.ListWorkflowRunsByFileNameIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Actions.ListWorkflowRunsByFileNameIter(t.Context(), "", "", "", nil)
	gotItems = 0
	iter(func(item *WorkflowRun, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Actions.ListWorkflowRunsByFileNameIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActionsService_ListWorkflowRunsByIDIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"workflow_runs": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"workflow_runs": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"workflow_runs": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"workflow_runs": [{},{}]}`)
		}
	})

	iter := client.Actions.ListWorkflowRunsByIDIter(t.Context(), "", "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Actions.ListWorkflowRunsByIDIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListWorkflowRunsOptions{}
	iter = client.Actions.ListWorkflowRunsByIDIter(t.Context(), "", "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Actions.ListWorkflowRunsByIDIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Actions.ListWorkflowRunsByIDIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Actions.ListWorkflowRunsByIDIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Actions.ListWorkflowRunsByIDIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	iter(func(item *WorkflowRun, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Actions.ListWorkflowRunsByIDIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActionsService_ListWorkflowsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"workflows": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"workflows": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"workflows": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"workflows": [{},{}]}`)
		}
	})

	iter := client.Actions.ListWorkflowsIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Actions.ListWorkflowsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Actions.ListWorkflowsIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Actions.ListWorkflowsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Actions.ListWorkflowsIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Actions.ListWorkflowsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Actions.ListWorkflowsIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Workflow, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Actions.ListWorkflowsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActivityService_ListEventsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Activity.ListEventsIter(t.Context(), nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Activity.ListEventsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Activity.ListEventsIter(t.Context(), opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Activity.ListEventsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Activity.ListEventsIter(t.Context(), nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Activity.ListEventsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Activity.ListEventsIter(t.Context(), nil)
	gotItems = 0
	iter(func(item *Event, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Activity.ListEventsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActivityService_ListEventsForOrganizationIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Activity.ListEventsForOrganizationIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Activity.ListEventsForOrganizationIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Activity.ListEventsForOrganizationIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Activity.ListEventsForOrganizationIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Activity.ListEventsForOrganizationIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Activity.ListEventsForOrganizationIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Activity.ListEventsForOrganizationIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *Event, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Activity.ListEventsForOrganizationIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActivityService_ListEventsForRepoNetworkIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Activity.ListEventsForRepoNetworkIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Activity.ListEventsForRepoNetworkIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Activity.ListEventsForRepoNetworkIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Activity.ListEventsForRepoNetworkIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Activity.ListEventsForRepoNetworkIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Activity.ListEventsForRepoNetworkIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Activity.ListEventsForRepoNetworkIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Event, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Activity.ListEventsForRepoNetworkIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActivityService_ListEventsPerformedByUserIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Activity.ListEventsPerformedByUserIter(t.Context(), "", false, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Activity.ListEventsPerformedByUserIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Activity.ListEventsPerformedByUserIter(t.Context(), "", false, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Activity.ListEventsPerformedByUserIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Activity.ListEventsPerformedByUserIter(t.Context(), "", false, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Activity.ListEventsPerformedByUserIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Activity.ListEventsPerformedByUserIter(t.Context(), "", false, nil)
	gotItems = 0
	iter(func(item *Event, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Activity.ListEventsPerformedByUserIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActivityService_ListEventsReceivedByUserIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Activity.ListEventsReceivedByUserIter(t.Context(), "", false, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Activity.ListEventsReceivedByUserIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Activity.ListEventsReceivedByUserIter(t.Context(), "", false, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Activity.ListEventsReceivedByUserIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Activity.ListEventsReceivedByUserIter(t.Context(), "", false, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Activity.ListEventsReceivedByUserIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Activity.ListEventsReceivedByUserIter(t.Context(), "", false, nil)
	gotItems = 0
	iter(func(item *Event, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Activity.ListEventsReceivedByUserIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActivityService_ListIssueEventsForRepositoryIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Activity.ListIssueEventsForRepositoryIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Activity.ListIssueEventsForRepositoryIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Activity.ListIssueEventsForRepositoryIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Activity.ListIssueEventsForRepositoryIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Activity.ListIssueEventsForRepositoryIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Activity.ListIssueEventsForRepositoryIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Activity.ListIssueEventsForRepositoryIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *IssueEvent, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Activity.ListIssueEventsForRepositoryIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActivityService_ListNotificationsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Activity.ListNotificationsIter(t.Context(), nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Activity.ListNotificationsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &NotificationListOptions{}
	iter = client.Activity.ListNotificationsIter(t.Context(), opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Activity.ListNotificationsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Activity.ListNotificationsIter(t.Context(), nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Activity.ListNotificationsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Activity.ListNotificationsIter(t.Context(), nil)
	gotItems = 0
	iter(func(item *Notification, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Activity.ListNotificationsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActivityService_ListRepositoryEventsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Activity.ListRepositoryEventsIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Activity.ListRepositoryEventsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Activity.ListRepositoryEventsIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Activity.ListRepositoryEventsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Activity.ListRepositoryEventsIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Activity.ListRepositoryEventsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Activity.ListRepositoryEventsIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Event, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Activity.ListRepositoryEventsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActivityService_ListRepositoryNotificationsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Activity.ListRepositoryNotificationsIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Activity.ListRepositoryNotificationsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &NotificationListOptions{}
	iter = client.Activity.ListRepositoryNotificationsIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Activity.ListRepositoryNotificationsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Activity.ListRepositoryNotificationsIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Activity.ListRepositoryNotificationsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Activity.ListRepositoryNotificationsIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Notification, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Activity.ListRepositoryNotificationsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActivityService_ListStargazersIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Activity.ListStargazersIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Activity.ListStargazersIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Activity.ListStargazersIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Activity.ListStargazersIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Activity.ListStargazersIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Activity.ListStargazersIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Activity.ListStargazersIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Stargazer, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Activity.ListStargazersIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActivityService_ListStarredIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Activity.ListStarredIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Activity.ListStarredIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ActivityListStarredOptions{}
	iter = client.Activity.ListStarredIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Activity.ListStarredIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Activity.ListStarredIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Activity.ListStarredIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Activity.ListStarredIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *StarredRepository, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Activity.ListStarredIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActivityService_ListUserEventsForOrganizationIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Activity.ListUserEventsForOrganizationIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Activity.ListUserEventsForOrganizationIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Activity.ListUserEventsForOrganizationIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Activity.ListUserEventsForOrganizationIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Activity.ListUserEventsForOrganizationIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Activity.ListUserEventsForOrganizationIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Activity.ListUserEventsForOrganizationIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Event, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Activity.ListUserEventsForOrganizationIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActivityService_ListWatchedIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Activity.ListWatchedIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Activity.ListWatchedIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Activity.ListWatchedIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Activity.ListWatchedIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Activity.ListWatchedIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Activity.ListWatchedIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Activity.ListWatchedIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *Repository, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Activity.ListWatchedIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestActivityService_ListWatchersIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Activity.ListWatchersIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Activity.ListWatchersIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Activity.ListWatchersIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Activity.ListWatchersIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Activity.ListWatchersIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Activity.ListWatchersIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Activity.ListWatchersIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *User, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Activity.ListWatchersIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestAppsService_ListHookDeliveriesIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?after=yo>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Apps.ListHookDeliveriesIter(t.Context(), nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Apps.ListHookDeliveriesIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListCursorOptions{}
	iter = client.Apps.ListHookDeliveriesIter(t.Context(), opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Apps.ListHookDeliveriesIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Apps.ListHookDeliveriesIter(t.Context(), nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Apps.ListHookDeliveriesIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Apps.ListHookDeliveriesIter(t.Context(), nil)
	gotItems = 0
	iter(func(item *HookDelivery, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Apps.ListHookDeliveriesIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestAppsService_ListInstallationRequestsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Apps.ListInstallationRequestsIter(t.Context(), nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Apps.ListInstallationRequestsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Apps.ListInstallationRequestsIter(t.Context(), opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Apps.ListInstallationRequestsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Apps.ListInstallationRequestsIter(t.Context(), nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Apps.ListInstallationRequestsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Apps.ListInstallationRequestsIter(t.Context(), nil)
	gotItems = 0
	iter(func(item *InstallationRequest, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Apps.ListInstallationRequestsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestAppsService_ListInstallationsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Apps.ListInstallationsIter(t.Context(), nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Apps.ListInstallationsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Apps.ListInstallationsIter(t.Context(), opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Apps.ListInstallationsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Apps.ListInstallationsIter(t.Context(), nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Apps.ListInstallationsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Apps.ListInstallationsIter(t.Context(), nil)
	gotItems = 0
	iter(func(item *Installation, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Apps.ListInstallationsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestAppsService_ListReposIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"repositories": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"repositories": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"repositories": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"repositories": [{},{}]}`)
		}
	})

	iter := client.Apps.ListReposIter(t.Context(), nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Apps.ListReposIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Apps.ListReposIter(t.Context(), opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Apps.ListReposIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Apps.ListReposIter(t.Context(), nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Apps.ListReposIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Apps.ListReposIter(t.Context(), nil)
	gotItems = 0
	iter(func(item *Repository, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Apps.ListReposIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestAppsService_ListUserInstallationsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"installations": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"installations": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"installations": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"installations": [{},{}]}`)
		}
	})

	iter := client.Apps.ListUserInstallationsIter(t.Context(), nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Apps.ListUserInstallationsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Apps.ListUserInstallationsIter(t.Context(), opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Apps.ListUserInstallationsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Apps.ListUserInstallationsIter(t.Context(), nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Apps.ListUserInstallationsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Apps.ListUserInstallationsIter(t.Context(), nil)
	gotItems = 0
	iter(func(item *Installation, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Apps.ListUserInstallationsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestAppsService_ListUserReposIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"repositories": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"repositories": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"repositories": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"repositories": [{},{}]}`)
		}
	})

	iter := client.Apps.ListUserReposIter(t.Context(), 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Apps.ListUserReposIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Apps.ListUserReposIter(t.Context(), 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Apps.ListUserReposIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Apps.ListUserReposIter(t.Context(), 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Apps.ListUserReposIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Apps.ListUserReposIter(t.Context(), 0, nil)
	gotItems = 0
	iter(func(item *Repository, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Apps.ListUserReposIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestChecksService_ListCheckRunAnnotationsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Checks.ListCheckRunAnnotationsIter(t.Context(), "", "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Checks.ListCheckRunAnnotationsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Checks.ListCheckRunAnnotationsIter(t.Context(), "", "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Checks.ListCheckRunAnnotationsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Checks.ListCheckRunAnnotationsIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Checks.ListCheckRunAnnotationsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Checks.ListCheckRunAnnotationsIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	iter(func(item *CheckRunAnnotation, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Checks.ListCheckRunAnnotationsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestChecksService_ListCheckRunsCheckSuiteIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"check_runs": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"check_runs": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"check_runs": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"check_runs": [{},{}]}`)
		}
	})

	iter := client.Checks.ListCheckRunsCheckSuiteIter(t.Context(), "", "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Checks.ListCheckRunsCheckSuiteIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListCheckRunsOptions{}
	iter = client.Checks.ListCheckRunsCheckSuiteIter(t.Context(), "", "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Checks.ListCheckRunsCheckSuiteIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Checks.ListCheckRunsCheckSuiteIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Checks.ListCheckRunsCheckSuiteIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Checks.ListCheckRunsCheckSuiteIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	iter(func(item *CheckRun, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Checks.ListCheckRunsCheckSuiteIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestChecksService_ListCheckRunsForRefIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"check_runs": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"check_runs": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"check_runs": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"check_runs": [{},{}]}`)
		}
	})

	iter := client.Checks.ListCheckRunsForRefIter(t.Context(), "", "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Checks.ListCheckRunsForRefIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListCheckRunsOptions{}
	iter = client.Checks.ListCheckRunsForRefIter(t.Context(), "", "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Checks.ListCheckRunsForRefIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Checks.ListCheckRunsForRefIter(t.Context(), "", "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Checks.ListCheckRunsForRefIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Checks.ListCheckRunsForRefIter(t.Context(), "", "", "", nil)
	gotItems = 0
	iter(func(item *CheckRun, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Checks.ListCheckRunsForRefIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestChecksService_ListCheckSuitesForRefIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"check_suites": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"check_suites": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"check_suites": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"check_suites": [{},{}]}`)
		}
	})

	iter := client.Checks.ListCheckSuitesForRefIter(t.Context(), "", "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Checks.ListCheckSuitesForRefIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListCheckSuiteOptions{}
	iter = client.Checks.ListCheckSuitesForRefIter(t.Context(), "", "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Checks.ListCheckSuitesForRefIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Checks.ListCheckSuitesForRefIter(t.Context(), "", "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Checks.ListCheckSuitesForRefIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Checks.ListCheckSuitesForRefIter(t.Context(), "", "", "", nil)
	gotItems = 0
	iter(func(item *CheckSuite, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Checks.ListCheckSuitesForRefIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestClassroomService_ListAcceptedAssignmentsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Classroom.ListAcceptedAssignmentsIter(t.Context(), 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Classroom.ListAcceptedAssignmentsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Classroom.ListAcceptedAssignmentsIter(t.Context(), 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Classroom.ListAcceptedAssignmentsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Classroom.ListAcceptedAssignmentsIter(t.Context(), 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Classroom.ListAcceptedAssignmentsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Classroom.ListAcceptedAssignmentsIter(t.Context(), 0, nil)
	gotItems = 0
	iter(func(item *AcceptedAssignment, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Classroom.ListAcceptedAssignmentsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestClassroomService_ListClassroomAssignmentsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Classroom.ListClassroomAssignmentsIter(t.Context(), 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Classroom.ListClassroomAssignmentsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Classroom.ListClassroomAssignmentsIter(t.Context(), 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Classroom.ListClassroomAssignmentsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Classroom.ListClassroomAssignmentsIter(t.Context(), 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Classroom.ListClassroomAssignmentsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Classroom.ListClassroomAssignmentsIter(t.Context(), 0, nil)
	gotItems = 0
	iter(func(item *ClassroomAssignment, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Classroom.ListClassroomAssignmentsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestClassroomService_ListClassroomsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Classroom.ListClassroomsIter(t.Context(), nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Classroom.ListClassroomsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Classroom.ListClassroomsIter(t.Context(), opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Classroom.ListClassroomsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Classroom.ListClassroomsIter(t.Context(), nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Classroom.ListClassroomsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Classroom.ListClassroomsIter(t.Context(), nil)
	gotItems = 0
	iter(func(item *Classroom, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Classroom.ListClassroomsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestCodeScanningService_ListAlertInstancesIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.CodeScanning.ListAlertInstancesIter(t.Context(), "", "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.CodeScanning.ListAlertInstancesIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &AlertInstancesListOptions{}
	iter = client.CodeScanning.ListAlertInstancesIter(t.Context(), "", "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.CodeScanning.ListAlertInstancesIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.CodeScanning.ListAlertInstancesIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.CodeScanning.ListAlertInstancesIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.CodeScanning.ListAlertInstancesIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	iter(func(item *MostRecentInstance, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.CodeScanning.ListAlertInstancesIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestCodeScanningService_ListAlertsForOrgIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?after=yo>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.CodeScanning.ListAlertsForOrgIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.CodeScanning.ListAlertsForOrgIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &AlertListOptions{}
	iter = client.CodeScanning.ListAlertsForOrgIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.CodeScanning.ListAlertsForOrgIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.CodeScanning.ListAlertsForOrgIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.CodeScanning.ListAlertsForOrgIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.CodeScanning.ListAlertsForOrgIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *Alert, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.CodeScanning.ListAlertsForOrgIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestCodeScanningService_ListAlertsForRepoIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?after=yo>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.CodeScanning.ListAlertsForRepoIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.CodeScanning.ListAlertsForRepoIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &AlertListOptions{}
	iter = client.CodeScanning.ListAlertsForRepoIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.CodeScanning.ListAlertsForRepoIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.CodeScanning.ListAlertsForRepoIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.CodeScanning.ListAlertsForRepoIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.CodeScanning.ListAlertsForRepoIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Alert, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.CodeScanning.ListAlertsForRepoIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestCodeScanningService_ListAnalysesForRepoIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.CodeScanning.ListAnalysesForRepoIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.CodeScanning.ListAnalysesForRepoIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &AnalysesListOptions{}
	iter = client.CodeScanning.ListAnalysesForRepoIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.CodeScanning.ListAnalysesForRepoIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.CodeScanning.ListAnalysesForRepoIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.CodeScanning.ListAnalysesForRepoIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.CodeScanning.ListAnalysesForRepoIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *ScanningAnalysis, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.CodeScanning.ListAnalysesForRepoIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestCodespacesService_ListIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"codespaces": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"codespaces": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"codespaces": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"codespaces": [{},{}]}`)
		}
	})

	iter := client.Codespaces.ListIter(t.Context(), nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Codespaces.ListIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListCodespacesOptions{}
	iter = client.Codespaces.ListIter(t.Context(), opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Codespaces.ListIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Codespaces.ListIter(t.Context(), nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Codespaces.ListIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Codespaces.ListIter(t.Context(), nil)
	gotItems = 0
	iter(func(item *Codespace, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Codespaces.ListIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestCodespacesService_ListDevContainerConfigurationsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"devcontainers": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"devcontainers": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"devcontainers": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"devcontainers": [{},{}]}`)
		}
	})

	iter := client.Codespaces.ListDevContainerConfigurationsIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Codespaces.ListDevContainerConfigurationsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Codespaces.ListDevContainerConfigurationsIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Codespaces.ListDevContainerConfigurationsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Codespaces.ListDevContainerConfigurationsIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Codespaces.ListDevContainerConfigurationsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Codespaces.ListDevContainerConfigurationsIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *DevContainer, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Codespaces.ListDevContainerConfigurationsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestCodespacesService_ListInOrgIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"codespaces": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"codespaces": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"codespaces": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"codespaces": [{},{}]}`)
		}
	})

	iter := client.Codespaces.ListInOrgIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Codespaces.ListInOrgIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Codespaces.ListInOrgIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Codespaces.ListInOrgIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Codespaces.ListInOrgIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Codespaces.ListInOrgIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Codespaces.ListInOrgIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *Codespace, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Codespaces.ListInOrgIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestCodespacesService_ListInRepoIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"codespaces": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"codespaces": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"codespaces": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"codespaces": [{},{}]}`)
		}
	})

	iter := client.Codespaces.ListInRepoIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Codespaces.ListInRepoIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Codespaces.ListInRepoIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Codespaces.ListInRepoIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Codespaces.ListInRepoIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Codespaces.ListInRepoIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Codespaces.ListInRepoIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Codespace, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Codespaces.ListInRepoIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestCodespacesService_ListOrgSecretsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"secrets": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"secrets": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"secrets": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"secrets": [{},{}]}`)
		}
	})

	iter := client.Codespaces.ListOrgSecretsIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Codespaces.ListOrgSecretsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Codespaces.ListOrgSecretsIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Codespaces.ListOrgSecretsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Codespaces.ListOrgSecretsIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Codespaces.ListOrgSecretsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Codespaces.ListOrgSecretsIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *Secret, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Codespaces.ListOrgSecretsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestCodespacesService_ListRepoSecretsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"secrets": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"secrets": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"secrets": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"secrets": [{},{}]}`)
		}
	})

	iter := client.Codespaces.ListRepoSecretsIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Codespaces.ListRepoSecretsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Codespaces.ListRepoSecretsIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Codespaces.ListRepoSecretsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Codespaces.ListRepoSecretsIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Codespaces.ListRepoSecretsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Codespaces.ListRepoSecretsIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Secret, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Codespaces.ListRepoSecretsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestCodespacesService_ListSelectedReposForOrgSecretIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"repositories": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"repositories": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"repositories": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"repositories": [{},{}]}`)
		}
	})

	iter := client.Codespaces.ListSelectedReposForOrgSecretIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Codespaces.ListSelectedReposForOrgSecretIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Codespaces.ListSelectedReposForOrgSecretIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Codespaces.ListSelectedReposForOrgSecretIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Codespaces.ListSelectedReposForOrgSecretIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Codespaces.ListSelectedReposForOrgSecretIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Codespaces.ListSelectedReposForOrgSecretIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Repository, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Codespaces.ListSelectedReposForOrgSecretIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestCodespacesService_ListSelectedReposForUserSecretIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"repositories": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"repositories": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"repositories": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"repositories": [{},{}]}`)
		}
	})

	iter := client.Codespaces.ListSelectedReposForUserSecretIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Codespaces.ListSelectedReposForUserSecretIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Codespaces.ListSelectedReposForUserSecretIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Codespaces.ListSelectedReposForUserSecretIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Codespaces.ListSelectedReposForUserSecretIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Codespaces.ListSelectedReposForUserSecretIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Codespaces.ListSelectedReposForUserSecretIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *Repository, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Codespaces.ListSelectedReposForUserSecretIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestCodespacesService_ListUserCodespacesInOrgIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"codespaces": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"codespaces": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"codespaces": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"codespaces": [{},{}]}`)
		}
	})

	iter := client.Codespaces.ListUserCodespacesInOrgIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Codespaces.ListUserCodespacesInOrgIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Codespaces.ListUserCodespacesInOrgIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Codespaces.ListUserCodespacesInOrgIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Codespaces.ListUserCodespacesInOrgIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Codespaces.ListUserCodespacesInOrgIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Codespaces.ListUserCodespacesInOrgIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Codespace, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Codespaces.ListUserCodespacesInOrgIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestCodespacesService_ListUserSecretsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"secrets": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"secrets": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"secrets": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"secrets": [{},{}]}`)
		}
	})

	iter := client.Codespaces.ListUserSecretsIter(t.Context(), nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Codespaces.ListUserSecretsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Codespaces.ListUserSecretsIter(t.Context(), opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Codespaces.ListUserSecretsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Codespaces.ListUserSecretsIter(t.Context(), nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Codespaces.ListUserSecretsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Codespaces.ListUserSecretsIter(t.Context(), nil)
	gotItems = 0
	iter(func(item *Secret, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Codespaces.ListUserSecretsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestCopilotService_ListCopilotEnterpriseSeatsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"seats": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"seats": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"seats": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"seats": [{},{}]}`)
		}
	})

	iter := client.Copilot.ListCopilotEnterpriseSeatsIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Copilot.ListCopilotEnterpriseSeatsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Copilot.ListCopilotEnterpriseSeatsIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Copilot.ListCopilotEnterpriseSeatsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Copilot.ListCopilotEnterpriseSeatsIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Copilot.ListCopilotEnterpriseSeatsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Copilot.ListCopilotEnterpriseSeatsIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *CopilotSeatDetails, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Copilot.ListCopilotEnterpriseSeatsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestCopilotService_ListCopilotSeatsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"seats": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"seats": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"seats": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"seats": [{},{}]}`)
		}
	})

	iter := client.Copilot.ListCopilotSeatsIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Copilot.ListCopilotSeatsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Copilot.ListCopilotSeatsIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Copilot.ListCopilotSeatsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Copilot.ListCopilotSeatsIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Copilot.ListCopilotSeatsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Copilot.ListCopilotSeatsIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *CopilotSeatDetails, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Copilot.ListCopilotSeatsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestDependabotService_ListOrgAlertsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?after=yo>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Dependabot.ListOrgAlertsIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Dependabot.ListOrgAlertsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListAlertsOptions{}
	iter = client.Dependabot.ListOrgAlertsIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Dependabot.ListOrgAlertsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Dependabot.ListOrgAlertsIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Dependabot.ListOrgAlertsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Dependabot.ListOrgAlertsIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *DependabotAlert, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Dependabot.ListOrgAlertsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestDependabotService_ListOrgSecretsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"secrets": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"secrets": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"secrets": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"secrets": [{},{}]}`)
		}
	})

	iter := client.Dependabot.ListOrgSecretsIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Dependabot.ListOrgSecretsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Dependabot.ListOrgSecretsIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Dependabot.ListOrgSecretsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Dependabot.ListOrgSecretsIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Dependabot.ListOrgSecretsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Dependabot.ListOrgSecretsIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *Secret, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Dependabot.ListOrgSecretsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestDependabotService_ListRepoAlertsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?after=yo>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Dependabot.ListRepoAlertsIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Dependabot.ListRepoAlertsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListAlertsOptions{}
	iter = client.Dependabot.ListRepoAlertsIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Dependabot.ListRepoAlertsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Dependabot.ListRepoAlertsIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Dependabot.ListRepoAlertsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Dependabot.ListRepoAlertsIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *DependabotAlert, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Dependabot.ListRepoAlertsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestDependabotService_ListRepoSecretsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"secrets": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"secrets": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"secrets": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"secrets": [{},{}]}`)
		}
	})

	iter := client.Dependabot.ListRepoSecretsIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Dependabot.ListRepoSecretsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Dependabot.ListRepoSecretsIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Dependabot.ListRepoSecretsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Dependabot.ListRepoSecretsIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Dependabot.ListRepoSecretsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Dependabot.ListRepoSecretsIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Secret, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Dependabot.ListRepoSecretsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestDependabotService_ListSelectedReposForOrgSecretIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"repositories": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"repositories": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"repositories": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"repositories": [{},{}]}`)
		}
	})

	iter := client.Dependabot.ListSelectedReposForOrgSecretIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Dependabot.ListSelectedReposForOrgSecretIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Dependabot.ListSelectedReposForOrgSecretIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Dependabot.ListSelectedReposForOrgSecretIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Dependabot.ListSelectedReposForOrgSecretIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Dependabot.ListSelectedReposForOrgSecretIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Dependabot.ListSelectedReposForOrgSecretIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Repository, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Dependabot.ListSelectedReposForOrgSecretIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestEnterpriseService_ListAppAccessibleOrganizationRepositoriesIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Enterprise.ListAppAccessibleOrganizationRepositoriesIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Enterprise.ListAppAccessibleOrganizationRepositoriesIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Enterprise.ListAppAccessibleOrganizationRepositoriesIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Enterprise.ListAppAccessibleOrganizationRepositoriesIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Enterprise.ListAppAccessibleOrganizationRepositoriesIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Enterprise.ListAppAccessibleOrganizationRepositoriesIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Enterprise.ListAppAccessibleOrganizationRepositoriesIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *AccessibleRepository, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Enterprise.ListAppAccessibleOrganizationRepositoriesIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestEnterpriseService_ListAppInstallableOrganizationsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Enterprise.ListAppInstallableOrganizationsIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Enterprise.ListAppInstallableOrganizationsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Enterprise.ListAppInstallableOrganizationsIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Enterprise.ListAppInstallableOrganizationsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Enterprise.ListAppInstallableOrganizationsIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Enterprise.ListAppInstallableOrganizationsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Enterprise.ListAppInstallableOrganizationsIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *InstallableOrganization, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Enterprise.ListAppInstallableOrganizationsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestEnterpriseService_ListAppInstallationsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Enterprise.ListAppInstallationsIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Enterprise.ListAppInstallationsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Enterprise.ListAppInstallationsIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Enterprise.ListAppInstallationsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Enterprise.ListAppInstallationsIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Enterprise.ListAppInstallationsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Enterprise.ListAppInstallationsIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Installation, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Enterprise.ListAppInstallationsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestEnterpriseService_ListAssignmentsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Enterprise.ListAssignmentsIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Enterprise.ListAssignmentsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Enterprise.ListAssignmentsIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Enterprise.ListAssignmentsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Enterprise.ListAssignmentsIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Enterprise.ListAssignmentsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Enterprise.ListAssignmentsIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Organization, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Enterprise.ListAssignmentsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestEnterpriseService_ListCodeSecurityConfigurationRepositoriesIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?after=yo>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Enterprise.ListCodeSecurityConfigurationRepositoriesIter(t.Context(), "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Enterprise.ListCodeSecurityConfigurationRepositoriesIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListCodeSecurityConfigurationRepositoriesOptions{}
	iter = client.Enterprise.ListCodeSecurityConfigurationRepositoriesIter(t.Context(), "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Enterprise.ListCodeSecurityConfigurationRepositoriesIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Enterprise.ListCodeSecurityConfigurationRepositoriesIter(t.Context(), "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Enterprise.ListCodeSecurityConfigurationRepositoriesIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Enterprise.ListCodeSecurityConfigurationRepositoriesIter(t.Context(), "", 0, nil)
	gotItems = 0
	iter(func(item *RepositoryAttachment, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Enterprise.ListCodeSecurityConfigurationRepositoriesIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestEnterpriseService_ListCodeSecurityConfigurationsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?after=yo>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Enterprise.ListCodeSecurityConfigurationsIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Enterprise.ListCodeSecurityConfigurationsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListEnterpriseCodeSecurityConfigurationOptions{}
	iter = client.Enterprise.ListCodeSecurityConfigurationsIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Enterprise.ListCodeSecurityConfigurationsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Enterprise.ListCodeSecurityConfigurationsIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Enterprise.ListCodeSecurityConfigurationsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Enterprise.ListCodeSecurityConfigurationsIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *CodeSecurityConfiguration, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Enterprise.ListCodeSecurityConfigurationsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestEnterpriseService_ListEnterpriseNetworkConfigurationsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"network_configurations": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"network_configurations": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"network_configurations": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"network_configurations": [{},{}]}`)
		}
	})

	iter := client.Enterprise.ListEnterpriseNetworkConfigurationsIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Enterprise.ListEnterpriseNetworkConfigurationsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Enterprise.ListEnterpriseNetworkConfigurationsIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Enterprise.ListEnterpriseNetworkConfigurationsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Enterprise.ListEnterpriseNetworkConfigurationsIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Enterprise.ListEnterpriseNetworkConfigurationsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Enterprise.ListEnterpriseNetworkConfigurationsIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *NetworkConfiguration, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Enterprise.ListEnterpriseNetworkConfigurationsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestEnterpriseService_ListHostedRunnersIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"runners": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"runners": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"runners": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"runners": [{},{}]}`)
		}
	})

	iter := client.Enterprise.ListHostedRunnersIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Enterprise.ListHostedRunnersIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Enterprise.ListHostedRunnersIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Enterprise.ListHostedRunnersIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Enterprise.ListHostedRunnersIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Enterprise.ListHostedRunnersIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Enterprise.ListHostedRunnersIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *HostedRunner, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Enterprise.ListHostedRunnersIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestEnterpriseService_ListOrganizationAccessRunnerGroupIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"organizations": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"organizations": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"organizations": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"organizations": [{},{}]}`)
		}
	})

	iter := client.Enterprise.ListOrganizationAccessRunnerGroupIter(t.Context(), "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Enterprise.ListOrganizationAccessRunnerGroupIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Enterprise.ListOrganizationAccessRunnerGroupIter(t.Context(), "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Enterprise.ListOrganizationAccessRunnerGroupIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Enterprise.ListOrganizationAccessRunnerGroupIter(t.Context(), "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Enterprise.ListOrganizationAccessRunnerGroupIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Enterprise.ListOrganizationAccessRunnerGroupIter(t.Context(), "", 0, nil)
	gotItems = 0
	iter(func(item *Organization, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Enterprise.ListOrganizationAccessRunnerGroupIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestEnterpriseService_ListOrganizationCustomPropertyValuesIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Enterprise.ListOrganizationCustomPropertyValuesIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Enterprise.ListOrganizationCustomPropertyValuesIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Enterprise.ListOrganizationCustomPropertyValuesIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Enterprise.ListOrganizationCustomPropertyValuesIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Enterprise.ListOrganizationCustomPropertyValuesIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Enterprise.ListOrganizationCustomPropertyValuesIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Enterprise.ListOrganizationCustomPropertyValuesIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *EnterpriseCustomPropertiesValues, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Enterprise.ListOrganizationCustomPropertyValuesIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestEnterpriseService_ListRepositoriesForOrgAppInstallationIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Enterprise.ListRepositoriesForOrgAppInstallationIter(t.Context(), "", "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Enterprise.ListRepositoriesForOrgAppInstallationIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Enterprise.ListRepositoriesForOrgAppInstallationIter(t.Context(), "", "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Enterprise.ListRepositoriesForOrgAppInstallationIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Enterprise.ListRepositoriesForOrgAppInstallationIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Enterprise.ListRepositoriesForOrgAppInstallationIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Enterprise.ListRepositoriesForOrgAppInstallationIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	iter(func(item *AccessibleRepository, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Enterprise.ListRepositoriesForOrgAppInstallationIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestEnterpriseService_ListRunnerGroupRunnersIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"runners": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"runners": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"runners": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"runners": [{},{}]}`)
		}
	})

	iter := client.Enterprise.ListRunnerGroupRunnersIter(t.Context(), "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Enterprise.ListRunnerGroupRunnersIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Enterprise.ListRunnerGroupRunnersIter(t.Context(), "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Enterprise.ListRunnerGroupRunnersIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Enterprise.ListRunnerGroupRunnersIter(t.Context(), "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Enterprise.ListRunnerGroupRunnersIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Enterprise.ListRunnerGroupRunnersIter(t.Context(), "", 0, nil)
	gotItems = 0
	iter(func(item *Runner, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Enterprise.ListRunnerGroupRunnersIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestEnterpriseService_ListRunnerGroupsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"runner_groups": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"runner_groups": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"runner_groups": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"runner_groups": [{},{}]}`)
		}
	})

	iter := client.Enterprise.ListRunnerGroupsIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Enterprise.ListRunnerGroupsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListEnterpriseRunnerGroupOptions{}
	iter = client.Enterprise.ListRunnerGroupsIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Enterprise.ListRunnerGroupsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Enterprise.ListRunnerGroupsIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Enterprise.ListRunnerGroupsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Enterprise.ListRunnerGroupsIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *EnterpriseRunnerGroup, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Enterprise.ListRunnerGroupsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestEnterpriseService_ListRunnersIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"runners": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"runners": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"runners": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"runners": [{},{}]}`)
		}
	})

	iter := client.Enterprise.ListRunnersIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Enterprise.ListRunnersIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListRunnersOptions{}
	iter = client.Enterprise.ListRunnersIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Enterprise.ListRunnersIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Enterprise.ListRunnersIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Enterprise.ListRunnersIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Enterprise.ListRunnersIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *Runner, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Enterprise.ListRunnersIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestEnterpriseService_ListTeamMembersIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Enterprise.ListTeamMembersIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Enterprise.ListTeamMembersIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Enterprise.ListTeamMembersIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Enterprise.ListTeamMembersIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Enterprise.ListTeamMembersIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Enterprise.ListTeamMembersIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Enterprise.ListTeamMembersIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *User, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Enterprise.ListTeamMembersIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestEnterpriseService_ListTeamsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Enterprise.ListTeamsIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Enterprise.ListTeamsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Enterprise.ListTeamsIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Enterprise.ListTeamsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Enterprise.ListTeamsIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Enterprise.ListTeamsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Enterprise.ListTeamsIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *EnterpriseTeam, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Enterprise.ListTeamsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestGistsService_ListIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Gists.ListIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Gists.ListIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &GistListOptions{}
	iter = client.Gists.ListIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Gists.ListIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Gists.ListIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Gists.ListIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Gists.ListIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *Gist, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Gists.ListIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestGistsService_ListAllIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Gists.ListAllIter(t.Context(), nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Gists.ListAllIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &GistListOptions{}
	iter = client.Gists.ListAllIter(t.Context(), opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Gists.ListAllIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Gists.ListAllIter(t.Context(), nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Gists.ListAllIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Gists.ListAllIter(t.Context(), nil)
	gotItems = 0
	iter(func(item *Gist, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Gists.ListAllIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestGistsService_ListCommentsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Gists.ListCommentsIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Gists.ListCommentsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Gists.ListCommentsIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Gists.ListCommentsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Gists.ListCommentsIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Gists.ListCommentsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Gists.ListCommentsIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *GistComment, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Gists.ListCommentsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestGistsService_ListCommitsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Gists.ListCommitsIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Gists.ListCommitsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Gists.ListCommitsIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Gists.ListCommitsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Gists.ListCommitsIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Gists.ListCommitsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Gists.ListCommitsIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *GistCommit, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Gists.ListCommitsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestGistsService_ListForksIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Gists.ListForksIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Gists.ListForksIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Gists.ListForksIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Gists.ListForksIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Gists.ListForksIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Gists.ListForksIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Gists.ListForksIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *GistFork, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Gists.ListForksIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestGistsService_ListStarredIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Gists.ListStarredIter(t.Context(), nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Gists.ListStarredIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &GistListOptions{}
	iter = client.Gists.ListStarredIter(t.Context(), opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Gists.ListStarredIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Gists.ListStarredIter(t.Context(), nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Gists.ListStarredIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Gists.ListStarredIter(t.Context(), nil)
	gotItems = 0
	iter(func(item *Gist, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Gists.ListStarredIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestIssuesService_ListAllIssuesIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Issues.ListAllIssuesIter(t.Context(), nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Issues.ListAllIssuesIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListAllIssuesOptions{}
	iter = client.Issues.ListAllIssuesIter(t.Context(), opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Issues.ListAllIssuesIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Issues.ListAllIssuesIter(t.Context(), nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Issues.ListAllIssuesIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Issues.ListAllIssuesIter(t.Context(), nil)
	gotItems = 0
	iter(func(item *Issue, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Issues.ListAllIssuesIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestIssuesService_ListAssigneesIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Issues.ListAssigneesIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Issues.ListAssigneesIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Issues.ListAssigneesIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Issues.ListAssigneesIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Issues.ListAssigneesIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Issues.ListAssigneesIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Issues.ListAssigneesIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *User, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Issues.ListAssigneesIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestIssuesService_ListByOrgIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Issues.ListByOrgIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Issues.ListByOrgIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &IssueListByOrgOptions{}
	iter = client.Issues.ListByOrgIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Issues.ListByOrgIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Issues.ListByOrgIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Issues.ListByOrgIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Issues.ListByOrgIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *Issue, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Issues.ListByOrgIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestIssuesService_ListByRepoIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?after=yo>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Issues.ListByRepoIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Issues.ListByRepoIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &IssueListByRepoOptions{}
	iter = client.Issues.ListByRepoIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Issues.ListByRepoIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Issues.ListByRepoIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Issues.ListByRepoIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Issues.ListByRepoIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Issue, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Issues.ListByRepoIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestIssuesService_ListCommentsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Issues.ListCommentsIter(t.Context(), "", "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Issues.ListCommentsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &IssueListCommentsOptions{}
	iter = client.Issues.ListCommentsIter(t.Context(), "", "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Issues.ListCommentsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Issues.ListCommentsIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Issues.ListCommentsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Issues.ListCommentsIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	iter(func(item *IssueComment, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Issues.ListCommentsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestIssuesService_ListIssueEventsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Issues.ListIssueEventsIter(t.Context(), "", "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Issues.ListIssueEventsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Issues.ListIssueEventsIter(t.Context(), "", "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Issues.ListIssueEventsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Issues.ListIssueEventsIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Issues.ListIssueEventsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Issues.ListIssueEventsIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	iter(func(item *IssueEvent, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Issues.ListIssueEventsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestIssuesService_ListIssueTimelineIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Issues.ListIssueTimelineIter(t.Context(), "", "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Issues.ListIssueTimelineIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Issues.ListIssueTimelineIter(t.Context(), "", "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Issues.ListIssueTimelineIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Issues.ListIssueTimelineIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Issues.ListIssueTimelineIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Issues.ListIssueTimelineIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	iter(func(item *Timeline, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Issues.ListIssueTimelineIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestIssuesService_ListLabelsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Issues.ListLabelsIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Issues.ListLabelsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Issues.ListLabelsIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Issues.ListLabelsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Issues.ListLabelsIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Issues.ListLabelsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Issues.ListLabelsIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Label, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Issues.ListLabelsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestIssuesService_ListLabelsByIssueIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Issues.ListLabelsByIssueIter(t.Context(), "", "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Issues.ListLabelsByIssueIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Issues.ListLabelsByIssueIter(t.Context(), "", "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Issues.ListLabelsByIssueIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Issues.ListLabelsByIssueIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Issues.ListLabelsByIssueIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Issues.ListLabelsByIssueIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	iter(func(item *Label, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Issues.ListLabelsByIssueIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestIssuesService_ListLabelsForMilestoneIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Issues.ListLabelsForMilestoneIter(t.Context(), "", "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Issues.ListLabelsForMilestoneIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Issues.ListLabelsForMilestoneIter(t.Context(), "", "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Issues.ListLabelsForMilestoneIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Issues.ListLabelsForMilestoneIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Issues.ListLabelsForMilestoneIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Issues.ListLabelsForMilestoneIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	iter(func(item *Label, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Issues.ListLabelsForMilestoneIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestIssuesService_ListMilestonesIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Issues.ListMilestonesIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Issues.ListMilestonesIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &MilestoneListOptions{}
	iter = client.Issues.ListMilestonesIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Issues.ListMilestonesIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Issues.ListMilestonesIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Issues.ListMilestonesIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Issues.ListMilestonesIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Milestone, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Issues.ListMilestonesIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestIssuesService_ListRepositoryEventsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Issues.ListRepositoryEventsIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Issues.ListRepositoryEventsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Issues.ListRepositoryEventsIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Issues.ListRepositoryEventsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Issues.ListRepositoryEventsIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Issues.ListRepositoryEventsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Issues.ListRepositoryEventsIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *IssueEvent, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Issues.ListRepositoryEventsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestIssuesService_ListUserIssuesIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Issues.ListUserIssuesIter(t.Context(), nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Issues.ListUserIssuesIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListUserIssuesOptions{}
	iter = client.Issues.ListUserIssuesIter(t.Context(), opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Issues.ListUserIssuesIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Issues.ListUserIssuesIter(t.Context(), nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Issues.ListUserIssuesIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Issues.ListUserIssuesIter(t.Context(), nil)
	gotItems = 0
	iter(func(item *Issue, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Issues.ListUserIssuesIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestLicensesService_ListIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Licenses.ListIter(t.Context(), nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Licenses.ListIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListLicensesOptions{}
	iter = client.Licenses.ListIter(t.Context(), opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Licenses.ListIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Licenses.ListIter(t.Context(), nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Licenses.ListIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Licenses.ListIter(t.Context(), nil)
	gotItems = 0
	iter(func(item *License, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Licenses.ListIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestMarketplaceService_ListMarketplacePurchasesForUserIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Marketplace.ListMarketplacePurchasesForUserIter(t.Context(), nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Marketplace.ListMarketplacePurchasesForUserIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Marketplace.ListMarketplacePurchasesForUserIter(t.Context(), opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Marketplace.ListMarketplacePurchasesForUserIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Marketplace.ListMarketplacePurchasesForUserIter(t.Context(), nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Marketplace.ListMarketplacePurchasesForUserIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Marketplace.ListMarketplacePurchasesForUserIter(t.Context(), nil)
	gotItems = 0
	iter(func(item *MarketplacePurchase, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Marketplace.ListMarketplacePurchasesForUserIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestMarketplaceService_ListPlanAccountsForPlanIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Marketplace.ListPlanAccountsForPlanIter(t.Context(), 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Marketplace.ListPlanAccountsForPlanIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Marketplace.ListPlanAccountsForPlanIter(t.Context(), 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Marketplace.ListPlanAccountsForPlanIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Marketplace.ListPlanAccountsForPlanIter(t.Context(), 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Marketplace.ListPlanAccountsForPlanIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Marketplace.ListPlanAccountsForPlanIter(t.Context(), 0, nil)
	gotItems = 0
	iter(func(item *MarketplacePlanAccount, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Marketplace.ListPlanAccountsForPlanIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestMarketplaceService_ListPlansIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Marketplace.ListPlansIter(t.Context(), nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Marketplace.ListPlansIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Marketplace.ListPlansIter(t.Context(), opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Marketplace.ListPlansIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Marketplace.ListPlansIter(t.Context(), nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Marketplace.ListPlansIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Marketplace.ListPlansIter(t.Context(), nil)
	gotItems = 0
	iter(func(item *MarketplacePlan, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Marketplace.ListPlansIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestMigrationService_ListMigrationsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Migrations.ListMigrationsIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Migrations.ListMigrationsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Migrations.ListMigrationsIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Migrations.ListMigrationsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Migrations.ListMigrationsIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Migrations.ListMigrationsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Migrations.ListMigrationsIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *Migration, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Migrations.ListMigrationsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestMigrationService_ListUserMigrationsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Migrations.ListUserMigrationsIter(t.Context(), nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Migrations.ListUserMigrationsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Migrations.ListUserMigrationsIter(t.Context(), opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Migrations.ListUserMigrationsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Migrations.ListUserMigrationsIter(t.Context(), nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Migrations.ListUserMigrationsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Migrations.ListUserMigrationsIter(t.Context(), nil)
	gotItems = 0
	iter(func(item *UserMigration, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Migrations.ListUserMigrationsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestOrganizationsService_ListIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Organizations.ListIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Organizations.ListIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Organizations.ListIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Organizations.ListIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Organizations.ListIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Organizations.ListIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *Organization, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestOrganizationsService_ListAttestationsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"attestations": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"attestations": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"attestations": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"attestations": [{},{}]}`)
		}
	})

	iter := client.Organizations.ListAttestationsIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Organizations.ListAttestationsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Organizations.ListAttestationsIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Organizations.ListAttestationsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Organizations.ListAttestationsIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListAttestationsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Organizations.ListAttestationsIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Attestation, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListAttestationsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestOrganizationsService_ListBlockedUsersIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Organizations.ListBlockedUsersIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Organizations.ListBlockedUsersIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Organizations.ListBlockedUsersIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Organizations.ListBlockedUsersIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Organizations.ListBlockedUsersIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListBlockedUsersIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Organizations.ListBlockedUsersIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *User, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListBlockedUsersIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestOrganizationsService_ListCodeSecurityConfigurationRepositoriesIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?after=yo>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Organizations.ListCodeSecurityConfigurationRepositoriesIter(t.Context(), "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Organizations.ListCodeSecurityConfigurationRepositoriesIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListCodeSecurityConfigurationRepositoriesOptions{}
	iter = client.Organizations.ListCodeSecurityConfigurationRepositoriesIter(t.Context(), "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Organizations.ListCodeSecurityConfigurationRepositoriesIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Organizations.ListCodeSecurityConfigurationRepositoriesIter(t.Context(), "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListCodeSecurityConfigurationRepositoriesIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Organizations.ListCodeSecurityConfigurationRepositoriesIter(t.Context(), "", 0, nil)
	gotItems = 0
	iter(func(item *RepositoryAttachment, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListCodeSecurityConfigurationRepositoriesIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestOrganizationsService_ListCodeSecurityConfigurationsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?after=yo>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Organizations.ListCodeSecurityConfigurationsIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Organizations.ListCodeSecurityConfigurationsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOrgCodeSecurityConfigurationOptions{}
	iter = client.Organizations.ListCodeSecurityConfigurationsIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Organizations.ListCodeSecurityConfigurationsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Organizations.ListCodeSecurityConfigurationsIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListCodeSecurityConfigurationsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Organizations.ListCodeSecurityConfigurationsIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *CodeSecurityConfiguration, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListCodeSecurityConfigurationsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestOrganizationsService_ListCredentialAuthorizationsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Organizations.ListCredentialAuthorizationsIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Organizations.ListCredentialAuthorizationsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &CredentialAuthorizationsListOptions{}
	iter = client.Organizations.ListCredentialAuthorizationsIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Organizations.ListCredentialAuthorizationsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Organizations.ListCredentialAuthorizationsIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListCredentialAuthorizationsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Organizations.ListCredentialAuthorizationsIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *CredentialAuthorization, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListCredentialAuthorizationsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestOrganizationsService_ListCustomPropertyValuesIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Organizations.ListCustomPropertyValuesIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Organizations.ListCustomPropertyValuesIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListCustomPropertyValuesOptions{}
	iter = client.Organizations.ListCustomPropertyValuesIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Organizations.ListCustomPropertyValuesIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Organizations.ListCustomPropertyValuesIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListCustomPropertyValuesIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Organizations.ListCustomPropertyValuesIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *RepoCustomPropertyValue, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListCustomPropertyValuesIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestOrganizationsService_ListFailedOrgInvitationsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Organizations.ListFailedOrgInvitationsIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Organizations.ListFailedOrgInvitationsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Organizations.ListFailedOrgInvitationsIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Organizations.ListFailedOrgInvitationsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Organizations.ListFailedOrgInvitationsIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListFailedOrgInvitationsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Organizations.ListFailedOrgInvitationsIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *Invitation, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListFailedOrgInvitationsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestOrganizationsService_ListFineGrainedPersonalAccessTokenRequestsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Organizations.ListFineGrainedPersonalAccessTokenRequestsIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Organizations.ListFineGrainedPersonalAccessTokenRequestsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListFineGrainedPATOptions{}
	iter = client.Organizations.ListFineGrainedPersonalAccessTokenRequestsIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Organizations.ListFineGrainedPersonalAccessTokenRequestsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Organizations.ListFineGrainedPersonalAccessTokenRequestsIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListFineGrainedPersonalAccessTokenRequestsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Organizations.ListFineGrainedPersonalAccessTokenRequestsIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *FineGrainedPersonalAccessTokenRequest, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListFineGrainedPersonalAccessTokenRequestsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestOrganizationsService_ListFineGrainedPersonalAccessTokensIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Organizations.ListFineGrainedPersonalAccessTokensIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Organizations.ListFineGrainedPersonalAccessTokensIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListFineGrainedPATOptions{}
	iter = client.Organizations.ListFineGrainedPersonalAccessTokensIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Organizations.ListFineGrainedPersonalAccessTokensIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Organizations.ListFineGrainedPersonalAccessTokensIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListFineGrainedPersonalAccessTokensIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Organizations.ListFineGrainedPersonalAccessTokensIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *PersonalAccessToken, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListFineGrainedPersonalAccessTokensIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestOrganizationsService_ListHookDeliveriesIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?after=yo>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Organizations.ListHookDeliveriesIter(t.Context(), "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Organizations.ListHookDeliveriesIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListCursorOptions{}
	iter = client.Organizations.ListHookDeliveriesIter(t.Context(), "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Organizations.ListHookDeliveriesIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Organizations.ListHookDeliveriesIter(t.Context(), "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListHookDeliveriesIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Organizations.ListHookDeliveriesIter(t.Context(), "", 0, nil)
	gotItems = 0
	iter(func(item *HookDelivery, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListHookDeliveriesIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestOrganizationsService_ListHooksIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Organizations.ListHooksIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Organizations.ListHooksIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Organizations.ListHooksIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Organizations.ListHooksIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Organizations.ListHooksIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListHooksIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Organizations.ListHooksIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *Hook, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListHooksIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestOrganizationsService_ListImmutableReleaseRepositoriesIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"repositories": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"repositories": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"repositories": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"repositories": [{},{}]}`)
		}
	})

	iter := client.Organizations.ListImmutableReleaseRepositoriesIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Organizations.ListImmutableReleaseRepositoriesIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Organizations.ListImmutableReleaseRepositoriesIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Organizations.ListImmutableReleaseRepositoriesIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Organizations.ListImmutableReleaseRepositoriesIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListImmutableReleaseRepositoriesIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Organizations.ListImmutableReleaseRepositoriesIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *Repository, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListImmutableReleaseRepositoriesIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestOrganizationsService_ListInstallationsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"installations": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"installations": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"installations": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"installations": [{},{}]}`)
		}
	})

	iter := client.Organizations.ListInstallationsIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Organizations.ListInstallationsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Organizations.ListInstallationsIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Organizations.ListInstallationsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Organizations.ListInstallationsIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListInstallationsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Organizations.ListInstallationsIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *Installation, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListInstallationsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestOrganizationsService_ListMembersIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Organizations.ListMembersIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Organizations.ListMembersIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListMembersOptions{}
	iter = client.Organizations.ListMembersIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Organizations.ListMembersIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Organizations.ListMembersIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListMembersIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Organizations.ListMembersIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *User, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListMembersIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestOrganizationsService_ListNetworkConfigurationsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"network_configurations": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"network_configurations": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"network_configurations": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"network_configurations": [{},{}]}`)
		}
	})

	iter := client.Organizations.ListNetworkConfigurationsIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Organizations.ListNetworkConfigurationsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Organizations.ListNetworkConfigurationsIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Organizations.ListNetworkConfigurationsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Organizations.ListNetworkConfigurationsIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListNetworkConfigurationsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Organizations.ListNetworkConfigurationsIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *NetworkConfiguration, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListNetworkConfigurationsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestOrganizationsService_ListOrgInvitationTeamsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Organizations.ListOrgInvitationTeamsIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Organizations.ListOrgInvitationTeamsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Organizations.ListOrgInvitationTeamsIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Organizations.ListOrgInvitationTeamsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Organizations.ListOrgInvitationTeamsIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListOrgInvitationTeamsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Organizations.ListOrgInvitationTeamsIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Team, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListOrgInvitationTeamsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestOrganizationsService_ListOrgMembershipsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Organizations.ListOrgMembershipsIter(t.Context(), nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Organizations.ListOrgMembershipsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOrgMembershipsOptions{}
	iter = client.Organizations.ListOrgMembershipsIter(t.Context(), opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Organizations.ListOrgMembershipsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Organizations.ListOrgMembershipsIter(t.Context(), nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListOrgMembershipsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Organizations.ListOrgMembershipsIter(t.Context(), nil)
	gotItems = 0
	iter(func(item *Membership, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListOrgMembershipsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestOrganizationsService_ListOutsideCollaboratorsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Organizations.ListOutsideCollaboratorsIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Organizations.ListOutsideCollaboratorsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOutsideCollaboratorsOptions{}
	iter = client.Organizations.ListOutsideCollaboratorsIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Organizations.ListOutsideCollaboratorsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Organizations.ListOutsideCollaboratorsIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListOutsideCollaboratorsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Organizations.ListOutsideCollaboratorsIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *User, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListOutsideCollaboratorsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestOrganizationsService_ListPackagesIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Organizations.ListPackagesIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Organizations.ListPackagesIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &PackageListOptions{}
	iter = client.Organizations.ListPackagesIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Organizations.ListPackagesIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Organizations.ListPackagesIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListPackagesIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Organizations.ListPackagesIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *Package, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListPackagesIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestOrganizationsService_ListPendingOrgInvitationsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Organizations.ListPendingOrgInvitationsIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Organizations.ListPendingOrgInvitationsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Organizations.ListPendingOrgInvitationsIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Organizations.ListPendingOrgInvitationsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Organizations.ListPendingOrgInvitationsIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListPendingOrgInvitationsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Organizations.ListPendingOrgInvitationsIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *Invitation, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListPendingOrgInvitationsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestOrganizationsService_ListTeamsAssignedToOrgRoleIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Organizations.ListTeamsAssignedToOrgRoleIter(t.Context(), "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Organizations.ListTeamsAssignedToOrgRoleIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Organizations.ListTeamsAssignedToOrgRoleIter(t.Context(), "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Organizations.ListTeamsAssignedToOrgRoleIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Organizations.ListTeamsAssignedToOrgRoleIter(t.Context(), "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListTeamsAssignedToOrgRoleIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Organizations.ListTeamsAssignedToOrgRoleIter(t.Context(), "", 0, nil)
	gotItems = 0
	iter(func(item *Team, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListTeamsAssignedToOrgRoleIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestOrganizationsService_ListUsersAssignedToOrgRoleIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Organizations.ListUsersAssignedToOrgRoleIter(t.Context(), "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Organizations.ListUsersAssignedToOrgRoleIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Organizations.ListUsersAssignedToOrgRoleIter(t.Context(), "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Organizations.ListUsersAssignedToOrgRoleIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Organizations.ListUsersAssignedToOrgRoleIter(t.Context(), "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListUsersAssignedToOrgRoleIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Organizations.ListUsersAssignedToOrgRoleIter(t.Context(), "", 0, nil)
	gotItems = 0
	iter(func(item *User, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Organizations.ListUsersAssignedToOrgRoleIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestPrivateRegistriesService_ListOrganizationPrivateRegistriesIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"configurations": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"configurations": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"configurations": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"configurations": [{},{}]}`)
		}
	})

	iter := client.PrivateRegistries.ListOrganizationPrivateRegistriesIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.PrivateRegistries.ListOrganizationPrivateRegistriesIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.PrivateRegistries.ListOrganizationPrivateRegistriesIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.PrivateRegistries.ListOrganizationPrivateRegistriesIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.PrivateRegistries.ListOrganizationPrivateRegistriesIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.PrivateRegistries.ListOrganizationPrivateRegistriesIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.PrivateRegistries.ListOrganizationPrivateRegistriesIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *PrivateRegistry, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.PrivateRegistries.ListOrganizationPrivateRegistriesIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestProjectsService_ListOrganizationProjectFieldsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?after=yo>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Projects.ListOrganizationProjectFieldsIter(t.Context(), "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Projects.ListOrganizationProjectFieldsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListProjectsOptions{}
	iter = client.Projects.ListOrganizationProjectFieldsIter(t.Context(), "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Projects.ListOrganizationProjectFieldsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Projects.ListOrganizationProjectFieldsIter(t.Context(), "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Projects.ListOrganizationProjectFieldsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Projects.ListOrganizationProjectFieldsIter(t.Context(), "", 0, nil)
	gotItems = 0
	iter(func(item *ProjectV2Field, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Projects.ListOrganizationProjectFieldsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestProjectsService_ListOrganizationProjectItemsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?after=yo>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Projects.ListOrganizationProjectItemsIter(t.Context(), "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Projects.ListOrganizationProjectItemsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListProjectItemsOptions{}
	iter = client.Projects.ListOrganizationProjectItemsIter(t.Context(), "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Projects.ListOrganizationProjectItemsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Projects.ListOrganizationProjectItemsIter(t.Context(), "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Projects.ListOrganizationProjectItemsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Projects.ListOrganizationProjectItemsIter(t.Context(), "", 0, nil)
	gotItems = 0
	iter(func(item *ProjectV2Item, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Projects.ListOrganizationProjectItemsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestProjectsService_ListOrganizationProjectsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?after=yo>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Projects.ListOrganizationProjectsIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Projects.ListOrganizationProjectsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListProjectsOptions{}
	iter = client.Projects.ListOrganizationProjectsIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Projects.ListOrganizationProjectsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Projects.ListOrganizationProjectsIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Projects.ListOrganizationProjectsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Projects.ListOrganizationProjectsIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *ProjectV2, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Projects.ListOrganizationProjectsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestProjectsService_ListUserProjectFieldsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?after=yo>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Projects.ListUserProjectFieldsIter(t.Context(), "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Projects.ListUserProjectFieldsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListProjectsOptions{}
	iter = client.Projects.ListUserProjectFieldsIter(t.Context(), "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Projects.ListUserProjectFieldsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Projects.ListUserProjectFieldsIter(t.Context(), "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Projects.ListUserProjectFieldsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Projects.ListUserProjectFieldsIter(t.Context(), "", 0, nil)
	gotItems = 0
	iter(func(item *ProjectV2Field, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Projects.ListUserProjectFieldsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestProjectsService_ListUserProjectItemsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?after=yo>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Projects.ListUserProjectItemsIter(t.Context(), "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Projects.ListUserProjectItemsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListProjectItemsOptions{}
	iter = client.Projects.ListUserProjectItemsIter(t.Context(), "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Projects.ListUserProjectItemsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Projects.ListUserProjectItemsIter(t.Context(), "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Projects.ListUserProjectItemsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Projects.ListUserProjectItemsIter(t.Context(), "", 0, nil)
	gotItems = 0
	iter(func(item *ProjectV2Item, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Projects.ListUserProjectItemsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestProjectsService_ListUserProjectsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?after=yo>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Projects.ListUserProjectsIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Projects.ListUserProjectsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListProjectsOptions{}
	iter = client.Projects.ListUserProjectsIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Projects.ListUserProjectsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Projects.ListUserProjectsIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Projects.ListUserProjectsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Projects.ListUserProjectsIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *ProjectV2, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Projects.ListUserProjectsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestPullRequestsService_ListIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.PullRequests.ListIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.PullRequests.ListIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &PullRequestListOptions{}
	iter = client.PullRequests.ListIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.PullRequests.ListIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.PullRequests.ListIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.PullRequests.ListIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.PullRequests.ListIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *PullRequest, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.PullRequests.ListIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestPullRequestsService_ListCommentsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.PullRequests.ListCommentsIter(t.Context(), "", "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.PullRequests.ListCommentsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &PullRequestListCommentsOptions{}
	iter = client.PullRequests.ListCommentsIter(t.Context(), "", "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.PullRequests.ListCommentsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.PullRequests.ListCommentsIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.PullRequests.ListCommentsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.PullRequests.ListCommentsIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	iter(func(item *PullRequestComment, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.PullRequests.ListCommentsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestPullRequestsService_ListCommitsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.PullRequests.ListCommitsIter(t.Context(), "", "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.PullRequests.ListCommitsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.PullRequests.ListCommitsIter(t.Context(), "", "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.PullRequests.ListCommitsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.PullRequests.ListCommitsIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.PullRequests.ListCommitsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.PullRequests.ListCommitsIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	iter(func(item *RepositoryCommit, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.PullRequests.ListCommitsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestPullRequestsService_ListFilesIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.PullRequests.ListFilesIter(t.Context(), "", "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.PullRequests.ListFilesIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.PullRequests.ListFilesIter(t.Context(), "", "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.PullRequests.ListFilesIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.PullRequests.ListFilesIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.PullRequests.ListFilesIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.PullRequests.ListFilesIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	iter(func(item *CommitFile, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.PullRequests.ListFilesIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestPullRequestsService_ListPullRequestsWithCommitIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.PullRequests.ListPullRequestsWithCommitIter(t.Context(), "", "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.PullRequests.ListPullRequestsWithCommitIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.PullRequests.ListPullRequestsWithCommitIter(t.Context(), "", "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.PullRequests.ListPullRequestsWithCommitIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.PullRequests.ListPullRequestsWithCommitIter(t.Context(), "", "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.PullRequests.ListPullRequestsWithCommitIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.PullRequests.ListPullRequestsWithCommitIter(t.Context(), "", "", "", nil)
	gotItems = 0
	iter(func(item *PullRequest, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.PullRequests.ListPullRequestsWithCommitIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestPullRequestsService_ListReviewCommentsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.PullRequests.ListReviewCommentsIter(t.Context(), "", "", 0, 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.PullRequests.ListReviewCommentsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.PullRequests.ListReviewCommentsIter(t.Context(), "", "", 0, 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.PullRequests.ListReviewCommentsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.PullRequests.ListReviewCommentsIter(t.Context(), "", "", 0, 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.PullRequests.ListReviewCommentsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.PullRequests.ListReviewCommentsIter(t.Context(), "", "", 0, 0, nil)
	gotItems = 0
	iter(func(item *PullRequestComment, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.PullRequests.ListReviewCommentsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestPullRequestsService_ListReviewsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.PullRequests.ListReviewsIter(t.Context(), "", "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.PullRequests.ListReviewsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.PullRequests.ListReviewsIter(t.Context(), "", "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.PullRequests.ListReviewsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.PullRequests.ListReviewsIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.PullRequests.ListReviewsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.PullRequests.ListReviewsIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	iter(func(item *PullRequestReview, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.PullRequests.ListReviewsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestReactionsService_ListCommentReactionsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Reactions.ListCommentReactionsIter(t.Context(), "", "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Reactions.ListCommentReactionsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListReactionOptions{}
	iter = client.Reactions.ListCommentReactionsIter(t.Context(), "", "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Reactions.ListCommentReactionsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Reactions.ListCommentReactionsIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Reactions.ListCommentReactionsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Reactions.ListCommentReactionsIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	iter(func(item *Reaction, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Reactions.ListCommentReactionsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestReactionsService_ListIssueCommentReactionsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Reactions.ListIssueCommentReactionsIter(t.Context(), "", "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Reactions.ListIssueCommentReactionsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListReactionOptions{}
	iter = client.Reactions.ListIssueCommentReactionsIter(t.Context(), "", "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Reactions.ListIssueCommentReactionsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Reactions.ListIssueCommentReactionsIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Reactions.ListIssueCommentReactionsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Reactions.ListIssueCommentReactionsIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	iter(func(item *Reaction, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Reactions.ListIssueCommentReactionsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestReactionsService_ListIssueReactionsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Reactions.ListIssueReactionsIter(t.Context(), "", "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Reactions.ListIssueReactionsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListReactionOptions{}
	iter = client.Reactions.ListIssueReactionsIter(t.Context(), "", "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Reactions.ListIssueReactionsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Reactions.ListIssueReactionsIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Reactions.ListIssueReactionsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Reactions.ListIssueReactionsIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	iter(func(item *Reaction, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Reactions.ListIssueReactionsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestReactionsService_ListPullRequestCommentReactionsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Reactions.ListPullRequestCommentReactionsIter(t.Context(), "", "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Reactions.ListPullRequestCommentReactionsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListReactionOptions{}
	iter = client.Reactions.ListPullRequestCommentReactionsIter(t.Context(), "", "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Reactions.ListPullRequestCommentReactionsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Reactions.ListPullRequestCommentReactionsIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Reactions.ListPullRequestCommentReactionsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Reactions.ListPullRequestCommentReactionsIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	iter(func(item *Reaction, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Reactions.ListPullRequestCommentReactionsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestReactionsService_ListReleaseReactionsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Reactions.ListReleaseReactionsIter(t.Context(), "", "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Reactions.ListReleaseReactionsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListReactionOptions{}
	iter = client.Reactions.ListReleaseReactionsIter(t.Context(), "", "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Reactions.ListReleaseReactionsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Reactions.ListReleaseReactionsIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Reactions.ListReleaseReactionsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Reactions.ListReleaseReactionsIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	iter(func(item *Reaction, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Reactions.ListReleaseReactionsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestReactionsService_ListTeamDiscussionCommentReactionsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Reactions.ListTeamDiscussionCommentReactionsIter(t.Context(), 0, 0, 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Reactions.ListTeamDiscussionCommentReactionsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListReactionOptions{}
	iter = client.Reactions.ListTeamDiscussionCommentReactionsIter(t.Context(), 0, 0, 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Reactions.ListTeamDiscussionCommentReactionsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Reactions.ListTeamDiscussionCommentReactionsIter(t.Context(), 0, 0, 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Reactions.ListTeamDiscussionCommentReactionsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Reactions.ListTeamDiscussionCommentReactionsIter(t.Context(), 0, 0, 0, nil)
	gotItems = 0
	iter(func(item *Reaction, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Reactions.ListTeamDiscussionCommentReactionsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestReactionsService_ListTeamDiscussionReactionsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Reactions.ListTeamDiscussionReactionsIter(t.Context(), 0, 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Reactions.ListTeamDiscussionReactionsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListReactionOptions{}
	iter = client.Reactions.ListTeamDiscussionReactionsIter(t.Context(), 0, 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Reactions.ListTeamDiscussionReactionsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Reactions.ListTeamDiscussionReactionsIter(t.Context(), 0, 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Reactions.ListTeamDiscussionReactionsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Reactions.ListTeamDiscussionReactionsIter(t.Context(), 0, 0, nil)
	gotItems = 0
	iter(func(item *Reaction, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Reactions.ListTeamDiscussionReactionsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestRepositoriesService_ListIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Repositories.ListIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Repositories.ListIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &RepositoryListOptions{}
	iter = client.Repositories.ListIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Repositories.ListIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Repositories.ListIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Repositories.ListIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *Repository, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestRepositoriesService_ListAllTopicsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"names": ["","",""]}`)
		case 2:
			fmt.Fprint(w, `{"names": ["","","",""]}`)
		case 3:
			fmt.Fprint(w, `{"names": ["",""]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"names": ["",""]}`)
		}
	})

	iter := client.Repositories.ListAllTopicsIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Repositories.ListAllTopicsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Repositories.ListAllTopicsIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Repositories.ListAllTopicsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Repositories.ListAllTopicsIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListAllTopicsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Repositories.ListAllTopicsIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item string, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListAllTopicsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestRepositoriesService_ListAttestationsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"attestations": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"attestations": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"attestations": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"attestations": [{},{}]}`)
		}
	})

	iter := client.Repositories.ListAttestationsIter(t.Context(), "", "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Repositories.ListAttestationsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Repositories.ListAttestationsIter(t.Context(), "", "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Repositories.ListAttestationsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Repositories.ListAttestationsIter(t.Context(), "", "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListAttestationsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Repositories.ListAttestationsIter(t.Context(), "", "", "", nil)
	gotItems = 0
	iter(func(item *Attestation, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListAttestationsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestRepositoriesService_ListBranchesIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Repositories.ListBranchesIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Repositories.ListBranchesIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &BranchListOptions{}
	iter = client.Repositories.ListBranchesIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Repositories.ListBranchesIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Repositories.ListBranchesIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListBranchesIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Repositories.ListBranchesIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Branch, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListBranchesIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestRepositoriesService_ListByAuthenticatedUserIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Repositories.ListByAuthenticatedUserIter(t.Context(), nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Repositories.ListByAuthenticatedUserIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &RepositoryListByAuthenticatedUserOptions{}
	iter = client.Repositories.ListByAuthenticatedUserIter(t.Context(), opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Repositories.ListByAuthenticatedUserIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Repositories.ListByAuthenticatedUserIter(t.Context(), nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListByAuthenticatedUserIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Repositories.ListByAuthenticatedUserIter(t.Context(), nil)
	gotItems = 0
	iter(func(item *Repository, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListByAuthenticatedUserIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestRepositoriesService_ListByOrgIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Repositories.ListByOrgIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Repositories.ListByOrgIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &RepositoryListByOrgOptions{}
	iter = client.Repositories.ListByOrgIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Repositories.ListByOrgIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Repositories.ListByOrgIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListByOrgIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Repositories.ListByOrgIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *Repository, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListByOrgIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestRepositoriesService_ListByUserIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Repositories.ListByUserIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Repositories.ListByUserIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &RepositoryListByUserOptions{}
	iter = client.Repositories.ListByUserIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Repositories.ListByUserIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Repositories.ListByUserIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListByUserIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Repositories.ListByUserIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *Repository, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListByUserIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestRepositoriesService_ListCollaboratorsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Repositories.ListCollaboratorsIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Repositories.ListCollaboratorsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListCollaboratorsOptions{}
	iter = client.Repositories.ListCollaboratorsIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Repositories.ListCollaboratorsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Repositories.ListCollaboratorsIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListCollaboratorsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Repositories.ListCollaboratorsIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *User, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListCollaboratorsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestRepositoriesService_ListCommentsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Repositories.ListCommentsIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Repositories.ListCommentsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Repositories.ListCommentsIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Repositories.ListCommentsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Repositories.ListCommentsIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListCommentsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Repositories.ListCommentsIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *RepositoryComment, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListCommentsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestRepositoriesService_ListCommitCommentsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Repositories.ListCommitCommentsIter(t.Context(), "", "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Repositories.ListCommitCommentsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Repositories.ListCommitCommentsIter(t.Context(), "", "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Repositories.ListCommitCommentsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Repositories.ListCommitCommentsIter(t.Context(), "", "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListCommitCommentsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Repositories.ListCommitCommentsIter(t.Context(), "", "", "", nil)
	gotItems = 0
	iter(func(item *RepositoryComment, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListCommitCommentsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestRepositoriesService_ListCommitsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Repositories.ListCommitsIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Repositories.ListCommitsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &CommitsListOptions{}
	iter = client.Repositories.ListCommitsIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Repositories.ListCommitsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Repositories.ListCommitsIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListCommitsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Repositories.ListCommitsIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *RepositoryCommit, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListCommitsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestRepositoriesService_ListContributorsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Repositories.ListContributorsIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Repositories.ListContributorsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListContributorsOptions{}
	iter = client.Repositories.ListContributorsIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Repositories.ListContributorsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Repositories.ListContributorsIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListContributorsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Repositories.ListContributorsIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Contributor, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListContributorsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestRepositoriesService_ListCustomDeploymentRuleIntegrationsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"available_custom_deployment_protection_rule_integrations": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"available_custom_deployment_protection_rule_integrations": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"available_custom_deployment_protection_rule_integrations": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"available_custom_deployment_protection_rule_integrations": [{},{}]}`)
		}
	})

	iter := client.Repositories.ListCustomDeploymentRuleIntegrationsIter(t.Context(), "", "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Repositories.ListCustomDeploymentRuleIntegrationsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Repositories.ListCustomDeploymentRuleIntegrationsIter(t.Context(), "", "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Repositories.ListCustomDeploymentRuleIntegrationsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Repositories.ListCustomDeploymentRuleIntegrationsIter(t.Context(), "", "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListCustomDeploymentRuleIntegrationsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Repositories.ListCustomDeploymentRuleIntegrationsIter(t.Context(), "", "", "", nil)
	gotItems = 0
	iter(func(item *CustomDeploymentProtectionRuleApp, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListCustomDeploymentRuleIntegrationsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestRepositoriesService_ListDeploymentBranchPoliciesIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"branch_policies": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"branch_policies": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"branch_policies": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"branch_policies": [{},{}]}`)
		}
	})

	iter := client.Repositories.ListDeploymentBranchPoliciesIter(t.Context(), "", "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Repositories.ListDeploymentBranchPoliciesIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Repositories.ListDeploymentBranchPoliciesIter(t.Context(), "", "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Repositories.ListDeploymentBranchPoliciesIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Repositories.ListDeploymentBranchPoliciesIter(t.Context(), "", "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListDeploymentBranchPoliciesIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Repositories.ListDeploymentBranchPoliciesIter(t.Context(), "", "", "", nil)
	gotItems = 0
	iter(func(item *DeploymentBranchPolicy, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListDeploymentBranchPoliciesIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestRepositoriesService_ListDeploymentStatusesIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Repositories.ListDeploymentStatusesIter(t.Context(), "", "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Repositories.ListDeploymentStatusesIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Repositories.ListDeploymentStatusesIter(t.Context(), "", "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Repositories.ListDeploymentStatusesIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Repositories.ListDeploymentStatusesIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListDeploymentStatusesIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Repositories.ListDeploymentStatusesIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	iter(func(item *DeploymentStatus, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListDeploymentStatusesIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestRepositoriesService_ListDeploymentsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Repositories.ListDeploymentsIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Repositories.ListDeploymentsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &DeploymentsListOptions{}
	iter = client.Repositories.ListDeploymentsIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Repositories.ListDeploymentsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Repositories.ListDeploymentsIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListDeploymentsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Repositories.ListDeploymentsIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Deployment, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListDeploymentsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestRepositoriesService_ListEnvironmentsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"environments": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"environments": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"environments": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"environments": [{},{}]}`)
		}
	})

	iter := client.Repositories.ListEnvironmentsIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Repositories.ListEnvironmentsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &EnvironmentListOptions{}
	iter = client.Repositories.ListEnvironmentsIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Repositories.ListEnvironmentsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Repositories.ListEnvironmentsIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListEnvironmentsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Repositories.ListEnvironmentsIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Environment, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListEnvironmentsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestRepositoriesService_ListForksIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Repositories.ListForksIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Repositories.ListForksIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &RepositoryListForksOptions{}
	iter = client.Repositories.ListForksIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Repositories.ListForksIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Repositories.ListForksIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListForksIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Repositories.ListForksIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Repository, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListForksIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestRepositoriesService_ListHookDeliveriesIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?after=yo>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Repositories.ListHookDeliveriesIter(t.Context(), "", "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Repositories.ListHookDeliveriesIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListCursorOptions{}
	iter = client.Repositories.ListHookDeliveriesIter(t.Context(), "", "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Repositories.ListHookDeliveriesIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Repositories.ListHookDeliveriesIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListHookDeliveriesIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Repositories.ListHookDeliveriesIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	iter(func(item *HookDelivery, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListHookDeliveriesIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestRepositoriesService_ListHooksIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Repositories.ListHooksIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Repositories.ListHooksIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Repositories.ListHooksIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Repositories.ListHooksIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Repositories.ListHooksIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListHooksIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Repositories.ListHooksIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Hook, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListHooksIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestRepositoriesService_ListInvitationsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Repositories.ListInvitationsIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Repositories.ListInvitationsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Repositories.ListInvitationsIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Repositories.ListInvitationsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Repositories.ListInvitationsIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListInvitationsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Repositories.ListInvitationsIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *RepositoryInvitation, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListInvitationsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestRepositoriesService_ListKeysIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Repositories.ListKeysIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Repositories.ListKeysIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Repositories.ListKeysIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Repositories.ListKeysIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Repositories.ListKeysIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListKeysIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Repositories.ListKeysIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Key, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListKeysIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestRepositoriesService_ListPagesBuildsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Repositories.ListPagesBuildsIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Repositories.ListPagesBuildsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Repositories.ListPagesBuildsIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Repositories.ListPagesBuildsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Repositories.ListPagesBuildsIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListPagesBuildsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Repositories.ListPagesBuildsIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *PagesBuild, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListPagesBuildsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestRepositoriesService_ListPreReceiveHooksIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Repositories.ListPreReceiveHooksIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Repositories.ListPreReceiveHooksIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Repositories.ListPreReceiveHooksIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Repositories.ListPreReceiveHooksIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Repositories.ListPreReceiveHooksIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListPreReceiveHooksIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Repositories.ListPreReceiveHooksIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *PreReceiveHook, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListPreReceiveHooksIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestRepositoriesService_ListReleaseAssetsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Repositories.ListReleaseAssetsIter(t.Context(), "", "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Repositories.ListReleaseAssetsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Repositories.ListReleaseAssetsIter(t.Context(), "", "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Repositories.ListReleaseAssetsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Repositories.ListReleaseAssetsIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListReleaseAssetsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Repositories.ListReleaseAssetsIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	iter(func(item *ReleaseAsset, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListReleaseAssetsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestRepositoriesService_ListReleasesIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Repositories.ListReleasesIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Repositories.ListReleasesIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Repositories.ListReleasesIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Repositories.ListReleasesIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Repositories.ListReleasesIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListReleasesIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Repositories.ListReleasesIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *RepositoryRelease, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListReleasesIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestRepositoriesService_ListRepositoryActivitiesIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?after=yo>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Repositories.ListRepositoryActivitiesIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Repositories.ListRepositoryActivitiesIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListRepositoryActivityOptions{}
	iter = client.Repositories.ListRepositoryActivitiesIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Repositories.ListRepositoryActivitiesIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Repositories.ListRepositoryActivitiesIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListRepositoryActivitiesIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Repositories.ListRepositoryActivitiesIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *RepositoryActivity, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListRepositoryActivitiesIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestRepositoriesService_ListStatusesIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Repositories.ListStatusesIter(t.Context(), "", "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Repositories.ListStatusesIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Repositories.ListStatusesIter(t.Context(), "", "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Repositories.ListStatusesIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Repositories.ListStatusesIter(t.Context(), "", "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListStatusesIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Repositories.ListStatusesIter(t.Context(), "", "", "", nil)
	gotItems = 0
	iter(func(item *RepoStatus, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListStatusesIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestRepositoriesService_ListTagsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Repositories.ListTagsIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Repositories.ListTagsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Repositories.ListTagsIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Repositories.ListTagsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Repositories.ListTagsIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListTagsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Repositories.ListTagsIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *RepositoryTag, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListTagsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestRepositoriesService_ListTeamsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Repositories.ListTeamsIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Repositories.ListTeamsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Repositories.ListTeamsIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Repositories.ListTeamsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Repositories.ListTeamsIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListTeamsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Repositories.ListTeamsIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Team, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Repositories.ListTeamsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestSecretScanningService_ListAlertsForEnterpriseIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?after=yo>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.SecretScanning.ListAlertsForEnterpriseIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.SecretScanning.ListAlertsForEnterpriseIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &SecretScanningAlertListOptions{}
	iter = client.SecretScanning.ListAlertsForEnterpriseIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.SecretScanning.ListAlertsForEnterpriseIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.SecretScanning.ListAlertsForEnterpriseIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.SecretScanning.ListAlertsForEnterpriseIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.SecretScanning.ListAlertsForEnterpriseIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *SecretScanningAlert, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.SecretScanning.ListAlertsForEnterpriseIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestSecretScanningService_ListAlertsForOrgIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?after=yo>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.SecretScanning.ListAlertsForOrgIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.SecretScanning.ListAlertsForOrgIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &SecretScanningAlertListOptions{}
	iter = client.SecretScanning.ListAlertsForOrgIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.SecretScanning.ListAlertsForOrgIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.SecretScanning.ListAlertsForOrgIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.SecretScanning.ListAlertsForOrgIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.SecretScanning.ListAlertsForOrgIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *SecretScanningAlert, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.SecretScanning.ListAlertsForOrgIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestSecretScanningService_ListAlertsForRepoIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?after=yo>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.SecretScanning.ListAlertsForRepoIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.SecretScanning.ListAlertsForRepoIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &SecretScanningAlertListOptions{}
	iter = client.SecretScanning.ListAlertsForRepoIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.SecretScanning.ListAlertsForRepoIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.SecretScanning.ListAlertsForRepoIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.SecretScanning.ListAlertsForRepoIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.SecretScanning.ListAlertsForRepoIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *SecretScanningAlert, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.SecretScanning.ListAlertsForRepoIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestSecretScanningService_ListLocationsForAlertIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.SecretScanning.ListLocationsForAlertIter(t.Context(), "", "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.SecretScanning.ListLocationsForAlertIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.SecretScanning.ListLocationsForAlertIter(t.Context(), "", "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.SecretScanning.ListLocationsForAlertIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.SecretScanning.ListLocationsForAlertIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.SecretScanning.ListLocationsForAlertIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.SecretScanning.ListLocationsForAlertIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	iter(func(item *SecretScanningAlertLocation, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.SecretScanning.ListLocationsForAlertIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestSecurityAdvisoriesService_ListGlobalSecurityAdvisoriesIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?after=yo>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.SecurityAdvisories.ListGlobalSecurityAdvisoriesIter(t.Context(), nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.SecurityAdvisories.ListGlobalSecurityAdvisoriesIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListGlobalSecurityAdvisoriesOptions{}
	iter = client.SecurityAdvisories.ListGlobalSecurityAdvisoriesIter(t.Context(), opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.SecurityAdvisories.ListGlobalSecurityAdvisoriesIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.SecurityAdvisories.ListGlobalSecurityAdvisoriesIter(t.Context(), nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.SecurityAdvisories.ListGlobalSecurityAdvisoriesIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.SecurityAdvisories.ListGlobalSecurityAdvisoriesIter(t.Context(), nil)
	gotItems = 0
	iter(func(item *GlobalSecurityAdvisory, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.SecurityAdvisories.ListGlobalSecurityAdvisoriesIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestSecurityAdvisoriesService_ListRepositorySecurityAdvisoriesIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?after=yo>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.SecurityAdvisories.ListRepositorySecurityAdvisoriesIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.SecurityAdvisories.ListRepositorySecurityAdvisoriesIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListRepositorySecurityAdvisoriesOptions{}
	iter = client.SecurityAdvisories.ListRepositorySecurityAdvisoriesIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.SecurityAdvisories.ListRepositorySecurityAdvisoriesIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.SecurityAdvisories.ListRepositorySecurityAdvisoriesIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.SecurityAdvisories.ListRepositorySecurityAdvisoriesIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.SecurityAdvisories.ListRepositorySecurityAdvisoriesIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *SecurityAdvisory, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.SecurityAdvisories.ListRepositorySecurityAdvisoriesIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestSecurityAdvisoriesService_ListRepositorySecurityAdvisoriesForOrgIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?after=yo>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.SecurityAdvisories.ListRepositorySecurityAdvisoriesForOrgIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.SecurityAdvisories.ListRepositorySecurityAdvisoriesForOrgIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListRepositorySecurityAdvisoriesOptions{}
	iter = client.SecurityAdvisories.ListRepositorySecurityAdvisoriesForOrgIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.SecurityAdvisories.ListRepositorySecurityAdvisoriesForOrgIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.SecurityAdvisories.ListRepositorySecurityAdvisoriesForOrgIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.SecurityAdvisories.ListRepositorySecurityAdvisoriesForOrgIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.SecurityAdvisories.ListRepositorySecurityAdvisoriesForOrgIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *SecurityAdvisory, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.SecurityAdvisories.ListRepositorySecurityAdvisoriesForOrgIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestSubIssueService_ListByIssueIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.SubIssue.ListByIssueIter(t.Context(), "", "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.SubIssue.ListByIssueIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.SubIssue.ListByIssueIter(t.Context(), "", "", 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.SubIssue.ListByIssueIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.SubIssue.ListByIssueIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.SubIssue.ListByIssueIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.SubIssue.ListByIssueIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	iter(func(item *SubIssue, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.SubIssue.ListByIssueIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestTeamsService_ListChildTeamsByParentIDIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Teams.ListChildTeamsByParentIDIter(t.Context(), 0, 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Teams.ListChildTeamsByParentIDIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Teams.ListChildTeamsByParentIDIter(t.Context(), 0, 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Teams.ListChildTeamsByParentIDIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Teams.ListChildTeamsByParentIDIter(t.Context(), 0, 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Teams.ListChildTeamsByParentIDIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Teams.ListChildTeamsByParentIDIter(t.Context(), 0, 0, nil)
	gotItems = 0
	iter(func(item *Team, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Teams.ListChildTeamsByParentIDIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestTeamsService_ListChildTeamsByParentSlugIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Teams.ListChildTeamsByParentSlugIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Teams.ListChildTeamsByParentSlugIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Teams.ListChildTeamsByParentSlugIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Teams.ListChildTeamsByParentSlugIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Teams.ListChildTeamsByParentSlugIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Teams.ListChildTeamsByParentSlugIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Teams.ListChildTeamsByParentSlugIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Team, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Teams.ListChildTeamsByParentSlugIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestTeamsService_ListCommentsByIDIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Teams.ListCommentsByIDIter(t.Context(), 0, 0, 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Teams.ListCommentsByIDIter call 1 got %v items; want %v", gotItems, want)
	}

	options := &DiscussionCommentListOptions{}
	iter = client.Teams.ListCommentsByIDIter(t.Context(), 0, 0, 0, options)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Teams.ListCommentsByIDIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Teams.ListCommentsByIDIter(t.Context(), 0, 0, 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Teams.ListCommentsByIDIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Teams.ListCommentsByIDIter(t.Context(), 0, 0, 0, nil)
	gotItems = 0
	iter(func(item *DiscussionComment, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Teams.ListCommentsByIDIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestTeamsService_ListCommentsBySlugIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Teams.ListCommentsBySlugIter(t.Context(), "", "", 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Teams.ListCommentsBySlugIter call 1 got %v items; want %v", gotItems, want)
	}

	options := &DiscussionCommentListOptions{}
	iter = client.Teams.ListCommentsBySlugIter(t.Context(), "", "", 0, options)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Teams.ListCommentsBySlugIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Teams.ListCommentsBySlugIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Teams.ListCommentsBySlugIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Teams.ListCommentsBySlugIter(t.Context(), "", "", 0, nil)
	gotItems = 0
	iter(func(item *DiscussionComment, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Teams.ListCommentsBySlugIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestTeamsService_ListDiscussionsByIDIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Teams.ListDiscussionsByIDIter(t.Context(), 0, 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Teams.ListDiscussionsByIDIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &DiscussionListOptions{}
	iter = client.Teams.ListDiscussionsByIDIter(t.Context(), 0, 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Teams.ListDiscussionsByIDIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Teams.ListDiscussionsByIDIter(t.Context(), 0, 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Teams.ListDiscussionsByIDIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Teams.ListDiscussionsByIDIter(t.Context(), 0, 0, nil)
	gotItems = 0
	iter(func(item *TeamDiscussion, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Teams.ListDiscussionsByIDIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestTeamsService_ListDiscussionsBySlugIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Teams.ListDiscussionsBySlugIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Teams.ListDiscussionsBySlugIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &DiscussionListOptions{}
	iter = client.Teams.ListDiscussionsBySlugIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Teams.ListDiscussionsBySlugIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Teams.ListDiscussionsBySlugIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Teams.ListDiscussionsBySlugIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Teams.ListDiscussionsBySlugIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *TeamDiscussion, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Teams.ListDiscussionsBySlugIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestTeamsService_ListExternalGroupsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"groups": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"groups": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"groups": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"groups": [{},{}]}`)
		}
	})

	iter := client.Teams.ListExternalGroupsIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Teams.ListExternalGroupsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListExternalGroupsOptions{}
	iter = client.Teams.ListExternalGroupsIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Teams.ListExternalGroupsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Teams.ListExternalGroupsIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Teams.ListExternalGroupsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Teams.ListExternalGroupsIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *ExternalGroup, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Teams.ListExternalGroupsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestTeamsService_ListIDPGroupsInOrganizationIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?after=yo>; rel="next"`)
			fmt.Fprint(w, `{"groups": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"groups": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"groups": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"groups": [{},{}]}`)
		}
	})

	iter := client.Teams.ListIDPGroupsInOrganizationIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Teams.ListIDPGroupsInOrganizationIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListIDPGroupsOptions{}
	iter = client.Teams.ListIDPGroupsInOrganizationIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Teams.ListIDPGroupsInOrganizationIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Teams.ListIDPGroupsInOrganizationIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Teams.ListIDPGroupsInOrganizationIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Teams.ListIDPGroupsInOrganizationIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *IDPGroup, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Teams.ListIDPGroupsInOrganizationIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestTeamsService_ListPendingTeamInvitationsByIDIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Teams.ListPendingTeamInvitationsByIDIter(t.Context(), 0, 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Teams.ListPendingTeamInvitationsByIDIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Teams.ListPendingTeamInvitationsByIDIter(t.Context(), 0, 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Teams.ListPendingTeamInvitationsByIDIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Teams.ListPendingTeamInvitationsByIDIter(t.Context(), 0, 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Teams.ListPendingTeamInvitationsByIDIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Teams.ListPendingTeamInvitationsByIDIter(t.Context(), 0, 0, nil)
	gotItems = 0
	iter(func(item *Invitation, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Teams.ListPendingTeamInvitationsByIDIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestTeamsService_ListPendingTeamInvitationsBySlugIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Teams.ListPendingTeamInvitationsBySlugIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Teams.ListPendingTeamInvitationsBySlugIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Teams.ListPendingTeamInvitationsBySlugIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Teams.ListPendingTeamInvitationsBySlugIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Teams.ListPendingTeamInvitationsBySlugIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Teams.ListPendingTeamInvitationsBySlugIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Teams.ListPendingTeamInvitationsBySlugIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Invitation, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Teams.ListPendingTeamInvitationsBySlugIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestTeamsService_ListTeamMembersByIDIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Teams.ListTeamMembersByIDIter(t.Context(), 0, 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Teams.ListTeamMembersByIDIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &TeamListTeamMembersOptions{}
	iter = client.Teams.ListTeamMembersByIDIter(t.Context(), 0, 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Teams.ListTeamMembersByIDIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Teams.ListTeamMembersByIDIter(t.Context(), 0, 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Teams.ListTeamMembersByIDIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Teams.ListTeamMembersByIDIter(t.Context(), 0, 0, nil)
	gotItems = 0
	iter(func(item *User, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Teams.ListTeamMembersByIDIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestTeamsService_ListTeamMembersBySlugIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Teams.ListTeamMembersBySlugIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Teams.ListTeamMembersBySlugIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &TeamListTeamMembersOptions{}
	iter = client.Teams.ListTeamMembersBySlugIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Teams.ListTeamMembersBySlugIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Teams.ListTeamMembersBySlugIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Teams.ListTeamMembersBySlugIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Teams.ListTeamMembersBySlugIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *User, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Teams.ListTeamMembersBySlugIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestTeamsService_ListTeamReposByIDIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Teams.ListTeamReposByIDIter(t.Context(), 0, 0, nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Teams.ListTeamReposByIDIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Teams.ListTeamReposByIDIter(t.Context(), 0, 0, opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Teams.ListTeamReposByIDIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Teams.ListTeamReposByIDIter(t.Context(), 0, 0, nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Teams.ListTeamReposByIDIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Teams.ListTeamReposByIDIter(t.Context(), 0, 0, nil)
	gotItems = 0
	iter(func(item *Repository, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Teams.ListTeamReposByIDIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestTeamsService_ListTeamReposBySlugIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Teams.ListTeamReposBySlugIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Teams.ListTeamReposBySlugIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Teams.ListTeamReposBySlugIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Teams.ListTeamReposBySlugIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Teams.ListTeamReposBySlugIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Teams.ListTeamReposBySlugIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Teams.ListTeamReposBySlugIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Repository, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Teams.ListTeamReposBySlugIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestTeamsService_ListTeamsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Teams.ListTeamsIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Teams.ListTeamsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Teams.ListTeamsIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Teams.ListTeamsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Teams.ListTeamsIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Teams.ListTeamsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Teams.ListTeamsIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *Team, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Teams.ListTeamsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestTeamsService_ListUserTeamsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Teams.ListUserTeamsIter(t.Context(), nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Teams.ListUserTeamsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Teams.ListUserTeamsIter(t.Context(), opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Teams.ListUserTeamsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Teams.ListUserTeamsIter(t.Context(), nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Teams.ListUserTeamsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Teams.ListUserTeamsIter(t.Context(), nil)
	gotItems = 0
	iter(func(item *Team, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Teams.ListUserTeamsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestUsersService_ListAttestationsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `{"attestations": [{},{},{}]}`)
		case 2:
			fmt.Fprint(w, `{"attestations": [{},{},{},{}]}`)
		case 3:
			fmt.Fprint(w, `{"attestations": [{},{}]}`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `{"attestations": [{},{}]}`)
		}
	})

	iter := client.Users.ListAttestationsIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Users.ListAttestationsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Users.ListAttestationsIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Users.ListAttestationsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Users.ListAttestationsIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Users.ListAttestationsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Users.ListAttestationsIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *Attestation, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Users.ListAttestationsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestUsersService_ListBlockedUsersIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Users.ListBlockedUsersIter(t.Context(), nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Users.ListBlockedUsersIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Users.ListBlockedUsersIter(t.Context(), opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Users.ListBlockedUsersIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Users.ListBlockedUsersIter(t.Context(), nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Users.ListBlockedUsersIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Users.ListBlockedUsersIter(t.Context(), nil)
	gotItems = 0
	iter(func(item *User, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Users.ListBlockedUsersIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestUsersService_ListEmailsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Users.ListEmailsIter(t.Context(), nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Users.ListEmailsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Users.ListEmailsIter(t.Context(), opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Users.ListEmailsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Users.ListEmailsIter(t.Context(), nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Users.ListEmailsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Users.ListEmailsIter(t.Context(), nil)
	gotItems = 0
	iter(func(item *UserEmail, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Users.ListEmailsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestUsersService_ListFollowersIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Users.ListFollowersIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Users.ListFollowersIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Users.ListFollowersIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Users.ListFollowersIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Users.ListFollowersIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Users.ListFollowersIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Users.ListFollowersIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *User, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Users.ListFollowersIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestUsersService_ListFollowingIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Users.ListFollowingIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Users.ListFollowingIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Users.ListFollowingIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Users.ListFollowingIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Users.ListFollowingIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Users.ListFollowingIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Users.ListFollowingIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *User, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Users.ListFollowingIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestUsersService_ListGPGKeysIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Users.ListGPGKeysIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Users.ListGPGKeysIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Users.ListGPGKeysIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Users.ListGPGKeysIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Users.ListGPGKeysIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Users.ListGPGKeysIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Users.ListGPGKeysIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *GPGKey, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Users.ListGPGKeysIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestUsersService_ListInvitationsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Users.ListInvitationsIter(t.Context(), nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Users.ListInvitationsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Users.ListInvitationsIter(t.Context(), opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Users.ListInvitationsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Users.ListInvitationsIter(t.Context(), nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Users.ListInvitationsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Users.ListInvitationsIter(t.Context(), nil)
	gotItems = 0
	iter(func(item *RepositoryInvitation, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Users.ListInvitationsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestUsersService_ListKeysIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Users.ListKeysIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Users.ListKeysIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Users.ListKeysIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Users.ListKeysIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Users.ListKeysIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Users.ListKeysIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Users.ListKeysIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *Key, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Users.ListKeysIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestUsersService_ListPackageVersionsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Users.ListPackageVersionsIter(t.Context(), "", "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Users.ListPackageVersionsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListPackageVersionsOptions{}
	iter = client.Users.ListPackageVersionsIter(t.Context(), "", "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Users.ListPackageVersionsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Users.ListPackageVersionsIter(t.Context(), "", "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Users.ListPackageVersionsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Users.ListPackageVersionsIter(t.Context(), "", "", nil)
	gotItems = 0
	iter(func(item *PackageVersion, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Users.ListPackageVersionsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestUsersService_ListPackagesIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Users.ListPackagesIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Users.ListPackagesIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &PackageListOptions{}
	iter = client.Users.ListPackagesIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Users.ListPackagesIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Users.ListPackagesIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Users.ListPackagesIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Users.ListPackagesIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *Package, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Users.ListPackagesIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestUsersService_ListSSHSigningKeysIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Users.ListSSHSigningKeysIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Users.ListSSHSigningKeysIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Users.ListSSHSigningKeysIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Users.ListSSHSigningKeysIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Users.ListSSHSigningKeysIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Users.ListSSHSigningKeysIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Users.ListSSHSigningKeysIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *SSHSigningKey, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Users.ListSSHSigningKeysIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestUsersService_ListSocialAccountsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Users.ListSocialAccountsIter(t.Context(), nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Users.ListSocialAccountsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Users.ListSocialAccountsIter(t.Context(), opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Users.ListSocialAccountsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Users.ListSocialAccountsIter(t.Context(), nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Users.ListSocialAccountsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Users.ListSocialAccountsIter(t.Context(), nil)
	gotItems = 0
	iter(func(item *SocialAccount, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Users.ListSocialAccountsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}

func TestUsersService_ListUserSocialAccountsIter(t *testing.T) {
	t.Parallel()
	client, mux, _ := setup(t)
	var callNum int
	mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		callNum++
		switch callNum {
		case 1:
			w.Header().Set("Link", `<https://api.github.com/?page=1>; rel="next"`)
			fmt.Fprint(w, `[{},{},{}]`)
		case 2:
			fmt.Fprint(w, `[{},{},{},{}]`)
		case 3:
			fmt.Fprint(w, `[{},{}]`)
		case 4:
			w.WriteHeader(http.StatusNotFound)
		case 5:
			fmt.Fprint(w, `[{},{}]`)
		}
	})

	iter := client.Users.ListUserSocialAccountsIter(t.Context(), "", nil)
	var gotItems int
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 7; gotItems != want {
		t.Errorf("client.Users.ListUserSocialAccountsIter call 1 got %v items; want %v", gotItems, want)
	}

	opts := &ListOptions{}
	iter = client.Users.ListUserSocialAccountsIter(t.Context(), "", opts)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
	}
	if want := 2; gotItems != want {
		t.Errorf("client.Users.ListUserSocialAccountsIter call 2 got %v items; want %v", gotItems, want)
	}

	iter = client.Users.ListUserSocialAccountsIter(t.Context(), "", nil)
	gotItems = 0
	for _, err := range iter {
		gotItems++
		if err == nil {
			t.Error("expected error; got nil")
		}
	}
	if gotItems != 1 {
		t.Errorf("client.Users.ListUserSocialAccountsIter call 3 got %v items; want 1 (an error)", gotItems)
	}

	iter = client.Users.ListUserSocialAccountsIter(t.Context(), "", nil)
	gotItems = 0
	iter(func(item *SocialAccount, err error) bool {
		gotItems++
		if err != nil {
			t.Errorf("Unexpected error: %v", err)
		}
		return false
	})
	if gotItems != 1 {
		t.Errorf("client.Users.ListUserSocialAccountsIter call 4 got %v items; want 1 (an error)", gotItems)
	}
}
