Skip to content

Commit

Permalink
Add test case for JSON resource marshaling (google#2517)
Browse files Browse the repository at this point in the history
  • Loading branch information
akshaypatil3096 authored and Harikesh00 committed Oct 25, 2022
1 parent 35b4faa commit 3c66d7d
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions github/teams_test.go
Expand Up @@ -2098,3 +2098,39 @@ func TestTeamsService_RemoveConnectedExternalGroup_notFound(t *testing.T) {
t.Errorf("Teams.GetExternalGroup returned status %d, want %d", got, want)
}
}

func TestIDPGroupList_Marshal(t *testing.T) {
testJSONMarshal(t, &IDPGroupList{}, "{}")

u := &IDPGroupList{
Groups: []*IDPGroup{
{
GroupID: String("abc1"),
GroupName: String("test group"),
GroupDescription: String("test group descripation"),
},
{
GroupID: String("abc2"),
GroupName: String("test group2"),
GroupDescription: String("test group descripation2"),
},
},
}

want := `{
"groups": [
{
"group_id": "abc1",
"group_name": "test group",
"group_description": "test group descripation"
},
{
"group_id": "abc2",
"group_name": "test group2",
"group_description": "test group descripation2"
}
]
}`

testJSONMarshal(t, u, want)
}

0 comments on commit 3c66d7d

Please sign in to comment.