Repository: google/go-github
Pull request #1087 (2018-12-28 16:15:14)

Renamed InteractionService methods to be specific to repositories and also renamed the header constant


Patch:
diff --git a/github/github.go b/github/github.go
index 7c0c2c1a..abed36dd 100644
--- a/github/github.go
+++ b/github/github.go
@@ -127,7 +127,7 @@ const (
 	mediaTypeProjectCardDetailsPreview = "application/vnd.github.starfox-preview+json"
 
 	// https://developer.github.com/changes/2018-12-18-interactions-preview/
-	mediaTypeRepositoryInteractionsPreview = "application/vnd.github.sombra-preview+json"
+	mediaTypeInteractionRestrictionsPreview = "application/vnd.github.sombra-preview+json"
 )
 
 // A Client manages communication with the GitHub API.
diff --git a/github/interactions_repos.go b/github/interactions_repos.go
index a9b553b6..a91297cc 100644
--- a/github/interactions_repos.go
+++ b/github/interactions_repos.go
@@ -10,10 +10,10 @@ import (
 	"fmt"
 )
 
-// GetRestrictions fetches the interaction restrictions for a repository.
+// GetRestrictionsForRepo fetches the interaction restrictions for a repository.
 //
 // GitHub API docs: https://developer.github.com/v3/interactions/repos/#get-interaction-restrictions-for-a-repository
