Skip to content

Commit b8d0a20

Browse files
Fix tests
1 parent 96c2cab commit b8d0a20

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+305
-162
lines changed

github/actions_cache_test.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ func TestActionsCache_Marshal(t *testing.T) {
545545

546546
func TestActionsCacheList_Marshal(t *testing.T) {
547547
t.Parallel()
548-
testJSONMarshal(t, &ActionsCacheList{}, "{}")
548+
testJSONMarshal(t, &ActionsCacheList{}, `{"total_count": 0}`)
549549

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

591591
func TestActionsCacheUsage_Marshal(t *testing.T) {
592592
t.Parallel()
593-
testJSONMarshal(t, &ActionsCacheUsage{}, "{}")
593+
testJSONMarshal(t, &ActionsCacheUsage{}, `{
594+
"active_caches_count": 0,
595+
"active_caches_size_in_bytes": 0,
596+
"full_name": ""
597+
}`)
594598

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

610614
func TestActionsCacheUsageList_Marshal(t *testing.T) {
611615
t.Parallel()
612-
testJSONMarshal(t, &ActionsCacheUsageList{}, "{}")
616+
testJSONMarshal(t, &ActionsCacheUsageList{}, `{"total_count": 0}`)
613617

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

637641
func TestTotalCacheUsage_Marshal(t *testing.T) {
638642
t.Parallel()
639-
testJSONMarshal(t, &TotalCacheUsage{}, "{}")
643+
testJSONMarshal(t, &TotalCacheUsage{}, `{
644+
"total_active_caches_count": 0,
645+
"total_active_caches_size_in_bytes": 0
646+
}`)
640647

641648
u := &TotalCacheUsage{
642649
TotalActiveCachesUsageSizeInBytes: 2,

github/actions_runner_groups_test.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -557,16 +557,15 @@ func TestRunnerGroup_Marshal(t *testing.T) {
557557
"runners_url": "r",
558558
"inherited": true,
559559
"allows_public_repositories": true,
560-
"restricted_to_workflows": false,
561-
"selected_workflows": []
560+
"restricted_to_workflows": false
562561
}`
563562

564563
testJSONMarshal(t, u, want)
565564
}
566565

567566
func TestRunnerGroups_Marshal(t *testing.T) {
568567
t.Parallel()
569-
testJSONMarshal(t, &RunnerGroups{}, "{}")
568+
testJSONMarshal(t, &RunnerGroups{}, `{"runner_groups": null, "total_count": 0}`)
570569

571570
u := &RunnerGroups{
572571
TotalCount: int(1),
@@ -597,8 +596,7 @@ func TestRunnerGroups_Marshal(t *testing.T) {
597596
"runners_url": "r",
598597
"inherited": true,
599598
"allows_public_repositories": true,
600-
"restricted_to_workflows": false,
601-
"selected_workflows": []
599+
"restricted_to_workflows": false
602600
}]
603601
}`
604602

@@ -648,16 +646,15 @@ func TestUpdateRunnerGroupRequest_Marshal(t *testing.T) {
648646
"name": "n",
649647
"visibility": "v",
650648
"allows_public_repositories": true,
651-
"restricted_to_workflows": false,
652-
"selected_workflows": []
649+
"restricted_to_workflows": false
653650
}`
654651

655652
testJSONMarshal(t, u, want)
656653
}
657654

658655
func TestSetRepoAccessRunnerGroupRequest_Marshal(t *testing.T) {
659656
t.Parallel()
660-
testJSONMarshal(t, &SetRepoAccessRunnerGroupRequest{}, "{}")
657+
testJSONMarshal(t, &SetRepoAccessRunnerGroupRequest{}, `{"selected_repository_ids": null}`)
661658

662659
u := &SetRepoAccessRunnerGroupRequest{
663660
SelectedRepositoryIDs: []int64{1},
@@ -672,7 +669,7 @@ func TestSetRepoAccessRunnerGroupRequest_Marshal(t *testing.T) {
672669

673670
func TestSetRunnerGroupRunnersRequest_Marshal(t *testing.T) {
674671
t.Parallel()
675-
testJSONMarshal(t, &SetRunnerGroupRunnersRequest{}, "{}")
672+
testJSONMarshal(t, &SetRunnerGroupRunnersRequest{}, `{"runners": null}`)
676673

677674
u := &SetRunnerGroupRunnersRequest{
678675
Runners: []int64{1},

github/actions_runners_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,10 @@ func TestRunnerApplicationDownload_Marshal(t *testing.T) {
577577

578578
func TestActionsEnabledOnOrgRepos_Marshal(t *testing.T) {
579579
t.Parallel()
580-
testJSONMarshal(t, &ActionsEnabledOnOrgRepos{}, "{}")
580+
testJSONMarshal(t, &ActionsEnabledOnOrgRepos{}, `{
581+
"repositories": null,
582+
"total_count": 0
583+
}`)
581584

582585
u := &ActionsEnabledOnOrgRepos{
583586
TotalCount: 1,
@@ -679,7 +682,7 @@ func TestRunner_Marshal(t *testing.T) {
679682

680683
func TestRunners_Marshal(t *testing.T) {
681684
t.Parallel()
682-
testJSONMarshal(t, &Runners{}, "{}")
685+
testJSONMarshal(t, &Runners{}, `{"runners": null, "total_count": 0}`)
683686

684687
u := &Runners{
685688
TotalCount: 1,

github/actions_secrets_test.go

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -859,7 +859,10 @@ func TestActionsService_DeleteEnvSecret(t *testing.T) {
859859

860860
func TestPublicKey_Marshal(t *testing.T) {
861861
t.Parallel()
862-
testJSONMarshal(t, &PublicKey{}, "{}")
862+
testJSONMarshal(t, &PublicKey{}, `{
863+
"key": null,
864+
"key_id": null
865+
}`)
863866

864867
u := &PublicKey{
865868
KeyID: Ptr("kid"),
@@ -876,7 +879,11 @@ func TestPublicKey_Marshal(t *testing.T) {
876879

877880
func TestSecret_Marshal(t *testing.T) {
878881
t.Parallel()
879-
testJSONMarshal(t, &Secret{}, "{}")
882+
testJSONMarshal(t, &Secret{}, `{
883+
"created_at": `+emptyTimeStr+`,
884+
"name": "",
885+
"updated_at": `+emptyTimeStr+`
886+
}`)
880887

881888
u := &Secret{
882889
Name: "n",
@@ -899,7 +906,7 @@ func TestSecret_Marshal(t *testing.T) {
899906

900907
func TestSecrets_Marshal(t *testing.T) {
901908
t.Parallel()
902-
testJSONMarshal(t, &Secrets{}, "{}")
909+
testJSONMarshal(t, &Secrets{}, `{"secrets": null, "total_count": 0}`)
903910

904911
u := &Secrets{
905912
TotalCount: 1,
@@ -931,7 +938,7 @@ func TestSecrets_Marshal(t *testing.T) {
931938

932939
func TestEncryptedSecret_Marshal(t *testing.T) {
933940
t.Parallel()
934-
testJSONMarshal(t, &EncryptedSecret{}, "{}")
941+
testJSONMarshal(t, &EncryptedSecret{}, `{"encrypted_value": "", "key_id": ""}`)
935942

936943
u := &EncryptedSecret{
937944
Name: "n",

github/actions_variables_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -703,7 +703,7 @@ func TestActionsService_DeleteEnvVariable(t *testing.T) {
703703

704704
func TestActionVariable_Marshal(t *testing.T) {
705705
t.Parallel()
706-
testJSONMarshal(t, &ActionsVariable{}, "{}")
706+
testJSONMarshal(t, &ActionsVariable{}, `{"name": "", "value": ""}`)
707707

708708
av := &ActionsVariable{
709709
Name: "n",

github/actions_workflow_runs_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,11 @@ func TestActionsService_ReviewCustomDeploymentProtectionRule(t *testing.T) {
897897

898898
func TestReviewCustomDeploymentProtectionRuleRequest_Marshal(t *testing.T) {
899899
t.Parallel()
900-
testJSONMarshal(t, &ReviewCustomDeploymentProtectionRuleRequest{}, "{}")
900+
testJSONMarshal(t, &ReviewCustomDeploymentProtectionRuleRequest{}, `{
901+
"comment": "",
902+
"environment_name": "",
903+
"state": ""
904+
}`)
901905

902906
r := &ReviewCustomDeploymentProtectionRuleRequest{
903907
EnvironmentName: "e",

github/actions_workflows_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ func TestWorkflowUsage_Marshal(t *testing.T) {
616616

617617
func TestCreateWorkflowDispatchEventRequest_Marshal(t *testing.T) {
618618
t.Parallel()
619-
testJSONMarshal(t, &CreateWorkflowDispatchEventRequest{}, "{}")
619+
testJSONMarshal(t, &CreateWorkflowDispatchEventRequest{}, `{"ref": ""}`)
620620

621621
inputs := make(map[string]interface{}, 0)
622622
inputs["key"] = "value"

github/activity_notifications_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ func TestNotificationSubject_Marshal(t *testing.T) {
409409

410410
func TestMarkReadOptions_Marshal(t *testing.T) {
411411
t.Parallel()
412-
testJSONMarshal(t, &markReadOptions{}, "{}")
412+
testJSONMarshal(t, &markReadOptions{}, `{"last_read_at": `+emptyTimeStr+`}`)
413413

414414
u := &markReadOptions{
415415
LastReadAt: Timestamp{referenceTime},

github/admin_users_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ func TestUserImpersonation_Delete(t *testing.T) {
186186

187187
func TestCreateUserRequest_Marshal(t *testing.T) {
188188
t.Parallel()
189-
testJSONMarshal(t, &CreateUserRequest{}, "{}")
189+
testJSONMarshal(t, &CreateUserRequest{}, `{"login": ""}`)
190190

191191
u := &CreateUserRequest{
192192
Login: "l",

github/apps_installation_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ func TestAppsService_RevokeInstallationToken(t *testing.T) {
176176

177177
func TestListRepositories_Marshal(t *testing.T) {
178178
t.Parallel()
179-
testJSONMarshal(t, &ListRepositories{}, "{}")
179+
testJSONMarshal(t, &ListRepositories{}, `{"repositories": null}`)
180180

181181
u := &ListRepositories{
182182
TotalCount: Ptr(1),

0 commit comments

Comments
 (0)