From 64a3ce24d0eaeba9446147a784ebf88ca2bd6544 Mon Sep 17 00:00:00 2001 From: sagar23sj Date: Thu, 24 Jun 2021 23:55:13 +0530 Subject: [PATCH 01/11] Resource Tested for JSON marshalling : IssueStats --- github/admin_stats_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/github/admin_stats_test.go b/github/admin_stats_test.go index 0d20b74cad8..41f3bf6e8df 100644 --- a/github/admin_stats_test.go +++ b/github/admin_stats_test.go @@ -209,3 +209,21 @@ var testAdminStats = &AdminStats{ TotalPullRequestComments: Int(30), }, } + +func TestIssueStats_Marshal(t *testing.T) { + testJSONMarshal(t, &IssueStats{}, "{}") + + u := &IssueStats{ + TotalIssues: Int(1), + OpenIssues: Int(1), + ClosedIssues: Int(1), + } + + want := `{ + "total_issues": 1, + "open_issues": 1, + "closed_issues": 1 + }` + + testJSONMarshal(t, u, want) +} From 3cfe138f845eedd95f85680acb95732b2821c68f Mon Sep 17 00:00:00 2001 From: sagar23sj Date: Thu, 24 Jun 2021 23:59:07 +0530 Subject: [PATCH 02/11] Resource Tested for JSON marshalling : HookStats --- github/admin_stats_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/github/admin_stats_test.go b/github/admin_stats_test.go index 41f3bf6e8df..623b36a0d04 100644 --- a/github/admin_stats_test.go +++ b/github/admin_stats_test.go @@ -227,3 +227,21 @@ func TestIssueStats_Marshal(t *testing.T) { testJSONMarshal(t, u, want) } + +func TestHookStats_Marshal(t *testing.T) { + testJSONMarshal(t, &HookStats{}, "{}") + + u := &HookStats{ + TotalHooks: Int(1), + ActiveHooks: Int(1), + InactiveHooks: Int(1), + } + + want := `{ + "total_hooks": 1, + "active_hooks": 1, + "inactive_hooks": 1 + }` + + testJSONMarshal(t, u, want) +} From abc28b031ec40431a00090d74281151750412fc2 Mon Sep 17 00:00:00 2001 From: sagar23sj Date: Fri, 25 Jun 2021 00:01:03 +0530 Subject: [PATCH 03/11] Resource Tested for JSON marshalling : MilestoneStats --- github/admin_stats_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/github/admin_stats_test.go b/github/admin_stats_test.go index 623b36a0d04..2d6a4eaba76 100644 --- a/github/admin_stats_test.go +++ b/github/admin_stats_test.go @@ -245,3 +245,21 @@ func TestHookStats_Marshal(t *testing.T) { testJSONMarshal(t, u, want) } + +func TestMilestoneStats_Marshal(t *testing.T) { + testJSONMarshal(t, &MilestoneStats{}, "{}") + + u := &MilestoneStats{ + TotalMilestones: Int(1), + OpenMilestones: Int(1), + ClosedMilestones: Int(1), + } + + want := `{ + "total_milestones": 1, + "open_milestones": 1, + "closed_milestones": 1 + }` + + testJSONMarshal(t, u, want) +} From e1f4ec56e4ebabd2e77d4162863abfd9d46ffc04 Mon Sep 17 00:00:00 2001 From: sagar23sj Date: Fri, 25 Jun 2021 00:04:42 +0530 Subject: [PATCH 04/11] Resource Tested for JSON marshalling : OrgStats --- github/admin_stats_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/github/admin_stats_test.go b/github/admin_stats_test.go index 2d6a4eaba76..314858768e7 100644 --- a/github/admin_stats_test.go +++ b/github/admin_stats_test.go @@ -263,3 +263,23 @@ func TestMilestoneStats_Marshal(t *testing.T) { testJSONMarshal(t, u, want) } + +func TestOrgStats_Marshal(t *testing.T) { + testJSONMarshal(t, &OrgStats{}, "{}") + + u := &OrgStats{ + TotalOrgs: Int(1), + DisabledOrgs: Int(1), + TotalTeams: Int(1), + TotalTeamMembers: Int(1), + } + + want := `{ + "total_orgs": 1, + "disabled_orgs": 1, + "total_teams": 1, + "total_team_members": 1 + }` + + testJSONMarshal(t, u, want) +} From c848a6b0475d84c607eee41e6921d91381b23c79 Mon Sep 17 00:00:00 2001 From: sagar23sj Date: Fri, 25 Jun 2021 00:08:38 +0530 Subject: [PATCH 05/11] Resource Tested for JSON marshalling : CommentStats --- github/admin_stats_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/github/admin_stats_test.go b/github/admin_stats_test.go index 314858768e7..56d8159e744 100644 --- a/github/admin_stats_test.go +++ b/github/admin_stats_test.go @@ -283,3 +283,23 @@ func TestOrgStats_Marshal(t *testing.T) { testJSONMarshal(t, u, want) } + +func TestCommentStats_Marshal(t *testing.T) { + testJSONMarshal(t, &CommentStats{}, "{}") + + u := &CommentStats{ + TotalCommitComments: Int(1), + TotalGistComments: Int(1), + TotalIssueComments: Int(1), + TotalPullRequestComments: Int(1), + } + + want := `{ + "total_commit_comments": 1, + "total_gist_comments": 1, + "total_issue_comments": 1, + "total_pull_request_comments": 1 + }` + + testJSONMarshal(t, u, want) +} From 0525bd7555086e4e16bf207d95f00cac87fb37f7 Mon Sep 17 00:00:00 2001 From: sagar23sj Date: Fri, 25 Jun 2021 00:10:51 +0530 Subject: [PATCH 06/11] Resource Tested for JSON marshalling : PageStats --- github/admin_stats_test.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/github/admin_stats_test.go b/github/admin_stats_test.go index 56d8159e744..e2b43428412 100644 --- a/github/admin_stats_test.go +++ b/github/admin_stats_test.go @@ -303,3 +303,17 @@ func TestCommentStats_Marshal(t *testing.T) { testJSONMarshal(t, u, want) } + +func TestPageStats_Marshal(t *testing.T) { + testJSONMarshal(t, &PageStats{}, "{}") + + u := &PageStats{ + TotalPages: Int(1), + } + + want := `{ + "total_pages": 1 + }` + + testJSONMarshal(t, u, want) +} From 7eb2b081df7980000e29c40a3b57807903ef4d6c Mon Sep 17 00:00:00 2001 From: sagar23sj Date: Fri, 25 Jun 2021 00:13:06 +0530 Subject: [PATCH 07/11] Resource Tested for JSON marshalling : UserStats --- github/admin_stats_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/github/admin_stats_test.go b/github/admin_stats_test.go index e2b43428412..969b38f46eb 100644 --- a/github/admin_stats_test.go +++ b/github/admin_stats_test.go @@ -317,3 +317,21 @@ func TestPageStats_Marshal(t *testing.T) { testJSONMarshal(t, u, want) } + +func TestUserStats_Marshal(t *testing.T) { + testJSONMarshal(t, &UserStats{}, "{}") + + u := &UserStats{ + TotalUsers: Int(1), + AdminUsers: Int(1), + SuspendedUsers: Int(1), + } + + want := `{ + "total_users": 1, + "admin_users": 1, + "suspended_users": 1 + }` + + testJSONMarshal(t, u, want) +} From faaf6622fdad6c968c963818dcd396e6003c7364 Mon Sep 17 00:00:00 2001 From: sagar23sj Date: Fri, 25 Jun 2021 00:15:51 +0530 Subject: [PATCH 08/11] Resource Tested for JSON marshalling : GistStats --- github/admin_stats_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/github/admin_stats_test.go b/github/admin_stats_test.go index 969b38f46eb..8b7be0e3d59 100644 --- a/github/admin_stats_test.go +++ b/github/admin_stats_test.go @@ -335,3 +335,21 @@ func TestUserStats_Marshal(t *testing.T) { testJSONMarshal(t, u, want) } + +func TestGistStats_Marshal(t *testing.T) { + testJSONMarshal(t, &GistStats{}, "{}") + + u := &GistStats{ + TotalGists: Int(1), + PrivateGists: Int(1), + PublicGists: Int(1), + } + + want := `{ + "total_gists": 1, + "private_gists": 1, + "public_gists": 1 + }` + + testJSONMarshal(t, u, want) +} From 0661e2b4f485636a68dfab0c008edb36cd05d923 Mon Sep 17 00:00:00 2001 From: sagar23sj Date: Fri, 25 Jun 2021 00:18:20 +0530 Subject: [PATCH 09/11] Resource Tested for JSON marshalling : PullStats --- github/admin_stats_test.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/github/admin_stats_test.go b/github/admin_stats_test.go index 8b7be0e3d59..ce33ef48ddb 100644 --- a/github/admin_stats_test.go +++ b/github/admin_stats_test.go @@ -353,3 +353,23 @@ func TestGistStats_Marshal(t *testing.T) { testJSONMarshal(t, u, want) } + +func TestPullStats_Marshal(t *testing.T) { + testJSONMarshal(t, &PullStats{}, "{}") + + u := &PullStats{ + TotalPulls: Int(1), + MergedPulls: Int(1), + MergablePulls: Int(1), + UnmergablePulls: Int(1), + } + + want := `{ + "total_pulls": 1, + "merged_pulls": 1, + "mergeable_pulls": 1, + "unmergeable_pulls": 1 + }` + + testJSONMarshal(t, u, want) +} From c636f3a36541d2349786c427d15074d8048635e7 Mon Sep 17 00:00:00 2001 From: sagar23sj Date: Fri, 25 Jun 2021 00:21:17 +0530 Subject: [PATCH 10/11] Resource Tested for JSON marshalling : RepoStats --- github/admin_stats_test.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/github/admin_stats_test.go b/github/admin_stats_test.go index ce33ef48ddb..8f57fdd2b7e 100644 --- a/github/admin_stats_test.go +++ b/github/admin_stats_test.go @@ -373,3 +373,27 @@ func TestPullStats_Marshal(t *testing.T) { testJSONMarshal(t, u, want) } + +func TestRepoStats_Marshal(t *testing.T) { + testJSONMarshal(t, &RepoStats{}, "{}") + + u := &RepoStats{ + TotalRepos: Int(1), + RootRepos: Int(1), + ForkRepos: Int(1), + OrgRepos: Int(1), + TotalPushes: Int(1), + TotalWikis: Int(1), + } + + want := `{ + "total_repos": 1, + "root_repos": 1, + "fork_repos": 1, + "org_repos": 1, + "total_pushes": 1, + "total_wikis": 1 + }` + + testJSONMarshal(t, u, want) +} From 72ea95b933185af634553d78a7101414da38b299 Mon Sep 17 00:00:00 2001 From: sagar23sj Date: Fri, 25 Jun 2021 00:38:03 +0530 Subject: [PATCH 11/11] Resource Tested for JSON marshalling : AdminStats --- github/admin_stats_test.go | 120 +++++++++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) diff --git a/github/admin_stats_test.go b/github/admin_stats_test.go index 8f57fdd2b7e..dab2bc21fce 100644 --- a/github/admin_stats_test.go +++ b/github/admin_stats_test.go @@ -397,3 +397,123 @@ func TestRepoStats_Marshal(t *testing.T) { testJSONMarshal(t, u, want) } + +func TestAdminStats_Marshal(t *testing.T) { + testJSONMarshal(t, &AdminStats{}, "{}") + + u := &AdminStats{ + Repos: &RepoStats{ + TotalRepos: Int(212), + RootRepos: Int(194), + ForkRepos: Int(18), + OrgRepos: Int(51), + TotalPushes: Int(3082), + TotalWikis: Int(15), + }, + Hooks: &HookStats{ + TotalHooks: Int(27), + ActiveHooks: Int(23), + InactiveHooks: Int(4), + }, + Pages: &PageStats{ + TotalPages: Int(36), + }, + Orgs: &OrgStats{ + TotalOrgs: Int(33), + DisabledOrgs: Int(0), + TotalTeams: Int(60), + TotalTeamMembers: Int(314), + }, + Users: &UserStats{ + TotalUsers: Int(254), + AdminUsers: Int(45), + SuspendedUsers: Int(21), + }, + Pulls: &PullStats{ + TotalPulls: Int(86), + MergedPulls: Int(60), + MergablePulls: Int(21), + UnmergablePulls: Int(3), + }, + Issues: &IssueStats{ + TotalIssues: Int(179), + OpenIssues: Int(83), + ClosedIssues: Int(96), + }, + Milestones: &MilestoneStats{ + TotalMilestones: Int(7), + OpenMilestones: Int(6), + ClosedMilestones: Int(1), + }, + Gists: &GistStats{ + TotalGists: Int(178), + PrivateGists: Int(151), + PublicGists: Int(25), + }, + Comments: &CommentStats{ + TotalCommitComments: Int(6), + TotalGistComments: Int(28), + TotalIssueComments: Int(366), + TotalPullRequestComments: Int(30), + }, + } + + want := `{ + "repos": { + "total_repos": 212, + "root_repos": 194, + "fork_repos": 18, + "org_repos": 51, + "total_pushes": 3082, + "total_wikis": 15 + }, + "hooks": { + "total_hooks": 27, + "active_hooks": 23, + "inactive_hooks": 4 + }, + "pages": { + "total_pages": 36 + }, + "orgs": { + "total_orgs": 33, + "disabled_orgs": 0, + "total_teams": 60, + "total_team_members": 314 + }, + "users": { + "total_users": 254, + "admin_users": 45, + "suspended_users": 21 + }, + "pulls": { + "total_pulls": 86, + "merged_pulls": 60, + "mergeable_pulls": 21, + "unmergeable_pulls": 3 + }, + "issues": { + "total_issues": 179, + "open_issues": 83, + "closed_issues": 96 + }, + "milestones": { + "total_milestones": 7, + "open_milestones": 6, + "closed_milestones": 1 + }, + "gists": { + "total_gists": 178, + "private_gists": 151, + "public_gists": 25 + }, + "comments": { + "total_commit_comments": 6, + "total_gist_comments": 28, + "total_issue_comments": 366, + "total_pull_request_comments": 30 + } + }` + + testJSONMarshal(t, u, want) +}