-func (s *InteractionsService) GetRestrictions(ctx context.Context, owner, repo string) (*InteractionRestriction, *Response, error) {
+func (s *InteractionsService) GetRestrictionsForRepo(ctx context.Context, owner, repo string) (*InteractionRestriction, *Response, error) {
 	u := fmt.Sprintf("repos/%v/%v/interaction-limits", owner, repo)
 	req, err := s.client.NewRequest("GET", u, nil)
 	if err != nil {
@@ -21,7 +21,7 @@ func (s *InteractionsService) GetRestrictions(ctx context.Context, owner, repo s
 	}
 
 	// TODO: remove custom Accept header when this API fully launches.
-	req.Header.Set("Accept", mediaTypeRepositoryInteractionsPreview)
+	req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview)
 
 	repositoryInteractions := new(InteractionRestriction)
 
@@ -33,10 +33,10 @@ func (s *InteractionsService) GetRestrictions(ctx context.Context, owner, repo s
 	return repositoryInteractions, resp, nil
 }
 
-// UpdateRestrictions adds or updates the interaction restrictions for a repository.
+// UpdateRestrictionsForRepo adds or updates the interaction restrictions for a repository.
 //
 // GitHub API docs: https://developer.github.com/v3/interactions/repos/#add-or-update-interaction-restrictions-for-a-repository
-func (s *InteractionsService) UpdateRestrictions(ctx context.Context, owner, repo string, interaction *InteractionRestriction) (*InteractionRestriction, *Response, error) {
+func (s *InteractionsService) UpdateRestrictionsForRepo(ctx context.Context, owner, repo string, interaction *InteractionRestriction) (*InteractionRestriction, *Response, error) {
 	u := fmt.Sprintf("repos/%v/%v/interaction-limits", owner, repo)
 	req, err := s.client.NewRequest("PUT", u, interaction)
 	if err != nil {
@@ -44,7 +44,7 @@ func (s *InteractionsService) UpdateRestrictions(ctx context.Context, owner, rep
 	}
 
 	// TODO: remove custom Accept header when this API fully launches.
-	req.Header.Set("Accept", mediaTypeRepositoryInteractionsPreview)
+	req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview)
 
 	repositoryInteractions := new(InteractionRestriction)
 
@@ -56,10 +56,10 @@ func (s *InteractionsService) UpdateRestrictions(ctx context.Context, owner, rep
 	return repositoryInteractions, resp, nil
 }
 
-// RemoveRestrictions removes the interaction restrictions for a repository.
+// RemoveRestrictionsFromRepo removes the interaction restrictions for a repository.
 //
 // GitHub API docs: https://developer.github.com/v3/interactions/repos/#remove-interaction-restrictions-for-a-repository
-func (s *InteractionsService) RemoveRestrictions(ctx context.Context, owner, repo string) (*Response, error) {
+func (s *InteractionsService) RemoveRestrictionsFromRepo(ctx context.Context, owner, repo string) (*Response, error) {
 	u := fmt.Sprintf("repos/%v/%v/interaction-limits", owner, repo)
 	req, err := s.client.NewRequest("DELETE", u, nil)
 	if err != nil {
@@ -67,7 +67,7 @@ func (s *InteractionsService) RemoveRestrictions(ctx context.Context, owner, rep
 	}
 
 	// TODO: remove custom Accept header when this API fully launches.
-	req.Header.Set("Accept", mediaTypeRepositoryInteractionsPreview)
+	req.Header.Set("Accept", mediaTypeInteractionRestrictionsPreview)
 
 	return s.client.Do(ctx, req, nil)
 }


Test patch:
diff --git a/github/interactions_repos_test.go b/github/interactions_repos_test.go
index c1c88b56..47ac89c6 100644
--- a/github/interactions_repos_test.go
+++ b/github/interactions_repos_test.go
@@ -14,28 +14,28 @@ import (
 	"testing"
 )
 
-func TestInteractionsService_GetRestrictions(t *testing.T) {
+func TestInteractionsService_GetRestrictionsForRepo(t *testing.T) {
 	client, mux, _, teardown := setup()
 	defer teardown()
 
 	mux.HandleFunc("/repos/o/r/interaction-limits", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "GET")
-		testHeader(t, r, "Accept", mediaTypeRepositoryInteractionsPreview)
+		testHeader(t, r, "Accept", mediaTypeInteractionRestrictionsPreview)
 		fmt.Fprint(w, `{"origin":"repository"}`)
 	})
 
-	repoInteractions, _, err := client.Interactions.GetRestrictions(context.Background(), "o", "r")
+	repoInteractions, _, err := client.Interactions.GetRestrictionsForRepo(context.Background(), "o", "r")
 	if err != nil {
-		t.Errorf("Interactions.GetRestrictions returned error: %v", err)
+		t.Errorf("Interactions.GetRestrictionsForRepo returned error: %v", err)
 	}
 
 	want := &InteractionRestriction{Origin: String("repository")}
 	if !reflect.DeepEqual(repoInteractions, want) {
-		t.Errorf("Interactions.GetRestrictions returned %+v, want %+v", repoInteractions, want)
+		t.Errorf("Interactions.GetRestrictionsForRepo returned %+v, want %+v", repoInteractions, want)
 	}
 }
 
-func TestInteractionsService_UpdateRestrictions(t *testing.T) {
+func TestInteractionsService_UpdateRestrictionsForRepo(t *testing.T) {
 	client, mux, _, teardown := setup()
 	defer teardown()
 
@@ -46,35 +46,35 @@ func TestInteractionsService_UpdateRestrictions(t *testing.T) {
 		json.NewDecoder(r.Body).Decode(v)
 
 		testMethod(t, r, "PUT")
-		testHeader(t, r, "Accept", mediaTypeRepositoryInteractionsPreview)
+		testHeader(t, r, "Accept", mediaTypeInteractionRestrictionsPreview)
 		if !reflect.DeepEqual(v, input) {
 			t.Errorf("Request body = %+v, want %+v", v, input)
 		}
 		fmt.Fprint(w, `{"origin":"repository"}`)
 	})
 
-	repoInteractions, _, err := client.Interactions.UpdateRestrictions(context.Background(), "o", "r", input)
+	repoInteractions, _, err := client.Interactions.UpdateRestrictionsForRepo(context.Background(), "o", "r", input)
 	if err != nil {
-		t.Errorf("Interactions.UpdateRestrictions returned error: %v", err)
+		t.Errorf("Interactions.UpdateRestrictionsForRepo returned error: %v", err)
 	}
 
 	want := &InteractionRestriction{Origin: String("repository")}
 	if !reflect.DeepEqual(repoInteractions, want) {
-		t.Errorf("Interactions.UpdateRestrictions returned %+v, want %+v", repoInteractions, want)
+		t.Errorf("Interactions.UpdateRestrictionsForRepo returned %+v, want %+v", repoInteractions, want)
 	}
 }
 
-func TestInteractionsService_RemoveRestrictions(t *testing.T) {
+func TestInteractionsService_RemoveRestrictionsFromRepo(t *testing.T) {
 	client, mux, _, teardown := setup()
 	defer teardown()
 
 	mux.HandleFunc("/repos/o/r/interaction-limits", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "DELETE")
-		testHeader(t, r, "Accept", mediaTypeRepositoryInteractionsPreview)
+		testHeader(t, r, "Accept", mediaTypeInteractionRestrictionsPreview)
 	})
 
-	_, err := client.Interactions.RemoveRestrictions(context.Background(), "o", "r")
+	_, err := client.Interactions.RemoveRestrictionsFromRepo(context.Background(), "o", "r")
 	if err != nil {
-		t.Errorf("Interactions.RemoveRestrictions returned error: %v", err)
+		t.Errorf("Interactions.RemoveRestrictionsFromRepo returned error: %v", err)
 	}
 }
diff --git a/github/issues_test.go b/github/issues_test.go
index 22190a02..7edcf09b 100644
--- a/github/issues_test.go
+++ b/github/issues_test.go
@@ -20,10 +20,10 @@ func TestIssuesService_List_all(t *testing.T) {
 	client, mux, _, teardown := setup()
 	defer teardown()
 
-	acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeLabelDescriptionSearchPreview, mediaTypeLockReasonPreview}
+	wantAcceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeLabelDescriptionSearchPreview, mediaTypeLockReasonPreview}
 	mux.HandleFunc("/issues", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "GET")
-		testHeader(t, r, "Accept", strings.Join(acceptHeaders, ", "))
+		testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
 		testFormValues(t, r, values{
 			"filter":    "all",
 			"state":     "closed",
@@ -57,10 +57,10 @@ func TestIssuesService_List_owned(t *testing.T) {
 	client, mux, _, teardown := setup()
 	defer teardown()
 
-	acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeLabelDescriptionSearchPreview, mediaTypeLockReasonPreview}
+	wantAcceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeLabelDescriptionSearchPreview, mediaTypeLockReasonPreview}
 	mux.HandleFunc("/user/issues", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "GET")
-		testHeader(t, r, "Accept", strings.Join(acceptHeaders, ", "))
+		testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
 		fmt.Fprint(w, `[{"number":1}]`)
 	})
 
@@ -79,10 +79,10 @@ func TestIssuesService_ListByOrg(t *testing.T) {
 	client, mux, _, teardown := setup()
 	defer teardown()
 
-	acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeLabelDescriptionSearchPreview, mediaTypeLockReasonPreview}
+	wantAcceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeLabelDescriptionSearchPreview, mediaTypeLockReasonPreview}
 	mux.HandleFunc("/orgs/o/issues", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "GET")
-		testHeader(t, r, "Accept", strings.Join(acceptHeaders, ", "))
+		testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
 		fmt.Fprint(w, `[{"number":1}]`)
 	})
 
