From 3c66d7d180c62509f283fc7ac9388eda2b8f66ce Mon Sep 17 00:00:00 2001 From: Akshay <48827972+akshaypatil3096@users.noreply.github.com> Date: Tue, 25 Oct 2022 18:43:00 +0530 Subject: [PATCH] Add test case for JSON resource marshaling (#2517) --- github/teams_test.go | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/github/teams_test.go b/github/teams_test.go index 83f559beff..cee6ff433e 100644 --- a/github/teams_test.go +++ b/github/teams_test.go @@ -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) +}