github.com/crosbymichael/octokat@v0.0.0-20160826194511-076a32289ed5/organizations_test.go (about) 1 package octokat 2 3 import ( 4 "github.com/bmizerany/assert" 5 "net/http" 6 "testing" 7 ) 8 9 func TestOrganizations(t *testing.T) { 10 setup() 11 defer tearDown() 12 13 mux.HandleFunc("/users/jingweno/orgs", func(w http.ResponseWriter, r *http.Request) { 14 testMethod(t, r, "GET") 15 respondWith(w, loadFixture("organizations.json")) 16 }) 17 18 orgs, _ := client.Organizations("jingweno", nil) 19 assert.Equal(t, 1, len(orgs)) 20 21 firstOrg := orgs[0] 22 assert.Equal(t, 1388703, firstOrg.ID) 23 assert.Equal(t, "acl-services", firstOrg.Login) 24 assert.Equal(t, "https://api.github.com/orgs/acl-services", firstOrg.URL) 25 assert.Equal(t, "https://api.github.com/orgs/acl-services/repos", firstOrg.ReposURL) 26 }