@@ -109,10 +109,10 @@ func TestIssuesService_ListByRepo(t *testing.T) {
 	client, mux, _, teardown := setup()
 	defer teardown()
 
-	acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeLabelDescriptionSearchPreview, mediaTypeIntegrationPreview}
+	wantAcceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeLabelDescriptionSearchPreview, mediaTypeIntegrationPreview}
 	mux.HandleFunc("/repos/o/r/issues", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "GET")
-		testHeader(t, r, "Accept", strings.Join(acceptHeaders, ", "))
+		testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
 		testFormValues(t, r, values{
 			"milestone": "*",
 			"state":     "closed",
@@ -155,10 +155,10 @@ func TestIssuesService_Get(t *testing.T) {
 	client, mux, _, teardown := setup()
 	defer teardown()
 
-	acceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeLabelDescriptionSearchPreview, mediaTypeLockReasonPreview}
+	wantAcceptHeaders := []string{mediaTypeReactionsPreview, mediaTypeLabelDescriptionSearchPreview, mediaTypeLockReasonPreview}
 	mux.HandleFunc("/repos/o/r/issues/1", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "GET")
-		testHeader(t, r, "Accept", strings.Join(acceptHeaders, ", "))
+		testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
 		fmt.Fprint(w, `{"number":1, "labels": [{"url": "u", "name": "n", "color": "c"}]}`)
 	})
 
