From b8a2c838c3fe125033bdc9964e7a8b4aeb11ee86 Mon Sep 17 00:00:00 2001 From: sagar23sj Date: Mon, 28 Jun 2021 00:00:17 +0530 Subject: [PATCH 1/4] Resource Tested for JSON marshalling : MinutesUsedBreakdown --- github/billing_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/github/billing_test.go b/github/billing_test.go index 92fada80c0a..2ce43356555 100644 --- a/github/billing_test.go +++ b/github/billing_test.go @@ -297,3 +297,21 @@ func TestBillingService_GetStorageBillingUser_invalidUser(t *testing.T) { _, _, err := client.Billing.GetStorageBillingUser(ctx, "%") testURLParseError(t, err) } + +func TestMinutesUsedBreakdown_Marshal(t *testing.T) { + testJSONMarshal(t, &MinutesUsedBreakdown{}, "{}") + + u := &MinutesUsedBreakdown{ + Ubuntu: 1, + MacOS: 1, + Windows: 1, + } + + want := `{ + "UBUNTU": 1, + "MACOS": 1, + "WINDOWS": 1 + }` + + testJSONMarshal(t, u, want) +} From f5e2e2a0c83eee0b7b2e3fc408e401771c84abe5 Mon Sep 17 00:00:00 2001 From: sagar23sj Date: Mon, 28 Jun 2021 00:04:27 +0530 Subject: [PATCH 2/4] Resource Tested for JSON marshalling : ActionBilling --- github/billing_test.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/github/billing_test.go b/github/billing_test.go index 2ce43356555..af8d3f9e393 100644 --- a/github/billing_test.go +++ b/github/billing_test.go @@ -315,3 +315,31 @@ func TestMinutesUsedBreakdown_Marshal(t *testing.T) { testJSONMarshal(t, u, want) } + +func TestActionBilling_Marshal(t *testing.T) { + testJSONMarshal(t, &MinutesUsedBreakdown{}, "{}") + + u := &ActionBilling{ + TotalMinutesUsed: 1, + TotalPaidMinutesUsed: 1, + IncludedMinutes: 1, + MinutesUsedBreakdown: MinutesUsedBreakdown{ + Ubuntu: 1, + MacOS: 1, + Windows: 1, + }, + } + + want := `{ + "total_minutes_used": 1, + "total_paid_minutes_used": 1, + "included_minutes": 1, + "minutes_used_breakdown": { + "UBUNTU": 1, + "MACOS": 1, + "WINDOWS": 1 + } + }` + + testJSONMarshal(t, u, want) +} From 3df933107fbf2557b21db31e9f23d4e7eaa44ae7 Mon Sep 17 00:00:00 2001 From: sagar23sj Date: Mon, 28 Jun 2021 00:07:13 +0530 Subject: [PATCH 3/4] Resource Tested for JSON marshalling : PackageBilling --- github/billing_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/github/billing_test.go b/github/billing_test.go index af8d3f9e393..504081688d3 100644 --- a/github/billing_test.go +++ b/github/billing_test.go @@ -343,3 +343,21 @@ func TestActionBilling_Marshal(t *testing.T) { testJSONMarshal(t, u, want) } + +func TestPackageBilling_Marshal(t *testing.T) { + testJSONMarshal(t, &PackageBilling{}, "{}") + + u := &PackageBilling{ + TotalGigabytesBandwidthUsed: 1, + TotalPaidGigabytesBandwidthUsed: 1, + IncludedGigabytesBandwidth: 1, + } + + want := `{ + "total_gigabytes_bandwidth_used": 1, + "total_paid_gigabytes_bandwidth_used": 1, + "included_gigabytes_bandwidth": 1 + }` + + testJSONMarshal(t, u, want) +} From 168d68048ec447d381558d7583561e284fe9817a Mon Sep 17 00:00:00 2001 From: sagar23sj Date: Mon, 28 Jun 2021 00:10:13 +0530 Subject: [PATCH 4/4] Resource Tested for JSON marshalling : StorageBilling --- github/billing_test.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/github/billing_test.go b/github/billing_test.go index 504081688d3..7d1c2a1d055 100644 --- a/github/billing_test.go +++ b/github/billing_test.go @@ -361,3 +361,21 @@ func TestPackageBilling_Marshal(t *testing.T) { testJSONMarshal(t, u, want) } + +func TestStorageBilling_Marshal(t *testing.T) { + testJSONMarshal(t, &StorageBilling{}, "{}") + + u := &StorageBilling{ + DaysLeftInBillingCycle: 1, + EstimatedPaidStorageForMonth: 1, + EstimatedStorageForMonth: 1, + } + + want := `{ + "days_left_in_billing_cycle": 1, + "estimated_paid_storage_for_month": 1, + "estimated_storage_for_month": 1 + }` + + testJSONMarshal(t, u, want) +}