Skip to content

Commit 55a9b44

Browse files
authored
Add test for JSON marshaling for Teams (#1941)
1 parent 53b7d44 commit 55a9b44

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed

github/teams_test.go

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1585,3 +1585,89 @@ func TestTeamsService_CreateOrUpdateIDPGroupConnectionsBySlug_empty(t *testing.T
15851585
t.Errorf("Teams.CreateOrUpdateIDPGroupConnectionsBySlug returned %+v. want %+v", groups, want)
15861586
}
15871587
}
1588+
1589+
func TestTeams_marshall(t *testing.T) {
1590+
testJSONMarshal(t, &Team{}, "{}")
1591+
1592+
u := &Team{
1593+
ID: Int64(1),
1594+
NodeID: String("n"),
1595+
Name: String("n"),
1596+
Description: String("d"),
1597+
URL: String("u"),
1598+
Slug: String("s"),
1599+
Permission: String("p"),
1600+
Privacy: String("p"),
1601+
MembersCount: Int(1),
1602+
ReposCount: Int(1),
1603+
MembersURL: String("m"),
1604+
RepositoriesURL: String("r"),
1605+
Organization: &Organization{
1606+
Login: String("l"),
1607+
ID: Int64(1),
1608+
NodeID: String("n"),
1609+
AvatarURL: String("a"),
1610+
HTMLURL: String("h"),
1611+
Name: String("n"),
1612+
Company: String("c"),
1613+
Blog: String("b"),
1614+
Location: String("l"),
1615+
Email: String("e"),
1616+
},
1617+
Parent: &Team{
1618+
ID: Int64(1),
1619+
NodeID: String("n"),
1620+
Name: String("n"),
1621+
Description: String("d"),
1622+
URL: String("u"),
1623+
Slug: String("s"),
1624+
Permission: String("p"),
1625+
Privacy: String("p"),
1626+
MembersCount: Int(1),
1627+
ReposCount: Int(1),
1628+
},
1629+
LDAPDN: String("l"),
1630+
}
1631+
1632+
want := `{
1633+
"id": 1,
1634+
"node_id": "n",
1635+
"name": "n",
1636+
"description": "d",
1637+
"url": "u",
1638+
"slug": "s",
1639+
"permission": "p",
1640+
"privacy": "p",
1641+
"members_count": 1,
1642+
"repos_count": 1,
1643+
"members_url": "m",
1644+
"repositories_url": "r",
1645+
"organization": {
1646+
"login": "l",
1647+
"id": 1,
1648+
"node_id": "n",
1649+
"avatar_url": "a",
1650+
"html_url": "h",
1651+
"name": "n",
1652+
"company": "c",
1653+
"blog": "b",
1654+
"location": "l",
1655+
"email": "e"
1656+
},
1657+
"parent": {
1658+
"id": 1,
1659+
"node_id": "n",
1660+
"name": "n",
1661+
"description": "d",
1662+
"url": "u",
1663+
"slug": "s",
1664+
"permission": "p",
1665+
"privacy": "p",
1666+
"members_count": 1,
1667+
"repos_count": 1
1668+
},
1669+
"ldap_dn": "l"
1670+
}`
1671+
1672+
testJSONMarshal(t, u, want)
1673+
}

0 commit comments

Comments
 (0)