diff --git a/github/projects_test.go b/github/projects_test.go
index 88d16ed1..666c0e66 100644
--- a/github/projects_test.go
+++ b/github/projects_test.go
@@ -15,6 +15,73 @@ import (
 	"testing"
 )
 
+func TestProject_marshall(t *testing.T) {
+	testJSONMarshal(t, &Project{}, "{}")
+
+	u := &Project{
+		ID:         Int64(1),
+		URL:        String("u"),
+		HTMLURL:    String("h"),
+		ColumnsURL: String("c"),
+		OwnerURL:   String("o"),
+		Name:       String("n"),
+		Body:       String("b"),
+		Number:     Int(1),
+		State:      String("s"),
+		CreatedAt:  &Timestamp{referenceTime},
+		UpdatedAt:  &Timestamp{referenceTime},
+		NodeID:     String("n"),
+		Creator: &User{
+			Login:       String("l"),
+			ID:          Int64(1),
+			AvatarURL:   String("a"),
+			GravatarID:  String("g"),
+			Name:        String("n"),
+			Company:     String("c"),
+			Blog:        String("b"),
+			Location:    String("l"),
+			Email:       String("e"),
+			Hireable:    Bool(true),
+			PublicRepos: Int(1),
+			Followers:   Int(1),
+			Following:   Int(1),
+			CreatedAt:   &Timestamp{referenceTime},
+			URL:         String("u"),
+		},
+	}
+	want := `{
+		"id": 1,
+		"url": "u",
+		"html_url": "h",
+		"columns_url": "c",
+		"owner_url": "o",
+		"name": "n",
+		"body": "b",
+		"number": 1,
+		"state": "s",
+		"created_at": ` + referenceTimeStr + `,
+		"updated_at": ` + referenceTimeStr + `,
+		"node_id": "n",
+		"creator": {
+			"login": "l",
+			"id": 1,
+			"avatar_url": "a",
+			"gravatar_id": "g",
+			"name": "n",
+			"company": "c",
+			"blog": "b",
+			"location": "l",
+			"email": "e",
+			"hireable": true,
+			"public_repos": 1,
+			"followers": 1,
+			"following": 1,
+			"created_at": ` + referenceTimeStr + `,
+			"url": "u"
+		}
+	}`
+	testJSONMarshal(t, u, want)
+}
 func TestProjectsService_UpdateProject(t *testing.T) {
 	client, mux, _, teardown := setup()
 	defer teardown()
@@ -92,10 +159,10 @@ func TestProjectsService_ListProjectColumns(t *testing.T) {
 	client, mux, _, teardown := setup()
 	defer teardown()
 
-	acceptHeaders := []string{mediaTypeProjectsPreview}
+	wantAcceptHeaders := []string{mediaTypeProjectsPreview}
 	mux.HandleFunc("/projects/1/columns", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "GET")
-		testHeader(t, r, "Accept", strings.Join(acceptHeaders, ", "))
+		testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
 		testFormValues(t, r, values{"page": "2"})
 		fmt.Fprint(w, `[{"id":1}]`)
 	})
