From 0b072a544ce922b5473f26101f315b2370056229 Mon Sep 17 00:00:00 2001 From: anjanashenoy Date: Tue, 25 Jun 2019 12:10:29 -0400 Subject: [PATCH 1/8] Add missing `LdapDn` field in Users class --- github/users.go | 1 + 1 file changed, 1 insertion(+) diff --git a/github/users.go b/github/users.go index 87cfa7f84b7..41f1365ca08 100644 --- a/github/users.go +++ b/github/users.go @@ -47,6 +47,7 @@ type User struct { Collaborators *int `json:"collaborators,omitempty"` TwoFactorAuthentication *bool `json:"two_factor_authentication,omitempty"` Plan *Plan `json:"plan,omitempty"` + LdapDn *string `json:"ldap_dn,omitempty"` // API URLs URL *string `json:"url,omitempty"` From a5c28c4f4c185cdccfeb400955c48a0dec383e3a Mon Sep 17 00:00:00 2001 From: anjanashenoy Date: Tue, 25 Jun 2019 14:14:53 -0400 Subject: [PATCH 2/8] modify test user --- github/github-stringify_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/github/github-stringify_test.go b/github/github-stringify_test.go index e8c0e2683ac..495bb383af5 100644 --- a/github/github-stringify_test.go +++ b/github/github-stringify_test.go @@ -1491,6 +1491,7 @@ func TestTreeEntry_String(t *testing.T) { func TestUser_String(t *testing.T) { v := User{ Login: String(""), + LdapDn: String(""), ID: Int64(0), NodeID: String(""), AvatarURL: String(""), @@ -1530,7 +1531,7 @@ func TestUser_String(t *testing.T) { StarredURL: String(""), SubscriptionsURL: String(""), } - want := `github.User{Login:"", ID:0, NodeID:"", AvatarURL:"", HTMLURL:"", GravatarID:"", Name:"", Company:"", Blog:"", Location:"", Email:"", Hireable:false, Bio:"", PublicRepos:0, PublicGists:0, Followers:0, Following:0, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, SuspendedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, Type:"", SiteAdmin:false, TotalPrivateRepos:0, OwnedPrivateRepos:0, PrivateGists:0, DiskUsage:0, Collaborators:0, TwoFactorAuthentication:false, Plan:github.Plan{}, URL:"", EventsURL:"", FollowingURL:"", FollowersURL:"", GistsURL:"", OrganizationsURL:"", ReceivedEventsURL:"", ReposURL:"", StarredURL:"", SubscriptionsURL:""}` + want := `github.User{Login:"", LdapDn:"", ID:0, NodeID:"", AvatarURL:"", HTMLURL:"", GravatarID:"", Name:"", Company:"", Blog:"", Location:"", Email:"", Hireable:false, Bio:"", PublicRepos:0, PublicGists:0, Followers:0, Following:0, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, SuspendedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, Type:"", SiteAdmin:false, TotalPrivateRepos:0, OwnedPrivateRepos:0, PrivateGists:0, DiskUsage:0, Collaborators:0, TwoFactorAuthentication:false, Plan:github.Plan{}, URL:"", EventsURL:"", FollowingURL:"", FollowersURL:"", GistsURL:"", OrganizationsURL:"", ReceivedEventsURL:"", ReposURL:"", StarredURL:"", SubscriptionsURL:""}` if got := v.String(); got != want { t.Errorf("User.String = %v, want %v", got, want) } From 326e73431f0df1598066736772005afb9bfd2af3 Mon Sep 17 00:00:00 2001 From: anjanashenoy Date: Tue, 25 Jun 2019 14:18:24 -0400 Subject: [PATCH 3/8] fixed test case issue for user --- github/github-stringify_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/github-stringify_test.go b/github/github-stringify_test.go index 495bb383af5..313688ec22c 100644 --- a/github/github-stringify_test.go +++ b/github/github-stringify_test.go @@ -1531,7 +1531,7 @@ func TestUser_String(t *testing.T) { StarredURL: String(""), SubscriptionsURL: String(""), } - want := `github.User{Login:"", LdapDn:"", ID:0, NodeID:"", AvatarURL:"", HTMLURL:"", GravatarID:"", Name:"", Company:"", Blog:"", Location:"", Email:"", Hireable:false, Bio:"", PublicRepos:0, PublicGists:0, Followers:0, Following:0, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, SuspendedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, Type:"", SiteAdmin:false, TotalPrivateRepos:0, OwnedPrivateRepos:0, PrivateGists:0, DiskUsage:0, Collaborators:0, TwoFactorAuthentication:false, Plan:github.Plan{}, URL:"", EventsURL:"", FollowingURL:"", FollowersURL:"", GistsURL:"", OrganizationsURL:"", ReceivedEventsURL:"", ReposURL:"", StarredURL:"", SubscriptionsURL:""}` + want := `github.User{Login:"", ID:0, NodeID:"", AvatarURL:"", HTMLURL:"", GravatarID:"", Name:"", Company:"", Blog:"", Location:"", Email:"", Hireable:false, Bio:"", PublicRepos:0, PublicGists:0, Followers:0, Following:0, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, SuspendedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, Type:"", SiteAdmin:false, TotalPrivateRepos:0, OwnedPrivateRepos:0, PrivateGists:0, DiskUsage:0, Collaborators:0, TwoFactorAuthentication:false, Plan:github.Plan{}, URL:"", LdapDn:"", EventsURL:"", FollowingURL:"", FollowersURL:"", GistsURL:"", OrganizationsURL:"", ReceivedEventsURL:"", ReposURL:"", StarredURL:"", SubscriptionsURL:""}` if got := v.String(); got != want { t.Errorf("User.String = %v, want %v", got, want) } From 3db7e70816df375606a5f954fdf812631f187e8f Mon Sep 17 00:00:00 2001 From: anjanashenoy Date: Tue, 25 Jun 2019 14:22:45 -0400 Subject: [PATCH 4/8] fixed test case again ... --- github/github-stringify_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/github-stringify_test.go b/github/github-stringify_test.go index 313688ec22c..fa717e2aca5 100644 --- a/github/github-stringify_test.go +++ b/github/github-stringify_test.go @@ -1531,7 +1531,7 @@ func TestUser_String(t *testing.T) { StarredURL: String(""), SubscriptionsURL: String(""), } - want := `github.User{Login:"", ID:0, NodeID:"", AvatarURL:"", HTMLURL:"", GravatarID:"", Name:"", Company:"", Blog:"", Location:"", Email:"", Hireable:false, Bio:"", PublicRepos:0, PublicGists:0, Followers:0, Following:0, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, SuspendedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, Type:"", SiteAdmin:false, TotalPrivateRepos:0, OwnedPrivateRepos:0, PrivateGists:0, DiskUsage:0, Collaborators:0, TwoFactorAuthentication:false, Plan:github.Plan{}, URL:"", LdapDn:"", EventsURL:"", FollowingURL:"", FollowersURL:"", GistsURL:"", OrganizationsURL:"", ReceivedEventsURL:"", ReposURL:"", StarredURL:"", SubscriptionsURL:""}` + want := `github.User{Login:"", ID:0, NodeID:"", AvatarURL:"", HTMLURL:"", GravatarID:"", Name:"", Company:"", Blog:"", Location:"", Email:"", Hireable:false, Bio:"", PublicRepos:0, PublicGists:0, Followers:0, Following:0, CreatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, UpdatedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, SuspendedAt:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}, Type:"", SiteAdmin:false, TotalPrivateRepos:0, OwnedPrivateRepos:0, PrivateGists:0, DiskUsage:0, Collaborators:0, TwoFactorAuthentication:false, Plan:github.Plan{}, LdapDn:"", URL:"", EventsURL:"", FollowingURL:"", FollowersURL:"", GistsURL:"", OrganizationsURL:"", ReceivedEventsURL:"", ReposURL:"", StarredURL:"", SubscriptionsURL:""}` if got := v.String(); got != want { t.Errorf("User.String = %v, want %v", got, want) } From 4b8f229facfd27d66e90133436d8f01c38baca16 Mon Sep 17 00:00:00 2001 From: anjanashenoy Date: Tue, 25 Jun 2019 14:26:11 -0400 Subject: [PATCH 5/8] not rly sure what the issue is --- github/github-stringify_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/github-stringify_test.go b/github/github-stringify_test.go index fa717e2aca5..d9883209777 100644 --- a/github/github-stringify_test.go +++ b/github/github-stringify_test.go @@ -1491,7 +1491,6 @@ func TestTreeEntry_String(t *testing.T) { func TestUser_String(t *testing.T) { v := User{ Login: String(""), - LdapDn: String(""), ID: Int64(0), NodeID: String(""), AvatarURL: String(""), @@ -1520,6 +1519,7 @@ func TestUser_String(t *testing.T) { Collaborators: Int(0), TwoFactorAuthentication: Bool(false), Plan: &Plan{}, + LdapDn: String(""), URL: String(""), EventsURL: String(""), FollowingURL: String(""), From a0f734537a8b8f53108534472b5077e0fdaadac4 Mon Sep 17 00:00:00 2001 From: anjanashenoy Date: Tue, 25 Jun 2019 14:48:51 -0400 Subject: [PATCH 6/8] ... let's see if this works --- github/github-accessors.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/github/github-accessors.go b/github/github-accessors.go index 687c9689f09..2bff2d271e7 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -172,6 +172,15 @@ func (a *App) GetNodeID() string { return *a.NodeID } +// GetLdapDn returns the LdapDn field if it's non-nil, zero value otherwise. +func (u *User) GetLdapDn() string { + if u == nil || u.LdapDn == nil { + return "" + } + return *u.LdapDn +} + + // GetOwner returns the Owner field. func (a *App) GetOwner() *User { if a == nil { From 2ef3b2484cf784771b3b5f03860fffa1bdfe9ebd Mon Sep 17 00:00:00 2001 From: Shenoy Date: Tue, 25 Jun 2019 15:13:16 -0400 Subject: [PATCH 7/8] gofmt files --- github/github-accessors.go | 1 - github/github-stringify_test.go | 2 +- github/users.go | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/github/github-accessors.go b/github/github-accessors.go index 2bff2d271e7..e2456aa2784 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -180,7 +180,6 @@ func (u *User) GetLdapDn() string { return *u.LdapDn } - // GetOwner returns the Owner field. func (a *App) GetOwner() *User { if a == nil { diff --git a/github/github-stringify_test.go b/github/github-stringify_test.go index d9883209777..6934f237c1d 100644 --- a/github/github-stringify_test.go +++ b/github/github-stringify_test.go @@ -1519,7 +1519,7 @@ func TestUser_String(t *testing.T) { Collaborators: Int(0), TwoFactorAuthentication: Bool(false), Plan: &Plan{}, - LdapDn: String(""), + LdapDn: String(""), URL: String(""), EventsURL: String(""), FollowingURL: String(""), diff --git a/github/users.go b/github/users.go index 41f1365ca08..2592aea0f4f 100644 --- a/github/users.go +++ b/github/users.go @@ -47,7 +47,7 @@ type User struct { Collaborators *int `json:"collaborators,omitempty"` TwoFactorAuthentication *bool `json:"two_factor_authentication,omitempty"` Plan *Plan `json:"plan,omitempty"` - LdapDn *string `json:"ldap_dn,omitempty"` + LdapDn *string `json:"ldap_dn,omitempty"` // API URLs URL *string `json:"url,omitempty"` From 3fb483692d9fb6ea69e067945fb2b5f2ef2e4d96 Mon Sep 17 00:00:00 2001 From: Shenoy Date: Tue, 25 Jun 2019 15:22:35 -0400 Subject: [PATCH 8/8] moved ldap accessor --- github/github-accessors.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/github/github-accessors.go b/github/github-accessors.go index e2456aa2784..b92e81fec29 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -172,14 +172,6 @@ func (a *App) GetNodeID() string { return *a.NodeID } -// GetLdapDn returns the LdapDn field if it's non-nil, zero value otherwise. -func (u *User) GetLdapDn() string { - if u == nil || u.LdapDn == nil { - return "" - } - return *u.LdapDn -} - // GetOwner returns the Owner field. func (a *App) GetOwner() *User { if a == nil { @@ -12172,6 +12164,14 @@ func (u *User) GetID() int64 { return *u.ID } +// GetLdapDn returns the LdapDn field if it's non-nil, zero value otherwise. +func (u *User) GetLdapDn() string { + if u == nil || u.LdapDn == nil { + return "" + } + return *u.LdapDn +} + // GetLocation returns the Location field if it's non-nil, zero value otherwise. func (u *User) GetLocation() string { if u == nil || u.Location == nil {