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

@@ -15,10 +15,10 @@ import (
)
func TestOrganizationsService_ListAll(t *testing.T) {
setup()
client, mux, _, teardown := setup()
defer teardown()
since := 1342004
since := int64(1342004)
mux.HandleFunc("/organizations", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
testFormValues(t, r, values{"since": "1342004"})
@@ -31,14 +31,14 @@ func TestOrganizationsService_ListAll(t *testing.T) {
t.Errorf("Organizations.ListAll returned error: %v", err)
}
want := []*Organization{{ID: Int(4314092)}}
want := []*Organization{{ID: Int64(4314092)}}
if !reflect.DeepEqual(orgs, want) {
t.Errorf("Organizations.ListAll returned %+v, want %+v", orgs, want)
}
}
func TestOrganizationsService_List_authenticatedUser(t *testing.T) {
setup()
client, mux, _, teardown := setup()
defer teardown()
mux.HandleFunc("/user/orgs", func(w http.ResponseWriter, r *http.Request) {
@@ -51,14 +51,14 @@ func TestOrganizationsService_List_authenticatedUser(t *testing.T) {
t.Errorf("Organizations.List returned error: %v", err)
}
want := []*Organization{{ID: Int(1)}, {ID: Int(2)}}
want := []*Organization{{ID: Int64(1)}, {ID: Int64(2)}}
if !reflect.DeepEqual(orgs, want) {
t.Errorf("Organizations.List returned %+v, want %+v", orgs, want)
}
}
func TestOrganizationsService_List_specifiedUser(t *testing.T) {
setup()
client, mux, _, teardown := setup()
defer teardown()
mux.HandleFunc("/users/u/orgs", func(w http.ResponseWriter, r *http.Request) {
@@ -73,19 +73,22 @@ func TestOrganizationsService_List_specifiedUser(t *testing.T) {
t.Errorf("Organizations.List returned error: %v", err)
}
want := []*Organization{{ID: Int(1)}, {ID: Int(2)}}
want := []*Organization{{ID: Int64(1)}, {ID: Int64(2)}}
if !reflect.DeepEqual(orgs, want) {
t.Errorf("Organizations.List returned %+v, want %+v", orgs, want)
}
}
func TestOrganizationsService_List_invalidUser(t *testing.T) {
client, _, _, teardown := setup()
defer teardown()
_, _, err := client.Organizations.List(context.Background(), "%", nil)
testURLParseError(t, err)
}
func TestOrganizationsService_Get(t *testing.T) {
setup()
client, mux, _, teardown := setup()
defer teardown()
mux.HandleFunc("/orgs/o", func(w http.ResponseWriter, r *http.Request) {
@@ -98,19 +101,22 @@ func TestOrganizationsService_Get(t *testing.T) {
t.Errorf("Organizations.Get returned error: %v", err)
}
want := &Organization{ID: Int(1), Login: String("l"), URL: String("u"), AvatarURL: String("a"), Location: String("l")}
want := &Organization{ID: Int64(1), Login: String("l"), URL: String("u"), AvatarURL: String("a"), Location: String("l")}
if !reflect.DeepEqual(org, want) {
t.Errorf("Organizations.Get returned %+v, want %+v", org, want)
}
}
func TestOrganizationsService_Get_invalidOrg(t *testing.T) {
client, _, _, teardown := setup()
defer teardown()
_, _, err := client.Organizations.Get(context.Background(), "%")
testURLParseError(t, err)
}
func TestOrganizationsService_GetByID(t *testing.T) {
setup()
client, mux, _, teardown := setup()
defer teardown()
mux.HandleFunc("/organizations/1", func(w http.ResponseWriter, r *http.Request) {
@@ -123,14 +129,14 @@ func TestOrganizationsService_GetByID(t *testing.T) {
t.Fatalf("Organizations.GetByID returned error: %v", err)
}
want := &Organization{ID: Int(1), Login: String("l"), URL: String("u"), AvatarURL: String("a"), Location: String("l")}
want := &Organization{ID: Int64(1), Login: String("l"), URL: String("u"), AvatarURL: String("a"), Location: String("l")}
if !reflect.DeepEqual(org, want) {
t.Errorf("Organizations.GetByID returned %+v, want %+v", org, want)
}
}
func TestOrganizationsService_Edit(t *testing.T) {
setup()
client, mux, _, teardown := setup()
defer teardown()
input := &Organization{Login: String("l")}
@@ -152,13 +158,16 @@ func TestOrganizationsService_Edit(t *testing.T) {
t.Errorf("Organizations.Edit returned error: %v", err)
}
want := &Organization{ID: Int(1)}
want := &Organization{ID: Int64(1)}
if !reflect.DeepEqual(org, want) {
t.Errorf("Organizations.Edit returned %+v, want %+v", org, want)
}
}
func TestOrganizationsService_Edit_invalidOrg(t *testing.T) {
client, _, _, teardown := setup()
defer teardown()
_, _, err := client.Organizations.Edit(context.Background(), "%", nil)
testURLParseError(t, err)
}