Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions github/copilot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ func TestCopilotService_GetSeatDetailsTeam(t *testing.T) {
}

want := &Team{
ID: Ptr(int64(1)),
ID: Ptr(int64(1)),
Type: Ptr("Team"),
}

if got, ok := seatDetails.GetTeam(); ok && !cmp.Equal(got, want) {
Expand Down Expand Up @@ -575,6 +576,7 @@ func TestCopilotService_ListCopilotSeats(t *testing.T) {
Assignee: &Team{
ID: Ptr(int64(1)),
Name: Ptr("octokittens"),
Type: Ptr("Team"),
},
AssigningTeam: nil,
CreatedAt: &createdAt2,
Expand All @@ -599,9 +601,7 @@ func TestCopilotService_ListCopilotSeats(t *testing.T) {
},
}

if !cmp.Equal(got, want) {
t.Errorf("Copilot.ListCopilotSeats returned %+v, want %+v", got, want)
}
assertNoDiff(t, want, got)

const methodName = "ListCopilotSeats"

Expand Down
8 changes: 8 additions & 0 deletions github/github-accessors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions github/github-accessors_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion github/github-stringify_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions github/teams.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ type Team struct {
// possible values are: "direct", "indirect", "mixed". This is only populated when
// calling the ListTeamsAssignedToOrgRole method.
Assignment *string `json:"assignment,omitempty"`

// Type identifies the ownership type of the team
// Possible values are: "organization", "enterprise".
Type *string `json:"type,omitempty"`
}

func (t Team) String() string {
Expand Down
12 changes: 7 additions & 5 deletions github/teams_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func TestTeamsService_GetTeamByID(t *testing.T) {

mux.HandleFunc("/organizations/1/team/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", "ldap_dn":"cn=n,ou=groups,dc=example,dc=com", "parent":null}`)
fmt.Fprint(w, `{"id":1, "name":"n", "description": "d", "url":"u", "slug": "s", "permission":"p", "ldap_dn":"cn=n,ou=groups,dc=example,dc=com", "type": "organization", "parent":null}`)
})

ctx := t.Context()
Expand All @@ -77,7 +77,7 @@ func TestTeamsService_GetTeamByID(t *testing.T) {
t.Errorf("Teams.GetTeamByID returned error: %v", err)
}

want := &Team{ID: Ptr(int64(1)), Name: Ptr("n"), Description: Ptr("d"), URL: Ptr("u"), Slug: Ptr("s"), Permission: Ptr("p"), LDAPDN: Ptr("cn=n,ou=groups,dc=example,dc=com")}
want := &Team{ID: Ptr(int64(1)), Name: Ptr("n"), Description: Ptr("d"), URL: Ptr("u"), Slug: Ptr("s"), Permission: Ptr("p"), LDAPDN: Ptr("cn=n,ou=groups,dc=example,dc=com"), Type: Ptr("organization")}
if !cmp.Equal(team, want) {
t.Errorf("Teams.GetTeamByID returned %+v, want %+v", team, want)
}
Expand Down Expand Up @@ -125,7 +125,7 @@ func TestTeamsService_GetTeamBySlug(t *testing.T) {

mux.HandleFunc("/orgs/o/teams/s", 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", "ldap_dn":"cn=n,ou=groups,dc=example,dc=com", "parent":null}`)
fmt.Fprint(w, `{"id":1, "name":"n", "description": "d", "url":"u", "slug": "s", "permission":"p", "ldap_dn":"cn=n,ou=groups,dc=example,dc=com", "type": "organization", "parent":null}`)
})

ctx := t.Context()
Expand All @@ -134,7 +134,7 @@ func TestTeamsService_GetTeamBySlug(t *testing.T) {
t.Errorf("Teams.GetTeamBySlug returned error: %v", err)
}

want := &Team{ID: Ptr(int64(1)), Name: Ptr("n"), Description: Ptr("d"), URL: Ptr("u"), Slug: Ptr("s"), Permission: Ptr("p"), LDAPDN: Ptr("cn=n,ou=groups,dc=example,dc=com")}
want := &Team{ID: Ptr(int64(1)), Name: Ptr("n"), Description: Ptr("d"), URL: Ptr("u"), Slug: Ptr("s"), Permission: Ptr("p"), LDAPDN: Ptr("cn=n,ou=groups,dc=example,dc=com"), Type: Ptr("organization")}
if !cmp.Equal(team, want) {
t.Errorf("Teams.GetTeamBySlug returned %+v, want %+v", team, want)
}
Expand Down Expand Up @@ -1650,6 +1650,7 @@ func TestTeams_Marshal(t *testing.T) {
ReposCount: Ptr(1),
},
LDAPDN: Ptr("l"),
Type: Ptr("t"),
}

want := `{
Expand Down Expand Up @@ -1689,7 +1690,8 @@ func TestTeams_Marshal(t *testing.T) {
"members_count": 1,
"repos_count": 1
},
"ldap_dn": "l"
"ldap_dn": "l",
"type": "t"
}`

testJSONMarshal(t, u, want)
Expand Down
Loading