func TestOrganizationsService_IsTeamMember_false(t *testing.T) {
	setup()
	defer teardown()
	mux.HandleFunc("/teams/1/members/u", func(w http.ResponseWriter, r *http.Request) {
		testMethod(t, r, "GET")
		w.WriteHeader(http.StatusNotFound)
	})
	member, _, err := client.Organizations.IsTeamMember(1, "u")
	if err != nil {
		t.Errorf("Organizations.IsTeamMember returned error: %+v", err)
	}
	if want := false; member != want {
		t.Errorf("Organizations.IsTeamMember returned %+v, want %+v", member, want)
	}
}
ensure that a 404 response is interpreted as "false" and not an error
package github
import (
	"encoding/json"
	"fmt"
	"net/http"
	"reflect"
	"testing"
	"time"
)
func TestOrganizationsService_ListTeams(t *testing.T) {
	setup()
	defer teardown()
	mux.HandleFunc("/orgs/o/teams", func(w http.ResponseWriter, r *http.Request) {
		testMethod(t, r, "GET")
		testFormValues(t, r, values{"page": "2"})
		fmt.Fprint(w, `[{"id":1}]`)
	})
	opt := &ListOptions{Page: 2}
	teams, _, err := client.Organizations.ListTeams("o", opt)
	if err != nil {
		t.Errorf("Organizations.ListTeams returned error: %v", err)
	}
	want := []*Team{{ID: Int(1)}}
	if !reflect.DeepEqual(teams, want) {
		t.Errorf("Organizations.ListTeams returned %+v, want %+v", teams, want)
	}
}
func TestOrganizationsService_ListTeams_invalidOrg(t *testing.T) {
	_, _, err := client.Organizations.ListTeams("%", nil)
	testURLParseError(t, err)
}
func TestOrganizationsService_GetTeam(t *testing.T) {
	setup()
	defer teardown()
	mux.HandleFunc("/teams/1", func(w http.ResponseWriter, r *http.Request) {
		testMethod(t, r, "GET")
		fmt.Fprint(w, `{"id":1, "name":"n", "description": "d", "url":"u", "slug": "s", "permission":"p"}`)
	})
	team, _, err := client.Organizations.GetTeam(1)
	if err != nil {
		t.Errorf("Organizations.GetTeam returned error: %v", err)
	}
	want := &Team{ID: Int(1), Name: String("n"), Description: String("d"), URL: String("u"), Slug: String("s"), Permission: String("p")}
	if !reflect.DeepEqual(team, want) {
		t.Errorf("Organizations.GetTeam returned %+v, want %+v", team, want)
	}
}
func TestOrganizationsService_CreateTeam(t *testing.T) {
	setup()
	defer teardown()
	input := &Team{Name: String("n"), Privacy: String("closed")}
	mux.HandleFunc("/orgs/o/teams", func(w http.ResponseWriter, r *http.Request) {
		v := new(Team)
		json.NewDecoder(r.Body).Decode(v)
		testMethod(t, r, "POST")
		if !reflect.DeepEqual(v, input) {
			t.Errorf("Request body = %+v, want %+v", v, input)
		}
		fmt.Fprint(w, `{"id":1}`)
	})
	team, _, err := client.Organizations.CreateTeam("o", input)
	if err != nil {
		t.Errorf("Organizations.CreateTeam returned error: %v", err)
	}
	want := &Team{ID: Int(1)}
	if !reflect.DeepEqual(team, want) {
		t.Errorf("Organizations.CreateTeam returned %+v, want %+v", team, want)
	}
}
func TestOrganizationsService_CreateTeam_invalidOrg(t *testing.T) {
	_, _, err := client.Organizations.CreateTeam("%", nil)
	testURLParseError(t, err)
}
func TestOrganizationsService_EditTeam(t *testing.T) {
	setup()
	defer teardown()
	input := &Team{Name: String("n"), Privacy: String("closed")}
	mux.HandleFunc("/teams/1", func(w http.ResponseWriter, r *http.Request) {
		v := new(Team)
		json.NewDecoder(r.Body).Decode(v)
		testMethod(t, r, "PATCH")
		if !reflect.DeepEqual(v, input) {
			t.Errorf("Request body = %+v, want %+v", v, input)
		}
		fmt.Fprint(w, `{"id":1}`)
	})
	team, _, err := client.Organizations.EditTeam(1, input)
	if err != nil {
		t.Errorf("Organizations.EditTeam returned error: %v", err)
	}
	want := &Team{ID: Int(1)}
	if !reflect.DeepEqual(team, want) {
		t.Errorf("Organizations.EditTeam returned %+v, want %+v", team, want)
	}
}
func TestOrganizationsService_DeleteTeam(t *testing.T) {
	setup()
	defer teardown()
	mux.HandleFunc("/teams/1", func(w http.ResponseWriter, r *http.Request) {
		testMethod(t, r, "DELETE")
	})
	_, err := client.Organizations.DeleteTeam(1)
	if err != nil {
		t.Errorf("Organizations.DeleteTeam returned error: %v", err)
	}
}
func TestOrganizationsService_ListTeamMembers(t *testing.T) {
	setup()
	defer teardown()
	mux.HandleFunc("/teams/1/members", func(w http.ResponseWriter, r *http.Request) {
		testMethod(t, r, "GET")
		testFormValues(t, r, values{"role": "member", "page": "2"})
		fmt.Fprint(w, `[{"id":1}]`)
	})
	opt := &OrganizationListTeamMembersOptions{Role: "member", ListOptions: ListOptions{Page: 2}}
	members, _, err := client.Organizations.ListTeamMembers(1, opt)
	if err != nil {
		t.Errorf("Organizations.ListTeamMembers returned error: %v", err)
	}
	want := []*User{{ID: Int(1)}}
	if !reflect.DeepEqual(members, want) {
		t.Errorf("Organizations.ListTeamMembers returned %+v, want %+v", members, want)
	}
}
func TestOrganizationsService_IsTeamMember_true(t *testing.T) {
	setup()
	defer teardown()
	mux.HandleFunc("/teams/1/members/u", func(w http.ResponseWriter, r *http.Request) {
		testMethod(t, r, "GET")
	})
	member, _, err := client.Organizations.IsTeamMember(1, "u")
	if err != nil {
		t.Errorf("Organizations.IsTeamMember returned error: %v", err)
	}
	if want := true; member != want {
		t.Errorf("Organizations.IsTeamMember returned %+v, want %+v", member, want)
	}
}