Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions github/actions_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ func TestActionsCache_Marshal(t *testing.T) {

func TestActionsCacheList_Marshal(t *testing.T) {
t.Parallel()
testJSONMarshal(t, &ActionsCacheList{}, "{}")
testJSONMarshal(t, &ActionsCacheList{}, `{"total_count":0}`)

u := &ActionsCacheList{
TotalCount: 2,
Expand Down Expand Up @@ -590,7 +590,11 @@ func TestActionsCacheList_Marshal(t *testing.T) {

func TestActionsCacheUsage_Marshal(t *testing.T) {
t.Parallel()
testJSONMarshal(t, &ActionsCacheUsage{}, "{}")
testJSONMarshal(t, &ActionsCacheUsage{}, `{
"active_caches_count": 0,
"active_caches_size_in_bytes": 0,
"full_name": ""
}`)

u := &ActionsCacheUsage{
FullName: "cache_usage1",
Expand All @@ -609,7 +613,7 @@ func TestActionsCacheUsage_Marshal(t *testing.T) {

func TestActionsCacheUsageList_Marshal(t *testing.T) {
t.Parallel()
testJSONMarshal(t, &ActionsCacheUsageList{}, "{}")
testJSONMarshal(t, &ActionsCacheUsageList{}, `{"total_count": 0}`)

u := &ActionsCacheUsageList{
TotalCount: 1,
Expand All @@ -636,7 +640,10 @@ func TestActionsCacheUsageList_Marshal(t *testing.T) {

func TestTotalCacheUsage_Marshal(t *testing.T) {
t.Parallel()
testJSONMarshal(t, &TotalCacheUsage{}, "{}")
testJSONMarshal(t, &TotalCacheUsage{}, `{
"total_active_caches_count": 0,
"total_active_caches_size_in_bytes": 0
}`)

u := &TotalCacheUsage{
TotalActiveCachesUsageSizeInBytes: 2,
Expand Down
19 changes: 8 additions & 11 deletions github/actions_runner_groups_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,6 @@ func TestRunnerGroup_Marshal(t *testing.T) {
Inherited: Ptr(true),
AllowsPublicRepositories: Ptr(true),
RestrictedToWorkflows: Ptr(false),
SelectedWorkflows: []string{},
}

want := `{
Expand All @@ -568,16 +567,18 @@ func TestRunnerGroup_Marshal(t *testing.T) {
"network_configuration_id": "nc",
"inherited": true,
"allows_public_repositories": true,
"restricted_to_workflows": false,
"selected_workflows": []
"restricted_to_workflows": false
}`

testJSONMarshal(t, u, want)
}

func TestRunnerGroups_Marshal(t *testing.T) {
t.Parallel()
testJSONMarshal(t, &RunnerGroups{}, "{}")
testJSONMarshal(t, &RunnerGroups{}, `{
"total_count": 0,
"runner_groups": null
}`)

u := &RunnerGroups{
TotalCount: int(1),
Expand All @@ -594,7 +595,6 @@ func TestRunnerGroups_Marshal(t *testing.T) {
Inherited: Ptr(true),
AllowsPublicRepositories: Ptr(true),
RestrictedToWorkflows: Ptr(false),
SelectedWorkflows: []string{},
},
},
}
Expand All @@ -612,8 +612,7 @@ func TestRunnerGroups_Marshal(t *testing.T) {
"network_configuration_id": "nc",
"inherited": true,
"allows_public_repositories": true,
"restricted_to_workflows": false,
"selected_workflows": []
"restricted_to_workflows": false
}]
}`

Expand Down Expand Up @@ -658,7 +657,6 @@ func TestUpdateRunnerGroupRequest_Marshal(t *testing.T) {
Visibility: Ptr("v"),
AllowsPublicRepositories: Ptr(true),
RestrictedToWorkflows: Ptr(false),
SelectedWorkflows: []string{},
NetworkConfigurationID: Ptr("nc"),
}

Expand All @@ -667,7 +665,6 @@ func TestUpdateRunnerGroupRequest_Marshal(t *testing.T) {
"visibility": "v",
"allows_public_repositories": true,
"restricted_to_workflows": false,
"selected_workflows": [],
"network_configuration_id": "nc"
}`

Expand All @@ -676,7 +673,7 @@ func TestUpdateRunnerGroupRequest_Marshal(t *testing.T) {

func TestSetRepoAccessRunnerGroupRequest_Marshal(t *testing.T) {
t.Parallel()
testJSONMarshal(t, &SetRepoAccessRunnerGroupRequest{}, "{}")
testJSONMarshal(t, &SetRepoAccessRunnerGroupRequest{}, `{"selected_repository_ids": null}`)

u := &SetRepoAccessRunnerGroupRequest{
SelectedRepositoryIDs: []int64{1},
Expand All @@ -691,7 +688,7 @@ func TestSetRepoAccessRunnerGroupRequest_Marshal(t *testing.T) {

func TestSetRunnerGroupRunnersRequest_Marshal(t *testing.T) {
t.Parallel()
testJSONMarshal(t, &SetRunnerGroupRunnersRequest{}, "{}")
testJSONMarshal(t, &SetRunnerGroupRunnersRequest{}, `{"runners": null}`)

u := &SetRunnerGroupRunnersRequest{
Runners: []int64{1},
Expand Down
10 changes: 8 additions & 2 deletions github/actions_runners_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,10 @@ func TestRunnerApplicationDownload_Marshal(t *testing.T) {

func TestActionsEnabledOnOrgRepos_Marshal(t *testing.T) {
t.Parallel()
testJSONMarshal(t, &ActionsEnabledOnOrgRepos{}, "{}")
testJSONMarshal(t, &ActionsEnabledOnOrgRepos{}, `{
"repositories": null,
"total_count": 0
}`)

u := &ActionsEnabledOnOrgRepos{
TotalCount: 1,
Expand Down Expand Up @@ -682,7 +685,10 @@ func TestRunner_Marshal(t *testing.T) {

func TestRunners_Marshal(t *testing.T) {
t.Parallel()
testJSONMarshal(t, &Runners{}, "{}")
testJSONMarshal(t, &Runners{}, `{
"runners": null,
"total_count": 0
}`)

u := &Runners{
TotalCount: 1,
Expand Down
23 changes: 18 additions & 5 deletions github/actions_secrets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -877,7 +877,10 @@ func TestActionsService_DeleteEnvSecret(t *testing.T) {

func TestPublicKey_Marshal(t *testing.T) {
t.Parallel()
testJSONMarshal(t, &PublicKey{}, "{}")
testJSONMarshal(t, &PublicKey{}, `{
"key": null,
"key_id": null
}`)

u := &PublicKey{
KeyID: Ptr("kid"),
Expand All @@ -894,7 +897,11 @@ func TestPublicKey_Marshal(t *testing.T) {

func TestSecret_Marshal(t *testing.T) {
t.Parallel()
testJSONMarshal(t, &Secret{}, "{}")
testJSONMarshal(t, &Secret{}, `{
"name": "",
"created_at": "0001-01-01T00:00:00Z",
"updated_at": "0001-01-01T00:00:00Z"
}`)

u := &Secret{
Name: "n",
Expand All @@ -917,7 +924,10 @@ func TestSecret_Marshal(t *testing.T) {

func TestSecrets_Marshal(t *testing.T) {
t.Parallel()
testJSONMarshal(t, &Secrets{}, "{}")
testJSONMarshal(t, &Secrets{}, `{
"total_count": 0,
"secrets": null
}`)

u := &Secrets{
TotalCount: 1,
Expand Down Expand Up @@ -950,7 +960,10 @@ func TestSecrets_Marshal(t *testing.T) {

func TestEncryptedSecret_Marshal(t *testing.T) {
t.Parallel()
testJSONMarshal(t, &EncryptedSecret{}, "{}")
testJSONMarshal(t, &EncryptedSecret{}, `{
"key_id": "",
"encrypted_value": ""
}`)

u := &EncryptedSecret{
Name: "n",
Expand All @@ -967,7 +980,7 @@ func TestEncryptedSecret_Marshal(t *testing.T) {
"selected_repository_ids": [1]
}`

testJSONMarshal(t, u, want)
testJSONMarshal(t, u, want, cmpIgnoreFieldOption("Name"))
}

func TestSelectedReposList_Marshal(t *testing.T) {
Expand Down
5 changes: 4 additions & 1 deletion github/actions_variables_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,10 @@ func TestActionsService_DeleteEnvVariable(t *testing.T) {

func TestActionVariable_Marshal(t *testing.T) {
t.Parallel()
testJSONMarshal(t, &ActionsVariable{}, "{}")
testJSONMarshal(t, &ActionsVariable{}, `{
"name": "",
"value": ""
}`)

av := &ActionsVariable{
Name: "n",
Expand Down
6 changes: 5 additions & 1 deletion github/actions_workflow_runs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,11 @@ func TestActionsService_ReviewCustomDeploymentProtectionRule(t *testing.T) {

func TestReviewCustomDeploymentProtectionRuleRequest_Marshal(t *testing.T) {
t.Parallel()
testJSONMarshal(t, &ReviewCustomDeploymentProtectionRuleRequest{}, "{}")
testJSONMarshal(t, &ReviewCustomDeploymentProtectionRuleRequest{}, `{
"comment": "",
"environment_name": "",
"state": ""
}`)

r := &ReviewCustomDeploymentProtectionRuleRequest{
EnvironmentName: "e",
Expand Down
2 changes: 1 addition & 1 deletion github/actions_workflows_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ func TestWorkflowUsage_Marshal(t *testing.T) {

func TestCreateWorkflowDispatchEventRequest_Marshal(t *testing.T) {
t.Parallel()
testJSONMarshal(t, &CreateWorkflowDispatchEventRequest{}, "{}")
testJSONMarshal(t, &CreateWorkflowDispatchEventRequest{}, `{"ref": ""}`)

inputs := make(map[string]any, 0)
inputs["key"] = "value"
Expand Down
2 changes: 1 addition & 1 deletion github/activity_notifications_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ func TestNotificationSubject_Marshal(t *testing.T) {

func TestMarkReadOptions_Marshal(t *testing.T) {
t.Parallel()
testJSONMarshal(t, &markReadOptions{}, "{}")
testJSONMarshal(t, &markReadOptions{}, `{}`)

u := &markReadOptions{
LastReadAt: Timestamp{referenceTime},
Expand Down
2 changes: 1 addition & 1 deletion github/admin_users_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ func TestUserImpersonation_Delete(t *testing.T) {

func TestCreateUserRequest_Marshal(t *testing.T) {
t.Parallel()
testJSONMarshal(t, &CreateUserRequest{}, "{}")
testJSONMarshal(t, &CreateUserRequest{}, `{"login": ""}`)

u := &CreateUserRequest{
Login: "l",
Expand Down
2 changes: 1 addition & 1 deletion github/apps_installation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func TestAppsService_RevokeInstallationToken(t *testing.T) {

func TestListRepositories_Marshal(t *testing.T) {
t.Parallel()
testJSONMarshal(t, &ListRepositories{}, "{}")
testJSONMarshal(t, &ListRepositories{}, `{"repositories": null}`)

u := &ListRepositories{
TotalCount: Ptr(1),
Expand Down
14 changes: 11 additions & 3 deletions github/billing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,13 @@ func TestMinutesUsedBreakdown_Marshal(t *testing.T) {
testJSONMarshal(t, u, want)
}

func TestPackageBilling_Marshal(t *testing.T) {
func TestPackagesBilling_Marshal(t *testing.T) {
t.Parallel()
testJSONMarshal(t, &PackagesBilling{}, "{}")
testJSONMarshal(t, &PackagesBilling{}, `{
"total_gigabytes_bandwidth_used": 0,
"total_paid_gigabytes_bandwidth_used": 0,
"included_gigabytes_bandwidth": 0
}`)

u := &PackagesBilling{
TotalGigabytesBandwidthUsed: 1,
Expand All @@ -261,7 +265,11 @@ func TestPackageBilling_Marshal(t *testing.T) {

func TestStorageBilling_Marshal(t *testing.T) {
t.Parallel()
testJSONMarshal(t, &StorageBilling{}, "{}")
testJSONMarshal(t, &StorageBilling{}, `{
"days_left_in_billing_cycle": 0,
"estimated_paid_storage_for_month": 0,
"estimated_storage_for_month": 0
}`)

u := &StorageBilling{
DaysLeftInBillingCycle: 1,
Expand Down
15 changes: 11 additions & 4 deletions github/checks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1014,7 +1014,11 @@ func TestCheckRunImage_Marshal(t *testing.T) {

func TestCheckRunAction_Marshal(t *testing.T) {
t.Parallel()
testJSONMarshal(t, &CheckRunAction{}, "{}")
testJSONMarshal(t, &CheckRunAction{}, `{
"label": "",
"description": "",
"identifier": ""
}`)

u := &CheckRunAction{
Label: "l",
Expand Down Expand Up @@ -1050,7 +1054,7 @@ func TestAutoTriggerCheck_Marshal(t *testing.T) {

func TestCreateCheckSuiteOptions_Marshal(t *testing.T) {
t.Parallel()
testJSONMarshal(t, &CreateCheckSuiteOptions{}, "{}")
testJSONMarshal(t, &CreateCheckSuiteOptions{}, `{"head_sha": ""}`)

u := &CreateCheckSuiteOptions{
HeadSHA: "hsha",
Expand Down Expand Up @@ -1130,7 +1134,10 @@ func TestCheckRunOutput_Marshal(t *testing.T) {

func TestCreateCheckRunOptions_Marshal(t *testing.T) {
t.Parallel()
testJSONMarshal(t, &CreateCheckRunOptions{}, "{}")
testJSONMarshal(t, &CreateCheckRunOptions{}, `{
"name": "",
"head_sha": ""
}`)

u := &CreateCheckRunOptions{
Name: "n",
Expand Down Expand Up @@ -1227,7 +1234,7 @@ func TestCreateCheckRunOptions_Marshal(t *testing.T) {

func TestUpdateCheckRunOptions_Marshal(t *testing.T) {
t.Parallel()
testJSONMarshal(t, &UpdateCheckRunOptions{}, "{}")
testJSONMarshal(t, &UpdateCheckRunOptions{}, `{"name": ""}`)

u := &UpdateCheckRunOptions{
Name: "n",
Expand Down
3 changes: 1 addition & 2 deletions github/dependabot_alerts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,7 @@ func TestDependabotSecurityAdvisory_Marshal(t *testing.T) {
}
],
"published_at": "2018-10-03T21:13:54Z",
"updated_at": "2022-04-26T18:35:37Z",
"withdrawn_at": null
"updated_at": "2022-04-26T18:35:37Z"
}`

testJSONMarshal(t, h, want)
Expand Down
Loading
Loading