diff --git a/plugin/remote/github/helper.go b/plugin/remote/github/helper.go index b55895a89..5bafccd8f 100644 --- a/plugin/remote/github/helper.go +++ b/plugin/remote/github/helper.go @@ -138,7 +138,7 @@ func GetOrgRepos(client *github.Client, org string) ([]github.Repository, error) } // GetOrgs is a helper function that returns a list of -// all org repositories. +// all orgs that a user belongs to. func GetOrgs(client *github.Client) ([]github.Organization, error) { orgs, _, err := client.Organizations.List("", nil) return orgs, err diff --git a/plugin/remote/github/helper_test.go b/plugin/remote/github/helper_test.go index 8bb060813..d5e6add33 100644 --- a/plugin/remote/github/helper_test.go +++ b/plugin/remote/github/helper_test.go @@ -12,13 +12,22 @@ func Test_Helper(t *testing.T) { var server = testdata.NewServer() defer server.Close() + var client = NewClient(server.URL, "sekret", false) + g := goblin.Goblin(t) g.Describe("GitHub Helper Functions", func() { g.It("Should Get a User") g.It("Should Get a User Primary Email") g.It("Should Get a User + Primary Email") - g.It("Should Get a list of Orgs") + + g.It("Should Get a list of Orgs", func() { + var orgs, err = GetOrgs(client) + g.Assert(err == nil).IsTrue() + g.Assert(len(orgs)).Equal(1) + g.Assert(*orgs[0].Login).Equal("octocats-inc") + }) + g.It("Should Get a list of User Repos") g.It("Should Get a list of Org Repos") g.It("Should Get a list of All Repos")