diff --git a/github/pulls_test.go b/github/pulls_test.go
index a29a6ecf..f8533828 100644
--- a/github/pulls_test.go
+++ b/github/pulls_test.go
@@ -20,10 +20,10 @@ func TestPullRequestsService_List(t *testing.T) {
 	client, mux, _, teardown := setup()
 	defer teardown()
 
-	acceptHeaders := []string{mediaTypeLabelDescriptionSearchPreview, mediaTypeLockReasonPreview}
+	wantAcceptHeaders := []string{mediaTypeLabelDescriptionSearchPreview, mediaTypeLockReasonPreview}
 	mux.HandleFunc("/repos/o/r/pulls", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "GET")
-		testHeader(t, r, "Accept", strings.Join(acceptHeaders, ", "))
+		testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
 		testFormValues(t, r, values{
 			"state":     "closed",
 			"head":      "h",
@@ -59,10 +59,10 @@ func TestPullRequestsService_Get(t *testing.T) {
 	client, mux, _, teardown := setup()
 	defer teardown()
 
-	acceptHeaders := []string{mediaTypeLabelDescriptionSearchPreview, mediaTypeLockReasonPreview}
+	wantAcceptHeaders := []string{mediaTypeLabelDescriptionSearchPreview, mediaTypeLockReasonPreview}
 	mux.HandleFunc("/repos/o/r/pulls/1", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "GET")
-		testHeader(t, r, "Accept", strings.Join(acceptHeaders, ", "))
+		testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
 		fmt.Fprint(w, `{"number":1}`)
 	})
 
@@ -333,10 +333,10 @@ func TestPullRequestsService_Edit(t *testing.T) {
 
 	for i, tt := range tests {
 		madeRequest := false
-		acceptHeaders := []string{mediaTypeLabelDescriptionSearchPreview, mediaTypeLockReasonPreview}
+		wantAcceptHeaders := []string{mediaTypeLabelDescriptionSearchPreview, mediaTypeLockReasonPreview}
 		mux.HandleFunc(fmt.Sprintf("/repos/o/r/pulls/%v", i), func(w http.ResponseWriter, r *http.Request) {
 			testMethod(t, r, "PATCH")
-			testHeader(t, r, "Accept", strings.Join(acceptHeaders, ", "))
+			testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
 			testBody(t, r, tt.wantUpdate+"\n")
 			io.WriteString(w, tt.sendResponse)
 			madeRequest = true
diff --git a/github/repos_deployments_test.go b/github/repos_deployments_test.go
index 3396cf44..4e6ae6dc 100644
--- a/github/repos_deployments_test.go
+++ b/github/repos_deployments_test.go
@@ -69,8 +69,8 @@ func TestRepositoriesService_CreateDeployment(t *testing.T) {
 		json.NewDecoder(r.Body).Decode(v)
 
 		testMethod(t, r, "POST")
-		acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview}
-		testHeader(t, r, "Accept", strings.Join(acceptHeaders, ", "))
+		wantAcceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview}
+		testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
 		if !reflect.DeepEqual(v, input) {
 			t.Errorf("Request body = %+v, want %+v", v, input)
 		}
@@ -115,10 +115,10 @@ func TestRepositoriesService_GetDeploymentStatus(t *testing.T) {
 	client, mux, _, teardown := setup()
 	defer teardown()
 
-	acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview}
+	wantAcceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview}
 	mux.HandleFunc("/repos/o/r/deployments/3/statuses/4", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "GET")
-		testHeader(t, r, "Accept", strings.Join(acceptHeaders, ", "))
+		testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
 		fmt.Fprint(w, `{"id":4}`)
 	})
 
@@ -144,8 +144,8 @@ func TestRepositoriesService_CreateDeploymentStatus(t *testing.T) {
 		json.NewDecoder(r.Body).Decode(v)
 
 		testMethod(t, r, "POST")
-		acceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview}
-		testHeader(t, r, "Accept", strings.Join(acceptHeaders, ", "))
+		wantAcceptHeaders := []string{mediaTypeDeploymentStatusPreview, mediaTypeExpandDeploymentStatusPreview}
+		testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
 		if !reflect.DeepEqual(v, input) {
 			t.Errorf("Request body = %+v, want %+v", v, input)
 		}
diff --git a/github/repos_test.go b/github/repos_test.go
index f6405187..6f4a8a3f 100644
--- a/github/repos_test.go
+++ b/github/repos_test.go
@@ -19,10 +19,10 @@ func TestRepositoriesService_List_authenticatedUser(t *testing.T) {
 	client, mux, _, teardown := setup()
 	defer teardown()
 
-	acceptHeaders := []string{mediaTypeTopicsPreview}
+	wantAcceptHeaders := []string{mediaTypeTopicsPreview}
 	mux.HandleFunc("/user/repos", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "GET")
-		testHeader(t, r, "Accept", strings.Join(acceptHeaders, ", "))
+		testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
 		fmt.Fprint(w, `[{"id":1},{"id":2}]`)
 	})
 
@@ -41,10 +41,10 @@ func TestRepositoriesService_List_specifiedUser(t *testing.T) {
 	client, mux, _, teardown := setup()
 	defer teardown()
 
-	acceptHeaders := []string{mediaTypeTopicsPreview}
+	wantAcceptHeaders := []string{mediaTypeTopicsPreview}
 	mux.HandleFunc("/users/u/repos", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "GET")
-		testHeader(t, r, "Accept", strings.Join(acceptHeaders, ", "))
+		testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
 		testFormValues(t, r, values{
 			"visibility":  "public",
 			"affiliation": "owner,collaborator",
@@ -77,10 +77,10 @@ func TestRepositoriesService_List_specifiedUser_type(t *testing.T) {
 	client, mux, _, teardown := setup()
 	defer teardown()
 
-	acceptHeaders := []string{mediaTypeTopicsPreview}
+	wantAcceptHeaders := []string{mediaTypeTopicsPreview}
 	mux.HandleFunc("/users/u/repos", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "GET")
-		testHeader(t, r, "Accept", strings.Join(acceptHeaders, ", "))
+		testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
 		testFormValues(t, r, values{
 			"type": "owner",
 		})
@@ -113,10 +113,10 @@ func TestRepositoriesService_ListByOrg(t *testing.T) {
 	client, mux, _, teardown := setup()
 	defer teardown()
 
-	acceptHeaders := []string{mediaTypeTopicsPreview}
+	wantAcceptHeaders := []string{mediaTypeTopicsPreview}
 	mux.HandleFunc("/orgs/o/repos", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "GET")
-		testHeader(t, r, "Accept", strings.Join(acceptHeaders, ", "))
+		testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
 		testFormValues(t, r, values{
 			"type": "forks",
 			"page": "2",
@@ -238,10 +238,10 @@ func TestRepositoriesService_Get(t *testing.T) {
 	client, mux, _, teardown := setup()
 	defer teardown()
 
-	acceptHeaders := []string{mediaTypeCodesOfConductPreview, mediaTypeTopicsPreview}
+	wantAcceptHeaders := []string{mediaTypeCodesOfConductPreview, mediaTypeTopicsPreview}
 	mux.HandleFunc("/repos/o/r", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "GET")
-		testHeader(t, r, "Accept", strings.Join(acceptHeaders, ", "))
+		testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
 		fmt.Fprint(w, `{"id":1,"name":"n","description":"d","owner":{"login":"l"},"license":{"key":"mit"}}`)
 	})
 
diff --git a/github/teams_test.go b/github/teams_test.go
index e793b3c1..fbd8130f 100644
--- a/github/teams_test.go
+++ b/github/teams_test.go
@@ -204,8 +204,8 @@ func TestTeamsService_ListTeamRepos(t *testing.T) {
 
 	mux.HandleFunc("/teams/1/repos", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "GET")
-		acceptHeaders := []string{mediaTypeTopicsPreview, mediaTypeNestedTeamsPreview}
-		testHeader(t, r, "Accept", strings.Join(acceptHeaders, ", "))
+		wantAcceptHeaders := []string{mediaTypeTopicsPreview, mediaTypeNestedTeamsPreview}
+		testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
 		testFormValues(t, r, values{"page": "2"})
 		fmt.Fprint(w, `[{"id":1}]`)
 	})
@@ -228,8 +228,8 @@ func TestTeamsService_IsTeamRepo_true(t *testing.T) {
 
 	mux.HandleFunc("/teams/1/repos/o/r", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "GET")
-		acceptHeaders := []string{mediaTypeOrgPermissionRepo, mediaTypeNestedTeamsPreview}
-		testHeader(t, r, "Accept", strings.Join(acceptHeaders, ", "))
+		wantAcceptHeaders := []string{mediaTypeOrgPermissionRepo, mediaTypeNestedTeamsPreview}
+		testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
 		fmt.Fprint(w, `{"id":1}`)
 	})
 
@@ -468,10 +468,10 @@ func TestTeamsService_ListProjects(t *testing.T) {
 	client, mux, _, teardown := setup()
 	defer teardown()
 
-	acceptHeaders := []string{mediaTypeNestedTeamsPreview, mediaTypeProjectsPreview}
+	wantAcceptHeaders := []string{mediaTypeNestedTeamsPreview, mediaTypeProjectsPreview}
 	mux.HandleFunc("/teams/1/projects", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "GET")
-		testHeader(t, r, "Accept", strings.Join(acceptHeaders, ", "))
+		testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
 		fmt.Fprint(w, `[{"id":1}]`)
 	})
 
@@ -490,10 +490,10 @@ func TestTeamsService_ReviewProjects(t *testing.T) {
 	client, mux, _, teardown := setup()
 	defer teardown()
 
-	acceptHeaders := []string{mediaTypeNestedTeamsPreview, mediaTypeProjectsPreview}
+	wantAcceptHeaders := []string{mediaTypeNestedTeamsPreview, mediaTypeProjectsPreview}
 	mux.HandleFunc("/teams/1/projects/1", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "GET")
-		testHeader(t, r, "Accept", strings.Join(acceptHeaders, ", "))
+		testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
 		fmt.Fprint(w, `{"id":1}`)
 	})
 
@@ -516,10 +516,10 @@ func TestTeamsService_AddTeamProject(t *testing.T) {
 		Permission: String("admin"),
 	}
 
-	acceptHeaders := []string{mediaTypeNestedTeamsPreview, mediaTypeProjectsPreview}
+	wantAcceptHeaders := []string{mediaTypeNestedTeamsPreview, mediaTypeProjectsPreview}
 	mux.HandleFunc("/teams/1/projects/1", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "PUT")
-		testHeader(t, r, "Accept", strings.Join(acceptHeaders, ", "))
+		testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
 
 		v := &TeamProjectOptions{}
 		json.NewDecoder(r.Body).Decode(v)
@@ -540,10 +540,10 @@ func TestTeamsService_RemoveTeamProject(t *testing.T) {
 	client, mux, _, teardown := setup()
 	defer teardown()
 
-	acceptHeaders := []string{mediaTypeNestedTeamsPreview, mediaTypeProjectsPreview}
+	wantAcceptHeaders := []string{mediaTypeNestedTeamsPreview, mediaTypeProjectsPreview}
 	mux.HandleFunc("/teams/1/projects/1", func(w http.ResponseWriter, r *http.Request) {
 		testMethod(t, r, "DELETE")
-		testHeader(t, r, "Accept", strings.Join(acceptHeaders, ", "))
+		testHeader(t, r, "Accept", strings.Join(wantAcceptHeaders, ", "))
 		w.WriteHeader(http.StatusNoContent)
 	})