Update go-github library

This commit is contained in:
Luke Kysow
2018-12-12 09:55:17 -06:00
parent e001353ae9
commit 139f05ab49
170 changed files with 14305 additions and 3086 deletions

View File

@@ -16,7 +16,7 @@ import (
)
func TestGistsService_List_specifiedUser(t *testing.T) {
setup()
client, mux, _, teardown := setup()
defer teardown()
since := "2013-01-01T00:00:00Z"
@@ -42,7 +42,7 @@ func TestGistsService_List_specifiedUser(t *testing.T) {
}
func TestGistsService_List_authenticatedUser(t *testing.T) {
setup()
client, mux, _, teardown := setup()
defer teardown()
mux.HandleFunc("/gists", func(w http.ResponseWriter, r *http.Request) {
@@ -62,12 +62,15 @@ func TestGistsService_List_authenticatedUser(t *testing.T) {
}
func TestGistsService_List_invalidUser(t *testing.T) {
client, _, _, teardown := setup()
defer teardown()
_, _, err := client.Gists.List(context.Background(), "%", nil)
testURLParseError(t, err)
}
func TestGistsService_ListAll(t *testing.T) {
setup()
client, mux, _, teardown := setup()
defer teardown()
since := "2013-01-01T00:00:00Z"
@@ -93,7 +96,7 @@ func TestGistsService_ListAll(t *testing.T) {
}
func TestGistsService_ListStarred(t *testing.T) {
setup()
client, mux, _, teardown := setup()
defer teardown()
since := "2013-01-01T00:00:00Z"
@@ -119,7 +122,7 @@ func TestGistsService_ListStarred(t *testing.T) {
}
func TestGistsService_Get(t *testing.T) {
setup()
client, mux, _, teardown := setup()
defer teardown()
mux.HandleFunc("/gists/1", func(w http.ResponseWriter, r *http.Request) {
@@ -139,12 +142,15 @@ func TestGistsService_Get(t *testing.T) {
}
func TestGistsService_Get_invalidID(t *testing.T) {
client, _, _, teardown := setup()
defer teardown()
_, _, err := client.Gists.Get(context.Background(), "%")
testURLParseError(t, err)
}
func TestGistsService_GetRevision(t *testing.T) {
setup()
client, mux, _, teardown := setup()
defer teardown()
mux.HandleFunc("/gists/1/s", func(w http.ResponseWriter, r *http.Request) {
@@ -164,12 +170,15 @@ func TestGistsService_GetRevision(t *testing.T) {
}
func TestGistsService_GetRevision_invalidID(t *testing.T) {
client, _, _, teardown := setup()
defer teardown()
_, _, err := client.Gists.GetRevision(context.Background(), "%", "%")
testURLParseError(t, err)
}
func TestGistsService_Create(t *testing.T) {
setup()
client, mux, _, teardown := setup()
defer teardown()
input := &Gist{
@@ -222,7 +231,7 @@ func TestGistsService_Create(t *testing.T) {
}
func TestGistsService_Edit(t *testing.T) {
setup()
client, mux, _, teardown := setup()
defer teardown()
input := &Gist{
@@ -278,12 +287,15 @@ func TestGistsService_Edit(t *testing.T) {
}
func TestGistsService_Edit_invalidID(t *testing.T) {
client, _, _, teardown := setup()
defer teardown()
_, _, err := client.Gists.Edit(context.Background(), "%", nil)
testURLParseError(t, err)
}
func TestGistsService_ListCommits(t *testing.T) {
setup()
client, mux, _, teardown := setup()
defer teardown()
mux.HandleFunc("/gists/1/commits", func(w http.ResponseWriter, r *http.Request) {
@@ -316,8 +328,8 @@ func TestGistsService_ListCommits(t *testing.T) {
want := []*GistCommit{{
URL: String("https://api.github.com/gists/1/1"),
Version: String("1"),
User: &User{ID: Int(1)},
CommittedAt: &Timestamp{time.Date(2010, 1, 1, 00, 00, 00, 0, time.UTC)},
User: &User{ID: Int64(1)},
CommittedAt: &Timestamp{time.Date(2010, time.January, 1, 00, 00, 00, 0, time.UTC)},
ChangeStatus: &CommitStats{
Additions: Int(180),
Deletions: Int(0),
@@ -330,7 +342,7 @@ func TestGistsService_ListCommits(t *testing.T) {
}
func TestGistsService_ListCommits_withOptions(t *testing.T) {
setup()
client, mux, _, teardown := setup()
defer teardown()
mux.HandleFunc("/gists/1/commits", func(w http.ResponseWriter, r *http.Request) {
@@ -348,7 +360,7 @@ func TestGistsService_ListCommits_withOptions(t *testing.T) {
}
func TestGistsService_Delete(t *testing.T) {
setup()
client, mux, _, teardown := setup()
defer teardown()
mux.HandleFunc("/gists/1", func(w http.ResponseWriter, r *http.Request) {
@@ -362,12 +374,15 @@ func TestGistsService_Delete(t *testing.T) {
}
func TestGistsService_Delete_invalidID(t *testing.T) {
client, _, _, teardown := setup()
defer teardown()
_, err := client.Gists.Delete(context.Background(), "%")
testURLParseError(t, err)
}
func TestGistsService_Star(t *testing.T) {
setup()
client, mux, _, teardown := setup()
defer teardown()
mux.HandleFunc("/gists/1/star", func(w http.ResponseWriter, r *http.Request) {
@@ -381,12 +396,15 @@ func TestGistsService_Star(t *testing.T) {
}
func TestGistsService_Star_invalidID(t *testing.T) {
client, _, _, teardown := setup()
defer teardown()
_, err := client.Gists.Star(context.Background(), "%")
testURLParseError(t, err)
}
func TestGistsService_Unstar(t *testing.T) {
setup()
client, mux, _, teardown := setup()
defer teardown()
mux.HandleFunc("/gists/1/star", func(w http.ResponseWriter, r *http.Request) {
@@ -400,12 +418,15 @@ func TestGistsService_Unstar(t *testing.T) {
}
func TestGistsService_Unstar_invalidID(t *testing.T) {
client, _, _, teardown := setup()
defer teardown()
_, err := client.Gists.Unstar(context.Background(), "%")
testURLParseError(t, err)
}
func TestGistsService_IsStarred_hasStar(t *testing.T) {
setup()
client, mux, _, teardown := setup()
defer teardown()
mux.HandleFunc("/gists/1/star", func(w http.ResponseWriter, r *http.Request) {
@@ -423,7 +444,7 @@ func TestGistsService_IsStarred_hasStar(t *testing.T) {
}
func TestGistsService_IsStarred_noStar(t *testing.T) {
setup()
client, mux, _, teardown := setup()
defer teardown()
mux.HandleFunc("/gists/1/star", func(w http.ResponseWriter, r *http.Request) {
@@ -441,12 +462,15 @@ func TestGistsService_IsStarred_noStar(t *testing.T) {
}
func TestGistsService_IsStarred_invalidID(t *testing.T) {
client, _, _, teardown := setup()
defer teardown()
_, _, err := client.Gists.IsStarred(context.Background(), "%")
testURLParseError(t, err)
}
func TestGistsService_Fork(t *testing.T) {
setup()
client, mux, _, teardown := setup()
defer teardown()
mux.HandleFunc("/gists/1/forks", func(w http.ResponseWriter, r *http.Request) {
@@ -466,7 +490,7 @@ func TestGistsService_Fork(t *testing.T) {
}
func TestGistsService_ListForks(t *testing.T) {
setup()
client, mux, _, teardown := setup()
defer teardown()
mux.HandleFunc("/gists/1/forks", func(w http.ResponseWriter, r *http.Request) {
@@ -492,9 +516,9 @@ func TestGistsService_ListForks(t *testing.T) {
want := []*GistFork{{
URL: String("https://api.github.com/gists/1"),
ID: String("1"),
User: &User{ID: Int(1)},
CreatedAt: &Timestamp{time.Date(2010, 1, 1, 00, 00, 00, 0, time.UTC)},
UpdatedAt: &Timestamp{time.Date(2013, 1, 1, 00, 00, 00, 0, time.UTC)}}}
User: &User{ID: Int64(1)},
CreatedAt: &Timestamp{time.Date(2010, time.January, 1, 00, 00, 00, 0, time.UTC)},
UpdatedAt: &Timestamp{time.Date(2013, time.January, 1, 00, 00, 00, 0, time.UTC)}}}
if !reflect.DeepEqual(gistForks, want) {
t.Errorf("Gists.ListForks returned %+v, want %+v", gistForks, want)
@@ -502,6 +526,9 @@ func TestGistsService_ListForks(t *testing.T) {
}
func TestGistsService_Fork_invalidID(t *testing.T) {
client, _, _, teardown := setup()
defer teardown()
_, _, err := client.Gists.Fork(context.Background(), "%")
testURLParseError(t, err)
}