Repository: google/go-github (go)

Issue:
Deprecate WebHookPayload
The `PushEvent` type was originally added in June 2013 in beaff13913b3dd17651e12f622473b1fb99756a1.  I then added the `WebHookPayload` type a month later in 023e8db8cbba83d90a62e2e546a96d3dcecbbce4.  I honestly am not sure why I did that, since they are effectively duplicates.  Maybe it wasn't clear at that point that we should be using the same types for webhook payloads and activity events?  Or maybe I just wasn't thinking.

In any event, #302 reminded me that we've updated `PushEvent` to include a variant of `Repository` that has a string Organization filed (see d722750ab19bf6318a2c8dfad8d4aa034779aa8f), but the same update was never made to `WebHookPayload`.  Instead of fixing that, I think we should probably just deprecate `WebHookPayload` and point people to `PushEvent` instead.


Pull request:
Deprecate WebHookPayload
Fixes #303.

Patch:
diff --git a/github/event_types.go b/github/event_types.go
index de729c06..71baac88 100644
--- a/github/event_types.go
+++ b/github/event_types.go
@@ -885,6 +885,7 @@ type PushEvent struct {
 	DistinctSize *int          `json:"distinct_size,omitempty"`
 
 	// The following fields are only populated by Webhook events.
+	Action       *string              `json:"action,omitempty"`
 	After        *string              `json:"after,omitempty"`
 	Created      *bool                `json:"created,omitempty"`
 	Deleted      *bool                `json:"deleted,omitempty"`
diff --git a/github/github-accessors.go b/github/github-accessors.go
index cad631db..26f06ea8 100644
--- a/github/github-accessors.go
+++ b/github/github-accessors.go
@@ -12988,6 +12988,14 @@ func (p *PunchCard) GetHour() int {
 	return *p.Hour
 }
 
+// GetAction returns the Action field if it's non-nil, zero value otherwise.
+func (p *PushEvent) GetAction() string {
+	if p == nil || p.Action == nil {
+		return ""
+	}
+	return *p.Action
+}
+
 // GetAfter returns the After field if it's non-nil, zero value otherwise.
 func (p *PushEvent) GetAfter() string {
 	if p == nil || p.After == nil {
@@ -19028,190 +19036,6 @@ func (w *WatchEvent) GetSender() *User {
 	return w.Sender
 }
 
-// GetEmail returns the Email field if it's non-nil, zero value otherwise.
-func (w *WebHookAuthor) GetEmail() string {
-	if w == nil || w.Email == nil {
-		return ""
-	}
-	return *w.Email
-}
-
-// GetName returns the Name field if it's non-nil, zero value otherwise.
-func (w *WebHookAuthor) GetName() string {
-	if w == nil || w.Name == nil {
-		return ""
-	}
-	return *w.Name
-}
-
-// GetUsername returns the Username field if it's non-nil, zero value otherwise.
-func (w *WebHookAuthor) GetUsername() string {
-	if w == nil || w.Username == nil {
-		return ""
-	}
-	return *w.Username
-}
-
-// GetAuthor returns the Author field.
-func (w *WebHookCommit) GetAuthor() *WebHookAuthor {
-	if w == nil {
-		return nil
-	}
-	return w.Author
-}
-
-// GetCommitter returns the Committer field.
-func (w *WebHookCommit) GetCommitter() *WebHookAuthor {
-	if w == nil {
-		return nil
-	}
-	return w.Committer
-}
-
-// GetDistinct returns the Distinct field if it's non-nil, zero value otherwise.
-func (w *WebHookCommit) GetDistinct() bool {
-	if w == nil || w.Distinct == nil {
-		return false
-	}
-	return *w.Distinct
-}
-
-// GetID returns the ID field if it's non-nil, zero value otherwise.
-func (w *WebHookCommit) GetID() string {
-	if w == nil || w.ID == nil {
-		return ""
-	}
-	return *w.ID
-}
-
-// GetMessage returns the Message field if it's non-nil, zero value otherwise.
-func (w *WebHookCommit) GetMessage() string {
-	if w == nil || w.Message == nil {
-		return ""
-	}
-	return *w.Message
-}
-
-// GetTimestamp returns the Timestamp field if it's non-nil, zero value otherwise.
-func (w *WebHookCommit) GetTimestamp() time.Time {
-	if w == nil || w.Timestamp == nil {
-		return time.Time{}
-	}
-	return *w.Timestamp
-}
-
-// GetAction returns the Action field if it's non-nil, zero value otherwise.
-func (w *WebHookPayload) GetAction() string {
-	if w == nil || w.Action == nil {
-		return ""
-	}
-	return *w.Action
-}
-
-// GetAfter returns the After field if it's non-nil, zero value otherwise.
-func (w *WebHookPayload) GetAfter() string {
-	if w == nil || w.After == nil {
-		return ""
-	}
-	return *w.After
-}
-
-// GetBefore returns the Before field if it's non-nil, zero value otherwise.
-func (w *WebHookPayload) GetBefore() string {
-	if w == nil || w.Before == nil {
-		return ""
-	}
-	return *w.Before
-}
-
-// GetCompare returns the Compare field if it's non-nil, zero value otherwise.
-func (w *WebHookPayload) GetCompare() string {
-	if w == nil || w.Compare == nil {
-		return ""
-	}
-	return *w.Compare
-}
-
-// GetCreated returns the Created field if it's non-nil, zero value otherwise.
-func (w *WebHookPayload) GetCreated() bool {
-	if w == nil || w.Created == nil {
-		return false
-	}
-	return *w.Created
-}
-
-// GetDeleted returns the Deleted field if it's non-nil, zero value otherwise.
-func (w *WebHookPayload) GetDeleted() bool {
-	if w == nil || w.Deleted == nil {
-		return false
-	}
-	return *w.Deleted
-}
-
-// GetForced returns the Forced field if it's non-nil, zero value otherwise.
-func (w *WebHookPayload) GetForced() bool {
-	if w == nil || w.Forced == nil {
-		return false
-	}
-	return *w.Forced
-}
-
-// GetHeadCommit returns the HeadCommit field.
-func (w *WebHookPayload) GetHeadCommit() *WebHookCommit {
-	if w == nil {
-		return nil
-	}
-	return w.HeadCommit
-}
-
-// GetInstallation returns the Installation field.
-func (w *WebHookPayload) GetInstallation() *Installation {
-	if w == nil {
-		return nil
-	}
-	return w.Installation
-}
-
-// GetOrganization returns the Organization field.
-func (w *WebHookPayload) GetOrganization() *Organization {
-	if w == nil {
-		return nil
-	}
-	return w.Organization
-}
-
-// GetPusher returns the Pusher field.
-func (w *WebHookPayload) GetPusher() *User {
-	if w == nil {
-		return nil
-	}
-	return w.Pusher
-}
-
-// GetRef returns the Ref field if it's non-nil, zero value otherwise.
-func (w *WebHookPayload) GetRef() string {
-	if w == nil || w.Ref == nil {
-		return ""
-	}
-	return *w.Ref
-}
-
-// GetRepo returns the Repo field.
-func (w *WebHookPayload) GetRepo() *Repository {
-	if w == nil {
-		return nil
-	}
-	return w.Repo
-}
-
-// GetSender returns the Sender field.
-func (w *WebHookPayload) GetSender() *User {
-	if w == nil {
-		return nil
-	}
-	return w.Sender
-}
-
 // GetTotal returns the Total field if it's non-nil, zero value otherwise.
 func (w *WeeklyCommitActivity) GetTotal() int {
 	if w == nil || w.Total == nil {
diff --git a/github/repos_hooks.go b/github/repos_hooks.go
index 6afec860..61c85219 100644
--- a/github/repos_hooks.go
+++ b/github/repos_hooks.go
@@ -18,57 +18,22 @@ import (
 // here to account for these differences.
 //
 // GitHub API docs: https://help.github.com/articles/post-receive-hooks
-type WebHookPayload struct {
-	Action       *string          `json:"action,omitempty"`
-	After        *string          `json:"after,omitempty"`
-	Before       *string          `json:"before,omitempty"`
-	Commits      []*WebHookCommit `json:"commits,omitempty"`
-	Compare      *string          `json:"compare,omitempty"`
-	Created      *bool            `json:"created,omitempty"`
-	Deleted      *bool            `json:"deleted,omitempty"`
-	Forced       *bool            `json:"forced,omitempty"`
-	HeadCommit   *WebHookCommit   `json:"head_commit,omitempty"`
-	Installation *Installation    `json:"installation,omitempty"`
-	Organization *Organization    `json:"organization,omitempty"`
-	Pusher       *User            `json:"pusher,omitempty"`
-	Ref          *string          `json:"ref,omitempty"`
-	Repo         *Repository      `json:"repository,omitempty"`
-	Sender       *User            `json:"sender,omitempty"`
-}
-
-func (w WebHookPayload) String() string {
-	return Stringify(w)
-}
+//
+// Deprecated: Please use PushEvent instead.
+type WebHookPayload = PushEvent
 
 // WebHookCommit represents the commit variant we receive from GitHub in a
 // WebHookPayload.
-type WebHookCommit struct {
-	Added     []string       `json:"added,omitempty"`
-	Author    *WebHookAuthor `json:"author,omitempty"`
-	Committer *WebHookAuthor `json:"committer,omitempty"`
-	Distinct  *bool          `json:"distinct,omitempty"`
-	ID        *string        `json:"id,omitempty"`
-	Message   *string        `json:"message,omitempty"`
-	Modified  []string       `json:"modified,omitempty"`
-	Removed   []string       `json:"removed,omitempty"`
-	Timestamp *time.Time     `json:"timestamp,omitempty"`
-}
-
-func (w WebHookCommit) String() string {
-	return Stringify(w)
-}
+//
+// Deprecated: Please use HeadCommit instead.
+type WebHookCommit = HeadCommit
 
 // WebHookAuthor represents the author or committer of a commit, as specified
 // in a WebHookCommit. The commit author may not correspond to a GitHub User.
-type WebHookAuthor struct {
-	Email    *string `json:"email,omitempty"`
-	Name     *string `json:"name,omitempty"`
-	Username *string `json:"username,omitempty"`
-}
-
-func (w WebHookAuthor) String() string {
-	return Stringify(w)
-}
+//
+// Deprecated: Please use CommitAuthor instead.
+// NOTE Breaking API change: the `Username` field is now called `Login`.
+type WebHookAuthor = CommitAuthor
 
 // Hook represents a GitHub (web and service) hook for a repository.
 type Hook struct {


Test patch:
diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go
index a796fe05..ab1039b8 100644
--- a/github/github-accessors_test.go
+++ b/github/github-accessors_test.go
@@ -15108,6 +15108,16 @@ func TestPunchCard_GetHour(tt *testing.T) {
 	p.GetHour()
 }
 
+func TestPushEvent_GetAction(tt *testing.T) {
+	var zeroValue string
+	p := &PushEvent{Action: &zeroValue}
+	p.GetAction()
+	p = &PushEvent{}
+	p.GetAction()
+	p = nil
+	p.GetAction()
+}
+
 func TestPushEvent_GetAfter(tt *testing.T) {
 	var zeroValue string
 	p := &PushEvent{After: &zeroValue}
@@ -22280,212 +22290,6 @@ func TestWatchEvent_GetSender(tt *testing.T) {
 	w.GetSender()
 }
 
-func TestWebHookAuthor_GetEmail(tt *testing.T) {
-	var zeroValue string
-	w := &WebHookAuthor{Email: &zeroValue}
-	w.GetEmail()
-	w = &WebHookAuthor{}
-	w.GetEmail()
-	w = nil
-	w.GetEmail()
-}
-
-func TestWebHookAuthor_GetName(tt *testing.T) {
-	var zeroValue string
-	w := &WebHookAuthor{Name: &zeroValue}
-	w.GetName()
-	w = &WebHookAuthor{}
-	w.GetName()
-	w = nil
-	w.GetName()
-}
-
-func TestWebHookAuthor_GetUsername(tt *testing.T) {
-	var zeroValue string
-	w := &WebHookAuthor{Username: &zeroValue}
-	w.GetUsername()
-	w = &WebHookAuthor{}
-	w.GetUsername()
-	w = nil
-	w.GetUsername()
-}
-
-func TestWebHookCommit_GetAuthor(tt *testing.T) {
-	w := &WebHookCommit{}
-	w.GetAuthor()
-	w = nil
-	w.GetAuthor()
-}
-
-func TestWebHookCommit_GetCommitter(tt *testing.T) {
-	w := &WebHookCommit{}
-	w.GetCommitter()
-	w = nil
-	w.GetCommitter()
-}
-
-func TestWebHookCommit_GetDistinct(tt *testing.T) {
-	var zeroValue bool
-	w := &WebHookCommit{Distinct: &zeroValue}
-	w.GetDistinct()
-	w = &WebHookCommit{}
-	w.GetDistinct()
-	w = nil
-	w.GetDistinct()
-}
-
-func TestWebHookCommit_GetID(tt *testing.T) {
-	var zeroValue string
-	w := &WebHookCommit{ID: &zeroValue}
-	w.GetID()
-	w = &WebHookCommit{}
-	w.GetID()
-	w = nil
-	w.GetID()
-}
-
-func TestWebHookCommit_GetMessage(tt *testing.T) {
-	var zeroValue string
-	w := &WebHookCommit{Message: &zeroValue}
-	w.GetMessage()
-	w = &WebHookCommit{}
-	w.GetMessage()
-	w = nil
-	w.GetMessage()
-}
-
-func TestWebHookCommit_GetTimestamp(tt *testing.T) {
-	var zeroValue time.Time
-	w := &WebHookCommit{Timestamp: &zeroValue}
-	w.GetTimestamp()
-	w = &WebHookCommit{}
-	w.GetTimestamp()
-	w = nil
-	w.GetTimestamp()
-}
-
-func TestWebHookPayload_GetAction(tt *testing.T) {
-	var zeroValue string
-	w := &WebHookPayload{Action: &zeroValue}
-	w.GetAction()
-	w = &WebHookPayload{}
-	w.GetAction()
-	w = nil
-	w.GetAction()
-}
-
-func TestWebHookPayload_GetAfter(tt *testing.T) {
-	var zeroValue string
-	w := &WebHookPayload{After: &zeroValue}
-	w.GetAfter()
-	w = &WebHookPayload{}
-	w.GetAfter()
-	w = nil
-	w.GetAfter()
-}
-
-func TestWebHookPayload_GetBefore(tt *testing.T) {
-	var zeroValue string
-	w := &WebHookPayload{Before: &zeroValue}
-	w.GetBefore()
-	w = &WebHookPayload{}
-	w.GetBefore()
-	w = nil
-	w.GetBefore()
-}
-
-func TestWebHookPayload_GetCompare(tt *testing.T) {
-	var zeroValue string
-	w := &WebHookPayload{Compare: &zeroValue}
-	w.GetCompare()
-	w = &WebHookPayload{}
-	w.GetCompare()
-	w = nil
-	w.GetCompare()
-}
-
-func TestWebHookPayload_GetCreated(tt *testing.T) {
-	var zeroValue bool
-	w := &WebHookPayload{Created: &zeroValue}
-	w.GetCreated()
-	w = &WebHookPayload{}
-	w.GetCreated()
-	w = nil
-	w.GetCreated()
-}
-
-func TestWebHookPayload_GetDeleted(tt *testing.T) {
-	var zeroValue bool
-	w := &WebHookPayload{Deleted: &zeroValue}
-	w.GetDeleted()
-	w = &WebHookPayload{}
-	w.GetDeleted()
-	w = nil
-	w.GetDeleted()
-}
-
-func TestWebHookPayload_GetForced(tt *testing.T) {
-	var zeroValue bool
-	w := &WebHookPayload{Forced: &zeroValue}
-	w.GetForced()
-	w = &WebHookPayload{}
-	w.GetForced()
-	w = nil
-	w.GetForced()
-}
-
-func TestWebHookPayload_GetHeadCommit(tt *testing.T) {
-	w := &WebHookPayload{}
-	w.GetHeadCommit()
-	w = nil
-	w.GetHeadCommit()
-}
-
-func TestWebHookPayload_GetInstallation(tt *testing.T) {
-	w := &WebHookPayload{}
-	w.GetInstallation()
-	w = nil
-	w.GetInstallation()
-}
-
-func TestWebHookPayload_GetOrganization(tt *testing.T) {
-	w := &WebHookPayload{}
-	w.GetOrganization()
-	w = nil
-	w.GetOrganization()
-}
-
-func TestWebHookPayload_GetPusher(tt *testing.T) {
-	w := &WebHookPayload{}
-	w.GetPusher()
-	w = nil
-	w.GetPusher()
-}
-
-func TestWebHookPayload_GetRef(tt *testing.T) {
-	var zeroValue string
-	w := &WebHookPayload{Ref: &zeroValue}
-	w.GetRef()
-	w = &WebHookPayload{}
-	w.GetRef()
-	w = nil
-	w.GetRef()
-}
-
-func TestWebHookPayload_GetRepo(tt *testing.T) {
-	w := &WebHookPayload{}
-	w.GetRepo()
-	w = nil
-	w.GetRepo()
-}
-
-func TestWebHookPayload_GetSender(tt *testing.T) {
-	w := &WebHookPayload{}
-	w.GetSender()
-	w = nil
-	w.GetSender()
-}
-
 func TestWeeklyCommitActivity_GetTotal(tt *testing.T) {
 	var zeroValue int
 	w := &WeeklyCommitActivity{Total: &zeroValue}
diff --git a/github/github-stringify_test.go b/github/github-stringify_test.go
index 26cfd82c..4be5b620 100644
--- a/github/github-stringify_test.go
+++ b/github/github-stringify_test.go
@@ -1341,6 +1341,7 @@ func TestPushEvent_String(t *testing.T) {
 		Size:         Int(0),
 		Before:       String(""),
 		DistinctSize: Int(0),
+		Action:       String(""),
 		After:        String(""),
 		Created:      Bool(false),
 		Deleted:      Bool(false),
@@ -1354,7 +1355,7 @@ func TestPushEvent_String(t *testing.T) {
 		Installation: &Installation{},
 		Organization: &Organization{},
 	}
-	want := `github.PushEvent{PushID:0, Head:"", Ref:"", Size:0, Before:"", DistinctSize:0, After:"", Created:false, Deleted:false, Forced:false, BaseRef:"", Compare:"", Repo:github.PushEventRepository{}, HeadCommit:github.HeadCommit{}, Pusher:github.User{}, Sender:github.User{}, Installation:github.Installation{}, Organization:github.Organization{}}`
+	want := `github.PushEvent{PushID:0, Head:"", Ref:"", Size:0, Before:"", DistinctSize:0, Action:"", After:"", Created:false, Deleted:false, Forced:false, BaseRef:"", Compare:"", Repo:github.PushEventRepository{}, HeadCommit:github.HeadCommit{}, Pusher:github.User{}, Sender:github.User{}, Installation:github.Installation{}, Organization:github.Organization{}}`
 	if got := v.String(); got != want {
 		t.Errorf("PushEvent.String = %v, want %v", got, want)
 	}
@@ -1951,58 +1952,6 @@ func TestUserStats_String(t *testing.T) {
 	}
 }
 
-func TestWebHookAuthor_String(t *testing.T) {
-	v := WebHookAuthor{
-		Email:    String(""),
-		Name:     String(""),
-		Username: String(""),
-	}
-	want := `github.WebHookAuthor{Email:"", Name:"", Username:""}`
-	if got := v.String(); got != want {
-		t.Errorf("WebHookAuthor.String = %v, want %v", got, want)
-	}
-}
-
-func TestWebHookCommit_String(t *testing.T) {
-	v := WebHookCommit{
-		Added:     []string{""},
-		Author:    &WebHookAuthor{},
-		Committer: &WebHookAuthor{},
-		Distinct:  Bool(false),
-		ID:        String(""),
-		Message:   String(""),
-		Modified:  []string{""},
-		Removed:   []string{""},
-	}
-	want := `github.WebHookCommit{Added:[""], Author:github.WebHookAuthor{}, Committer:github.WebHookAuthor{}, Distinct:false, ID:"", Message:"", Modified:[""], Removed:[""]}`
-	if got := v.String(); got != want {
-		t.Errorf("WebHookCommit.String = %v, want %v", got, want)
-	}
-}
-
-func TestWebHookPayload_String(t *testing.T) {
-	v := WebHookPayload{
-		Action:       String(""),
-		After:        String(""),
-		Before:       String(""),
-		Compare:      String(""),
-		Created:      Bool(false),
-		Deleted:      Bool(false),
-		Forced:       Bool(false),
-		HeadCommit:   &WebHookCommit{},
-		Installation: &Installation{},
-		Organization: &Organization{},
-		Pusher:       &User{},
-		Ref:          String(""),
-		Repo:         &Repository{},
-		Sender:       &User{},
-	}
-	want := `github.WebHookPayload{Action:"", After:"", Before:"", Compare:"", Created:false, Deleted:false, Forced:false, HeadCommit:github.WebHookCommit{}, Installation:github.Installation{}, Organization:github.Organization{}, Pusher:github.User{}, Ref:"", Repo:github.Repository{}, Sender:github.User{}}`
-	if got := v.String(); got != want {
-		t.Errorf("WebHookPayload.String = %v, want %v", got, want)
-	}
-}
-
 func TestWeeklyCommitActivity_String(t *testing.T) {
 	v := WeeklyCommitActivity{
 		Days:  []int{0},
diff --git a/github/repos_hooks_test.go b/github/repos_hooks_test.go
index 3137bf49..50dad9c2 100644
--- a/github/repos_hooks_test.go
+++ b/github/repos_hooks_test.go
@@ -316,14 +316,14 @@ func TestBranchWebHookPayload_Marshal(t *testing.T) {
 			{
 				Added: []string{"1", "2", "3"},
 				Author: &WebHookAuthor{
-					Email:    String("abc@gmail.com"),
-					Name:     String("abc"),
-					Username: String("abc_12"),
+					Email: String("abc@gmail.com"),
+					Name:  String("abc"),
+					Login: String("abc_12"),
 				},
 				Committer: &WebHookAuthor{
-					Email:    String("abc@gmail.com"),
-					Name:     String("abc"),
-					Username: String("abc_12"),
+					Email: String("abc@gmail.com"),
+					Name:  String("abc"),
+					Login: String("abc_12"),
 				},
 				ID:       String("1"),
 				Message:  String("WebHookCommit"),
@@ -337,14 +337,14 @@ func TestBranchWebHookPayload_Marshal(t *testing.T) {
 		HeadCommit: &WebHookCommit{
 			Added: []string{"1", "2", "3"},
 			Author: &WebHookAuthor{
-				Email:    String("abc@gmail.com"),
-				Name:     String("abc"),
-				Username: String("abc_12"),
+				Email: String("abc@gmail.com"),
+				Name:  String("abc"),
+				Login: String("abc_12"),
 			},
 			Committer: &WebHookAuthor{
-				Email:    String("abc@gmail.com"),
-				Name:     String("abc"),
-				Username: String("abc_12"),
+				Email: String("abc@gmail.com"),
+				Name:  String("abc"),
+				Login: String("abc_12"),
 			},
 			ID:       String("1"),
 			Message:  String("WebHookCommit"),
@@ -361,7 +361,7 @@ func TestBranchWebHookPayload_Marshal(t *testing.T) {
 			Login: String("rd@yahoo.com"),
 			ID:    Int64(112),
 		},
-		Repo: &Repository{
+		Repo: &PushEventRepository{
 			ID:     Int64(321),
 			NodeID: String("node_321"),
 		},
@@ -441,9 +441,9 @@ func TestBranchWebHookAuthor_Marshal(t *testing.T) {
 	testJSONMarshal(t, &WebHookAuthor{}, "{}")
 
 	v := &WebHookAuthor{
-		Email:    String("abc@gmail.com"),
-		Name:     String("abc"),
-		Username: String("abc_12"),
+		Email: String("abc@gmail.com"),
+		Name:  String("abc"),
+		Login: String("abc_12"),
 	}
 
 	want := `{
@@ -461,14 +461,14 @@ func TestBranchWebHookCommit_Marshal(t *testing.T) {
 	v := &WebHookCommit{
 		Added: []string{"1", "2", "3"},
 		Author: &WebHookAuthor{
-			Email:    String("abc@gmail.com"),
-			Name:     String("abc"),
-			Username: String("abc_12"),
+			Email: String("abc@gmail.com"),
+			Name:  String("abc"),
+			Login: String("abc_12"),
 		},
 		Committer: &WebHookAuthor{
-			Email:    String("abc@gmail.com"),
-			Name:     String("abc"),
-			Username: String("abc_12"),
+			Email: String("abc@gmail.com"),
+			Name:  String("abc"),
+			Login: String("abc_12"),
 		},
 		ID:       String("1"),
 		Message:  String("WebHookCommit"),
diff --git a/github/strings_test.go b/github/strings_test.go
index 83cb231b..10074f08 100644
--- a/github/strings_test.go
+++ b/github/strings_test.go
@@ -127,9 +127,9 @@ func TestString(t *testing.T) {
 		{TreeEntry{SHA: String("s")}, `github.TreeEntry{SHA:"s"}`},
 		{Tree{SHA: String("s")}, `github.Tree{SHA:"s"}`},
 		{User{ID: Int64(1)}, `github.User{ID:1}`},
-		{WebHookAuthor{Name: String("n")}, `github.WebHookAuthor{Name:"n"}`},
-		{WebHookCommit{ID: String("1")}, `github.WebHookCommit{ID:"1"}`},
-		{WebHookPayload{Ref: String("r")}, `github.WebHookPayload{Ref:"r"}`},
+		{WebHookAuthor{Name: String("n")}, `github.CommitAuthor{Name:"n"}`},
+		{WebHookCommit{ID: String("1")}, `github.HeadCommit{ID:"1"}`},
+		{WebHookPayload{Ref: String("r")}, `github.PushEvent{Ref:"r"}`},
 	}
 
 	for i, tt := range tests {