diff --git a/github/actions_artifacts_test.go b/github/actions_artifacts_test.go index 296e7259c08..9e8209eb8a4 100644 --- a/github/actions_artifacts_test.go +++ b/github/actions_artifacts_test.go @@ -454,22 +454,22 @@ func TestArtifact_Marshal(t *testing.T) { } want := `{ - "id": 1, - "node_id": "nid", - "name": "n", - "size_in_bytes": 1, - "url": "u", - "archive_download_url": "a", - "expired": false, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "expires_at": ` + referenceTimeStr + `, - "workflow_run": { - "id": 1, - "repository_id": 1, - "head_repository_id": 1, - "head_branch": "b", - "head_sha": "s" + "id":1, + "node_id":"nid", + "name":"n", + "size_in_bytes":1, + "url":"u", + "archive_download_url":"a", + "expired":false, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "expires_at":` + referenceTimeStr + `, + "workflow_run":{ + "id":1, + "repository_id":1, + "head_repository_id":1, + "head_branch":"b", + "head_sha":"s" } }` @@ -505,26 +505,28 @@ func TestArtifactList_Marshal(t *testing.T) { } want := `{ - "total_count": 1, - "artifacts": [{ - "id": 1, - "node_id": "nid", - "name": "n", - "size_in_bytes": 1, - "url": "u", - "archive_download_url": "a", - "expired": false, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "expires_at": ` + referenceTimeStr + `, - "workflow_run": { - "id": 1, - "repository_id": 1, - "head_repository_id": 1, - "head_branch": "b", - "head_sha": "s" + "total_count":1, + "artifacts":[ + { + "id":1, + "node_id":"nid", + "name":"n", + "size_in_bytes":1, + "url":"u", + "archive_download_url":"a", + "expired":false, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "expires_at":` + referenceTimeStr + `, + "workflow_run":{ + "id":1, + "repository_id":1, + "head_repository_id":1, + "head_branch":"b", + "head_sha":"s" + } } - }] + ] }` testJSONMarshal(t, u, want) diff --git a/github/actions_cache_test.go b/github/actions_cache_test.go index c13b772691c..fc6915d055b 100644 --- a/github/actions_cache_test.go +++ b/github/actions_cache_test.go @@ -530,20 +530,20 @@ func TestActionsCache_Marshal(t *testing.T) { } want := `{ - "id": 1, - "ref": "refAction", - "key": "key1", - "version": "alpha", - "last_accessed_at": ` + referenceTimeStr + `, - "created_at": ` + referenceTimeStr + `, - "size_in_bytes": 1 + "id":1, + "ref":"refAction", + "key":"key1", + "version":"alpha", + "last_accessed_at":` + referenceTimeStr + `, + "created_at":` + referenceTimeStr + `, + "size_in_bytes":1 }` testJSONMarshal(t, u, want) } func TestActionsCacheList_Marshal(t *testing.T) { - testJSONMarshal(t, &ActionsCacheList{}, "{}") + testJSONMarshal(t, &ActionsCacheList{}, `{"total_count":0}`) u := &ActionsCacheList{ TotalCount: 2, @@ -566,28 +566,33 @@ func TestActionsCacheList_Marshal(t *testing.T) { }, } want := `{ - "total_count": 2, - "actions_caches": [{ - "id": 1, - "key": "key1", - "version": "alpha", - "last_accessed_at": ` + referenceTimeStr + `, - "created_at": ` + referenceTimeStr + `, - "size_in_bytes": 1 + "total_count":2, + "actions_caches":[{ + "id":1, + "key":"key1", + "version":"alpha", + "last_accessed_at":` + referenceTimeStr + `, + "created_at":` + referenceTimeStr + `, + "size_in_bytes":1 }, { - "id": 2, - "ref": "refAction", - "last_accessed_at": ` + referenceTimeStr + `, - "created_at": ` + referenceTimeStr + `, - "size_in_bytes": 1 + "id":2, + "ref":"refAction", + "last_accessed_at":` + referenceTimeStr + `, + "created_at":` + referenceTimeStr + `, + "size_in_bytes":1 }] }` testJSONMarshal(t, u, want) } func TestActionsCacheUsage_Marshal(t *testing.T) { - testJSONMarshal(t, &ActionsCacheUsage{}, "{}") + want := `{ + "full_name":"", + "active_caches_size_in_bytes":0, + "active_caches_count":0 + }` + testJSONMarshal(t, &ActionsCacheUsage{}, want) u := &ActionsCacheUsage{ FullName: "cache_usage1", @@ -595,17 +600,17 @@ func TestActionsCacheUsage_Marshal(t *testing.T) { ActiveCachesCount: 2, } - want := `{ - "full_name": "cache_usage1", - "active_caches_size_in_bytes": 2, - "active_caches_count": 2 + want = `{ + "full_name":"cache_usage1", + "active_caches_size_in_bytes":2, + "active_caches_count":2 }` testJSONMarshal(t, u, want) } func TestActionsCacheUsageList_Marshal(t *testing.T) { - testJSONMarshal(t, &ActionsCacheUsageList{}, "{}") + testJSONMarshal(t, &ActionsCacheUsageList{}, `{"total_count":0}`) u := &ActionsCacheUsageList{ TotalCount: 1, @@ -619,11 +624,11 @@ func TestActionsCacheUsageList_Marshal(t *testing.T) { } want := `{ - "total_count": 1, - "repository_cache_usages": [{ - "full_name": "cache_usage1", - "active_caches_size_in_bytes": 2, - "active_caches_count": 2 + "total_count":1, + "repository_cache_usages":[{ + "full_name":"cache_usage1", + "active_caches_size_in_bytes":2, + "active_caches_count":2 }] }` @@ -631,16 +636,20 @@ func TestActionsCacheUsageList_Marshal(t *testing.T) { } func TestTotalCacheUsage_Marshal(t *testing.T) { - testJSONMarshal(t, &TotalCacheUsage{}, "{}") + want := `{ + "total_active_caches_size_in_bytes":0, + "total_active_caches_count":0 + }` + testJSONMarshal(t, &TotalCacheUsage{}, want) u := &TotalCacheUsage{ TotalActiveCachesUsageSizeInBytes: 2, TotalActiveCachesCount: 2, } - want := `{ - "total_active_caches_size_in_bytes": 2, - "total_active_caches_count": 2 + want = `{ + "total_active_caches_size_in_bytes":2, + "total_active_caches_count":2 }` testJSONMarshal(t, u, want) diff --git a/github/actions_oidc_test.go b/github/actions_oidc_test.go index a1eee7c3157..e5276b6bc24 100644 --- a/github/actions_oidc_test.go +++ b/github/actions_oidc_test.go @@ -189,8 +189,8 @@ func TestOIDCSubjectClaimCustomTemplate_Marshal(t *testing.T) { } want := `{ - "use_default": false, - "include_claim_keys": [ + "use_default":false, + "include_claim_keys":[ "s" ] }` diff --git a/github/actions_permissions_orgs_test.go b/github/actions_permissions_orgs_test.go index 36a241f6ea2..c57d4139b99 100644 --- a/github/actions_permissions_orgs_test.go +++ b/github/actions_permissions_orgs_test.go @@ -307,9 +307,9 @@ func TestActionsAllowed_Marshal(t *testing.T) { } want := `{ - "github_owned_allowed": false, - "verified_allowed": false, - "patterns_allowed": [ + "github_owned_allowed":false, + "verified_allowed":false, + "patterns_allowed":[ "s" ] }` @@ -327,9 +327,9 @@ func TestActionsPermissions_Marshal(t *testing.T) { } want := `{ - "enabled_repositories": "e", - "allowed_actions": "a", - "selected_actions_url": "sau" + "enabled_repositories":"e", + "allowed_actions":"a", + "selected_actions_url":"sau" }` testJSONMarshal(t, u, want) diff --git a/github/actions_runner_groups_test.go b/github/actions_runner_groups_test.go index 16d92ed7c64..66e5bb2366a 100644 --- a/github/actions_runner_groups_test.go +++ b/github/actions_runner_groups_test.go @@ -544,27 +544,32 @@ func TestRunnerGroup_Marshal(t *testing.T) { Inherited: Bool(true), AllowsPublicRepositories: Bool(true), RestrictedToWorkflows: Bool(false), - SelectedWorkflows: []string{}, + SelectedWorkflows: []string{"1"}, } want := `{ - "id": 1, - "name": "n", - "visibility": "v", - "default": true, - "selected_repositories_url": "s", - "runners_url": "r", - "inherited": true, - "allows_public_repositories": true, - "restricted_to_workflows": false, - "selected_workflows": [] + "id":1, + "name":"n", + "visibility":"v", + "default":true, + "selected_repositories_url":"s", + "runners_url":"r", + "inherited":true, + "allows_public_repositories":true, + "restricted_to_workflows":false, + "selected_workflows":[ + "1" + ] }` testJSONMarshal(t, u, want) } func TestRunnerGroups_Marshal(t *testing.T) { - testJSONMarshal(t, &RunnerGroups{}, "{}") + testJSONMarshal(t, &RunnerGroups{}, `{ + "total_count":0, + "runner_groups":null + }`) u := &RunnerGroups{ TotalCount: int(1), @@ -579,25 +584,29 @@ func TestRunnerGroups_Marshal(t *testing.T) { Inherited: Bool(true), AllowsPublicRepositories: Bool(true), RestrictedToWorkflows: Bool(false), - SelectedWorkflows: []string{}, + SelectedWorkflows: []string{"1"}, }, }, } want := `{ - "total_count": 1, - "runner_groups": [{ - "id": 1, - "name": "n", - "visibility": "v", - "default": true, - "selected_repositories_url": "s", - "runners_url": "r", - "inherited": true, - "allows_public_repositories": true, - "restricted_to_workflows": false, - "selected_workflows": [] - }] + "total_count":1, + "runner_groups":[ + { + "id":1, + "name":"n", + "visibility":"v", + "default":true, + "selected_repositories_url":"s", + "runners_url":"r", + "inherited":true, + "allows_public_repositories":true, + "restricted_to_workflows":false, + "selected_workflows":[ + "1" + ] + } + ] }` testJSONMarshal(t, u, want) @@ -617,13 +626,20 @@ func TestCreateRunnerGroupRequest_Marshal(t *testing.T) { } want := `{ - "name": "n", - "visibility": "v", - "selected_repository_ids": [1], - "runners": [1], - "allows_public_repositories": true, - "restricted_to_workflows": true, - "selected_workflows": ["a","b"] + "name":"n", + "visibility":"v", + "selected_repository_ids":[ + 1 + ], + "runners":[ + 1 + ], + "allows_public_repositories":true, + "restricted_to_workflows":true, + "selected_workflows":[ + "a", + "b" + ] }` testJSONMarshal(t, u, want) @@ -641,40 +657,48 @@ func TestUpdateRunnerGroupRequest_Marshal(t *testing.T) { } want := `{ - "name": "n", - "visibility": "v", - "allows_public_repositories": true, - "restricted_to_workflows": false, - "selected_workflows": [] + "name":"n", + "visibility":"v", + "allows_public_repositories":true, + "restricted_to_workflows":false + }` + + testJSONMarshal(t, u, want) + + u.SelectedWorkflows = []string{"1"} + want = `{ + "name":"n", + "visibility":"v", + "allows_public_repositories":true, + "restricted_to_workflows":false, + "selected_workflows":[ + "1" + ] }` testJSONMarshal(t, u, want) } func TestSetRepoAccessRunnerGroupRequest_Marshal(t *testing.T) { - testJSONMarshal(t, &SetRepoAccessRunnerGroupRequest{}, "{}") + testJSONMarshal(t, &SetRepoAccessRunnerGroupRequest{}, `{"selected_repository_ids":null}`) u := &SetRepoAccessRunnerGroupRequest{ SelectedRepositoryIDs: []int64{1}, } - want := `{ - "selected_repository_ids": [1] - }` + want := `{"selected_repository_ids":[1]}` testJSONMarshal(t, u, want) } func TestSetRunnerGroupRunnersRequest_Marshal(t *testing.T) { - testJSONMarshal(t, &SetRunnerGroupRunnersRequest{}, "{}") + testJSONMarshal(t, &SetRunnerGroupRunnersRequest{}, `{"runners":null}`) u := &SetRunnerGroupRunnersRequest{ Runners: []int64{1}, } - want := `{ - "runners": [1] - }` + want := `{"runners":[1]}` testJSONMarshal(t, u, want) } diff --git a/github/actions_runners_test.go b/github/actions_runners_test.go index 581e459442d..c9d881dd725 100644 --- a/github/actions_runners_test.go +++ b/github/actions_runners_test.go @@ -559,19 +559,22 @@ func TestRunnerApplicationDownload_Marshal(t *testing.T) { } want := `{ - "os": "o", - "architecture": "a", - "download_url": "d", - "filename": "f", - "temp_download_token": "t", - "sha256_checksum": "s" + "os":"o", + "architecture":"a", + "download_url":"d", + "filename":"f", + "temp_download_token":"t", + "sha256_checksum":"s" }` testJSONMarshal(t, u, want) } func TestActionsEnabledOnOrgRepos_Marshal(t *testing.T) { - testJSONMarshal(t, &ActionsEnabledOnOrgRepos{}, "{}") + testJSONMarshal(t, &ActionsEnabledOnOrgRepos{}, `{ + "total_count":0, + "repositories":null + }`) u := &ActionsEnabledOnOrgRepos{ TotalCount: 1, @@ -585,12 +588,12 @@ func TestActionsEnabledOnOrgRepos_Marshal(t *testing.T) { } want := `{ - "total_count": 1, - "repositories": [ + "total_count":1, + "repositories":[ { - "id": 1, - "url": "u", - "name": "n" + "id":1, + "name":"n", + "url":"u" } ] }` @@ -607,8 +610,8 @@ func TestRegistrationToken_Marshal(t *testing.T) { } want := `{ - "token": "t", - "expires_at": ` + referenceTimeStr + ` + "token":"t", + "expires_at":` + referenceTimeStr + ` }` testJSONMarshal(t, u, want) @@ -624,9 +627,9 @@ func TestRunnerLabels_Marshal(t *testing.T) { } want := `{ - "id": 1, - "name": "n", - "type": "t" + "id":1, + "name":"n", + "type":"t" }` testJSONMarshal(t, u, want) @@ -651,16 +654,16 @@ func TestRunner_Marshal(t *testing.T) { } want := `{ - "id": 1, - "name": "n", - "os": "o", - "status": "s", - "busy": false, - "labels": [ + "id":1, + "name":"n", + "os":"o", + "status":"s", + "busy":false, + "labels":[ { - "id": 1, - "name": "n", - "type": "t" + "id":1, + "name":"n", + "type":"t" } ] }` @@ -669,7 +672,10 @@ func TestRunner_Marshal(t *testing.T) { } func TestRunners_Marshal(t *testing.T) { - testJSONMarshal(t, &Runners{}, "{}") + testJSONMarshal(t, &Runners{}, `{ + "total_count":0, + "runners":null + }`) u := &Runners{ TotalCount: 1, @@ -692,21 +698,21 @@ func TestRunners_Marshal(t *testing.T) { } want := `{ - "total_count": 1, - "runners": [ + "total_count":1, + "runners":[ { - "id": 1, - "name": "n", - "os": "o", - "status": "s", - "busy": false, - "labels": [ - { - "id": 1, - "name": "n", - "type": "t" - } - ] + "id":1, + "name":"n", + "os":"o", + "status":"s", + "busy":false, + "labels":[ + { + "id":1, + "name":"n", + "type":"t" + } + ] } ] }` @@ -723,8 +729,8 @@ func TestRemoveToken_Marshal(t *testing.T) { } want := `{ - "token": "t", - "expires_at": ` + referenceTimeStr + ` + "token":"t", + "expires_at":` + referenceTimeStr + ` }` testJSONMarshal(t, u, want) diff --git a/github/actions_secrets_test.go b/github/actions_secrets_test.go index a1266d6bae6..f4b5b6057f3 100644 --- a/github/actions_secrets_test.go +++ b/github/actions_secrets_test.go @@ -812,7 +812,10 @@ func TestActionsService_DeleteEnvSecret(t *testing.T) { } func TestPublicKey_Marshal(t *testing.T) { - testJSONMarshal(t, &PublicKey{}, "{}") + testJSONMarshal(t, &PublicKey{}, `{ + "key_id":null, + "key":null + }`) u := &PublicKey{ KeyID: String("kid"), @@ -820,15 +823,19 @@ func TestPublicKey_Marshal(t *testing.T) { } want := `{ - "key_id": "kid", - "key": "k" + "key_id":"kid", + "key":"k" }` testJSONMarshal(t, u, want) } func TestSecret_Marshal(t *testing.T) { - 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", @@ -839,18 +846,21 @@ func TestSecret_Marshal(t *testing.T) { } want := `{ - "name": "n", - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "visibility": "v", - "selected_repositories_url": "s" + "name":"n", + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "visibility":"v", + "selected_repositories_url":"s" }` testJSONMarshal(t, u, want) } func TestSecrets_Marshal(t *testing.T) { - testJSONMarshal(t, &Secrets{}, "{}") + testJSONMarshal(t, &Secrets{}, `{ + "total_count":0, + "secrets":null + }`) u := &Secrets{ TotalCount: 1, @@ -865,14 +875,14 @@ func TestSecrets_Marshal(t *testing.T) { } want := `{ - "total_count": 1, - "secrets": [ + "total_count":1, + "secrets":[ { - "name": "n", - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "visibility": "v", - "selected_repositories_url": "s" + "name":"n", + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "visibility":"v", + "selected_repositories_url":"s" } ] }` @@ -881,7 +891,10 @@ func TestSecrets_Marshal(t *testing.T) { } func TestEncryptedSecret_Marshal(t *testing.T) { - testJSONMarshal(t, &EncryptedSecret{}, "{}") + testJSONMarshal(t, &EncryptedSecret{}, `{ + "key_id":"", + "encrypted_value":"" + }`) u := &EncryptedSecret{ Name: "n", @@ -892,10 +905,12 @@ func TestEncryptedSecret_Marshal(t *testing.T) { } want := `{ - "key_id": "kid", - "encrypted_value": "e", - "visibility": "v", - "selected_repository_ids": [1] + "key_id":"kid", + "encrypted_value":"e", + "visibility":"v", + "selected_repository_ids":[ + 1 + ] }` testJSONMarshal(t, u, want) @@ -916,12 +931,12 @@ func TestSelectedReposList_Marshal(t *testing.T) { } want := `{ - "total_count": 1, - "repositories": [ + "total_count":1, + "repositories":[ { - "id": 1, - "url": "u", - "name": "n" + "id":1, + "name":"n", + "url":"u" } ] }` diff --git a/github/actions_variables_test.go b/github/actions_variables_test.go index a9f773c261e..302abe544ef 100644 --- a/github/actions_variables_test.go +++ b/github/actions_variables_test.go @@ -659,7 +659,7 @@ func TestActionsService_DeleteEnvVariable(t *testing.T) { } func TestActionVariable_Marshal(t *testing.T) { - testJSONMarshal(t, &ActionsVariable{}, "{}") + testJSONMarshal(t, &ActionsVariable{}, `{"name":"","value":""}`) av := &ActionsVariable{ Name: "n", @@ -672,13 +672,13 @@ func TestActionVariable_Marshal(t *testing.T) { } want := fmt.Sprintf(`{ - "name": "n", - "value": "v", - "created_at": %s, - "updated_at": %s, - "visibility": "v", - "selected_repositories_url": "s", - "selected_repository_ids": [1,2,3] + "name":"n", + "value":"v", + "created_at":%s, + "updated_at":%s, + "visibility":"v", + "selected_repositories_url":"s", + "selected_repository_ids":[1,2,3] }`, referenceTimeStr, referenceTimeStr) fmt.Println(want) diff --git a/github/actions_workflow_jobs_test.go b/github/actions_workflow_jobs_test.go index 1cdf4a6c81a..3295b1bcb22 100644 --- a/github/actions_workflow_jobs_test.go +++ b/github/actions_workflow_jobs_test.go @@ -227,12 +227,12 @@ func TestTaskStep_Marshal(t *testing.T) { } want := `{ - "name": "n", - "status": "s", - "conclusion": "c", - "number": 1, - "started_at": ` + referenceTimeStr + `, - "completed_at": ` + referenceTimeStr + ` + "name":"n", + "status":"s", + "conclusion":"c", + "number":1, + "started_at":` + referenceTimeStr + `, + "completed_at":` + referenceTimeStr + ` }` testJSONMarshal(t, u, want) @@ -271,30 +271,32 @@ func TestWorkflowJob_Marshal(t *testing.T) { } want := `{ - "id": 1, - "run_id": 1, - "run_url": "r", - "node_id": "n", - "head_branch": "b", - "head_sha": "h", - "url": "u", - "html_url": "h", - "status": "s", - "conclusion": "c", - "created_at": ` + referenceTimeStr + `, - "started_at": ` + referenceTimeStr + `, - "completed_at": ` + referenceTimeStr + `, - "name": "n", - "steps": [{ - "name": "n", - "status": "s", - "conclusion": "c", - "number": 1, - "started_at": ` + referenceTimeStr + `, - "completed_at": ` + referenceTimeStr + ` - }], - "check_run_url": "c", - "workflow_name": "w" + "id":1, + "run_id":1, + "run_url":"r", + "node_id":"n", + "head_branch":"b", + "head_sha":"h", + "url":"u", + "html_url":"h", + "status":"s", + "conclusion":"c", + "created_at":` + referenceTimeStr + `, + "started_at":` + referenceTimeStr + `, + "completed_at":` + referenceTimeStr + `, + "name":"n", + "steps":[ + { + "name":"n", + "status":"s", + "conclusion":"c", + "number":1, + "started_at":` + referenceTimeStr + `, + "completed_at":` + referenceTimeStr + ` + } + ], + "check_run_url":"c", + "workflow_name":"w" }` testJSONMarshal(t, u, want) @@ -339,34 +341,38 @@ func TestJobs_Marshal(t *testing.T) { } want := `{ - "total_count": 1, - "jobs": [{ - "id": 1, - "run_id": 1, - "run_url": "r", - "node_id": "n", - "head_branch": "b", - "head_sha": "h", - "url": "u", - "html_url": "h", - "status": "s", - "conclusion": "c", - "created_at": ` + referenceTimeStr + `, - "started_at": ` + referenceTimeStr + `, - "completed_at": ` + referenceTimeStr + `, - "name": "n", - "steps": [{ - "name": "n", - "status": "s", - "conclusion": "c", - "number": 1, - "started_at": ` + referenceTimeStr + `, - "completed_at": ` + referenceTimeStr + ` - }], - "check_run_url": "c", - "run_attempt": 2, - "workflow_name": "w" - }] + "total_count":1, + "jobs":[ + { + "id":1, + "run_id":1, + "run_url":"r", + "node_id":"n", + "head_branch":"b", + "head_sha":"h", + "url":"u", + "html_url":"h", + "status":"s", + "conclusion":"c", + "created_at":` + referenceTimeStr + `, + "started_at":` + referenceTimeStr + `, + "completed_at":` + referenceTimeStr + `, + "name":"n", + "steps":[ + { + "name":"n", + "status":"s", + "conclusion":"c", + "number":1, + "started_at":` + referenceTimeStr + `, + "completed_at":` + referenceTimeStr + ` + } + ], + "check_run_url":"c", + "run_attempt":2, + "workflow_name":"w" + } + ] }` testJSONMarshal(t, u, want) diff --git a/github/actions_workflow_runs_test.go b/github/actions_workflow_runs_test.go index 8a573c20ac2..8b6f8b5e5e3 100644 --- a/github/actions_workflow_runs_test.go +++ b/github/actions_workflow_runs_test.go @@ -764,20 +764,20 @@ func TestWorkflowRun_Marshal(t *testing.T) { } want := `{ - "id": 1, - "name": "n", - "node_id": "nid", - "head_branch": "hb", - "head_sha": "hs", - "run_number": 1, - "run_attempt": 1, - "event": "e", - "status": "s", - "conclusion": "c", - "workflow_id": 1, - "url": "u", - "html_url": "h", - "pull_requests": [ + "id":1, + "name":"n", + "node_id":"nid", + "head_branch":"hb", + "head_sha":"hs", + "run_number":1, + "run_attempt":1, + "event":"e", + "status":"s", + "conclusion":"c", + "workflow_id":1, + "url":"u", + "html_url":"h", + "pull_requests":[ { "id":1, "number":1, @@ -785,102 +785,102 @@ func TestWorkflowRun_Marshal(t *testing.T) { "head":{ "ref":"r", "sha":"s", - "repo": { + "repo":{ "id":1, "name":"n", "url":"s" - } - }, - "base": { - "ref":"r", - "sha":"s", - "repo": { - "id":1, - "name":"n", - "url":"u" - } } + }, + "base":{ + "ref":"r", + "sha":"s", + "repo":{ + "id":1, + "name":"n", + "url":"u" + } + } } ], - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "run_started_at": ` + referenceTimeStr + `, - "jobs_url": "j", - "logs_url": "l", - "check_suite_url": "c", - "artifacts_url": "a", - "cancel_url": "c", - "rerun_url": "r", - "previous_attempt_url": "p", - "head_commit": { - "message": "m", - "author": { - "name": "n", - "email": "e", - "username": "l" + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "run_started_at":` + referenceTimeStr + `, + "jobs_url":"j", + "logs_url":"l", + "check_suite_url":"c", + "artifacts_url":"a", + "cancel_url":"c", + "rerun_url":"r", + "previous_attempt_url":"p", + "head_commit":{ + "message":"m", + "author":{ + "name":"n", + "email":"e", + "username":"l" }, - "url": "u", - "distinct": false, - "sha": "s", - "id": "i", - "tree_id": "tid", - "timestamp": ` + referenceTimeStr + `, - "committer": { - "name": "n", - "email": "e", - "username": "l" + "url":"u", + "distinct":false, + "sha":"s", + "id":"i", + "tree_id":"tid", + "timestamp":` + referenceTimeStr + `, + "committer":{ + "name":"n", + "email":"e", + "username":"l" } }, - "workflow_url": "w", - "repository": { - "id": 1, - "url": "u", - "name": "n" + "workflow_url":"w", + "repository":{ + "id":1, + "name":"n", + "url":"u" }, - "head_repository": { - "id": 1, - "url": "u", - "name": "n" + "head_repository":{ + "id":1, + "name":"n", + "url":"u" }, - "actor": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "actor":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "triggering_actor": { - "login": "l2", - "id": 2, - "avatar_url": "a2", - "gravatar_id": "g2", - "name": "n2", - "company": "c2", - "blog": "b2", - "location": "l2", - "email": "e2", - "hireable": false, - "bio": "b2", - "twitter_username": "t2", - "public_repos": 2, - "followers": 2, - "following": 2, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u2" + "triggering_actor":{ + "login":"l2", + "id":2, + "avatar_url":"a2", + "gravatar_id":"g2", + "name":"n2", + "company":"c2", + "blog":"b2", + "location":"l2", + "email":"e2", + "hireable":false, + "bio":"b2", + "twitter_username":"t2", + "public_repos":2, + "followers":2, + "following":2, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u2" } }` @@ -1017,23 +1017,23 @@ func TestWorkflowRuns_Marshal(t *testing.T) { } want := `{ - "total_count": 1, - "workflow_runs": [ + "total_count":1, + "workflow_runs":[ { - "id": 1, - "name": "n", - "node_id": "nid", - "head_branch": "hb", - "head_sha": "hs", - "run_number": 1, - "run_attempt": 1, - "event": "e", - "status": "s", - "conclusion": "c", - "workflow_id": 1, - "url": "u", - "html_url": "h", - "pull_requests": [ + "id":1, + "name":"n", + "node_id":"nid", + "head_branch":"hb", + "head_sha":"hs", + "run_number":1, + "run_attempt":1, + "event":"e", + "status":"s", + "conclusion":"c", + "workflow_id":1, + "url":"u", + "html_url":"h", + "pull_requests":[ { "id":1, "number":1, @@ -1041,102 +1041,102 @@ func TestWorkflowRuns_Marshal(t *testing.T) { "head":{ "ref":"r", "sha":"s", - "repo": { + "repo":{ "id":1, "name":"n", "url":"s" - } - }, - "base": { - "ref":"r", - "sha":"s", - "repo": { - "id":1, - "name":"n", - "url":"u" - } } + }, + "base":{ + "ref":"r", + "sha":"s", + "repo":{ + "id":1, + "name":"n", + "url":"u" + } + } } ], - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "run_started_at": ` + referenceTimeStr + `, - "jobs_url": "j", - "logs_url": "l", - "check_suite_url": "c", - "artifacts_url": "a", - "cancel_url": "c", - "rerun_url": "r", - "previous_attempt_url": "p", - "head_commit": { - "message": "m", - "author": { - "name": "n", - "email": "e", - "username": "l" + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "run_started_at":` + referenceTimeStr + `, + "jobs_url":"j", + "logs_url":"l", + "check_suite_url":"c", + "artifacts_url":"a", + "cancel_url":"c", + "rerun_url":"r", + "previous_attempt_url":"p", + "head_commit":{ + "message":"m", + "author":{ + "name":"n", + "email":"e", + "username":"l" }, - "url": "u", - "distinct": false, - "sha": "s", - "id": "i", - "tree_id": "tid", - "timestamp": ` + referenceTimeStr + `, - "committer": { - "name": "n", - "email": "e", - "username": "l" + "url":"u", + "distinct":false, + "sha":"s", + "id":"i", + "tree_id":"tid", + "timestamp":` + referenceTimeStr + `, + "committer":{ + "name":"n", + "email":"e", + "username":"l" } }, - "workflow_url": "w", - "repository": { - "id": 1, - "url": "u", - "name": "n" + "workflow_url":"w", + "repository":{ + "id":1, + "name":"n", + "url":"u" }, - "head_repository": { - "id": 1, - "url": "u", - "name": "n" + "head_repository":{ + "id":1, + "name":"n", + "url":"u" }, - "actor": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "actor":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "triggering_actor": { - "login": "l2", - "id": 2, - "avatar_url": "a2", - "gravatar_id": "g2", - "name": "n2", - "company": "c2", - "blog": "b2", - "location": "l2", - "email": "e2", - "hireable": false, - "bio": "b2", - "twitter_username": "t2", - "public_repos": 2, - "followers": 2, - "following": 2, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u2" + "triggering_actor":{ + "login":"l2", + "id":2, + "avatar_url":"a2", + "gravatar_id":"g2", + "name":"n2", + "company":"c2", + "blog":"b2", + "location":"l2", + "email":"e2", + "hireable":false, + "bio":"b2", + "twitter_username":"t2", + "public_repos":2, + "followers":2, + "following":2, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u2" } } ] @@ -1154,8 +1154,8 @@ func TestWorkflowRunBill_Marshal(t *testing.T) { } want := `{ - "total_ms": 1, - "jobs": 1 + "total_ms":1, + "jobs":1 }` testJSONMarshal(t, u, want) @@ -1180,17 +1180,17 @@ func TestWorkflowRunBillMap_Marshal(t *testing.T) { } want := `{ - "UBUNTU": { - "total_ms": 1, - "jobs": 1 + "MACOS":{ + "total_ms":1, + "jobs":1 }, - "MACOS": { - "total_ms": 1, - "jobs": 1 + "UBUNTU":{ + "total_ms":1, + "jobs":1 }, - "WINDOWS": { - "total_ms": 1, - "jobs": 1 + "WINDOWS":{ + "total_ms":1, + "jobs":1 } }` @@ -1219,21 +1219,21 @@ func TestWorkflowRunUsage_Marshal(t *testing.T) { } want := `{ - "billable": { - "UBUNTU": { - "total_ms": 1, - "jobs": 1 + "billable":{ + "MACOS":{ + "total_ms":1, + "jobs":1 }, - "MACOS": { - "total_ms": 1, - "jobs": 1 + "UBUNTU":{ + "total_ms":1, + "jobs":1 }, - "WINDOWS": { - "total_ms": 1, - "jobs": 1 + "WINDOWS":{ + "total_ms":1, + "jobs":1 } }, - "run_duration_ms": 1 + "run_duration_ms":1 }` testJSONMarshal(t, u, want) diff --git a/github/actions_workflows_test.go b/github/actions_workflows_test.go index 66ad164f4ac..d9e79749135 100644 --- a/github/actions_workflows_test.go +++ b/github/actions_workflows_test.go @@ -476,16 +476,16 @@ func TestWorkflow_Marshal(t *testing.T) { } want := `{ - "id": 1, - "node_id": "nid", - "name": "n", - "path": "p", - "state": "s", - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "url": "u", - "html_url": "h", - "badge_url": "b" + "id":1, + "node_id":"nid", + "name":"n", + "path":"p", + "state":"s", + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "url":"u", + "html_url":"h", + "badge_url":"b" }` testJSONMarshal(t, u, want) @@ -513,19 +513,21 @@ func TestWorkflows_Marshal(t *testing.T) { } want := `{ - "total_count": 1, - "workflows": [{ - "id": 1, - "node_id": "nid", - "name": "n", - "path": "p", - "state": "s", - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "url": "u", - "html_url": "h", - "badge_url": "b" - }] + "total_count":1, + "workflows":[ + { + "id":1, + "node_id":"nid", + "name":"n", + "path":"p", + "state":"s", + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "url":"u", + "html_url":"h", + "badge_url":"b" + } + ] }` testJSONMarshal(t, u, want) @@ -538,9 +540,7 @@ func TestWorkflowBill_Marshal(t *testing.T) { TotalMS: Int64(1), } - want := `{ - "total_ms": 1 - }` + want := `{"total_ms":1}` testJSONMarshal(t, u, want) } @@ -561,14 +561,14 @@ func TestWorkflowBillMap_Marshal(t *testing.T) { } want := `{ - "UBUNTU": { - "total_ms": 1 + "MACOS":{ + "total_ms":1 }, - "MACOS": { - "total_ms": 1 + "UBUNTU":{ + "total_ms":1 }, - "WINDOWS": { - "total_ms": 1 + "WINDOWS":{ + "total_ms":1 } }` @@ -593,15 +593,15 @@ func TestWorkflowUsage_Marshal(t *testing.T) { } want := `{ - "billable": { - "UBUNTU": { - "total_ms": 1 + "billable":{ + "MACOS":{ + "total_ms":1 }, - "MACOS": { - "total_ms": 1 + "UBUNTU":{ + "total_ms":1 }, - "WINDOWS": { - "total_ms": 1 + "WINDOWS":{ + "total_ms":1 } } }` @@ -610,7 +610,7 @@ func TestWorkflowUsage_Marshal(t *testing.T) { } func TestCreateWorkflowDispatchEventRequest_Marshal(t *testing.T) { - testJSONMarshal(t, &CreateWorkflowDispatchEventRequest{}, "{}") + testJSONMarshal(t, &CreateWorkflowDispatchEventRequest{}, `{"ref":""}`) inputs := make(map[string]interface{}, 0) inputs["key"] = "value" @@ -621,9 +621,9 @@ func TestCreateWorkflowDispatchEventRequest_Marshal(t *testing.T) { } want := `{ - "ref": "r", - "inputs": { - "key": "value" + "ref":"r", + "inputs":{ + "key":"value" } }` diff --git a/github/activity_notifications_test.go b/github/activity_notifications_test.go index 815238ebb5e..49c26ef0fc6 100644 --- a/github/activity_notifications_test.go +++ b/github/activity_notifications_test.go @@ -337,23 +337,23 @@ func TestNotification_Marshal(t *testing.T) { } want := `{ - "id": "id", - "repository": { - "id": 1, - "url": "u", - "name": "n" + "id":"id", + "repository":{ + "id":1, + "name":"n", + "url":"u" }, - "subject": { - "title": "t", - "url": "u", - "latest_comment_url": "l", - "type": "t" + "subject":{ + "title":"t", + "url":"u", + "latest_comment_url":"l", + "type":"t" }, - "reason": "r", - "unread": true, - "updated_at": ` + referenceTimeStr + `, - "last_read_at": ` + referenceTimeStr + `, - "url": "u" + "reason":"r", + "unread":true, + "updated_at":` + referenceTimeStr + `, + "last_read_at":` + referenceTimeStr + `, + "url":"u" }` testJSONMarshal(t, u, want) @@ -370,24 +370,24 @@ func TestNotificationSubject_Marshal(t *testing.T) { } want := `{ - "title": "t", - "url": "u", - "latest_comment_url": "l", - "type": "t" + "title":"t", + "url":"u", + "latest_comment_url":"l", + "type":"t" }` testJSONMarshal(t, u, want) } func TestMarkReadOptions_Marshal(t *testing.T) { - testJSONMarshal(t, &markReadOptions{}, "{}") + testJSONMarshal(t, &markReadOptions{}, `{"last_read_at":"0001-01-01T00:00:00Z"}`) u := &markReadOptions{ LastReadAt: Timestamp{referenceTime}, } want := `{ - "last_read_at": ` + referenceTimeStr + ` + "last_read_at":` + referenceTimeStr + ` }` testJSONMarshal(t, u, want) diff --git a/github/activity_star_test.go b/github/activity_star_test.go index 122c399366d..8067f197249 100644 --- a/github/activity_star_test.go +++ b/github/activity_star_test.go @@ -299,11 +299,11 @@ func TestStarredRepository_Marshal(t *testing.T) { } want := `{ - "starred_at": ` + referenceTimeStr + `, - "repo": { - "id": 1, - "url": "u", - "name": "n" + "starred_at":` + referenceTimeStr + `, + "repo":{ + "id":1, + "name":"n", + "url":"u" } }` @@ -338,26 +338,26 @@ func TestStargazer_Marshal(t *testing.T) { } want := `{ - "starred_at": ` + referenceTimeStr + `, - "user": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "starred_at":` + referenceTimeStr + `, + "user":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" } }` diff --git a/github/activity_test.go b/github/activity_test.go index e2d800220d8..2db4de8433c 100644 --- a/github/activity_test.go +++ b/github/activity_test.go @@ -140,8 +140,8 @@ func TestFeedLink_Marshal(t *testing.T) { } want := `{ - "href": "h", - "type": "t" + "href":"h", + "type":"t" }` testJSONMarshal(t, u, want) @@ -193,42 +193,44 @@ func TestFeeds_Marshal(t *testing.T) { } want := `{ - "timeline_url": "t", - "user_url": "u", - "current_user_public_url": "cupu", - "current_user_url": "cuu", - "current_user_actor_url": "cuau", - "current_user_organization_url": "cuou", - "current_user_organization_urls": ["a"], - "_links": { - "timeline": { - "href": "h", - "type": "t" - }, - "user": { - "href": "h", - "type": "t" + "timeline_url":"t", + "user_url":"u", + "current_user_public_url":"cupu", + "current_user_url":"cuu", + "current_user_actor_url":"cuau", + "current_user_organization_url":"cuou", + "current_user_organization_urls":[ + "a" + ], + "_links":{ + "timeline":{ + "href":"h", + "type":"t" + }, + "user":{ + "href":"h", + "type":"t" }, - "current_user_public": { - "href": "h", - "type": "t" + "current_user_public":{ + "href":"h", + "type":"t" }, - "current_user": { - "href": "h", - "type": "t" + "current_user":{ + "href":"h", + "type":"t" }, - "current_user_actor": { - "href": "h", - "type": "t" + "current_user_actor":{ + "href":"h", + "type":"t" }, - "current_user_organization": { - "href": "h", - "type": "t" + "current_user_organization":{ + "href":"h", + "type":"t" }, - "current_user_organizations": [ + "current_user_organizations":[ { - "href": "h", - "type": "t" + "href":"h", + "type":"t" } ] } @@ -274,34 +276,34 @@ func TestFeedLinks_Marshal(t *testing.T) { } want := `{ - "timeline": { - "href": "h", - "type": "t" + "timeline":{ + "href":"h", + "type":"t" }, - "user": { - "href": "h", - "type": "t" + "user":{ + "href":"h", + "type":"t" }, - "current_user_public": { - "href": "h", - "type": "t" + "current_user_public":{ + "href":"h", + "type":"t" }, - "current_user": { - "href": "h", - "type": "t" + "current_user":{ + "href":"h", + "type":"t" }, - "current_user_actor": { - "href": "h", - "type": "t" + "current_user_actor":{ + "href":"h", + "type":"t" }, - "current_user_organization": { - "href": "h", - "type": "t" + "current_user_organization":{ + "href":"h", + "type":"t" }, - "current_user_organizations": [ + "current_user_organizations":[ { - "href": "h", - "type": "t" + "href":"h", + "type":"t" } ] }` diff --git a/github/activity_watching_test.go b/github/activity_watching_test.go index da43f5a481e..e7af5d34b2d 100644 --- a/github/activity_watching_test.go +++ b/github/activity_watching_test.go @@ -272,13 +272,13 @@ func TestSubscription_Marshal(t *testing.T) { } want := `{ - "subscribed": true, - "ignored": false, - "reason": "r", - "created_at": ` + referenceTimeStr + `, - "url": "u", - "repository_url": "ru", - "thread_url": "tu" + "subscribed":true, + "ignored":false, + "reason":"r", + "created_at":` + referenceTimeStr + `, + "url":"u", + "repository_url":"ru", + "thread_url":"tu" }` testJSONMarshal(t, u, want) diff --git a/github/admin_orgs_test.go b/github/admin_orgs_test.go index 55963441c7a..2a3a645aad4 100644 --- a/github/admin_orgs_test.go +++ b/github/admin_orgs_test.go @@ -151,8 +151,8 @@ func TestCreateOrgRequest_Marshal(t *testing.T) { } want := `{ - "login": "l", - "admin": "a" + "login":"l", + "admin":"a" }` testJSONMarshal(t, u, want) @@ -165,9 +165,7 @@ func TestRenameOrgRequest_Marshal(t *testing.T) { Login: String("l"), } - want := `{ - "login": "l" - }` + want := `{"login":"l"}` testJSONMarshal(t, u, want) } @@ -181,8 +179,8 @@ func TestRenameOrgResponse_Marshal(t *testing.T) { } want := `{ - "message": "m", - "url": "u" + "message":"m", + "url":"u" }` testJSONMarshal(t, u, want) diff --git a/github/admin_stats_test.go b/github/admin_stats_test.go index dab2bc21fce..972b9bef69c 100644 --- a/github/admin_stats_test.go +++ b/github/admin_stats_test.go @@ -220,9 +220,9 @@ func TestIssueStats_Marshal(t *testing.T) { } want := `{ - "total_issues": 1, - "open_issues": 1, - "closed_issues": 1 + "total_issues":1, + "open_issues":1, + "closed_issues":1 }` testJSONMarshal(t, u, want) @@ -238,9 +238,9 @@ func TestHookStats_Marshal(t *testing.T) { } want := `{ - "total_hooks": 1, - "active_hooks": 1, - "inactive_hooks": 1 + "total_hooks":1, + "active_hooks":1, + "inactive_hooks":1 }` testJSONMarshal(t, u, want) @@ -256,9 +256,9 @@ func TestMilestoneStats_Marshal(t *testing.T) { } want := `{ - "total_milestones": 1, - "open_milestones": 1, - "closed_milestones": 1 + "total_milestones":1, + "open_milestones":1, + "closed_milestones":1 }` testJSONMarshal(t, u, want) @@ -275,10 +275,10 @@ func TestOrgStats_Marshal(t *testing.T) { } want := `{ - "total_orgs": 1, - "disabled_orgs": 1, - "total_teams": 1, - "total_team_members": 1 + "total_orgs":1, + "disabled_orgs":1, + "total_teams":1, + "total_team_members":1 }` testJSONMarshal(t, u, want) @@ -295,10 +295,10 @@ func TestCommentStats_Marshal(t *testing.T) { } want := `{ - "total_commit_comments": 1, - "total_gist_comments": 1, - "total_issue_comments": 1, - "total_pull_request_comments": 1 + "total_commit_comments":1, + "total_gist_comments":1, + "total_issue_comments":1, + "total_pull_request_comments":1 }` testJSONMarshal(t, u, want) @@ -311,9 +311,7 @@ func TestPageStats_Marshal(t *testing.T) { TotalPages: Int(1), } - want := `{ - "total_pages": 1 - }` + want := `{"total_pages":1}` testJSONMarshal(t, u, want) } @@ -328,9 +326,9 @@ func TestUserStats_Marshal(t *testing.T) { } want := `{ - "total_users": 1, - "admin_users": 1, - "suspended_users": 1 + "total_users":1, + "admin_users":1, + "suspended_users":1 }` testJSONMarshal(t, u, want) @@ -346,9 +344,9 @@ func TestGistStats_Marshal(t *testing.T) { } want := `{ - "total_gists": 1, - "private_gists": 1, - "public_gists": 1 + "total_gists":1, + "private_gists":1, + "public_gists":1 }` testJSONMarshal(t, u, want) @@ -365,10 +363,10 @@ func TestPullStats_Marshal(t *testing.T) { } want := `{ - "total_pulls": 1, - "merged_pulls": 1, - "mergeable_pulls": 1, - "unmergeable_pulls": 1 + "total_pulls":1, + "merged_pulls":1, + "mergeable_pulls":1, + "unmergeable_pulls":1 }` testJSONMarshal(t, u, want) @@ -387,12 +385,12 @@ func TestRepoStats_Marshal(t *testing.T) { } want := `{ - "total_repos": 1, - "root_repos": 1, - "fork_repos": 1, - "org_repos": 1, - "total_pushes": 1, - "total_wikis": 1 + "total_repos":1, + "root_repos":1, + "fork_repos":1, + "org_repos":1, + "total_pushes":1, + "total_wikis":1 }` testJSONMarshal(t, u, want) @@ -459,59 +457,59 @@ func TestAdminStats_Marshal(t *testing.T) { } want := `{ - "repos": { - "total_repos": 212, - "root_repos": 194, - "fork_repos": 18, - "org_repos": 51, - "total_pushes": 3082, - "total_wikis": 15 + "issues":{ + "total_issues":179, + "open_issues":83, + "closed_issues":96 }, - "hooks": { - "total_hooks": 27, - "active_hooks": 23, - "inactive_hooks": 4 + "hooks":{ + "total_hooks":27, + "active_hooks":23, + "inactive_hooks":4 }, - "pages": { - "total_pages": 36 + "milestones":{ + "total_milestones":7, + "open_milestones":6, + "closed_milestones":1 }, - "orgs": { - "total_orgs": 33, - "disabled_orgs": 0, - "total_teams": 60, - "total_team_members": 314 + "orgs":{ + "total_orgs":33, + "disabled_orgs":0, + "total_teams":60, + "total_team_members":314 }, - "users": { - "total_users": 254, - "admin_users": 45, - "suspended_users": 21 + "comments":{ + "total_commit_comments":6, + "total_gist_comments":28, + "total_issue_comments":366, + "total_pull_request_comments":30 }, - "pulls": { - "total_pulls": 86, - "merged_pulls": 60, - "mergeable_pulls": 21, - "unmergeable_pulls": 3 + "pages":{ + "total_pages":36 }, - "issues": { - "total_issues": 179, - "open_issues": 83, - "closed_issues": 96 + "users":{ + "total_users":254, + "admin_users":45, + "suspended_users":21 }, - "milestones": { - "total_milestones": 7, - "open_milestones": 6, - "closed_milestones": 1 + "gists":{ + "total_gists":178, + "private_gists":151, + "public_gists":25 }, - "gists": { - "total_gists": 178, - "private_gists": 151, - "public_gists": 25 + "pulls":{ + "total_pulls":86, + "merged_pulls":60, + "mergeable_pulls":21, + "unmergeable_pulls":3 }, - "comments": { - "total_commit_comments": 6, - "total_gist_comments": 28, - "total_issue_comments": 366, - "total_pull_request_comments": 30 + "repos":{ + "total_repos":212, + "root_repos":194, + "fork_repos":18, + "org_repos":51, + "total_pushes":3082, + "total_wikis":15 } }` diff --git a/github/admin_test.go b/github/admin_test.go index dbe0bd2802b..f0ea9c11d3d 100644 --- a/github/admin_test.go +++ b/github/admin_test.go @@ -175,16 +175,16 @@ func TestTeamLDAPMapping_Marshal(t *testing.T) { } want := `{ - "id": 1, - "ldap_dn": "ldapdn", - "url": "u", - "name": "n", - "slug": "s", - "description": "d", - "privacy": "p", - "permission": "per", - "members_url": "mu", - "repositories_url": "ru" + "id":1, + "ldap_dn":"ldapdn", + "url":"u", + "name":"n", + "slug":"s", + "description":"d", + "privacy":"p", + "permission":"per", + "members_url":"mu", + "repositories_url":"ru" }` testJSONMarshal(t, u, want) @@ -214,23 +214,23 @@ func TestUserLDAPMapping_Marshal(t *testing.T) { } want := `{ - "id": 1, - "ldap_dn": "ldapdn", - "login": "l", - "avatar_url": "au", - "gravatar_id": "gi", - "type": "t", - "site_admin": true, - "url": "u", - "events_url": "eu", - "following_url": "fu", - "followers_url": "fu", - "gists_url": "gu", - "organizations_url": "ou", - "received_events_url": "reu", - "repos_url": "ru", - "starred_url": "su", - "subscriptions_url": "subu" + "id":1, + "ldap_dn":"ldapdn", + "login":"l", + "avatar_url":"au", + "gravatar_id":"gi", + "type":"t", + "site_admin":true, + "url":"u", + "events_url":"eu", + "following_url":"fu", + "followers_url":"fu", + "gists_url":"gu", + "organizations_url":"ou", + "received_events_url":"reu", + "repos_url":"ru", + "starred_url":"su", + "subscriptions_url":"subu" }` testJSONMarshal(t, u, want) @@ -253,16 +253,16 @@ func TestEnterprise_Marshal(t *testing.T) { } want := `{ - "id": 1, - "slug": "s", - "name": "n", - "node_id": "nid", - "avatar_url": "au", - "description": "d", - "website_url": "wu", - "html_url": "hu", - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + ` + "id":1, + "slug":"s", + "name":"n", + "node_id":"nid", + "avatar_url":"au", + "description":"d", + "website_url":"wu", + "html_url":"hu", + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + ` }` testJSONMarshal(t, u, want) diff --git a/github/admin_users_test.go b/github/admin_users_test.go index 2dac611709e..609cbb87a8f 100644 --- a/github/admin_users_test.go +++ b/github/admin_users_test.go @@ -185,8 +185,8 @@ func TestCreateUserRequest_Marshal(t *testing.T) { } want := `{ - "login": "l", - "email": "e" + "login":"l", + "email":"e" }` testJSONMarshal(t, u, want) @@ -201,9 +201,7 @@ func TestImpersonateUserOptions_Marshal(t *testing.T) { }, } - want := `{ - "scopes": ["s"] - }` + want := `{"scopes":["s"]}` testJSONMarshal(t, u, want) } @@ -218,9 +216,9 @@ func TestOAuthAPP_Marshal(t *testing.T) { } want := `{ - "url": "u", - "name": "n", - "client_id": "cid" + "url":"u", + "name":"n", + "client_id":"cid" }` testJSONMarshal(t, u, want) @@ -251,22 +249,24 @@ func TestUserAuthorization_Marshal(t *testing.T) { } want := `{ - "id": 1, - "url": "u", - "scopes": ["s"], - "token": "t", - "token_last_eight": "tle", - "hashed_token": "ht", - "app": { - "url": "u", - "name": "n", - "client_id": "cid" + "id":1, + "url":"u", + "scopes":[ + "s" + ], + "token":"t", + "token_last_eight":"tle", + "hashed_token":"ht", + "app":{ + "url":"u", + "name":"n", + "client_id":"cid" }, - "note": "n", - "note_url": "nu", - "updated_at": ` + referenceTimeStr + `, - "created_at": ` + referenceTimeStr + `, - "fingerprint": "f" + "note":"n", + "note_url":"nu", + "updated_at":` + referenceTimeStr + `, + "created_at":` + referenceTimeStr + `, + "fingerprint":"f" }` testJSONMarshal(t, u, want) diff --git a/github/apps_installation_test.go b/github/apps_installation_test.go index 56f0ad9e81d..7544f54bf79 100644 --- a/github/apps_installation_test.go +++ b/github/apps_installation_test.go @@ -175,7 +175,7 @@ func TestAppsService_RevokeInstallationToken(t *testing.T) { } func TestListRepositories_Marshal(t *testing.T) { - testJSONMarshal(t, &ListRepositories{}, "{}") + testJSONMarshal(t, &ListRepositories{}, `{"repositories":null}`) u := &ListRepositories{ TotalCount: Int(1), @@ -189,12 +189,14 @@ func TestListRepositories_Marshal(t *testing.T) { } want := `{ - "total_count": 1, - "repositories": [{ - "id":1, - "name":"n", - "url":"u" - }] + "total_count":1, + "repositories":[ + { + "id":1, + "name":"n", + "url":"u" + } + ] }` testJSONMarshal(t, u, want) diff --git a/github/apps_manifest_test.go b/github/apps_manifest_test.go index 833982e4850..745d46d0919 100644 --- a/github/apps_manifest_test.go +++ b/github/apps_manifest_test.go @@ -107,39 +107,39 @@ func TestAppConfig_Marshal(t *testing.T) { } want := `{ - "id": 1, - "slug": "s", - "node_id": "nid", - "owner": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "id":1, + "slug":"s", + "node_id":"nid", + "owner":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "name": "n", - "description": "d", - "external_url": "eu", - "html_url": "hu", - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "client_id": "ci", - "client_secret": "cs", - "webhook_secret": "ws", - "pem": "pem" + "name":"n", + "description":"d", + "external_url":"eu", + "html_url":"hu", + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "client_id":"ci", + "client_secret":"cs", + "webhook_secret":"ws", + "pem":"pem" }` testJSONMarshal(t, u, want) diff --git a/github/apps_marketplace_test.go b/github/apps_marketplace_test.go index dcf5eb89ca1..f69f5a4cc70 100644 --- a/github/apps_marketplace_test.go +++ b/github/apps_marketplace_test.go @@ -256,19 +256,21 @@ func TestMarketplacePlan_Marshal(t *testing.T) { } want := `{ - "url": "u", - "accounts_url": "au", - "id": 1, - "number": 1, - "name": "n", - "description": "d", - "monthly_price_in_cents": 1, - "yearly_price_in_cents": 1, - "price_model": "pm", - "unit_name": "un", - "bullets": ["b"], - "state": "s", - "has_free_trial": false + "url":"u", + "accounts_url":"au", + "id":1, + "number":1, + "name":"n", + "description":"d", + "monthly_price_in_cents":1, + "yearly_price_in_cents":1, + "price_model":"pm", + "unit_name":"un", + "bullets":[ + "b" + ], + "state":"s", + "has_free_trial":false }` testJSONMarshal(t, u, want) @@ -302,27 +304,29 @@ func TestMarketplacePurchase_Marshal(t *testing.T) { } want := `{ - "billing_cycle": "bc", - "next_billing_date": ` + referenceTimeStr + `, - "unit_count": 1, - "plan": { - "url": "u", - "accounts_url": "au", - "id": 1, - "number": 1, - "name": "n", - "description": "d", - "monthly_price_in_cents": 1, - "yearly_price_in_cents": 1, - "price_model": "pm", - "unit_name": "un", - "bullets": ["b"], - "state": "s", - "has_free_trial": false - }, - "on_free_trial": false, - "free_trial_ends_on": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + ` + "billing_cycle":"bc", + "next_billing_date":` + referenceTimeStr + `, + "unit_count":1, + "plan":{ + "url":"u", + "accounts_url":"au", + "id":1, + "number":1, + "name":"n", + "description":"d", + "monthly_price_in_cents":1, + "yearly_price_in_cents":1, + "price_model":"pm", + "unit_name":"un", + "bullets":[ + "b" + ], + "state":"s", + "has_free_trial":false + }, + "on_free_trial":false, + "free_trial_ends_on":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + ` }` testJSONMarshal(t, u, want) @@ -353,24 +357,26 @@ func TestMarketplacePendingChange_Marshal(t *testing.T) { } want := `{ - "effective_date": ` + referenceTimeStr + `, - "unit_count": 1, - "id": 1, - "plan": { - "url": "u", - "accounts_url": "au", - "id": 1, - "number": 1, - "name": "n", - "description": "d", - "monthly_price_in_cents": 1, - "yearly_price_in_cents": 1, - "price_model": "pm", - "unit_name": "un", - "bullets": ["b"], - "state": "s", - "has_free_trial": false - } + "effective_date":` + referenceTimeStr + `, + "unit_count":1, + "id":1, + "plan":{ + "url":"u", + "accounts_url":"au", + "id":1, + "number":1, + "name":"n", + "description":"d", + "monthly_price_in_cents":1, + "yearly_price_in_cents":1, + "price_model":"pm", + "unit_name":"un", + "bullets":[ + "b" + ], + "state":"s", + "has_free_trial":false + } }` testJSONMarshal(t, u, want) @@ -431,52 +437,56 @@ func TestMarketplacePlanAccount_Marshal(t *testing.T) { } want := `{ - "url": "u", - "type": "t", - "id": 1, - "login": "l", - "organization_billing_email": "obe", - "marketplace_purchase": { - "billing_cycle": "bc", - "next_billing_date": ` + referenceTimeStr + `, - "unit_count": 1, - "plan": { - "url": "u", - "accounts_url": "au", - "id": 1, - "number": 1, - "name": "n", - "description": "d", - "monthly_price_in_cents": 1, - "yearly_price_in_cents": 1, - "price_model": "pm", - "unit_name": "un", - "bullets": ["b"], - "state": "s", - "has_free_trial": false - }, - "on_free_trial": false, - "free_trial_ends_on": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + ` + "url":"u", + "type":"t", + "id":1, + "login":"l", + "organization_billing_email":"obe", + "marketplace_purchase":{ + "billing_cycle":"bc", + "next_billing_date":` + referenceTimeStr + `, + "unit_count":1, + "plan":{ + "url":"u", + "accounts_url":"au", + "id":1, + "number":1, + "name":"n", + "description":"d", + "monthly_price_in_cents":1, + "yearly_price_in_cents":1, + "price_model":"pm", + "unit_name":"un", + "bullets":[ + "b" + ], + "state":"s", + "has_free_trial":false + }, + "on_free_trial":false, + "free_trial_ends_on":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + ` }, - "marketplace_pending_change": { - "effective_date": ` + referenceTimeStr + `, - "unit_count": 1, - "id": 1, - "plan": { - "url": "u", - "accounts_url": "au", - "id": 1, - "number": 1, - "name": "n", - "description": "d", - "monthly_price_in_cents": 1, - "yearly_price_in_cents": 1, - "price_model": "pm", - "unit_name": "un", - "bullets": ["b"], - "state": "s", - "has_free_trial": false + "marketplace_pending_change":{ + "effective_date":` + referenceTimeStr + `, + "unit_count":1, + "id":1, + "plan":{ + "url":"u", + "accounts_url":"au", + "id":1, + "number":1, + "name":"n", + "description":"d", + "monthly_price_in_cents":1, + "yearly_price_in_cents":1, + "price_model":"pm", + "unit_name":"un", + "bullets":[ + "b" + ], + "state":"s", + "has_free_trial":false } } }` diff --git a/github/apps_test.go b/github/apps_test.go index a58326ea5ee..80c6f8c53c1 100644 --- a/github/apps_test.go +++ b/github/apps_test.go @@ -657,9 +657,9 @@ func TestContentReference_Marshal(t *testing.T) { } want := `{ - "id": 1, - "node_id": "nid", - "reference": "r" + "id":1, + "node_id":"nid", + "reference":"r" }` testJSONMarshal(t, u, want) @@ -675,9 +675,9 @@ func TestAttachment_Marshal(t *testing.T) { } want := `{ - "id": 1, - "title": "t", - "body": "b" + "id":1, + "title":"t", + "body":"b" }` testJSONMarshal(t, u, want) @@ -722,38 +722,38 @@ func TestInstallationPermissions_Marshal(t *testing.T) { } want := `{ - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", "vulnerability_alerts":"va", - "workflows": "w" + "workflows":"w" }` testJSONMarshal(t, u, want) @@ -857,101 +857,101 @@ func TestInstallation_Marshal(t *testing.T) { } want := `{ - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "suspended_at": ` + referenceTimeStr + ` + "suspended_at":` + referenceTimeStr + ` }` testJSONMarshal(t, u, want) @@ -999,40 +999,42 @@ func TestInstallationTokenOptions_Marshal(t *testing.T) { } want := `{ - "repository_ids": [1], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" + "repository_ids":[ + 1 + ], + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" } }` @@ -1089,47 +1091,47 @@ func TestInstallationToken_Marshal(t *testing.T) { } want := `{ - "token": "t", - "expires_at": ` + referenceTimeStr + `, - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" + "token":"t", + "expires_at":` + referenceTimeStr + `, + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" }, - "repositories": [ + "repositories":[ { - "id": 1, - "url": "u", - "name": "n" + "id":1, + "name":"n", + "url":"u" } ] }` @@ -1208,70 +1210,72 @@ func TestApp_Marshal(t *testing.T) { } want := `{ - "id": 1, - "slug": "s", - "node_id": "nid", - "owner": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "id":1, + "slug":"s", + "node_id":"nid", + "owner":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "name": "n", - "description": "d", - "external_url": "eu", - "html_url": "hu", - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" + "name":"n", + "description":"d", + "external_url":"eu", + "html_url":"hu", + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" }, - "events": ["s"] + "events":[ + "s" + ] }` testJSONMarshal(t, u, want) diff --git a/github/authorizations_test.go b/github/authorizations_test.go index bd7ff29d811..bd0cd2e3ae4 100644 --- a/github/authorizations_test.go +++ b/github/authorizations_test.go @@ -217,12 +217,12 @@ func TestAuthorizationUpdateRequest_Marshal(t *testing.T) { } want := `{ - "scopes": ["s"], - "add_scopes": ["a"], - "remove_scopes": ["r"], - "note": "n", - "note_url": "nu", - "fingerprint": "f" + "scopes":["s"], + "add_scopes":["a"], + "remove_scopes":["r"], + "note":"n", + "note_url":"nu", + "fingerprint":"f" }` testJSONMarshal(t, u, want) @@ -241,12 +241,12 @@ func TestAuthorizationRequest_Marshal(t *testing.T) { } want := `{ - "scopes": ["s"], - "client_id": "cid", - "client_secret": "cs", - "note": "n", - "note_url": "nu", - "fingerprint": "f" + "scopes":["s"], + "note":"n", + "note_url":"nu", + "client_id":"cid", + "client_secret":"cs", + "fingerprint":"f" }` testJSONMarshal(t, u, want) @@ -262,9 +262,9 @@ func TestAuthorizationApp_Marshal(t *testing.T) { } want := `{ - "url": "u", - "name": "n", - "client_id": "cid" + "url":"u", + "name":"n", + "client_id":"cid" }` testJSONMarshal(t, u, want) @@ -287,16 +287,18 @@ func TestGrant_Marshal(t *testing.T) { } want := `{ - "id": 1, - "url": "u", - "app": { - "url": "u", - "name": "n", - "client_id": "cid" + "id":1, + "url":"u", + "app":{ + "url":"u", + "name":"n", + "client_id":"cid" }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "scopes": ["s"] + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "scopes":[ + "s" + ] }` testJSONMarshal(t, u, want) @@ -345,41 +347,43 @@ func TestAuthorization_Marshal(t *testing.T) { } want := `{ - "id": 1, - "url": "u", - "scopes": ["s"], - "token": "t", - "token_last_eight": "tle", - "hashed_token": "ht", - "app": { - "url": "u", - "name": "n", - "client_id": "cid" + "id":1, + "url":"u", + "scopes":[ + "s" + ], + "token":"t", + "token_last_eight":"tle", + "hashed_token":"ht", + "app":{ + "url":"u", + "name":"n", + "client_id":"cid" }, - "note": "n", - "note_url": "nu", - "updated_at": ` + referenceTimeStr + `, - "created_at": ` + referenceTimeStr + `, - "fingerprint": "f", - "user": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "note":"n", + "note_url":"nu", + "updated_at":` + referenceTimeStr + `, + "created_at":` + referenceTimeStr + `, + "fingerprint":"f", + "user":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" } }` diff --git a/github/billing_test.go b/github/billing_test.go index d7adcb09f72..4afea36dc7e 100644 --- a/github/billing_test.go +++ b/github/billing_test.go @@ -356,9 +356,9 @@ func TestMinutesUsedBreakdown_Marshal(t *testing.T) { } want := `{ - "UBUNTU": 1, - "MACOS": 1, - "WINDOWS": 1 + "MACOS":1, + "UBUNTU":1, + "WINDOWS":1 }` testJSONMarshal(t, u, want) @@ -379,13 +379,13 @@ func TestActionBilling_Marshal(t *testing.T) { } want := `{ - "total_minutes_used": 1, - "total_paid_minutes_used": 1, - "included_minutes": 1, - "minutes_used_breakdown": { - "UBUNTU": 1, - "MACOS": 1, - "WINDOWS": 1 + "total_minutes_used":1, + "total_paid_minutes_used":1, + "included_minutes":1, + "minutes_used_breakdown":{ + "MACOS":1, + "UBUNTU":1, + "WINDOWS":1 } }` @@ -393,7 +393,11 @@ func TestActionBilling_Marshal(t *testing.T) { } func TestPackageBilling_Marshal(t *testing.T) { - testJSONMarshal(t, &PackageBilling{}, "{}") + testJSONMarshal(t, &PackageBilling{}, `{ + "total_gigabytes_bandwidth_used":0, + "total_paid_gigabytes_bandwidth_used":0, + "included_gigabytes_bandwidth":0 + }`) u := &PackageBilling{ TotalGigabytesBandwidthUsed: 1, @@ -402,16 +406,20 @@ func TestPackageBilling_Marshal(t *testing.T) { } want := `{ - "total_gigabytes_bandwidth_used": 1, - "total_paid_gigabytes_bandwidth_used": 1, - "included_gigabytes_bandwidth": 1 + "total_gigabytes_bandwidth_used":1, + "total_paid_gigabytes_bandwidth_used":1, + "included_gigabytes_bandwidth":1 }` testJSONMarshal(t, u, want) } func TestStorageBilling_Marshal(t *testing.T) { - 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, @@ -420,9 +428,9 @@ func TestStorageBilling_Marshal(t *testing.T) { } want := `{ - "days_left_in_billing_cycle": 1, - "estimated_paid_storage_for_month": 1, - "estimated_storage_for_month": 1 + "days_left_in_billing_cycle":1, + "estimated_paid_storage_for_month":1, + "estimated_storage_for_month":1 }` testJSONMarshal(t, u, want) diff --git a/github/checks_test.go b/github/checks_test.go index 2fdd2476e56..e36635e611a 100644 --- a/github/checks_test.go +++ b/github/checks_test.go @@ -732,92 +732,92 @@ func Test_CheckRunMarshal(t *testing.T) { }, }, } - w := fmt.Sprintf(`{ - "id": 1, - "node_id": "n", - "head_sha": "h", - "external_id": "1", - "url": "u", - "html_url": "u", - "details_url": "u", - "status": "s", - "conclusion": "c", - "started_at": "%s", - "completed_at": "%s", - "output": { - "title": "t", - "summary": "s", - "text": "t", - "annotations_count": 1, - "annotations_url": "a", - "annotations": [ + w := `{ + "id":1, + "node_id":"n", + "head_sha":"h", + "external_id":"1", + "url":"u", + "html_url":"u", + "details_url":"u", + "status":"s", + "conclusion":"c", + "started_at":"` + ts + `", + "completed_at":"` + ts + `", + "output":{ + "title":"t", + "summary":"s", + "text":"t", + "annotations_count":1, + "annotations_url":"a", + "annotations":[ { - "path": "p", - "start_line": 1, - "end_line": 1, - "annotation_level": "a", - "message": "m", - "title": "t", - "raw_details": "r" + "path":"p", + "start_line":1, + "end_line":1, + "annotation_level":"a", + "message":"m", + "title":"t", + "raw_details":"r" } ], - "images": [ + "images":[ { - "alt": "a", - "image_url": "i", - "caption": "c" + "alt":"a", + "image_url":"i", + "caption":"c" } ] }, - "name": "n", - "check_suite": { - "id": 1 + "name":"n", + "check_suite":{ + "id":1 }, - "app": { - "id": 1, - "node_id": "n", - "owner": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" + "app":{ + "id":1, + "node_id":"n", + "owner":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" }, - "name": "n", - "description": "d", - "external_url": "u", - "html_url": "h", - "created_at": "%s", - "updated_at": "%s" + "name":"n", + "description":"d", + "external_url":"u", + "html_url":"h", + "created_at":"` + ts + `", + "updated_at":"` + ts + `" }, - "pull_requests": [ + "pull_requests":[ { - "id": 1, - "number": 1, - "url": "u", - "head": { - "ref": "r", - "sha": "s", - "repo": { - "id": 1, - "name": "n", - "url": "s" + "id":1, + "number":1, + "url":"u", + "head":{ + "ref":"r", + "sha":"s", + "repo":{ + "id":1, + "name":"n", + "url":"s" } }, - "base": { - "ref": "r", - "sha": "s", - "repo": { - "id": 1, - "name": "n", - "url": "u" + "base":{ + "ref":"r", + "sha":"s", + "repo":{ + "id":1, + "name":"n", + "url":"u" } } } ] - }`, ts, ts, ts, ts) + }` testJSONMarshal(t, &c, w) } @@ -890,67 +890,67 @@ func Test_CheckSuiteMarshal(t *testing.T) { }, } - w := fmt.Sprintf(`{ - "id": 1, - "node_id": "n", - "head_branch": "h", - "head_sha": "h", - "url": "u", - "before": "b", - "after": "a", - "status": "s", - "conclusion": "c", - "app": { - "id": 1, - "node_id": "n", - "owner": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "name": "n", - "description": "d", - "external_url": "u", - "html_url": "h", - "created_at": "%s", - "updated_at": "%s" - }, - "repository": { - "id": 1 + w := `{ + "id":1, + "node_id":"n", + "head_branch":"h", + "head_sha":"h", + "url":"u", + "before":"b", + "after":"a", + "status":"s", + "conclusion":"c", + "app":{ + "id":1, + "node_id":"n", + "owner":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" }, - "pull_requests": [ + "name":"n", + "description":"d", + "external_url":"u", + "html_url":"h", + "created_at":"` + ts + `", + "updated_at":"` + ts + `" + }, + "repository":{ + "id":1 + }, + "pull_requests":[ { - "id": 1, - "number": 1, - "url": "u", - "head": { - "ref": "r", - "sha": "s", - "repo": { - "id": 1, - "name": "n", - "url": "s" + "id":1, + "number":1, + "url":"u", + "head":{ + "ref":"r", + "sha":"s", + "repo":{ + "id":1, + "name":"n", + "url":"s" } }, - "base": { - "ref": "r", - "sha": "s", - "repo": { - "id": 1, - "name": "n", - "url": "u" + "base":{ + "ref":"r", + "sha":"s", + "repo":{ + "id":1, + "name":"n", + "url":"u" } } } ], - "head_commit": { - "sha": "s" + "head_commit":{ + "sha":"s" } - }`, ts, ts) + }` testJSONMarshal(t, &c, w) } @@ -971,15 +971,15 @@ func TestCheckRunAnnotation_Marshal(t *testing.T) { } want := `{ - "path": "p", - "start_line": 1, - "end_line": 1, - "start_column": 1, - "end_column": 1, - "annotation_level": "al", - "message": "m", - "title": "t", - "raw_details": "rd" + "path":"p", + "start_line":1, + "end_line":1, + "start_column":1, + "end_column":1, + "annotation_level":"al", + "message":"m", + "title":"t", + "raw_details":"rd" }` testJSONMarshal(t, u, want) @@ -995,16 +995,20 @@ func TestCheckRunImage_Marshal(t *testing.T) { } want := `{ - "alt": "a", - "image_url": "i", - "caption": "c" + "alt":"a", + "image_url":"i", + "caption":"c" }` testJSONMarshal(t, u, want) } func TestCheckRunAction_Marshal(t *testing.T) { - testJSONMarshal(t, &CheckRunAction{}, "{}") + testJSONMarshal(t, &CheckRunAction{}, `{ + "label":"", + "description":"", + "identifier":"" + }`) u := &CheckRunAction{ Label: "l", @@ -1013,9 +1017,9 @@ func TestCheckRunAction_Marshal(t *testing.T) { } want := `{ - "label": "l", - "description": "d", - "identifier": "i" + "label":"l", + "description":"d", + "identifier":"i" }` testJSONMarshal(t, u, want) @@ -1030,15 +1034,15 @@ func TestAutoTriggerCheck_Marshal(t *testing.T) { } want := `{ - "app_id": 1, - "setting": false + "app_id":1, + "setting":false }` testJSONMarshal(t, u, want) } func TestCreateCheckSuiteOptions_Marshal(t *testing.T) { - testJSONMarshal(t, &CreateCheckSuiteOptions{}, "{}") + testJSONMarshal(t, &CreateCheckSuiteOptions{}, `{"head_sha":""}`) u := &CreateCheckSuiteOptions{ HeadSHA: "hsha", @@ -1046,8 +1050,8 @@ func TestCreateCheckSuiteOptions_Marshal(t *testing.T) { } want := `{ - "head_sha": "hsha", - "head_branch": "hb" + "head_sha":"hsha", + "head_branch":"hb" }` testJSONMarshal(t, u, want) @@ -1085,29 +1089,29 @@ func TestCheckRunOutput_Marshal(t *testing.T) { } want := `{ - "title": "ti", - "summary": "s", - "text": "t", - "annotations_count": 1, - "annotations_url": "au", - "annotations": [ + "title":"ti", + "summary":"s", + "text":"t", + "annotations_count":1, + "annotations_url":"au", + "annotations":[ { - "path": "p", - "start_line": 1, - "end_line": 1, - "start_column": 1, - "end_column": 1, - "annotation_level": "al", - "message": "m", - "title": "t", - "raw_details": "rd" + "path":"p", + "start_line":1, + "end_line":1, + "start_column":1, + "end_column":1, + "annotation_level":"al", + "message":"m", + "title":"t", + "raw_details":"rd" } ], - "images": [ + "images":[ { - "alt": "a", - "image_url": "i", - "caption": "c" + "alt":"a", + "image_url":"i", + "caption":"c" } ] }` @@ -1116,7 +1120,10 @@ func TestCheckRunOutput_Marshal(t *testing.T) { } func TestCreateCheckRunOptions_Marshal(t *testing.T) { - testJSONMarshal(t, &CreateCheckRunOptions{}, "{}") + testJSONMarshal(t, &CreateCheckRunOptions{}, `{ + "name":"", + "head_sha":"" + }`) u := &CreateCheckRunOptions{ Name: "n", @@ -1164,46 +1171,46 @@ func TestCreateCheckRunOptions_Marshal(t *testing.T) { } want := `{ - "name": "n", - "head_sha": "hsha", - "details_url": "durl", - "external_id": "eid", - "status": "s", - "conclusion": "c", - "started_at": ` + referenceTimeStr + `, - "completed_at": ` + referenceTimeStr + `, - "output": { - "title": "ti", - "summary": "s", - "text": "t", - "annotations_count": 1, - "annotations_url": "au", - "annotations": [ + "name":"n", + "head_sha":"hsha", + "details_url":"durl", + "external_id":"eid", + "status":"s", + "conclusion":"c", + "started_at":` + referenceTimeStr + `, + "completed_at":` + referenceTimeStr + `, + "output":{ + "title":"ti", + "summary":"s", + "text":"t", + "annotations_count":1, + "annotations_url":"au", + "annotations":[ { - "path": "p", - "start_line": 1, - "end_line": 1, - "start_column": 1, - "end_column": 1, - "annotation_level": "al", - "message": "m", - "title": "t", - "raw_details": "rd" + "path":"p", + "start_line":1, + "end_line":1, + "start_column":1, + "end_column":1, + "annotation_level":"al", + "message":"m", + "title":"t", + "raw_details":"rd" } ], - "images": [ + "images":[ { - "alt": "a", - "image_url": "i", - "caption": "c" + "alt":"a", + "image_url":"i", + "caption":"c" } ] }, - "actions": [ + "actions":[ { - "label": "l", - "description": "d", - "identifier": "i" + "label":"l", + "description":"d", + "identifier":"i" } ] }` @@ -1212,7 +1219,7 @@ func TestCreateCheckRunOptions_Marshal(t *testing.T) { } func TestUpdateCheckRunOptions_Marshal(t *testing.T) { - testJSONMarshal(t, &UpdateCheckRunOptions{}, "{}") + testJSONMarshal(t, &UpdateCheckRunOptions{}, `{"name":""}`) u := &UpdateCheckRunOptions{ Name: "n", @@ -1258,44 +1265,44 @@ func TestUpdateCheckRunOptions_Marshal(t *testing.T) { } want := `{ - "name": "n", - "details_url": "durl", - "external_id": "eid", - "status": "s", - "conclusion": "c", - "completed_at": ` + referenceTimeStr + `, - "output": { - "title": "ti", - "summary": "s", - "text": "t", - "annotations_count": 1, - "annotations_url": "au", - "annotations": [ + "name":"n", + "details_url":"durl", + "external_id":"eid", + "status":"s", + "conclusion":"c", + "completed_at":` + referenceTimeStr + `, + "output":{ + "title":"ti", + "summary":"s", + "text":"t", + "annotations_count":1, + "annotations_url":"au", + "annotations":[ { - "path": "p", - "start_line": 1, - "end_line": 1, - "start_column": 1, - "end_column": 1, - "annotation_level": "al", - "message": "m", - "title": "t", - "raw_details": "rd" + "path":"p", + "start_line":1, + "end_line":1, + "start_column":1, + "end_column":1, + "annotation_level":"al", + "message":"m", + "title":"t", + "raw_details":"rd" } ], - "images": [ + "images":[ { - "alt": "a", - "image_url": "i", - "caption": "c" + "alt":"a", + "image_url":"i", + "caption":"c" } ] }, - "actions": [ + "actions":[ { - "label": "l", - "description": "d", - "identifier": "i" + "label":"l", + "description":"d", + "identifier":"i" } ] }` @@ -1399,89 +1406,89 @@ func TestListCheckRunsResults_Marshal(t *testing.T) { } w := `{ - "total_count": 1, - "check_runs": [ + "total_count":1, + "check_runs":[ { - "id": 1, - "node_id": "n", - "head_sha": "h", - "external_id": "1", - "url": "u", - "html_url": "u", - "details_url": "u", - "status": "s", - "conclusion": "c", - "started_at": ` + referenceTimeStr + `, - "completed_at": ` + referenceTimeStr + `, - "output": { - "title": "t", - "summary": "s", - "text": "t", - "annotations_count": 1, - "annotations_url": "a", - "annotations": [ + "id":1, + "node_id":"n", + "head_sha":"h", + "external_id":"1", + "url":"u", + "html_url":"u", + "details_url":"u", + "status":"s", + "conclusion":"c", + "started_at":` + referenceTimeStr + `, + "completed_at":` + referenceTimeStr + `, + "output":{ + "title":"t", + "summary":"s", + "text":"t", + "annotations_count":1, + "annotations_url":"a", + "annotations":[ { - "path": "p", - "start_line": 1, - "end_line": 1, - "annotation_level": "a", - "message": "m", - "title": "t", - "raw_details": "r" + "path":"p", + "start_line":1, + "end_line":1, + "annotation_level":"a", + "message":"m", + "title":"t", + "raw_details":"r" } ], - "images": [ + "images":[ { - "alt": "a", - "image_url": "i", - "caption": "c" + "alt":"a", + "image_url":"i", + "caption":"c" } ] }, - "name": "n", - "check_suite": { - "id": 1 + "name":"n", + "check_suite":{ + "id":1 }, - "app": { - "id": 1, - "node_id": "n", - "owner": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" + "app":{ + "id":1, + "node_id":"n", + "owner":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" }, - "name": "n", - "description": "d", - "external_url": "u", - "html_url": "h", - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + ` + "name":"n", + "description":"d", + "external_url":"u", + "html_url":"h", + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + ` }, - "pull_requests": [ + "pull_requests":[ { - "id": 1, - "number": 1, - "url": "u", - "head": { - "ref": "r", - "sha": "s", - "repo": { - "id": 1, - "name": "n", - "url": "s" + "id":1, + "number":1, + "url":"u", + "head":{ + "ref":"r", + "sha":"s", + "repo":{ + "id":1, + "name":"n", + "url":"s" } }, - "base": { - "ref": "r", - "sha": "s", - "repo": { - "id": 1, - "name": "n", - "url": "u" + "base":{ + "ref":"r", + "sha":"s", + "repo":{ + "id":1, + "name":"n", + "url":"u" } } } @@ -1490,7 +1497,7 @@ func TestListCheckRunsResults_Marshal(t *testing.T) { ] }` - testJSONMarshal(t, &l, w) + testJSONMarshal(t, l, w) } func TestListCheckSuiteResults_Marshal(t *testing.T) { @@ -1564,73 +1571,73 @@ func TestListCheckSuiteResults_Marshal(t *testing.T) { } w := `{ - "total_count": 1, - "check_suites": [ + "total_count":1, + "check_suites":[ { - "id": 1, - "node_id": "n", - "head_branch": "h", - "head_sha": "h", - "url": "u", - "before": "b", - "after": "a", - "status": "s", - "conclusion": "c", - "app": { - "id": 1, - "node_id": "n", - "owner": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" + "id":1, + "node_id":"n", + "head_branch":"h", + "head_sha":"h", + "url":"u", + "before":"b", + "after":"a", + "status":"s", + "conclusion":"c", + "app":{ + "id":1, + "node_id":"n", + "owner":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" }, - "name": "n", - "description": "d", - "external_url": "u", - "html_url": "h", - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + ` + "name":"n", + "description":"d", + "external_url":"u", + "html_url":"h", + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + ` }, - "repository": { - "id": 1 + "repository":{ + "id":1 }, - "pull_requests": [ - { - "id": 1, - "number": 1, - "url": "u", - "head": { - "ref": "r", - "sha": "s", - "repo": { - "id": 1, - "name": "n", - "url": "s" - } - }, - "base": { - "ref": "r", - "sha": "s", - "repo": { - "id": 1, - "name": "n", - "url": "u" + "pull_requests":[ + { + "id":1, + "number":1, + "url":"u", + "head":{ + "ref":"r", + "sha":"s", + "repo":{ + "id":1, + "name":"n", + "url":"s" + } + }, + "base":{ + "ref":"r", + "sha":"s", + "repo":{ + "id":1, + "name":"n", + "url":"u" + } } } + ], + "head_commit":{ + "sha":"s" } - ], - "head_commit": { - "sha": "s" - } } ] }` - testJSONMarshal(t, &l, w) + testJSONMarshal(t, l, w) } func TestCheckSuitePreferenceOptions_Marshal(t *testing.T) { @@ -1646,10 +1653,10 @@ func TestCheckSuitePreferenceOptions_Marshal(t *testing.T) { } want := `{ - "auto_trigger_checks": [ + "auto_trigger_checks":[ { - "app_id": 1, - "setting": false + "app_id":1, + "setting":false } ] }` @@ -1670,10 +1677,10 @@ func TestPreferenceList_Marshal(t *testing.T) { } want := `{ - "auto_trigger_checks": [ + "auto_trigger_checks":[ { - "app_id": 1, - "setting": false + "app_id":1, + "setting":false } ] }` @@ -1701,15 +1708,15 @@ func TestCheckSuitePreferenceResults_Marshal(t *testing.T) { } want := `{ - "preferences": { - "auto_trigger_checks": [ + "preferences":{ + "auto_trigger_checks":[ { - "app_id": 1, - "setting": false + "app_id":1, + "setting":false } ] }, - "repository": { + "repository":{ "id":1, "name":"n", "url":"u" diff --git a/github/code-scanning_test.go b/github/code-scanning_test.go index 4fbe45e7813..9bacd163684 100644 --- a/github/code-scanning_test.go +++ b/github/code-scanning_test.go @@ -991,28 +991,28 @@ func TestAlert_Marshal(t *testing.T) { } want := `{ - "rule_id": "rid", - "rule_severity": "rs", - "rule_description": "rd", - "tool": { - "name": "n", - "guid": "g", - "version": "v" + "rule_id":"rid", + "rule_severity":"rs", + "rule_description":"rd", + "tool":{ + "name":"n", + "guid":"g", + "version":"v" }, - "created_at": ` + referenceTimeStr + `, - "state": "fixed", - "closed_by": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" + "created_at":` + referenceTimeStr + `, + "state":"fixed", + "closed_by":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" }, - "closed_at": ` + referenceTimeStr + `, - "url": "url", - "html_url": "hurl" + "closed_at":` + referenceTimeStr + `, + "url":"url", + "html_url":"hurl" }` testJSONMarshal(t, u, want) @@ -1030,11 +1030,11 @@ func TestLocation_Marshal(t *testing.T) { } want := `{ - "path": "path", - "start_line": 1, - "end_line": 2, - "start_column": 3, - "end_column": 4 + "path":"path", + "start_line":1, + "end_line":2, + "start_column":3, + "end_column":4 }` testJSONMarshal(t, u, want) @@ -1055,14 +1055,17 @@ func TestRule_Marshal(t *testing.T) { } want := `{ - "id": "1", - "severity": "3", - "description": "description", - "name": "first", - "security_severity_level": "2", - "full_description": "summary", - "tags": ["tag1", "tag2"], - "help": "Help Text" + "id":"1", + "severity":"3", + "description":"description", + "name":"first", + "security_severity_level":"2", + "full_description":"summary", + "tags":[ + "tag1", + "tag2" + ], + "help":"Help Text" }` testJSONMarshal(t, u, want) @@ -1078,9 +1081,9 @@ func TestTool_Marshal(t *testing.T) { } want := `{ - "name": "name", - "guid": "guid", - "version": "ver" + "name":"name", + "guid":"guid", + "version":"ver" }` testJSONMarshal(t, u, want) @@ -1093,9 +1096,7 @@ func TestMessage_Marshal(t *testing.T) { Text: String("text"), } - want := `{ - "text": "text" - }` + want := `{"text":"text"}` testJSONMarshal(t, u, want) } diff --git a/github/codesofconduct_test.go b/github/codesofconduct_test.go index 71ef31f7afd..a0d85c93945 100644 --- a/github/codesofconduct_test.go +++ b/github/codesofconduct_test.go @@ -107,10 +107,10 @@ func TestCodeOfConduct_Marshal(t *testing.T) { } want := `{ - "name": "name", - "key": "key", - "url": "url", - "body": "body" + "name":"name", + "key":"key", + "url":"url", + "body":"body" }` testJSONMarshal(t, a, want) diff --git a/github/enterprise_actions_runner_groups_test.go b/github/enterprise_actions_runner_groups_test.go index 36036e419c2..46ef6519119 100644 --- a/github/enterprise_actions_runner_groups_test.go +++ b/github/enterprise_actions_runner_groups_test.go @@ -548,23 +548,22 @@ func TestEnterpriseRunnerGroup_Marshal(t *testing.T) { } want := `{ - "id": 1, - "name": "n", - "visibility": "v", - "default": true, - "selected_organizations_url": "s", - "runners_url": "r", - "inherited": true, - "allows_public_repositories": true, - "restricted_to_workflows": false, - "selected_workflows": [] + "id":1, + "name":"n", + "visibility":"v", + "default":true, + "selected_organizations_url":"s", + "runners_url":"r", + "inherited":true, + "allows_public_repositories":true, + "restricted_to_workflows":false }` testJSONMarshal(t, u, want) } func TestEnterpriseRunnerGroups_Marshal(t *testing.T) { - testJSONMarshal(t, &EnterpriseRunnerGroups{}, "{}") + testJSONMarshal(t, &EnterpriseRunnerGroups{}, `{"runner_groups":null}`) u := &EnterpriseRunnerGroups{ TotalCount: Int(1), @@ -585,18 +584,17 @@ func TestEnterpriseRunnerGroups_Marshal(t *testing.T) { } want := `{ - "total_count": 1, - "runner_groups": [{ - "id": 1, - "name": "n", - "visibility": "v", - "default": true, - "selected_organizations_url": "s", - "runners_url": "r", - "inherited": true, - "allows_public_repositories": true, - "restricted_to_workflows": false, - "selected_workflows": [] + "total_count":1, + "runner_groups":[{ + "id":1, + "name":"n", + "visibility":"v", + "default":true, + "selected_organizations_url":"s", + "runners_url":"r", + "inherited":true, + "allows_public_repositories":true, + "restricted_to_workflows":false }] }` @@ -617,13 +615,13 @@ func TestCreateEnterpriseRunnerGroupRequest_Marshal(t *testing.T) { } want := `{ - "name": "n", - "visibility": "v", - "selected_organization_ids": [1], - "runners": [1], - "allows_public_repositories": true, - "restricted_to_workflows": true, - "selected_workflows": ["a","b"] + "name":"n", + "visibility":"v", + "selected_organization_ids":[1], + "runners":[1], + "allows_public_repositories":true, + "restricted_to_workflows":true, + "selected_workflows":["a","b"] }` testJSONMarshal(t, u, want) @@ -641,25 +639,24 @@ func TestUpdateEnterpriseRunnerGroupRequest_Marshal(t *testing.T) { } want := `{ - "name": "n", - "visibility": "v", - "allows_public_repositories": true, - "restricted_to_workflows": false, - "selected_workflows": [] + "name":"n", + "visibility":"v", + "allows_public_repositories":true, + "restricted_to_workflows":false }` testJSONMarshal(t, u, want) } func TestSetOrgAccessRunnerGroupRequest_Marshal(t *testing.T) { - testJSONMarshal(t, &SetOrgAccessRunnerGroupRequest{}, "{}") + testJSONMarshal(t, &SetOrgAccessRunnerGroupRequest{}, `{"selected_organization_ids":null}`) u := &SetOrgAccessRunnerGroupRequest{ SelectedOrganizationIDs: []int64{1}, } want := `{ - "selected_organization_ids": [1] + "selected_organization_ids":[1] }` testJSONMarshal(t, u, want) diff --git a/github/event_test.go b/github/event_test.go index 66a6bcd7e45..e36a130edf7 100644 --- a/github/event_test.go +++ b/github/event_test.go @@ -95,49 +95,49 @@ func TestEvent_Marshal(t *testing.T) { } want := `{ - "type": "t", - "public": false, - "payload": { - "key": "value" + "type":"t", + "public":false, + "payload":{ + "key":"value" }, - "repo": { - "id": 1, - "name": "n", - "url": "s" + "repo":{ + "id":1, + "name":"n", + "url":"s" }, - "actor": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" + "actor":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" }, - "org": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true + "org":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true }, - "created_at": ` + referenceTimeStr + `, - "id": "id" + "created_at":` + referenceTimeStr + `, + "id":"id" }` testJSONMarshal(t, u, want) diff --git a/github/event_types_test.go b/github/event_types_test.go index 91ac291205f..d5575f63b21 100644 --- a/github/event_types_test.go +++ b/github/event_types_test.go @@ -22,9 +22,9 @@ func TestEditChange_Marshal_TitleChange(t *testing.T) { } want := `{ - "title": { - "from": "TitleFrom" - } + "title":{ + "from":"TitleFrom" + } }` testJSONMarshal(t, u, want) @@ -42,9 +42,9 @@ func TestEditChange_Marshal_BodyChange(t *testing.T) { } want := `{ - "body": { - "from": "BodyFrom" - } + "body":{ + "from":"BodyFrom" + } }` testJSONMarshal(t, u, want) @@ -69,12 +69,12 @@ func TestEditChange_Marshal_BaseChange(t *testing.T) { } want := `{ - "base": { - "ref": { - "from": "BaseRefFrom" + "base":{ + "ref":{ + "from":"BaseRefFrom" }, - "sha": { - "from": "BaseSHAFrom" + "sha":{ + "from":"BaseSHAFrom" } } }` @@ -94,9 +94,9 @@ func TestEditChange_Marshal_Repo(t *testing.T) { } want := `{ - "repository": { - "name": { - "from": "old-repo-name" + "repository":{ + "name":{ + "from":"old-repo-name" } } }` @@ -124,16 +124,16 @@ func TestEditChange_Marshal_TransferFromUser(t *testing.T) { } want := `{ - "owner": { - "from": { - "user": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "repos_url": "r", - "events_url": "e" + "owner":{ + "from":{ + "user":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" } } } @@ -162,16 +162,16 @@ func TestEditChange_Marshal_TransferFromOrg(t *testing.T) { } want := `{ - "owner": { - "from": { - "organization": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "repos_url": "r", - "events_url": "e" + "owner":{ + "from":{ + "organization":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" } } } @@ -189,9 +189,9 @@ func TestProjectChange_Marshal_NameChange(t *testing.T) { } want := `{ - "name": { - "from": "NameFrom" - } + "name":{ + "from":"NameFrom" + } }` testJSONMarshal(t, u, want) @@ -206,9 +206,9 @@ func TestProjectChange_Marshal_BodyChange(t *testing.T) { } want := `{ - "body": { - "from": "BodyFrom" - } + "body":{ + "from":"BodyFrom" + } }` testJSONMarshal(t, u, want) @@ -222,9 +222,9 @@ func TestProjectCardChange_Marshal_NoteChange(t *testing.T) { } want := `{ - "note": { - "from": "NoteFrom" - } + "note":{ + "from":"NoteFrom" + } }` testJSONMarshal(t, u, want) @@ -238,9 +238,9 @@ func TestProjectColumnChange_Marshal_NameChange(t *testing.T) { } want := `{ - "name": { - "from": "NameFrom" - } + "name":{ + "from":"NameFrom" + } }` testJSONMarshal(t, u, want) @@ -421,177 +421,177 @@ func TestTeamAddEvent_Marshal(t *testing.T) { } want := `{ - "team": { - "id": 1, - "node_id": "n", - "name": "n", - "description": "d", - "url": "u", - "slug": "s", - "permission": "p", - "privacy": "p", - "members_count": 1, - "repos_count": 1, - "organization": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "html_url": "h", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e" - }, - "members_url": "m", - "repositories_url": "r", - "parent": { - "id": 1, - "node_id": "n", - "name": "n", - "description": "d", - "url": "u", - "slug": "s", - "permission": "p", - "privacy": "p", - "members_count": 1, - "repos_count": 1 - }, - "ldap_dn": "l" - }, - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "team":{ + "id":1, + "node_id":"n", + "name":"n", + "description":"d", + "url":"u", + "slug":"s", + "permission":"p", + "privacy":"p", + "members_count":1, + "repos_count":1, + "organization":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "html_url":"h", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e" + }, + "members_url":"m", + "repositories_url":"r", + "parent":{ + "id":1, + "node_id":"n", + "name":"n", + "description":"d", + "url":"u", + "slug":"s", + "permission":"p", + "privacy":"p", + "members_count":1, + "repos_count":1 + }, + "ldap_dn":"l" + }, + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -643,43 +643,43 @@ func TestStarEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "starred_at": ` + referenceTimeStr + `, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" + "action":"a", + "starred_at":` + referenceTimeStr + `, + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true + }, + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" } }` @@ -882,198 +882,198 @@ func TestTeamEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "team": { - "id": 1, - "node_id": "n", - "name": "n", - "description": "d", - "url": "u", - "slug": "s", - "permission": "p", - "privacy": "p", - "members_count": 1, - "repos_count": 1, - "organization": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "html_url": "h", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e" - }, - "members_url": "m", - "repositories_url": "r", - "parent": { - "id": 1, - "node_id": "n", - "name": "n", - "description": "d", - "url": "u", - "slug": "s", - "permission": "p", - "privacy": "p", - "members_count": 1, - "repos_count": 1 - }, - "ldap_dn": "l" - }, - "changes": { - "description": { - "from": "from" - }, - "name": { - "from": "from" - }, - "privacy": { - "from": "from" - }, - "repository": { - "permissions": { - "from": { - "admin": true, - "pull": true, - "push": true + "action":"a", + "team":{ + "id":1, + "node_id":"n", + "name":"n", + "description":"d", + "url":"u", + "slug":"s", + "permission":"p", + "privacy":"p", + "members_count":1, + "repos_count":1, + "organization":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "html_url":"h", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e" + }, + "members_url":"m", + "repositories_url":"r", + "parent":{ + "id":1, + "node_id":"n", + "name":"n", + "description":"d", + "url":"u", + "slug":"s", + "permission":"p", + "privacy":"p", + "members_count":1, + "repos_count":1 + }, + "ldap_dn":"l" + }, + "changes":{ + "description":{ + "from":"from" + }, + "name":{ + "from":"from" + }, + "privacy":{ + "from":"from" + }, + "repository":{ + "permissions":{ + "from":{ + "admin":true, + "pull":true, + "push":true } } } }, - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -1205,127 +1205,127 @@ func TestInstallationRepositoriesEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "repositories_added": [ + "action":"a", + "repositories_added":[ { - "id": 1, - "name": "n", - "url": "s" + "id":1, + "name":"n", + "url":"s" } ], - "repositories_removed": [ + "repositories_removed":[ { - "id": 1, - "name": "n", - "url": "s" + "id":1, + "name":"n", + "url":"s" } ], - "repository_selection": "rs", - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "repository_selection":"rs", + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -1499,170 +1499,170 @@ func TestInstallationTargetEvent_Marshal(t *testing.T) { } want := `{ - "account": { - "login": "u", - "id": 1, - "node_id": "n", - "avatar_url": "l", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "action": "a", - "changes": { - "login": { - "from": "p" - }, - "slug": { - "from": "j" + "account":{ + "login":"u", + "id":1, + "node_id":"n", + "avatar_url":"l", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "action":"a", + "changes":{ + "login":{ + "from":"p" + }, + "slug":{ + "from":"j" } }, - "enterprise": { - "id": 1, - "slug": "s", - "name": "n", - "node_id": "nid", - "avatar_url": "au", - "description": "d", - "website_url": "wu", - "html_url": "hu", - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + ` - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "enterprise":{ + "id":1, + "slug":"s", + "name":"n", + "node_id":"nid", + "avatar_url":"au", + "description":"d", + "website_url":"wu", + "html_url":"hu", + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + ` + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` - }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "repository": { - "id": 1, - "url": "s", - "name": "n" - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "target_type": "running" + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` + }, + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true + }, + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "target_type":"running" }` testJSONMarshal(t, u, want) @@ -1675,9 +1675,7 @@ func TestEditTitle_Marshal(t *testing.T) { From: String("EditTitleFrom"), } - want := `{ - "from": "EditTitleFrom" - }` + want := `{"from":"EditTitleFrom"}` testJSONMarshal(t, u, want) } @@ -1689,9 +1687,7 @@ func TestEditBody_Marshal(t *testing.T) { From: String("EditBodyFrom"), } - want := `{ - "from": "EditBodyFrom" - }` + want := `{"from":"EditBodyFrom"}` testJSONMarshal(t, u, want) } @@ -1709,11 +1705,11 @@ func TestEditBase_Marshal(t *testing.T) { } want := `{ - "ref": { - "from": "EditRefFrom" + "ref":{ + "from":"EditRefFrom" }, - "sha": { - "from": "EditSHAFrom" + "sha":{ + "from":"EditSHAFrom" } }` @@ -1727,9 +1723,7 @@ func TestEditRef_Marshal(t *testing.T) { From: String("EditRefFrom"), } - want := `{ - "from": "EditRefFrom" - }` + want := `{"from":"EditRefFrom"}` testJSONMarshal(t, u, want) } @@ -1741,9 +1735,7 @@ func TestEditSHA_Marshal(t *testing.T) { From: String("EditSHAFrom"), } - want := `{ - "from": "EditSHAFrom" - }` + want := `{"from":"EditSHAFrom"}` testJSONMarshal(t, u, want) } @@ -1755,9 +1747,7 @@ func TestProjectName_Marshal(t *testing.T) { From: String("ProjectNameFrom"), } - want := `{ - "from": "ProjectNameFrom" - }` + want := `{"from":"ProjectNameFrom"}` testJSONMarshal(t, u, want) } @@ -1769,9 +1759,7 @@ func TestProjectBody_Marshal(t *testing.T) { From: String("ProjectBodyFrom"), } - want := `{ - "from": "ProjectBodyFrom" - }` + want := `{"from":"ProjectBodyFrom"}` testJSONMarshal(t, u, want) } @@ -1783,9 +1771,7 @@ func TestProjectCardNote_Marshal(t *testing.T) { From: String("ProjectCardNoteFrom"), } - want := `{ - "from": "ProjectCardNoteFrom" - }` + want := `{"from":"ProjectCardNoteFrom"}` testJSONMarshal(t, u, want) } @@ -1797,9 +1783,7 @@ func TestProjectColumnName_Marshal(t *testing.T) { From: String("ProjectColumnNameFrom"), } - want := `{ - "from": "ProjectColumnNameFrom" - }` + want := `{"from":"ProjectColumnNameFrom"}` testJSONMarshal(t, u, want) } @@ -1811,9 +1795,7 @@ func TestTeamDescription_Marshal(t *testing.T) { From: String("TeamDescriptionFrom"), } - want := `{ - "from": "TeamDescriptionFrom" - }` + want := `{"from":"TeamDescriptionFrom"}` testJSONMarshal(t, u, want) } @@ -1825,9 +1807,7 @@ func TestTeamName_Marshal(t *testing.T) { From: String("TeamNameFrom"), } - want := `{ - "from": "TeamNameFrom" - }` + want := `{"from":"TeamNameFrom"}` testJSONMarshal(t, u, want) } @@ -1839,9 +1819,7 @@ func TestTeamPrivacy_Marshal(t *testing.T) { From: String("TeamPrivacyFrom"), } - want := `{ - "from": "TeamPrivacyFrom" - }` + want := `{"from":"TeamPrivacyFrom"}` testJSONMarshal(t, u, want) } @@ -1860,11 +1838,11 @@ func TestTeamRepository_Marshal(t *testing.T) { } want := `{ - "permissions": { - "from": { - "admin": true, - "pull": true, - "push": true + "permissions":{ + "from":{ + "admin":true, + "pull":true, + "push":true } } }` @@ -1884,10 +1862,10 @@ func TestTeamPermissions_Marshal(t *testing.T) { } want := `{ - "from": { - "admin": true, - "pull": true, - "push": true + "from":{ + "admin":true, + "pull":true, + "push":true } }` @@ -1904,9 +1882,9 @@ func TestTeamPermissionsFrom_Marshal(t *testing.T) { } want := `{ - "admin": true, - "pull": true, - "push": true + "admin":true, + "pull":true, + "push":true }` testJSONMarshal(t, u, want) @@ -1936,23 +1914,23 @@ func TestRepositoryVulnerabilityAlert_Marshal(t *testing.T) { } want := `{ - "id": 1, - "affected_range": "ar", - "affected_package_name": "apn", - "external_reference": "er", - "external_identifier": "ei", - "fixed_in": "fi", - "dismisser": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "dismiss_reason": "dr", - "dismissed_at": ` + referenceTimeStr + ` + "id":1, + "affected_range":"ar", + "affected_package_name":"apn", + "external_reference":"er", + "external_identifier":"ei", + "fixed_in":"fi", + "dismisser":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "dismiss_reason":"dr", + "dismissed_at":` + referenceTimeStr + ` }` testJSONMarshal(t, u, want) @@ -1971,12 +1949,12 @@ func TestPage_Marshal(t *testing.T) { } want := `{ - "page_name": "p", - "title": "t", - "summary": "s", - "action": "a", - "sha": "s", - "html_url": "h" + "page_name":"p", + "title":"t", + "summary":"s", + "action":"a", + "sha":"s", + "html_url":"h" }` testJSONMarshal(t, u, want) @@ -2007,21 +1985,21 @@ func TestTeamChange_Marshal(t *testing.T) { } want := `{ - "description": { - "from": "DescriptionFrom" + "description":{ + "from":"DescriptionFrom" }, - "name": { - "from": "NameFrom" + "name":{ + "from":"NameFrom" }, - "privacy": { - "from": "PrivacyFrom" + "privacy":{ + "from":"PrivacyFrom" }, - "repository": { - "permissions": { - "from": { - "admin": false, - "pull": false, - "push": false + "repository":{ + "permissions":{ + "from":{ + "admin":false, + "pull":false, + "push":false } } } @@ -2185,161 +2163,161 @@ func TestIssueCommentEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "issue": { - "id": 1 + "action":"a", + "issue":{ + "id":1 }, - "comment": { - "id": 1 + "comment":{ + "id":1 }, - "changes": { - "title": { - "from": "TitleFrom" + "changes":{ + "title":{ + "from":"TitleFrom" }, - "body": { - "from": "BodyFrom" + "body":{ + "from":"BodyFrom" }, - "base": { - "ref": { - "from": "BaseRefFrom" + "base":{ + "ref":{ + "from":"BaseRefFrom" }, - "sha": { - "from": "BaseSHAFrom" + "sha":{ + "from":"BaseSHAFrom" } } }, - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` - }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` + }, + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true } }` @@ -2488,148 +2466,148 @@ func TestIssuesEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "issue": { - "id": 1 - }, - "assignee": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "label": { - "id": 1 - }, - "changes": { - "title": { - "from": "TitleFrom" - }, - "body": { - "from": "BodyFrom" - }, - "base": { - "ref": { - "from": "BaseRefFrom" + "action":"a", + "issue":{ + "id":1 + }, + "assignee":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "label":{ + "id":1 + }, + "changes":{ + "title":{ + "from":"TitleFrom" + }, + "body":{ + "from":"BodyFrom" + }, + "base":{ + "ref":{ + "from":"BaseRefFrom" }, - "sha": { - "from": "BaseSHAFrom" + "sha":{ + "from":"BaseSHAFrom" } } }, - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -2781,149 +2759,149 @@ func TestLabelEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "label": { - "id": 1 + "action":"a", + "label":{ + "id":1 }, - "changes": { - "title": { - "from": "TitleFrom" + "changes":{ + "title":{ + "from":"TitleFrom" }, - "body": { - "from": "BodyFrom" + "body":{ + "from":"BodyFrom" }, - "base": { - "ref": { - "from": "BaseRefFrom" + "base":{ + "ref":{ + "from":"BaseRefFrom" }, - "sha": { - "from": "BaseSHAFrom" + "sha":{ + "from":"BaseSHAFrom" } } }, - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -3084,158 +3062,158 @@ func TestMilestoneEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "milestone": { - "id": 1 + "action":"a", + "milestone":{ + "id":1 }, - "changes": { - "title": { - "from": "TitleFrom" + "changes":{ + "title":{ + "from":"TitleFrom" }, - "body": { - "from": "BodyFrom" + "body":{ + "from":"BodyFrom" }, - "base": { - "ref": { - "from": "BaseRefFrom" + "base":{ + "ref":{ + "from":"BaseRefFrom" }, - "sha": { - "from": "BaseSHAFrom" + "sha":{ + "from":"BaseSHAFrom" } } }, - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -3356,116 +3334,116 @@ func TestPublicEvent_Marshal(t *testing.T) { } want := `{ - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -3611,145 +3589,145 @@ func TestPullRequestReviewEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "review": { - "id": 1 - }, - "pull_request": { - "id": 1 - }, - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "action":"a", + "review":{ + "id":1 + }, + "pull_request":{ + "id":1 + }, + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` - }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` + }, + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true } }` @@ -3913,165 +3891,165 @@ func TestPushEvent_Marshal(t *testing.T) { } want := `{ - "push_id": 1, - "head": "h", - "ref": "ref", - "size": 1, - "commits": [ + "push_id":1, + "head":"h", + "ref":"ref", + "size":1, + "commits":[ { - "id": "id" + "id":"id" } ], - "before": "b", - "distinct_size": 1, - "after": "a", - "created": true, - "deleted": true, - "forced": true, - "base_ref": "a", - "compare": "a", - "repository": { - "id": 1 - }, - "head_commit": { - "id": "id" - }, - "pusher": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "before":"b", + "distinct_size":1, + "after":"a", + "created":true, + "deleted":true, + "forced":true, + "base_ref":"a", + "compare":"a", + "repository":{ + "id":1 + }, + "head_commit":{ + "id":"id" + }, + "pusher":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` - }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` + }, + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true } }` @@ -4204,132 +4182,132 @@ func TestStatusEvent_Marshal(t *testing.T) { } want := `{ - "sha": "sha", - "state": "s", - "description": "d", - "target_url": "turl", - "branches": [ + "sha":"sha", + "state":"s", + "description":"d", + "target_url":"turl", + "branches":[ { - "name": "n", - "commit": { - "node_id": "nid" + "name":"n", + "commit":{ + "node_id":"nid" }, - "protected": false + "protected":false } ], - "id": 1, - "name": "n", - "context": "c", - "commit": { - "node_id": "nid" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "id":1, + "name":"n", + "context":"c", + "commit":{ + "node_id":"nid" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -4493,163 +4471,163 @@ func TestMarketplacePurchaseEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "effective_date": ` + referenceTimeStr + `, - "marketplace_purchase": { - "billing_cycle": "bc", - "next_billing_date": ` + referenceTimeStr + `, - "unit_count": 1, - "plan": { - "url": "u", - "accounts_url": "au", - "id": 1, - "number": 1, - "name": "n", - "description": "d", - "monthly_price_in_cents": 1, - "yearly_price_in_cents": 1, - "price_model": "pm", - "unit_name": "un", - "bullets": [ + "action":"a", + "effective_date":` + referenceTimeStr + `, + "marketplace_purchase":{ + "billing_cycle":"bc", + "next_billing_date":` + referenceTimeStr + `, + "unit_count":1, + "plan":{ + "url":"u", + "accounts_url":"au", + "id":1, + "number":1, + "name":"n", + "description":"d", + "monthly_price_in_cents":1, + "yearly_price_in_cents":1, + "price_model":"pm", + "unit_name":"un", + "bullets":[ "b" ], - "state": "s", - "has_free_trial": false - }, - "on_free_trial": false, - "free_trial_ends_on": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + ` - }, - "previous_marketplace_purchase": { - "billing_cycle": "bc", - "next_billing_date": ` + referenceTimeStr + `, - "unit_count": 1, - "plan": { - "url": "u", - "accounts_url": "au", - "id": 1, - "number": 1, - "name": "n", - "description": "d", - "monthly_price_in_cents": 1, - "yearly_price_in_cents": 1, - "price_model": "pm", - "unit_name": "un", - "bullets": [ + "state":"s", + "has_free_trial":false + }, + "on_free_trial":false, + "free_trial_ends_on":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + ` + }, + "previous_marketplace_purchase":{ + "billing_cycle":"bc", + "next_billing_date":` + referenceTimeStr + `, + "unit_count":1, + "plan":{ + "url":"u", + "accounts_url":"au", + "id":1, + "number":1, + "name":"n", + "description":"d", + "monthly_price_in_cents":1, + "yearly_price_in_cents":1, + "price_model":"pm", + "unit_name":"un", + "bullets":[ "b" ], - "state": "s", - "has_free_trial": false - }, - "on_free_trial": false, - "free_trial_ends_on": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + ` - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "state":"s", + "has_free_trial":false + }, + "on_free_trial":false, + "free_trial_ends_on":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + ` + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -4826,174 +4804,174 @@ func TestOrganizationEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "invitation": { - "id": 1 - }, - "membership": { - "url": "url", - "state": "s", - "role": "r", - "organization_url": "ou", - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "user": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" + "action":"a", + "invitation":{ + "id":1 + }, + "membership":{ + "url":"url", + "state":"s", + "role":"r", + "organization_url":"ou", + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true + }, + "user":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" } }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -5116,120 +5094,120 @@ func TestPageBuildEvent_Marshal(t *testing.T) { } want := `{ - "build": { - "url": "url" - }, - "id": 1, - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "build":{ + "url":"url" + }, + "id":1, + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -5384,150 +5362,150 @@ func TestCommitCommentEvent_Marshal(t *testing.T) { } want := `{ - "comment": { - "html_url": "hurl", - "url": "url", - "id": 1, - "node_id": "nid", - "commit_id": "cid", - "user": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "reactions": { - "total_count": 1, - "+1": 1, - "-1": 1, - "laugh": 1, - "confused": 1, - "heart": 1, - "hooray": 1, - "rocket": 1, - "eyes": 1, - "url": "url" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "body": "b", - "path": "path", - "position": 1 - }, - "action": "a", - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "comment":{ + "html_url":"hurl", + "url":"url", + "id":1, + "node_id":"nid", + "commit_id":"cid", + "user":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "reactions":{ + "total_count":1, + "+1":1, + "-1":1, + "laugh":1, + "confused":1, + "heart":1, + "hooray":1, + "rocket":1, + "eyes":1, + "url":"url" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "body":"b", + "path":"path", + "position":1 + }, + "action":"a", + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -5769,234 +5747,234 @@ func TestDeploymentEvent_Marshal(t *testing.T) { } want := `{ - "deployment": { - "url": "url", - "id": 1, - "sha": "sha", - "ref": "ref", - "task": "t", - "payload": { - "key": "value" - }, - "environment": "e", - "description": "d", - "creator": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "statuses_url": "surl", - "repository_url": "rurl", - "node_id": "nid" - }, - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ - "e" - ], - "single_file_paths": [ - "s" - ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` - }, - "workflow": { - "id": 1, - "node_id": "nid", - "name": "n", - "path": "p", - "state": "s", - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "url": "u", - "html_url": "h", - "badge_url": "b" - }, - "workflow_run": { - "id": 1, - "name": "n", - "node_id": "nid", - "head_branch": "hb", - "head_sha": "hs", - "run_number": 1, - "run_attempt": 1, - "event": "e", - "status": "s", - "conclusion": "c", - "workflow_id": 1, - "url": "u", - "html_url": "h", - "pull_requests": [ + "deployment":{ + "url":"url", + "id":1, + "sha":"sha", + "ref":"ref", + "task":"t", + "payload":{ + "key":"value" + }, + "environment":"e", + "description":"d", + "creator":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "statuses_url":"surl", + "repository_url":"rurl", + "node_id":"nid" + }, + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "workflow":{ + "id":1, + "node_id":"nid", + "name":"n", + "path":"p", + "state":"s", + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "url":"u", + "html_url":"h", + "badge_url":"b" + }, + "workflow_run":{ + "id":1, + "name":"n", + "node_id":"nid", + "head_branch":"hb", + "head_sha":"hs", + "run_number":1, + "run_attempt":1, + "event":"e", + "status":"s", + "conclusion":"c", + "workflow_id":1, + "url":"u", + "html_url":"h", + "pull_requests":[ { - "id": 1, - "number": 1, - "url": "u", - "head": { - "ref": "r", - "sha": "s", - "repo": { - "id": 1, - "name": "n", - "url": "s" + "id":1, + "number":1, + "url":"u", + "head":{ + "ref":"r", + "sha":"s", + "repo":{ + "id":1, + "name":"n", + "url":"s" } }, - "base": { - "ref": "r", - "sha": "s", - "repo": { - "id": 1, - "name": "n", - "url": "u" + "base":{ + "ref":"r", + "sha":"s", + "repo":{ + "id":1, + "name":"n", + "url":"u" } } } ], - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "run_started_at": ` + referenceTimeStr + `, - "jobs_url": "j", - "logs_url": "l", - "check_suite_url": "c", - "artifacts_url": "a", - "cancel_url": "c", - "rerun_url": "r", - "previous_attempt_url": "p", - "head_commit": { - "message": "m", - "author": { - "name": "n", - "email": "e", - "username": "l" + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "run_started_at":` + referenceTimeStr + `, + "jobs_url":"j", + "logs_url":"l", + "check_suite_url":"c", + "artifacts_url":"a", + "cancel_url":"c", + "rerun_url":"r", + "previous_attempt_url":"p", + "head_commit":{ + "message":"m", + "author":{ + "name":"n", + "email":"e", + "username":"l" }, - "url": "u", - "distinct": false, - "sha": "s", - "id": "i", - "tree_id": "tid", - "timestamp": ` + referenceTimeStr + `, - "committer": { - "name": "n", - "email": "e", - "username": "l" + "url":"u", + "distinct":false, + "sha":"s", + "id":"i", + "tree_id":"tid", + "timestamp":` + referenceTimeStr + `, + "committer":{ + "name":"n", + "email":"e", + "username":"l" } }, - "workflow_url": "w", - "repository": { - "id": 1, - "name": "n", - "url": "u" + "workflow_url":"w", + "repository":{ + "id":1, + "name":"n", + "url":"u" }, - "head_repository": { - "id": 1, - "name": "n", - "url": "u" + "head_repository":{ + "id":1, + "name":"n", + "url":"u" } + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ + "e" + ], + "single_file_paths":[ + "s" + ], + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -6196,192 +6174,192 @@ func TestDeploymentProtectionRuleEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "environment": "e", - "deployment_callback_url": "b", - "deployment": { - "url": "url", - "id": 1, - "sha": "sha", - "ref": "ref", - "task": "t", - "payload": { - "key": "value" - }, - "environment": "e", - "description": "d", - "creator": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "statuses_url": "surl", - "repository_url": "rurl", - "node_id": "nid" - }, - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "pull_requests": [ + "action":"a", + "environment":"e", + "deployment_callback_url":"b", + "deployment":{ + "url":"url", + "id":1, + "sha":"sha", + "ref":"ref", + "task":"t", + "payload":{ + "key":"value" + }, + "environment":"e", + "description":"d", + "creator":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "statuses_url":"surl", + "repository_url":"rurl", + "node_id":"nid" + }, + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true + }, + "pull_requests":[ { - "id": 1, - "number": 1, - "url": "u", - "head": { - "ref": "r", - "sha": "s", - "repo": { - "id": 1, - "name": "n", - "url": "s" + "id":1, + "number":1, + "url":"u", + "head":{ + "ref":"r", + "sha":"s", + "repo":{ + "id":1, + "name":"n", + "url":"s" } }, - "base": { - "ref": "r", - "sha": "s", - "repo": { - "id": 1, - "name": "n", - "url": "u" + "base":{ + "ref":"r", + "sha":"s", + "repo":{ + "id":1, + "name":"n", + "url":"u" } } } ], - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -6555,166 +6533,166 @@ func TestDeploymentStatusEvent_Marshal(t *testing.T) { } want := `{ - "deployment": { - "url": "url", - "id": 1, - "sha": "sha", - "ref": "ref", - "task": "t", - "payload": { - "key": "value" - }, - "environment": "e", - "description": "d", - "creator": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "statuses_url": "surl", - "repository_url": "rurl", - "node_id": "nid" - }, - "deployment_status": { - "id": 1, - "state": "s", - "creator": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "description": "s", - "environment": "s", - "node_id": "s", - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "target_url": "s", - "deployment_url": "s", - "repository_url": "s", - "environment_url": "s", - "log_url": "s", - "url": "s" - }, - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "deployment":{ + "url":"url", + "id":1, + "sha":"sha", + "ref":"ref", + "task":"t", + "payload":{ + "key":"value" + }, + "environment":"e", + "description":"d", + "creator":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "statuses_url":"surl", + "repository_url":"rurl", + "node_id":"nid" + }, + "deployment_status":{ + "id":1, + "state":"s", + "creator":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "description":"s", + "environment":"s", + "node_id":"s", + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "target_url":"s", + "deployment_url":"s", + "repository_url":"s", + "environment_url":"s", + "log_url":"s", + "url":"s" + }, + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -6927,208 +6905,208 @@ func TestDiscussionCommentEvent_Marshal(t *testing.T) { } want := `{ - "comment": { - "author_association": "aa", - "body": "bo", - "child_comment_count": 1, - "created_at": ` + referenceTimeStr + `, - "discussion_id": 1, - "html_url": "hurl", - "id": 1, - "node_id": "nid", - "parent_id": 1, - "reactions": { - "total_count": 1, - "+1": 1, - "-1": 1, - "laugh": 1, - "confused": 1, - "heart": 1, - "hooray": 1, - "rocket": 1, - "eyes": 1, - "url": "url" - }, - "repository_url": "rurl", - "updated_at": ` + referenceTimeStr + `, - "user": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" + "discussion":{ + "repository_url":"rurl", + "category":{ + "id":1, + "node_id":"nid", + "repository_id":1, + "emoji":"emoji", + "name":"name", + "description":"description", + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "slug":"slug", + "is_answerable":false + }, + "html_url":"hurl", + "id":1, + "node_id":"nurl", + "number":1, + "title":"title", + "user":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "state":"st", + "locked":false, + "comments":1, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "author_association":"aa", + "body":"bo" + }, + "comment":{ + "author_association":"aa", + "body":"bo", + "child_comment_count":1, + "created_at":` + referenceTimeStr + `, + "discussion_id":1, + "html_url":"hurl", + "id":1, + "node_id":"nid", + "parent_id":1, + "reactions":{ + "total_count":1, + "+1":1, + "-1":1, + "laugh":1, + "confused":1, + "heart":1, + "hooray":1, + "rocket":1, + "eyes":1, + "url":"url" + }, + "repository_url":"rurl", + "updated_at":` + referenceTimeStr + `, + "user":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" } }, - "discussion": { - "repository_url": "rurl", - "category": { - "id": 1, - "node_id": "nid", - "repository_id": 1, - "emoji": "emoji", - "name": "name", - "description": "description", - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "slug": "slug", - "is_answerable": false - }, - "html_url": "hurl", - "id": 1, - "node_id": "nurl", - "number": 1, - "title": "title", - "user": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "state": "st", - "locked": false, - "comments": 1, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "author_association": "aa", - "body": "bo" - }, - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -7307,174 +7285,174 @@ func TestDiscussionEvent_Marshal(t *testing.T) { } want := `{ - "discussion": { - "repository_url": "rurl", - "category": { - "id": 1, - "node_id": "nid", - "repository_id": 1, - "emoji": "emoji", - "name": "name", - "description": "description", - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "slug": "slug", - "is_answerable": false - }, - "html_url": "hurl", - "id": 1, - "node_id": "nurl", - "number": 1, - "title": "title", - "user": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "state": "st", - "locked": false, - "comments": 1, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "author_association": "aa", - "body": "bo" - }, - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "discussion":{ + "repository_url":"rurl", + "category":{ + "id":1, + "node_id":"nid", + "repository_id":1, + "emoji":"emoji", + "name":"name", + "description":"description", + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "slug":"slug", + "is_answerable":false + }, + "html_url":"hurl", + "id":1, + "node_id":"nurl", + "number":1, + "title":"title", + "user":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "state":"st", + "locked":false, + "comments":1, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "author_association":"aa", + "body":"bo" + }, + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -7544,65 +7522,65 @@ func TestPackageEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "package": { - "id": 1, - "name": "n", - "package_type": "pt", - "html_url": "hurl", - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "owner": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "package_version": { - "id": 1 - }, - "registry": { - "name": "n" + "action":"a", + "package":{ + "id":1, + "name":"n", + "package_type":"pt", + "html_url":"hurl", + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "owner":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "package_version":{ + "id":1 + }, + "registry":{ + "name":"n" } }, - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" } }` @@ -7643,40 +7621,40 @@ func TestPersonalAccessTokenRequestEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "personal_access_token_request": { - "id": 1, - "owner": { - "login": "l" - }, - "permissions_added": { - "organization": { - "organization_events": "read" + "action":"a", + "personal_access_token_request":{ + "id":1, + "owner":{ + "login":"l" + }, + "permissions_added":{ + "organization":{ + "organization_events":"read" }, - "repository": { - "security_events": "write" + "repository":{ + "security_events":"write" } }, - "created_at": ` + referenceTimeStr + `, - "token_expired": false, - "token_expires_at": ` + referenceTimeStr + `, - "token_last_used_at": ` + referenceTimeStr + `, - "repository_count": 1, - "repository_selection": "rs", - "repositories": [ + "repository_selection":"rs", + "repository_count":1, + "repositories":[ { - "name": "n" + "name":"n" } - ] + ], + "created_at":` + referenceTimeStr + `, + "token_expired":false, + "token_expires_at":` + referenceTimeStr + `, + "token_last_used_at":` + referenceTimeStr + ` }, - "organization": { - "name": "n" + "organization":{ + "name":"n" }, - "sender": { - "login": "l" + "sender":{ + "login":"l" }, - "installation": { - "id": 1 + "installation":{ + "id":1 } }` @@ -7802,124 +7780,124 @@ func TestPingEvent_Marshal(t *testing.T) { } want := `{ - "zen": "z", - "hook_id": 1, - "hook": { - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "url": "url", - "id": 1, - "type": "t", - "name": "n", - "test_url": "tu", - "ping_url": "pu", - "last_response": { - "key": "value" - }, - "config": { - "key": "value" - }, - "events": [ + "zen":"z", + "hook_id":1, + "hook":{ + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "url":"url", + "id":1, + "type":"t", + "name":"n", + "test_url":"tu", + "ping_url":"pu", + "last_response":{ + "key":"value" + }, + "config":{ + "key":"value" + }, + "events":[ "a" ], - "active": true - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "active":true + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -8071,143 +8049,143 @@ func TestRepositoryDispatchEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "branch": "b", - "client_payload": { - "key": "value" - }, - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ - "e" - ], - "single_file_paths": [ + "action":"a", + "branch":"b", + "client_payload":{ + "key":"value" + }, + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ + "e" + ], + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -8258,42 +8236,42 @@ func TestRepositoryImportEvent_Marshal(t *testing.T) { } want := `{ - "status": "success", - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" + "status":"success", + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" } }` @@ -8437,139 +8415,139 @@ func TestRepositoryEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "action":"a", + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -8707,139 +8685,139 @@ func TestReleaseEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "release": { - "name": "n", - "discussion_category_name": "dcn", - "id": 2, - "created_at": ` + referenceTimeStr + `, - "published_at": ` + referenceTimeStr + `, - "url": "url", - "html_url": "htmlurl", - "assets_url": "assetsurl", - "assets": [ + "action":"a", + "release":{ + "name":"n", + "discussion_category_name":"dcn", + "id":2, + "created_at":` + referenceTimeStr + `, + "published_at":` + referenceTimeStr + `, + "url":"url", + "html_url":"htmlurl", + "assets_url":"assetsurl", + "assets":[ { - "id": 1 + "id":1 } ], - "upload_url": "uploadurl", - "zipball_url": "zipballurl", - "tarball_url": "tarballurl", - "author": { - "name": "octocat" - }, - "node_id": "nid" - }, - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "upload_url":"uploadurl", + "zipball_url":"zipballurl", + "tarball_url":"tarballurl", + "author":{ + "name":"octocat" + }, + "node_id":"nid" + }, + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -8966,122 +8944,122 @@ func TestContentReferenceEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "content_reference": { - "id": 1, - "node_id": "nid", - "reference": "ref" - }, - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "action":"a", + "content_reference":{ + "id":1, + "node_id":"nid", + "reference":"ref" + }, + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -9212,126 +9190,126 @@ func TestMemberEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "member": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "action":"a", + "member":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -9519,183 +9497,183 @@ func TestMembershipEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "scope": "s", - "member": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "team": { - "id": 1, - "node_id": "n", - "name": "n", - "description": "d", - "url": "u", - "slug": "s", - "permission": "p", - "privacy": "p", - "members_count": 1, - "repos_count": 1, - "organization": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "html_url": "h", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e" - }, - "members_url": "m", - "repositories_url": "r", - "parent": { - "id": 1, - "node_id": "n", - "name": "n", - "description": "d", - "url": "u", - "slug": "s", - "permission": "p", - "privacy": "p", - "members_count": 1, - "repos_count": 1 - }, - "ldap_dn": "l" - }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "action":"a", + "scope":"s", + "member":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "team":{ + "id":1, + "node_id":"n", + "name":"n", + "description":"d", + "url":"u", + "slug":"s", + "permission":"p", + "privacy":"p", + "members_count":1, + "repos_count":1, + "organization":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "html_url":"h", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e" + }, + "members_url":"m", + "repositories_url":"r", + "parent":{ + "id":1, + "node_id":"n", + "name":"n", + "description":"d", + "url":"u", + "slug":"s", + "permission":"p", + "privacy":"p", + "members_count":1, + "repos_count":1 + }, + "ldap_dn":"l" + }, + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -9846,148 +9824,148 @@ func TestMergeGroupEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "merge_group": { - "head_sha": "hs", - "head_ref": "hr", - "base_sha": "bs", - "base_ref": "br", - "head_commit": { - "node_id": "nid" + "action":"a", + "merge_group":{ + "head_sha":"hs", + "head_ref":"hr", + "base_sha":"bs", + "base_ref":"br", + "head_commit":{ + "node_id":"nid" } }, - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" } }` @@ -10135,143 +10113,143 @@ func TestOrgBlockEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "blocked_user": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "action":"a", + "blocked_user":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -10402,126 +10380,126 @@ func TestGollumEvent_Marshal(t *testing.T) { } want := `{ - "pages": [ + "pages":[ { - "page_name": "pn", - "title": "t", - "summary": "s", - "action": "a", - "sha": "sha", - "html_url": "hu" + "page_name":"pn", + "title":"t", + "summary":"s", + "action":"a", + "sha":"sha", + "html_url":"hu" } ], - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -10664,134 +10642,134 @@ func TestWorkflowRunEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "workflow": { - "id": 1, - "node_id": "nid", - "name": "n", - "path": "p", - "state": "s", - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "url": "u", - "html_url": "h", - "badge_url": "b" - }, - "workflow_run": { - "id": 1, - "name": "n", - "node_id": "nid", - "head_branch": "hb", - "head_sha": "hs", - "run_number": 1, - "run_attempt": 1, - "event": "e", - "status": "s", - "conclusion": "c", - "workflow_id": 1, - "url": "u", - "html_url": "h", - "pull_requests": [ + "action":"a", + "workflow":{ + "id":1, + "node_id":"nid", + "name":"n", + "path":"p", + "state":"s", + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "url":"u", + "html_url":"h", + "badge_url":"b" + }, + "workflow_run":{ + "id":1, + "name":"n", + "node_id":"nid", + "head_branch":"hb", + "head_sha":"hs", + "run_number":1, + "run_attempt":1, + "event":"e", + "status":"s", + "conclusion":"c", + "workflow_id":1, + "url":"u", + "html_url":"h", + "pull_requests":[ { - "id": 1, - "number": 1, - "url": "u", - "head": { - "ref": "r", - "sha": "s", - "repo": { - "id": 1, - "name": "n", - "url": "s" + "id":1, + "number":1, + "url":"u", + "head":{ + "ref":"r", + "sha":"s", + "repo":{ + "id":1, + "name":"n", + "url":"s" } }, - "base": { - "ref": "r", - "sha": "s", - "repo": { - "id": 1, - "name": "n", - "url": "u" + "base":{ + "ref":"r", + "sha":"s", + "repo":{ + "id":1, + "name":"n", + "url":"u" } } } ], - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "run_started_at": ` + referenceTimeStr + `, - "jobs_url": "j", - "logs_url": "l", - "check_suite_url": "c", - "artifacts_url": "a", - "cancel_url": "c", - "rerun_url": "r", - "previous_attempt_url": "p", - "head_commit": { - "message": "m", - "author": { - "name": "n", - "email": "e", - "username": "l" + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "run_started_at":` + referenceTimeStr + `, + "jobs_url":"j", + "logs_url":"l", + "check_suite_url":"c", + "artifacts_url":"a", + "cancel_url":"c", + "rerun_url":"r", + "previous_attempt_url":"p", + "head_commit":{ + "message":"m", + "author":{ + "name":"n", + "email":"e", + "username":"l" }, - "url": "u", - "distinct": false, - "sha": "s", - "id": "i", - "tree_id": "tid", - "timestamp": ` + referenceTimeStr + `, - "committer": { - "name": "n", - "email": "e", - "username": "l" + "url":"u", + "distinct":false, + "sha":"s", + "id":"i", + "tree_id":"tid", + "timestamp":` + referenceTimeStr + `, + "committer":{ + "name":"n", + "email":"e", + "username":"l" } }, - "workflow_url": "w", - "repository": { - "id": 1, - "name": "n", - "url": "u" + "workflow_url":"w", + "repository":{ + "id":1, + "name":"n", + "url":"u" }, - "head_repository": { - "id": 1, - "name": "n", - "url": "u" + "head_repository":{ + "id":1, + "name":"n", + "url":"u" } }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true + }, + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" } }` @@ -10848,46 +10826,46 @@ func TestWorkflowDispatchEvent_Marshal(t *testing.T) { } want := `{ - "inputs": { - "key": "value" - }, - "ref": "r", - "workflow": "w", - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" + "inputs":{ + "key":"value" + }, + "ref":"r", + "workflow":"w", + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" } }` @@ -11009,117 +10987,117 @@ func TestWatchEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "action":"a", + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -11165,36 +11143,36 @@ func TestUserEvent_Marshal(t *testing.T) { } want := `{ - "user": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "action": "a", - "enterprise": { - "id": 1, - "slug": "s", - "name": "n", - "node_id": "nid", - "avatar_url": "au", - "description": "d", - "website_url": "wu", - "html_url": "hu", - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + ` - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" + "user":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "action":"a", + "enterprise":{ + "id":1, + "slug":"s", + "name":"n", + "node_id":"nid", + "avatar_url":"au", + "description":"d", + "website_url":"wu", + "html_url":"hu", + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + ` + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" } }` @@ -11427,228 +11405,228 @@ func TestCheckRunEvent_Marshal(t *testing.T) { } want := `{ - "check_run": { - "id": 1, - "node_id": "n", - "head_sha": "h", - "external_id": "1", - "url": "u", - "html_url": "u", - "details_url": "u", - "status": "s", - "conclusion": "c", - "started_at": ` + referenceTimeStr + `, - "completed_at": ` + referenceTimeStr + `, - "output": { - "title": "t", - "summary": "s", - "text": "t", - "annotations_count": 1, - "annotations_url": "a", - "annotations": [ + "check_run":{ + "id":1, + "node_id":"n", + "head_sha":"h", + "external_id":"1", + "url":"u", + "html_url":"u", + "details_url":"u", + "status":"s", + "conclusion":"c", + "started_at":` + referenceTimeStr + `, + "completed_at":` + referenceTimeStr + `, + "output":{ + "title":"t", + "summary":"s", + "text":"t", + "annotations_count":1, + "annotations_url":"a", + "annotations":[ { - "path": "p", - "start_line": 1, - "end_line": 1, - "annotation_level": "a", - "message": "m", - "title": "t", - "raw_details": "r" + "path":"p", + "start_line":1, + "end_line":1, + "annotation_level":"a", + "message":"m", + "title":"t", + "raw_details":"r" } ], - "images": [ + "images":[ { - "alt": "a", - "image_url": "i", - "caption": "c" + "alt":"a", + "image_url":"i", + "caption":"c" } ] }, - "name": "n", - "check_suite": { - "id": 1 - }, - "app": { - "id": 1, - "node_id": "n", - "owner": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" + "name":"n", + "check_suite":{ + "id":1 + }, + "app":{ + "id":1, + "node_id":"n", + "owner":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" }, - "name": "n", - "description": "d", - "external_url": "u", - "html_url": "h", - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + ` - }, - "pull_requests": [ + "name":"n", + "description":"d", + "external_url":"u", + "html_url":"h", + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + ` + }, + "pull_requests":[ { - "id": 1, - "number": 1, - "url": "u", - "head": { - "ref": "r", - "sha": "s", - "repo": { - "id": 1, - "name": "n", - "url": "s" + "id":1, + "number":1, + "url":"u", + "head":{ + "ref":"r", + "sha":"s", + "repo":{ + "id":1, + "name":"n", + "url":"s" } }, - "base": { - "ref": "r", - "sha": "s", - "repo": { - "id": 1, - "name": "n", - "url": "u" + "base":{ + "ref":"r", + "sha":"s", + "repo":{ + "id":1, + "name":"n", + "url":"u" } } } ] }, - "action": "a", - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "action":"a", + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` - }, - "requested_action": { - "identifier": "i" + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` + }, + "requested_action":{ + "identifier":"i" } }` @@ -11853,200 +11831,200 @@ func TestCheckSuiteEvent_Marshal(t *testing.T) { } want := `{ - "check_suite": { - "id": 1, - "node_id": "n", - "head_branch": "h", - "head_sha": "h", - "url": "u", - "before": "b", - "after": "a", - "status": "s", - "conclusion": "c", - "app": { - "id": 1, - "node_id": "n", - "owner": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" + "check_suite":{ + "id":1, + "node_id":"n", + "head_branch":"h", + "head_sha":"h", + "url":"u", + "before":"b", + "after":"a", + "status":"s", + "conclusion":"c", + "app":{ + "id":1, + "node_id":"n", + "owner":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" }, - "name": "n", - "description": "d", - "external_url": "u", - "html_url": "h", - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + ` + "name":"n", + "description":"d", + "external_url":"u", + "html_url":"h", + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + ` }, - "repository": { - "id": 1 + "repository":{ + "id":1 }, - "pull_requests": [ - { - "id": 1, - "number": 1, - "url": "u", - "head": { - "ref": "r", - "sha": "s", - "repo": { - "id": 1, - "name": "n", - "url": "s" - } - }, - "base": { - "ref": "r", - "sha": "s", - "repo": { - "id": 1, - "name": "n", - "url": "u" + "pull_requests":[ + { + "id":1, + "number":1, + "url":"u", + "head":{ + "ref":"r", + "sha":"s", + "repo":{ + "id":1, + "name":"n", + "url":"s" + } + }, + "base":{ + "ref":"r", + "sha":"s", + "repo":{ + "id":1, + "name":"n", + "url":"u" + } } } + ], + "head_commit":{ + "sha":"s" } - ], - "head_commit": { - "sha": "s" - } }, - "action": "a", - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "action":"a", + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -12106,51 +12084,51 @@ func TestDeployKeyEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "key": { - "id": 1, - "key": "k", - "url": "k", - "title": "k", - "read_only": false, - "verified": false, - "created_at": ` + referenceTimeStr + ` - }, - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" + "action":"a", + "key":{ + "id":1, + "key":"k", + "url":"k", + "title":"k", + "read_only":false, + "verified":false, + "created_at":` + referenceTimeStr + ` + }, + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" } }` @@ -12183,27 +12161,27 @@ func TestMetaEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "hook_id": 1, - "hook": { - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "url": "u", - "id": 1, - "type": "t", - "name": "n", - "test_url": "tu", - "ping_url": "pu", - "last_response": { - "a": "b" - }, - "config": { - "a": "b" - }, - "events": [ + "action":"a", + "hook_id":1, + "hook":{ + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "url":"u", + "id":1, + "type":"t", + "name":"n", + "test_url":"tu", + "ping_url":"pu", + "last_response":{ + "a":"b" + }, + "config":{ + "a":"b" + }, + "events":[ "a" ], - "active": true + "active":true } }` @@ -12211,15 +12189,13 @@ func TestMetaEvent_Marshal(t *testing.T) { } func TestRequestedAction_Marshal(t *testing.T) { - testJSONMarshal(t, &RequestedAction{}, "{}") + testJSONMarshal(t, &RequestedAction{}, `{"identifier":""}`) r := &RequestedAction{ Identifier: "i", } - want := `{ - "identifier": "i" - }` + want := `{"identifier":"i"}` testJSONMarshal(t, r, want) } @@ -12343,121 +12319,121 @@ func TestCreateEvent_Marshal(t *testing.T) { } want := `{ - "ref": "r", - "ref_type": "rt", - "master_branch": "mb", - "description": "d", - "pusher_type": "pt", - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "ref":"r", + "ref_type":"rt", + "master_branch":"mb", + "description":"d", + "pusher_type":"pt", + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -12581,119 +12557,119 @@ func TestDeleteEvent_Marshal(t *testing.T) { } want := `{ - "ref": "r", - "ref_type": "rt", - "pusher_type": "pt", - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "ref":"r", + "ref_type":"rt", + "pusher_type":"pt", + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -12929,232 +12905,232 @@ func TestDependabotAlertEvent_Marshal(t *testing.T) { }, } want := `{ - "action": "a", - "alert": { - "number": 1, - "state": "s", - "dependency": { - "package": { - "ecosystem": "e", - "name": "n" + "action":"a", + "alert":{ + "number":1, + "state":"s", + "dependency":{ + "package":{ + "ecosystem":"e", + "name":"n" }, - "manifest_path": "mp", - "scope": "s" - }, - "security_advisory": { - "ghsa_id": "ghsaid", - "cve_id": "cveid", - "summary": "s", - "description": "d", - "vulnerabilities": [ + "manifest_path":"mp", + "scope":"s" + }, + "security_advisory":{ + "ghsa_id":"ghsaid", + "cve_id":"cveid", + "summary":"s", + "description":"d", + "vulnerabilities":[ { - "package": { - "ecosystem": "e", - "name": "n" + "package":{ + "ecosystem":"e", + "name":"n" }, - "severity": "s" + "severity":"s" } ], - "severity": "s", - "cvss": { - "score": 1.0, - "vector_string": "vs" + "severity":"s", + "cvss":{ + "score":1, + "vector_string":"vs" }, - "cwes": [ + "cwes":[ { - "cwe_id": "cweid", - "name": "n" + "cwe_id":"cweid", + "name":"n" } ], - "identifiers": [ + "identifiers":[ { - "value": "v", - "type": "t" + "value":"v", + "type":"t" } ], - "references": [ + "references":[ { - "url": "u" + "url":"u" } ], - "published_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "withdrawn_at": ` + referenceTimeStr + ` - }, - "security_vulnerability": { - "package": { - "ecosystem": "e", - "name": "n" + "published_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "withdrawn_at":` + referenceTimeStr + ` + }, + "security_vulnerability":{ + "package":{ + "ecosystem":"e", + "name":"n" }, - "severity": "s", - "vulnerable_version_range": "vvr", - "first_patched_version": { - "identifier": "i" + "severity":"s", + "vulnerable_version_range":"vvr", + "first_patched_version":{ + "identifier":"i" } }, - "url": "u", - "html_url": "hu", - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "dismissed_at": ` + referenceTimeStr + `, - "dismissed_by": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "dismissed_reason": "dr", - "dismissed_comment": "dc", - "fixed_at": ` + referenceTimeStr + `, - "auto_dismissed_at": ` + referenceTimeStr + ` - }, - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "enterprise": { - "id": 1, - "slug": "s", - "name": "n", - "node_id": "nid", - "avatar_url": "au", - "description": "d", - "website_url": "wu", - "html_url": "hu", - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + ` - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "url":"u", + "html_url":"hu", + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "dismissed_at":` + referenceTimeStr + `, + "dismissed_by":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "dismissed_reason":"dr", + "dismissed_comment":"dc", + "fixed_at":` + referenceTimeStr + `, + "auto_dismissed_at":` + referenceTimeStr + ` + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` + }, + "enterprise":{ + "id":1, + "slug":"s", + "name":"n", + "node_id":"nid", + "avatar_url":"au", + "description":"d", + "website_url":"wu", + "html_url":"hu", + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + ` + }, + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true } }` @@ -13280,121 +13256,121 @@ func TestForkEvent_Marshal(t *testing.T) { } want := `{ - "forkee": { - "id": 1, - "name": "n", - "url": "s" - }, - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "forkee":{ + "id":1, + "name":"n", + "url":"s" + }, + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -13418,15 +13394,15 @@ func TestGitHubAppAuthorizationEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" + "action":"a", + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" } }` @@ -13550,119 +13526,119 @@ func TestInstallationEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "repositories": [ + "action":"a", + "repositories":[ { "id":1, "name":"n", "url":"u" } ], - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -13698,32 +13674,32 @@ func TestHeadCommit_Marshal(t *testing.T) { } want := `{ - "message": "m", - "author": { - "date": ` + referenceTimeStr + `, - "name": "n", - "email": "e", - "username": "u" - }, - "url": "u", - "distinct": true, - "sha": "s", - "id": "id", - "tree_id": "tid", - "timestamp": ` + referenceTimeStr + `, - "committer": { - "date": ` + referenceTimeStr + `, - "name": "n", - "email": "e", - "username": "u" - }, - "added": [ + "message":"m", + "author":{ + "date":` + referenceTimeStr + `, + "name":"n", + "email":"e", + "username":"u" + }, + "url":"u", + "distinct":true, + "sha":"s", + "id":"id", + "tree_id":"tid", + "timestamp":` + referenceTimeStr + `, + "committer":{ + "date":` + referenceTimeStr + `, + "name":"n", + "email":"e", + "username":"u" + }, + "added":[ "a" ], - "removed": [ + "removed":[ "r" ], - "modified": [ + "modified":[ "m" ] }` @@ -13791,60 +13767,63 @@ func TestPushEventRepository_Marshal(t *testing.T) { } want := `{ - "id": 1, - "node_id": "nid", - "name": "n", - "full_name": "fn", - "owner": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "url": "u" - }, - "private": true, - "description": "d", - "fork": true, - "created_at": ` + referenceTimeStr + `, - "pushed_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "homepage": "h", - "pulls_url": "p", - "size": 1, - "stargazers_count": 1, - "watchers_count": 1, - "language": "l", - "has_issues": true, - "has_downloads": true, - "has_wiki": true, - "has_pages": true, - "forks_count": 1, - "archived": true, - "disabled": true, - "open_issues_count": 1, - "default_branch": "d", - "master_branch": "m", - "organization": "o", - "url": "u", - "archive_url": "a", - "html_url": "h", - "statuses_url": "s", - "git_url": "g", - "ssh_url": "s", - "clone_url": "c", - "svn_url": "s", - "topics": ["octocat","api"] - }` + "id":1, + "node_id":"nid", + "name":"n", + "full_name":"fn", + "owner":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "url":"u" + }, + "private":true, + "description":"d", + "fork":true, + "created_at":` + referenceTimeStr + `, + "pushed_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "homepage":"h", + "pulls_url":"p", + "size":1, + "stargazers_count":1, + "watchers_count":1, + "language":"l", + "has_issues":true, + "has_downloads":true, + "has_wiki":true, + "has_pages":true, + "forks_count":1, + "archived":true, + "disabled":true, + "open_issues_count":1, + "default_branch":"d", + "master_branch":"m", + "organization":"o", + "url":"u", + "archive_url":"a", + "html_url":"h", + "statuses_url":"s", + "git_url":"g", + "ssh_url":"s", + "clone_url":"c", + "svn_url":"s", + "topics":[ + "octocat", + "api" + ] + }` testJSONMarshal(t, u, want) } @@ -13858,8 +13837,8 @@ func TestPushEventRepoOwner_Marshal(t *testing.T) { } want := `{ - "name": "n", - "email": "e" + "name":"n", + "email":"e" }` testJSONMarshal(t, u, want) @@ -14007,150 +13986,150 @@ func TestProjectEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "changes": { - "name": { - "from": "NameFrom" + "action":"a", + "changes":{ + "name":{ + "from":"NameFrom" }, - "body": { - "from": "BodyFrom" + "body":{ + "from":"BodyFrom" } }, - "project": { - "id": 1 - }, - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "project":{ + "id":1 + }, + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -14299,148 +14278,148 @@ func TestProjectCardEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "changes": { - "note": { - "from": "NoteFrom" + "action":"a", + "changes":{ + "note":{ + "from":"NoteFrom" } }, - "after_id": 1, - "project_card": { - "id": 1 - }, - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "after_id":1, + "project_card":{ + "id":1 + }, + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -14589,148 +14568,148 @@ func TestProjectColumnEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "changes": { - "name": { - "from": "NameFrom" + "action":"a", + "changes":{ + "name":{ + "from":"NameFrom" } }, - "after_id": 1, - "project_column": { - "id": 1 - }, - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "after_id":1, + "project_column":{ + "id":1 + }, + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -14843,104 +14822,104 @@ func TestProjectV2Event_Marshal(t *testing.T) { } want := `{ - "action": "a", - "projects_v2": { - "id": 1, - "node_id": "nid", - "owner": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "creator": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "title": "t", - "description": "d", - "public": true, - "closed_at": ` + referenceTimeStr + `, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "deleted_at": ` + referenceTimeStr + `, - "number": 1, - "short_description": "sd", - "deleted_by": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" + "action":"a", + "projects_v2":{ + "id":1, + "node_id":"nid", + "owner":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "creator":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "title":"t", + "description":"d", + "public":true, + "closed_at":` + referenceTimeStr + `, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "deleted_at":` + referenceTimeStr + `, + "number":1, + "short_description":"sd", + "deleted_by":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" } }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" } + }, + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" } }` @@ -15038,89 +15017,89 @@ func TestProjectV2ItemEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "changes": { - "archived_at": { - "from": ` + referenceTimeStr + `, - "to": ` + referenceTimeStr + ` + "action":"a", + "changes":{ + "archived_at":{ + "from":` + referenceTimeStr + `, + "to":` + referenceTimeStr + ` } }, - "projects_v2_item": { - "id": 1, - "node_id": "nid", - "project_node_id": "pnid", - "content_node_id": "cnid", - "content_type": "ct", - "creator": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "archived_at": ` + referenceTimeStr + ` - }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "projects_v2_item":{ + "id":1, + "node_id":"nid", + "project_node_id":"pnid", + "content_node_id":"cnid", + "content_type":"ct", + "creator":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "archived_at":` + referenceTimeStr + ` + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" } + }, + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" } }` @@ -15313,194 +15292,194 @@ func TestPullRequestEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "assignee": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "number": 1, - "pull_request": { - "id": 1 - }, - "changes": { - "title": { - "from": "TitleFrom" - }, - "body": { - "from": "BodyFrom" - }, - "base": { - "ref": { - "from": "BaseRefFrom" + "action":"a", + "assignee":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "number":1, + "pull_request":{ + "id":1 + }, + "changes":{ + "title":{ + "from":"TitleFrom" + }, + "body":{ + "from":"BodyFrom" + }, + "base":{ + "ref":{ + "from":"BaseRefFrom" }, - "sha": { - "from": "BaseSHAFrom" + "sha":{ + "from":"BaseSHAFrom" } } }, - "requested_reviewer": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "requested_team": { - "id": 1 - }, - "label": { - "id": 1 - }, - "before": "before", - "after": "after", - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "performed_via_github_app": { - "id": 1, - "node_id": "n", - "slug": "s", - "name": "n", - "description": "d", - "external_url": "e", - "html_url": "h" - }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "requested_reviewer":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "requested_team":{ + "id":1 + }, + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` + }, + "label":{ + "id":1 + }, + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true + }, + "before":"before", + "after":"after", + "performed_via_github_app":{ + "id":1, + "slug":"s", + "node_id":"n", + "name":"n", + "description":"d", + "external_url":"e", + "html_url":"h" } }` @@ -15640,139 +15619,139 @@ func TestPullRequestReviewCommentEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "pull_request": { - "id": 1 + "action":"a", + "pull_request":{ + "id":1 }, - "comment": { - "id": 1 + "comment":{ + "id":1 }, - "changes": { - "title": { - "from": "TitleFrom" + "changes":{ + "title":{ + "from":"TitleFrom" }, - "body": { - "from": "BodyFrom" + "body":{ + "from":"BodyFrom" }, - "base": { - "ref": { - "from": "BaseRefFrom" + "base":{ + "ref":{ + "from":"BaseRefFrom" }, - "sha": { - "from": "BaseSHAFrom" + "sha":{ + "from":"BaseSHAFrom" } } }, - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -15898,130 +15877,130 @@ func TestPullRequestReviewThreadEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "pull_request": { - "id": 1 - }, - "thread": { - "comments": [ + "action":"a", + "thread":{ + "comments":[ { - "id": 1 + "id":1 }, { - "id": 2 + "id":2 } ] }, - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "pull_request":{ + "id":1 + }, + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -16214,194 +16193,194 @@ func TestPullRequestTargetEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "assignee": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "number": 1, - "pull_request": { - "id": 1 - }, - "changes": { - "title": { - "from": "TitleFrom" - }, - "body": { - "from": "BodyFrom" - }, - "base": { - "ref": { - "from": "BaseRefFrom" + "action":"a", + "assignee":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "number":1, + "pull_request":{ + "id":1 + }, + "changes":{ + "title":{ + "from":"TitleFrom" + }, + "body":{ + "from":"BodyFrom" + }, + "base":{ + "ref":{ + "from":"BaseRefFrom" }, - "sha": { - "from": "BaseSHAFrom" + "sha":{ + "from":"BaseSHAFrom" } } }, - "requested_reviewer": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "requested_team": { - "id": 1 - }, - "label": { - "id": 1 - }, - "before": "before", - "after": "after", - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "performed_via_github_app": { - "id": 1, - "node_id": "n", - "slug": "s", - "name": "n", - "description": "d", - "external_url": "e", - "html_url": "h" - }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "requested_reviewer":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "requested_team":{ + "id":1 + }, + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` + }, + "label":{ + "id":1 + }, + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true + }, + "before":"before", + "after":"after", + "performed_via_github_app":{ + "id":1, + "slug":"s", + "node_id":"n", + "name":"n", + "description":"d", + "external_url":"e", + "html_url":"h" } }` @@ -16440,30 +16419,30 @@ func TestRepositoryVulnerabilityAlertEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "alert": { - "id": 1, - "affected_range": "ar", - "affected_package_name": "apn", - "external_reference": "er", - "external_identifier": "ei", - "fixed_in": "fi", - "dismisser": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "dismiss_reason": "dr", - "dismissed_at": ` + referenceTimeStr + ` - }, - "repository": { - "id": 1, - "name": "n", - "url": "s" + "action":"a", + "alert":{ + "id":1, + "affected_range":"ar", + "affected_package_name":"apn", + "external_reference":"er", + "external_identifier":"ei", + "fixed_in":"fi", + "dismisser":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "dismiss_reason":"dr", + "dismissed_at":` + referenceTimeStr + ` + }, + "repository":{ + "id":1, + "name":"n", + "url":"s" } }` @@ -16634,166 +16613,166 @@ func TestSecretScanningAlertEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "alert": { - "number": 1, - "secret_type": "t", - "resolution": "r", - "resolved_by": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "resolved_at": ` + referenceTimeStr + ` - }, - "repository": { - "id": 1, - "name": "n", - "url": "s" - }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "enterprise": { - "id": 1, - "slug": "s", - "name": "n", - "node_id": "nid", - "avatar_url": "au", - "description": "d", - "website_url": "wu", - "html_url": "hu", - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + ` - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "action":"a", + "alert":{ + "number":1, + "resolution":"r", + "resolved_at":` + referenceTimeStr + `, + "resolved_by":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "secret_type":"t" + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true + }, + "enterprise":{ + "id":1, + "slug":"s", + "name":"n", + "node_id":"nid", + "avatar_url":"au", + "description":"d", + "website_url":"wu", + "html_url":"hu", + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + ` + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` } }` @@ -16991,196 +16970,195 @@ func TestSecurityAdvisoryEvent_Marshal(t *testing.T) { } want := `{ - "action": "published", - "security_advisory": { - "ghsa_id": "GHSA-rf4j-j272-some", - "summary": "Siuuuuuuuuu", - "cvss": { - "score": 1.0, - "vector_string": "vs" - }, - "cwes": [ - { - "cwe_id": "cweid", - "name": "n" - } - ], - "description": "desc", - "severity": "moderate", - "identifiers": [ - { - "value": "GHSA-rf4j-j272-some", - "type": "GHSA" - } - ], - "references": [ - { - "url": "https://some-url" - } - ], - "published_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "withdrawn_at": null, - "vulnerabilities": [ - { - "package": { - "ecosystem": "ucl", - "name": "penaldo" - }, - "severity": "moderate", - "vulnerable_version_range": ">= 2.0.0, < 2.0.2", - "first_patched_version": { - "identifier": "2.0.2" - } - } - ] - }, - "enterprise": { - "id": 1, - "slug": "s", - "name": "n", - "node_id": "nid", - "avatar_url": "au", - "description": "d", - "website_url": "wu", - "html_url": "hu", - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + ` - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "action":"published", + "security_advisory":{ + "cvss":{ + "score":1, + "vector_string":"vs" + }, + "cwes":[ + { + "cwe_id":"cweid", + "name":"n" + } + ], + "ghsa_id":"GHSA-rf4j-j272-some", + "summary":"Siuuuuuuuuu", + "description":"desc", + "severity":"moderate", + "identifiers":[ + { + "value":"GHSA-rf4j-j272-some", + "type":"GHSA" + } + ], + "references":[ + { + "url":"https://some-url" + } + ], + "published_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "vulnerabilities":[ + { + "package":{ + "ecosystem":"ucl", + "name":"penaldo" + }, + "severity":"moderate", + "vulnerable_version_range":"\u003e= 2.0.0, \u003c 2.0.2", + "first_patched_version":{ + "identifier":"2.0.2" + } + } + ] + }, + "enterprise":{ + "id":1, + "slug":"s", + "name":"n", + "node_id":"nid", + "avatar_url":"au", + "description":"d", + "website_url":"wu", + "html_url":"hu", + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + ` + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` - }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "repository": { - "id": 1, - "url": "s", - "name": "n" - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` + }, + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true + }, + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" } - }` + }` testJSONMarshal(t, u, want) } @@ -17351,170 +17329,169 @@ func TestSecurityAndAnalysisEvent_Marshal(t *testing.T) { } want := `{ - "changes": { - "from": { - "security_and_analysis": { - "advanced_security": { - "status": "enabled" + "changes":{ + "from":{ + "security_and_analysis":{ + "advanced_security":{ + "status":"enabled" }, - "secret_scanning": { - "status": "enabled" + "secret_scanning":{ + "status":"enabled" }, - "secret_scanning_push_protection": { - "status": "enabled" + "secret_scanning_push_protection":{ + "status":"enabled" }, - "dependabot_security_updates": { - "status": "enabled" + "dependabot_security_updates":{ + "status":"enabled" } } } }, - "enterprise": { - "id": 1, - "slug": "s", - "name": "n", - "node_id": "nid", - "avatar_url": "au", - "description": "d", - "website_url": "wu", - "html_url": "hu", - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + ` - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ + "enterprise":{ + "id":1, + "slug":"s", + "name":"n", + "node_id":"nid", + "avatar_url":"au", + "description":"d", + "website_url":"wu", + "html_url":"hu", + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + ` + }, + "installation":{ + "id":1, + "node_id":"nid", + "app_id":1, + "app_slug":"as", + "target_id":1, + "account":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "access_tokens_url":"atu", + "repositories_url":"ru", + "html_url":"hu", + "target_type":"tt", + "single_file_name":"sfn", + "repository_selection":"rs", + "events":[ "e" ], - "single_file_paths": [ + "single_file_paths":[ "s" ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` - }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "repository": { - "id": 1, - "url": "s", - "name": "n" - }, - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - }, - "target_type": "running" + "permissions":{ + "actions":"a", + "administration":"ad", + "checks":"c", + "contents":"co", + "content_references":"cr", + "deployments":"d", + "environments":"e", + "issues":"i", + "metadata":"md", + "members":"m", + "organization_administration":"oa", + "organization_hooks":"oh", + "organization_plan":"op", + "organization_pre_receive_hooks":"opr", + "organization_projects":"op", + "organization_secrets":"os", + "organization_self_hosted_runners":"osh", + "organization_user_blocking":"oub", + "packages":"pkg", + "pages":"pg", + "pull_requests":"pr", + "repository_hooks":"rh", + "repository_projects":"rp", + "repository_pre_receive_hooks":"rprh", + "secrets":"s", + "secret_scanning_alerts":"ssa", + "security_events":"se", + "single_file":"sf", + "statuses":"s", + "team_discussions":"td", + "vulnerability_alerts":"va", + "workflows":"w" + }, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "has_multiple_single_files":false, + "suspended_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" + }, + "suspended_at":` + referenceTimeStr + ` + }, + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true + }, + "repository":{ + "id":1, + "name":"n", + "url":"s" + }, + "sender":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + } }` testJSONMarshal(t, u, want) @@ -17689,172 +17666,161 @@ func TestCodeScanningAlertEvent_Marshal(t *testing.T) { } want := `{ - "action": "reopened", - "alert": { - "number": 10, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "url": "a", - "html_url": "a", - "instances": [ - { - "ref": "refs/heads/main", - "analysis_key": ".github/workflows/workflow.yml:upload", - "environment": "{}", - "state": "open" - } - ], - "state": "open", - "fixed_at": null, - "dismissed_by": null, - "dismissed_at": null, - "dismissed_reason": null, - "rule": { - "id": "Style/FrozenStringLiteralComment", - "severity": "note", - "description": "desc", - "full_description": "full desc", - "tags": [ - "style" - ], - "help": "help" - }, - "tool": { - "name": "Rubocop", - "version": null - } - }, - "ref": "refs/heads/main", - "commit_oid": "d6e4c75c141dbacecc279b721b8bsomeSHA", - "repository": { - "id": 1234234535, - "node_id": "MDEwOlJlcG9zaXRvcnkxODY4NT==", - "name": "Hello-World", - "full_name": "Codertocat/Hello-World", - "private": false, - "owner": { - "login": "Codertocat", - "id": 21031067, - "node_id": "MDQ6VXNlcjIxMDMxMDY3", - "avatar_url": "a", - "gravatar_id": "", - "url": "a", - "html_url": "a", - "followers_url": "a", - "following_url": "a", - "gists_url": "a", - "starred_url": "a", - "subscriptions_url": "a", - "organizations_url": "a", - "repos_url": "a", - "events_url": "a", - "received_events_url": "a", - "type": "User", - "site_admin": false - }, - "html_url": "a", - "description": null, - "fork": false, - "url": "a", - "forks_url": "a", - "keys_url": "a", - "collaborators_url": "a", - "teams_url": "a", - "hooks_url": "a", - "issue_events_url": "a", - "events_url": "a", - "assignees_url": "a", - "branches_url": "a", - "tags_url": "a", - "blobs_url": "a", - "git_tags_url": "a", - "git_refs_url": "a", - "trees_url": "a", - "statuses_url": "a", - "languages_url": "a", - "stargazers_url": "a", - "contributors_url": "a", - "subscribers_url": "a", - "subscription_url": "a", - "commits_url": "a", - "git_commits_url": "a", - "comments_url": "a", - "issue_comment_url": "a", - "contents_url": "a", - "compare_url": "a", - "merges_url": "a", - "archive_url": "a", - "downloads_url": "a", - "issues_url": "a", - "pulls_url": "a", - "milestones_url": "a", - "notifications_url": "a", - "labels_url": "a", - "releases_url": "a", - "deployments_url": "a", - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "pushed_at": ` + referenceTimeStr + `, - "git_url": "a", - "ssh_url": "a", - "clone_url": "a", - "svn_url": "a", - "homepage": null, - "size": 0, - "stargazers_count": 0, - "watchers_count": 0, - "language": null, - "has_issues": true, - "has_projects": true, - "has_downloads": true, - "has_wiki": true, - "has_pages": true, - "forks_count": 0, - "mirror_url": null, - "archived": false, - "disabled": false, - "open_issues_count": 2, - "license": null, - "forks": 0, - "open_issues": 2, - "watchers": 0, - "default_branch": "main" - }, - "organization": { - "login": "Octocoders", - "id": 6, - "node_id": "MDEyOk9yZ2FuaXphdGlvbjY=", - "url": "a", - "repos_url": "a", - "events_url": "a", - "hooks_url": "a", - "issues_url": "a", - "members_url": "a", - "public_members_url": "a", - "avatar_url": "a", - "description": "" - }, - "sender": { - "login": "github", - "id": 9919, - "node_id": "MDEyOk9yZ2FuaXphdGlvbjk5MTk=", - "avatar_url": "a", - "gravatar_id": "", - "url": "a", - "html_url": "a", - "followers_url": "a", - "following_url": "a", - "gists_url": "a", - "starred_url": "a", - "subscriptions_url": "a", - "organizations_url": "a", - "repos_url": "a", - "events_url": "a", - "received_events_url": "a", - "type": "Organization", - "site_admin": false + "action":"reopened", + "alert":{ + "number":10, + "rule":{ + "id":"Style/FrozenStringLiteralComment", + "severity":"note", + "description":"desc", + "full_description":"full desc", + "tags":[ + "style" + ], + "help":"help" + }, + "tool":{ + "name":"Rubocop" + }, + "created_at":"2006-01-02T15:04:05Z", + "updated_at":"2006-01-02T15:04:05Z", + "state":"open", + "url":"a", + "html_url":"a", + "instances":[ + { + "ref":"refs/heads/main", + "analysis_key":".github/workflows/workflow.yml:upload", + "environment":"{}", + "state":"open" + } + ] + }, + "ref":"refs/heads/main", + "commit_oid":"d6e4c75c141dbacecc279b721b8bsomeSHA", + "repository":{ + "id":1234234535, + "node_id":"MDEwOlJlcG9zaXRvcnkxODY4NT==", + "owner":{ + "login":"Codertocat", + "id":21031067, + "node_id":"MDQ6VXNlcjIxMDMxMDY3", + "avatar_url":"a", + "html_url":"a", + "gravatar_id":"", + "type":"User", + "site_admin":false, + "url":"a", + "events_url":"a", + "following_url":"a", + "followers_url":"a", + "gists_url":"a", + "organizations_url":"a", + "received_events_url":"a", + "repos_url":"a", + "starred_url":"a", + "subscriptions_url":"a" + }, + "name":"Hello-World", + "full_name":"Codertocat/Hello-World", + "default_branch":"main", + "created_at":"2006-01-02T15:04:05Z", + "pushed_at":"2006-01-02T15:04:05Z", + "updated_at":"2006-01-02T15:04:05Z", + "html_url":"a", + "clone_url":"a", + "git_url":"a", + "ssh_url":"a", + "svn_url":"a", + "fork":false, + "forks_count":0, + "open_issues_count":2, + "open_issues":2, + "stargazers_count":0, + "watchers_count":0, + "watchers":0, + "size":0, + "archived":false, + "disabled":false, + "private":false, + "has_issues":true, + "has_wiki":true, + "has_pages":true, + "has_projects":true, + "has_downloads":true, + "url":"a", + "archive_url":"a", + "assignees_url":"a", + "blobs_url":"a", + "branches_url":"a", + "collaborators_url":"a", + "comments_url":"a", + "commits_url":"a", + "compare_url":"a", + "contents_url":"a", + "contributors_url":"a", + "deployments_url":"a", + "downloads_url":"a", + "events_url":"a", + "forks_url":"a", + "git_commits_url":"a", + "git_refs_url":"a", + "git_tags_url":"a", + "hooks_url":"a", + "issue_comment_url":"a", + "issue_events_url":"a", + "issues_url":"a", + "keys_url":"a", + "labels_url":"a", + "languages_url":"a", + "merges_url":"a", + "milestones_url":"a", + "notifications_url":"a", + "pulls_url":"a", + "releases_url":"a", + "stargazers_url":"a", + "statuses_url":"a", + "subscribers_url":"a", + "subscription_url":"a", + "tags_url":"a", + "trees_url":"a", + "teams_url":"a" + }, + "organization":{ + "login":"Octocoders", + "id":6, + "node_id":"MDEyOk9yZ2FuaXphdGlvbjY=", + "avatar_url":"a", + "description":"", + "url":"a", + "events_url":"a", + "hooks_url":"a", + "issues_url":"a", + "members_url":"a", + "public_members_url":"a", + "repos_url":"a" + }, + "sender":{ + "login":"github", + "id":9919, + "node_id":"MDEyOk9yZ2FuaXphdGlvbjk5MTk=", + "avatar_url":"a", + "html_url":"a", + "gravatar_id":"", + "type":"Organization", + "site_admin":false, + "url":"a", + "events_url":"a", + "following_url":"a", + "followers_url":"a", + "gists_url":"a", + "organizations_url":"a", + "received_events_url":"a", + "repos_url":"a", + "starred_url":"a", + "subscriptions_url":"a" } - }` + }` testJSONMarshal(t, u, want) } diff --git a/github/gists_comments_test.go b/github/gists_comments_test.go index 593c9eeddc6..8a500500720 100644 --- a/github/gists_comments_test.go +++ b/github/gists_comments_test.go @@ -46,27 +46,27 @@ func TestGistComments_Marshal(t *testing.T) { } want := `{ - "id": 1, - "url": "u", - "body": "test gist comment", - "user": { - "login": "ll", - "id": 123, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "url": "u" + "id":1, + "url":"u", + "body":"test gist comment", + "user":{ + "login":"ll", + "id":123, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "url":"u" }, - "created_at": "2002-02-10T15:30:00Z" + "created_at":"2002-02-10T15:30:00Z" }` testJSONMarshal(t, u, want) diff --git a/github/gists_test.go b/github/gists_test.go index 995363ec4cc..1519b1963a8 100644 --- a/github/gists_test.go +++ b/github/gists_test.go @@ -63,43 +63,43 @@ func TestGist_Marshal(t *testing.T) { } want := `{ - "id": "i", - "description": "description", - "public": true, - "owner": { - "login": "ll", - "id": 123, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "url": "u" + "id":"i", + "description":"description", + "public":true, + "owner":{ + "login":"ll", + "id":123, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "url":"u" }, - "files": { - "gistfile.py": { - "size": 167, - "filename": "gistfile.py", - "language": "Python", - "type": "application/x-python", - "raw_url": "raw-url", - "content": "c" + "files":{ + "gistfile.py":{ + "size":167, + "filename":"gistfile.py", + "language":"Python", + "type":"application/x-python", + "raw_url":"raw-url", + "content":"c" } }, - "comments": 1, - "html_url": "html-url", - "git_pull_url": "gitpull-url", - "git_push_url": "gitpush-url", - "created_at": "2010-02-10T10:10:00Z", - "updated_at": "2010-02-10T10:10:00Z", - "node_id": "node" + "comments":1, + "html_url":"html-url", + "git_pull_url":"gitpull-url", + "git_push_url":"gitpush-url", + "created_at":"2010-02-10T10:10:00Z", + "updated_at":"2010-02-10T10:10:00Z", + "node_id":"node" }` testJSONMarshal(t, u, want) @@ -138,32 +138,32 @@ func TestGistCommit_Marshal(t *testing.T) { } want := `{ - "url": "u", - "version": "v", - "user": { - "login": "ll", - "id": 123, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "url": "u" + "url":"u", + "version":"v", + "user":{ + "login":"ll", + "id":123, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "url":"u" }, - "change_status": { - "additions": 1, - "deletions": 1, - "total": 2 + "change_status":{ + "additions":1, + "deletions":1, + "total":2 }, - "committed_at": ` + referenceTimeStr + `, - "node_id": "node" + "committed_at":` + referenceTimeStr + `, + "node_id":"node" }` testJSONMarshal(t, u, want) @@ -198,28 +198,28 @@ func TestGistFork_Marshal(t *testing.T) { } want := `{ - "url": "u", - "user": { - "login": "ll", - "id": 123, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "url": "u" + "url":"u", + "user":{ + "login":"ll", + "id":123, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "url":"u" }, - "id": "id", - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "node_id": "node" + "id":"id", + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "node_id":"node" }` testJSONMarshal(t, u, want) @@ -1031,12 +1031,12 @@ func TestGistFile_Marshal(t *testing.T) { } want := `{ - "size": 1, - "filename": "fn", - "language": "lan", - "type": "type", - "raw_url": "rurl", - "content": "con" + "size":1, + "filename":"fn", + "language":"lan", + "type":"type", + "raw_url":"rurl", + "content":"con" }` testJSONMarshal(t, u, want) diff --git a/github/git_blobs_test.go b/github/git_blobs_test.go index 94cdd34e7a3..af4b80fee18 100644 --- a/github/git_blobs_test.go +++ b/github/git_blobs_test.go @@ -184,12 +184,12 @@ func TestBlob_Marshal(t *testing.T) { } want := `{ - "content": "content", - "encoding": "encoding", - "sha": "sha", - "size": 1, - "url": "url", - "node_id": "nid" + "content":"content", + "encoding":"encoding", + "sha":"sha", + "size":1, + "url":"url", + "node_id":"nid" }` testJSONMarshal(t, u, want) diff --git a/github/git_commits_test.go b/github/git_commits_test.go index bc25206b495..211db1281c1 100644 --- a/github/git_commits_test.go +++ b/github/git_commits_test.go @@ -87,50 +87,50 @@ func TestCommit_Marshal(t *testing.T) { } want := `{ - "sha": "s", - "author": { - "date": ` + referenceTimeStr + `, - "name": "n", - "email": "e", - "username": "u" + "sha":"s", + "author":{ + "date":` + referenceTimeStr + `, + "name":"n", + "email":"e", + "username":"u" }, - "committer": { - "date": ` + referenceTimeStr + `, - "name": "n", - "email": "e", - "username": "u" + "committer":{ + "date":` + referenceTimeStr + `, + "name":"n", + "email":"e", + "username":"u" }, - "message": "m", - "tree": { - "sha": "s", - "tree": [ + "message":"m", + "tree":{ + "sha":"s", + "tree":[ { - "sha": "s", - "path": "p", - "mode": "m", - "type": "t", - "size": 1, - "content": "c", - "url": "u" + "sha":"s", + "path":"p", + "mode":"m", + "type":"t", + "size":1, + "content":"c", + "url":"u" } ], - "truncated": false + "truncated":false }, - "stats": { - "additions": 1, - "deletions": 1, - "total": 1 + "stats":{ + "additions":1, + "deletions":1, + "total":1 }, - "html_url": "h", - "url": "u", - "verification": { - "verified": false, - "reason": "r", - "signature": "s", - "payload": "p" + "html_url":"h", + "url":"u", + "verification":{ + "verified":false, + "reason":"r", + "signature":"s", + "payload":"p" }, - "node_id": "n", - "comment_count": 1 + "node_id":"n", + "comment_count":1 }` testJSONMarshal(t, u, want) @@ -526,10 +526,10 @@ func TestSignatureVerification_Marshal(t *testing.T) { } want := `{ - "verified": true, - "reason": "reason", - "signature": "sign", - "payload": "payload" + "verified":true, + "reason":"reason", + "signature":"sign", + "payload":"payload" }` testJSONMarshal(t, u, want) @@ -546,10 +546,10 @@ func TestCommitAuthor_Marshal(t *testing.T) { } want := `{ - "date": ` + referenceTimeStr + `, - "name": "name", - "email": "email", - "username": "login" + "date":` + referenceTimeStr + `, + "name":"name", + "email":"email", + "username":"login" }` testJSONMarshal(t, u, want) @@ -578,24 +578,24 @@ func TestCreateCommit_Marshal(t *testing.T) { } want := `{ - "author": { - "date": ` + referenceTimeStr + `, - "name": "name", - "email": "email", - "username": "login" + "author":{ + "date":` + referenceTimeStr + `, + "name":"name", + "email":"email", + "username":"login" }, - "committer": { - "date": ` + referenceTimeStr + `, - "name": "name", - "email": "email", - "username": "login" + "committer":{ + "date":` + referenceTimeStr + `, + "name":"name", + "email":"email", + "username":"login" }, - "message": "message", - "tree": "tree", - "parents": [ + "message":"message", + "tree":"tree", + "parents":[ "p" ], - "signature": "sign" + "signature":"sign" }` testJSONMarshal(t, u, want) diff --git a/github/git_refs_test.go b/github/git_refs_test.go index 1014a44aa5b..bb7b2ab02d9 100644 --- a/github/git_refs_test.go +++ b/github/git_refs_test.go @@ -677,7 +677,11 @@ func TestGitService_UpdateRef_pathEscape(t *testing.T) { } func TestReference_Marshal(t *testing.T) { - testJSONMarshal(t, &Reference{}, "{}") + testJSONMarshal(t, &Reference{}, `{ + "ref":null, + "url":null, + "object":null + }`) u := &Reference{ Ref: String("ref"), @@ -691,21 +695,25 @@ func TestReference_Marshal(t *testing.T) { } want := `{ - "ref": "ref", - "url": "url", - "object": { - "type": "type", - "sha": "sha", - "url": "url" + "ref":"ref", + "url":"url", + "object":{ + "type":"type", + "sha":"sha", + "url":"url" }, - "node_id": "nid" + "node_id":"nid" }` testJSONMarshal(t, u, want) } func TestGitObject_Marshal(t *testing.T) { - testJSONMarshal(t, &GitObject{}, "{}") + testJSONMarshal(t, &GitObject{}, `{ + "type":null, + "sha":null, + "url":null + }`) u := &GitObject{ Type: String("type"), @@ -714,16 +722,19 @@ func TestGitObject_Marshal(t *testing.T) { } want := `{ - "type": "type", - "sha": "sha", - "url": "url" + "type":"type", + "sha":"sha", + "url":"url" }` testJSONMarshal(t, u, want) } func TestCreateRefRequest_Marshal(t *testing.T) { - testJSONMarshal(t, &createRefRequest{}, "{}") + testJSONMarshal(t, &createRefRequest{}, `{ + "ref":null, + "sha":null + }`) u := &createRefRequest{ Ref: String("ref"), @@ -731,15 +742,18 @@ func TestCreateRefRequest_Marshal(t *testing.T) { } want := `{ - "ref": "ref", - "sha": "sha" + "ref":"ref", + "sha":"sha" }` testJSONMarshal(t, u, want) } func TestUpdateRefRequest_Marshal(t *testing.T) { - testJSONMarshal(t, &updateRefRequest{}, "{}") + testJSONMarshal(t, &updateRefRequest{}, `{ + "sha":null, + "force":null + }`) u := &updateRefRequest{ SHA: String("sha"), @@ -747,8 +761,8 @@ func TestUpdateRefRequest_Marshal(t *testing.T) { } want := `{ - "sha": "sha", - "force": true + "sha":"sha", + "force":true }` testJSONMarshal(t, u, want) diff --git a/github/git_tags_test.go b/github/git_tags_test.go index 44084141a06..caa82c22fed 100644 --- a/github/git_tags_test.go +++ b/github/git_tags_test.go @@ -127,28 +127,28 @@ func TestTag_Marshal(t *testing.T) { } want := `{ - "tag": "tag", - "sha": "sha", - "url": "url", - "message": "msg", - "tagger": { - "date": ` + referenceTimeStr + `, - "name": "name", - "email": "email", - "username": "login" + "tag":"tag", + "sha":"sha", + "url":"url", + "message":"msg", + "tagger":{ + "date":` + referenceTimeStr + `, + "name":"name", + "email":"email", + "username":"login" }, - "object": { - "type": "type", - "sha": "sha", - "url": "url" + "object":{ + "type":"type", + "sha":"sha", + "url":"url" }, - "verification": { - "verified": true, - "reason": "reason", - "signature": "sign", - "payload": "payload" + "verification":{ + "verified":true, + "reason":"reason", + "signature":"sign", + "payload":"payload" }, - "node_id": "nid" + "node_id":"nid" }` testJSONMarshal(t, u, want) @@ -171,15 +171,15 @@ func TestCreateTagRequest_Marshal(t *testing.T) { } want := `{ - "tag": "tag", - "message": "msg", - "object": "obj", - "type": "type", - "tagger": { - "date": ` + referenceTimeStr + `, - "name": "name", - "email": "email", - "username": "login" + "tag":"tag", + "message":"msg", + "object":"obj", + "type":"type", + "tagger":{ + "date":` + referenceTimeStr + `, + "name":"name", + "email":"email", + "username":"login" } }` diff --git a/github/git_trees_test.go b/github/git_trees_test.go index 25e5f2aeec6..76021c6d1ff 100644 --- a/github/git_trees_test.go +++ b/github/git_trees_test.go @@ -361,26 +361,26 @@ func TestTree_Marshal(t *testing.T) { } want := `{ - "sha": "sha", - "tree": [ + "sha":"sha", + "tree":[ { - "sha": "sha", - "path": "path", - "mode": "mode", - "type": "type", - "size": 1, - "content": "content", - "url": "url" + "sha":"sha", + "path":"path", + "mode":"mode", + "type":"type", + "size":1, + "content":"content", + "url":"url" } ], - "truncated": false + "truncated":false }` testJSONMarshal(t, u, want) } func TestTreeEntry_Marshal(t *testing.T) { - testJSONMarshal(t, &TreeEntry{}, "{}") + testJSONMarshal(t, &TreeEntry{}, `{"sha":null}`) u := &TreeEntry{ SHA: String("sha"), @@ -393,20 +393,20 @@ func TestTreeEntry_Marshal(t *testing.T) { } want := `{ - "sha": "sha", - "path": "path", - "mode": "mode", - "type": "type", - "size": 1, - "content": "content", - "url": "url" + "sha":"sha", + "path":"path", + "mode":"mode", + "type":"type", + "size":1, + "content":"content", + "url":"url" }` testJSONMarshal(t, u, want) } func TestTreeEntryWithFileDelete_Marshal(t *testing.T) { - testJSONMarshal(t, &treeEntryWithFileDelete{}, "{}") + testJSONMarshal(t, &treeEntryWithFileDelete{}, `{"sha":null}`) u := &treeEntryWithFileDelete{ SHA: String("sha"), @@ -419,20 +419,20 @@ func TestTreeEntryWithFileDelete_Marshal(t *testing.T) { } want := `{ - "sha": "sha", - "path": "path", - "mode": "mode", - "type": "type", - "size": 1, - "content": "content", - "url": "url" + "sha":"sha", + "path":"path", + "mode":"mode", + "type":"type", + "size":1, + "content":"content", + "url":"url" }` testJSONMarshal(t, u, want) } func TestCreateTree_Marshal(t *testing.T) { - testJSONMarshal(t, &createTree{}, "{}") + testJSONMarshal(t, &createTree{}, `{"tree":null}`) u := &createTree{ BaseTree: "bt", @@ -440,8 +440,8 @@ func TestCreateTree_Marshal(t *testing.T) { } want := `{ - "base_tree": "bt", - "tree": ["e"] + "base_tree":"bt", + "tree":["e"] }` testJSONMarshal(t, u, want) diff --git a/github/github_test.go b/github/github_test.go index 7d92946dfd0..3a6522dce45 100644 --- a/github/github_test.go +++ b/github/github_test.go @@ -6,6 +6,7 @@ package github import ( + "bytes" "context" "encoding/json" "errors" @@ -143,29 +144,63 @@ func testBody(t *testing.T, r *http.Request, want string) { } } -// Test whether the marshaling of v produces JSON that corresponds -// to the want string. -func testJSONMarshal(t *testing.T, v interface{}, want string) { +// Test whether structure v has the specified tag in all fields. +func testStructTags(t *testing.T, v interface{}, tag string) { t.Helper() - // Unmarshal the wanted JSON, to verify its correctness, and marshal it back - // to sort the keys. - u := reflect.New(reflect.TypeOf(v)).Interface() - if err := json.Unmarshal([]byte(want), &u); err != nil { - t.Errorf("Unable to unmarshal JSON for %v: %v", want, err) + + vt := reflect.Indirect(reflect.ValueOf(v)).Type() + for i := 0; i < vt.NumField(); i++ { + field := vt.Field(i) + if alias, ok := field.Tag.Lookup(tag); ok { + if alias == "" { + t.Errorf("The field %+v has a blank tag", field) + } + } else { + t.Errorf("The field %+v has no tag specified", field) + } } - w, err := json.MarshalIndent(u, "", " ") - if err != nil { - t.Errorf("Unable to marshal JSON for %#v", u) +} + +// Test whether the marshaling of v produces JSON that corresponds to the +// want string. +// +// Since this is a strictly exact comparison, it is important that we follow +// some rules when constructing the expected value: +// +// - No extra spaces. JSON strings can be formatted using only line breaks and tabs +// (make sure they are tabs and not spaces). +// +// - The JSON fields must be in the same order as they were defined in the +// structure, or in lexicographical order if it's a map. +// +// - All fields must have the JSON tag. +func testJSONMarshal(t *testing.T, v interface{}, want string) { + t.Helper() + + // As the comparison can be made using structures and maps, we need to + // determine the name of the type of v to know if it's a map or not. + interfaceName := fmt.Sprintf("%s", reflect.ValueOf(&v).Elem().Interface()) + + // If the type of v is a structure, check that all fields have the JSON tag. + if !strings.HasPrefix(interfaceName, "&map") { + testStructTags(t, v, "json") } - // Marshal the target value. - got, err := json.MarshalIndent(v, "", " ") + j, err := json.Marshal(v) if err != nil { - t.Errorf("Unable to marshal JSON for %#v", v) + t.Errorf("Unable to unmarshal JSON for %v: %v", v, err) } - if diff := cmp.Diff(string(w), string(got)); diff != "" { - t.Errorf("json.Marshal returned:\n%s\nwant:\n%s\ndiff:\n%v", got, w, diff) + // Remove all spaces and new lines from the JSON strings. + want = strings.Replace(want, "\t", "", -1) + want = strings.Replace(want, "\n", "", -1) + + // Replace the "<" and ">" characters with their unicode escape sequences. + want = strings.Replace(want, "<", "\\u003c", -1) + want = strings.Replace(want, ">", "\\u003e", -1) + + if !bytes.Equal(j, []byte(want)) { + t.Errorf("json.Marshal(%+v) returned %s, want %s", v, j, want) } } @@ -174,17 +209,7 @@ func testJSONMarshal(t *testing.T, v interface{}, want string) { func testAddURLOptions(t *testing.T, url string, v interface{}, want string) { t.Helper() - vt := reflect.Indirect(reflect.ValueOf(v)).Type() - for i := 0; i < vt.NumField(); i++ { - field := vt.Field(i) - if alias, ok := field.Tag.Lookup("url"); ok { - if alias == "" { - t.Errorf("The field %+v has a blank url tag", field) - } - } else { - t.Errorf("The field %+v has no url tag specified", field) - } - } + testStructTags(t, v, "url") got, err := addOptions(url, v) if err != nil { @@ -2657,7 +2682,10 @@ func TestBareDo_returnsOpenBody(t *testing.T) { } func TestErrorResponse_Marshal(t *testing.T) { - testJSONMarshal(t, &ErrorResponse{}, "{}") + testJSONMarshal(t, &ErrorResponse{}, `{ + "message":"", + "errors":null + }`) u := &ErrorResponse{ Message: "msg", @@ -2677,20 +2705,20 @@ func TestErrorResponse_Marshal(t *testing.T) { } want := `{ - "message": "msg", - "errors": [ + "message":"msg", + "errors":[ { - "resource": "res", - "field": "f", - "code": "c", - "message": "msg" + "resource":"res", + "field":"f", + "code":"c", + "message":"msg" } ], - "block": { - "reason": "reason", - "created_at": ` + referenceTimeStr + ` + "block":{ + "reason":"reason", + "created_at":` + referenceTimeStr + ` }, - "documentation_url": "doc" + "documentation_url":"doc" }` testJSONMarshal(t, u, want) @@ -2705,53 +2733,20 @@ func TestErrorBlock_Marshal(t *testing.T) { } want := `{ - "reason": "reason", - "created_at": ` + referenceTimeStr + ` - }` - - testJSONMarshal(t, u, want) -} - -func TestRateLimitError_Marshal(t *testing.T) { - testJSONMarshal(t, &RateLimitError{}, "{}") - - u := &RateLimitError{ - Rate: Rate{ - Limit: 1, - Remaining: 1, - Reset: Timestamp{referenceTime}, - }, - Message: "msg", - } - - want := `{ - "Rate": { - "limit": 1, - "remaining": 1, - "reset": ` + referenceTimeStr + ` - }, - "message": "msg" - }` - - testJSONMarshal(t, u, want) -} - -func TestAbuseRateLimitError_Marshal(t *testing.T) { - testJSONMarshal(t, &AbuseRateLimitError{}, "{}") - - u := &AbuseRateLimitError{ - Message: "msg", - } - - want := `{ - "message": "msg" + "reason":"reason", + "created_at":` + referenceTimeStr + ` }` testJSONMarshal(t, u, want) } func TestError_Marshal(t *testing.T) { - testJSONMarshal(t, &Error{}, "{}") + testJSONMarshal(t, &Error{}, `{ + "resource":"", + "field":"", + "code":"", + "message":"" + }`) u := &Error{ Resource: "res", @@ -2761,17 +2756,21 @@ func TestError_Marshal(t *testing.T) { } want := `{ - "resource": "res", - "field": "field", - "code": "code", - "message": "msg" + "resource":"res", + "field":"field", + "code":"code", + "message":"msg" }` testJSONMarshal(t, u, want) } func TestRate_Marshal(t *testing.T) { - testJSONMarshal(t, &Rate{}, "{}") + testJSONMarshal(t, &Rate{}, `{ + "limit":0, + "remaining":0, + "reset":"0001-01-01T00:00:00Z" + }`) u := &Rate{ Limit: 1, @@ -2780,16 +2779,25 @@ func TestRate_Marshal(t *testing.T) { } want := `{ - "limit": 1, - "remaining": 1, - "reset": ` + referenceTimeStr + ` + "limit":1, + "remaining":1, + "reset":` + referenceTimeStr + ` }` testJSONMarshal(t, u, want) } func TestRateLimits_Marshal(t *testing.T) { - testJSONMarshal(t, &RateLimits{}, "{}") + testJSONMarshal(t, &RateLimits{}, `{ + "core":null, + "search":null, + "graphql":null, + "integration_manifest":null, + "source_import":null, + "code_scanning_upload":null, + "actions_runner_registration":null, + "scim":null + }`) u := &RateLimits{ Core: &Rate{ @@ -2835,45 +2843,45 @@ func TestRateLimits_Marshal(t *testing.T) { } want := `{ - "core": { - "limit": 1, - "remaining": 1, - "reset": ` + referenceTimeStr + ` - }, - "search": { - "limit": 1, - "remaining": 1, - "reset": ` + referenceTimeStr + ` - }, - "graphql": { - "limit": 1, - "remaining": 1, - "reset": ` + referenceTimeStr + ` - }, - "integration_manifest": { - "limit": 1, - "remaining": 1, - "reset": ` + referenceTimeStr + ` - }, - "source_import": { - "limit": 1, - "remaining": 1, - "reset": ` + referenceTimeStr + ` - }, - "code_scanning_upload": { - "limit": 1, - "remaining": 1, - "reset": ` + referenceTimeStr + ` - }, - "actions_runner_registration": { - "limit": 1, - "remaining": 1, - "reset": ` + referenceTimeStr + ` - }, - "scim": { - "limit": 1, - "remaining": 1, - "reset": ` + referenceTimeStr + ` + "core":{ + "limit":1, + "remaining":1, + "reset":` + referenceTimeStr + ` + }, + "search":{ + "limit":1, + "remaining":1, + "reset":` + referenceTimeStr + ` + }, + "graphql":{ + "limit":1, + "remaining":1, + "reset":` + referenceTimeStr + ` + }, + "integration_manifest":{ + "limit":1, + "remaining":1, + "reset":` + referenceTimeStr + ` + }, + "source_import":{ + "limit":1, + "remaining":1, + "reset":` + referenceTimeStr + ` + }, + "code_scanning_upload":{ + "limit":1, + "remaining":1, + "reset":` + referenceTimeStr + ` + }, + "actions_runner_registration":{ + "limit":1, + "remaining":1, + "reset":` + referenceTimeStr + ` + }, + "scim":{ + "limit":1, + "remaining":1, + "reset":` + referenceTimeStr + ` } }` diff --git a/github/gitignore_test.go b/github/gitignore_test.go index 61ee4d52e58..7243afe1452 100644 --- a/github/gitignore_test.go +++ b/github/gitignore_test.go @@ -97,8 +97,8 @@ func TestGitignore_Marshal(t *testing.T) { } want := `{ - "name": "name", - "source": "source" + "name":"name", + "source":"source" }` testJSONMarshal(t, u, want) diff --git a/github/interactions_test.go b/github/interactions_test.go index 47ebae18c48..4e0c5398c3a 100644 --- a/github/interactions_test.go +++ b/github/interactions_test.go @@ -17,9 +17,9 @@ func TestInteractionRestriction_Marshal(t *testing.T) { } want := `{ - "limit": "limit", - "origin": "origin", - "expires_at": ` + referenceTimeStr + ` + "limit":"limit", + "origin":"origin", + "expires_at":` + referenceTimeStr + ` }` testJSONMarshal(t, u, want) diff --git a/github/issue_import_test.go b/github/issue_import_test.go index 17c7c17ffe4..3aedc05c001 100644 --- a/github/issue_import_test.go +++ b/github/issue_import_test.go @@ -307,11 +307,11 @@ func TestIssueImportError_Marshal(t *testing.T) { } want := `{ - "location": "loc", - "resource": "res", - "field": "field", - "value": "value", - "code": "code" + "location":"loc", + "resource":"res", + "field":"field", + "value":"value", + "code":"code" }` testJSONMarshal(t, u, want) @@ -342,22 +342,22 @@ func TestIssueImportResponse_Marshal(t *testing.T) { } want := `{ - "id": 1, - "status": "status", - "url": "url", - "import_issues_url": "iiu", - "repository_url": "ru", - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "message": "msg", - "documentation_url": "durl", - "errors": [ + "id":1, + "status":"status", + "url":"url", + "import_issues_url":"iiu", + "repository_url":"ru", + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "message":"msg", + "documentation_url":"durl", + "errors":[ { - "location": "loc", - "resource": "res", - "field": "field", - "value": "value", - "code": "code" + "location":"loc", + "resource":"res", + "field":"field", + "value":"value", + "code":"code" } ] }` @@ -366,7 +366,7 @@ func TestIssueImportResponse_Marshal(t *testing.T) { } func TestComment_Marshal(t *testing.T) { - testJSONMarshal(t, &Comment{}, "{}") + testJSONMarshal(t, &Comment{}, `{"body":""}`) u := &Comment{ CreatedAt: &Timestamp{referenceTime}, @@ -374,15 +374,18 @@ func TestComment_Marshal(t *testing.T) { } want := `{ - "created_at": ` + referenceTimeStr + `, - "body": "body" + "created_at":` + referenceTimeStr + `, + "body":"body" }` testJSONMarshal(t, u, want) } func TestIssueImport_Marshal(t *testing.T) { - testJSONMarshal(t, &IssueImport{}, "{}") + testJSONMarshal(t, &IssueImport{}, `{ + "title":"", + "body":"" + }`) u := &IssueImport{ Title: "title", @@ -397,15 +400,15 @@ func TestIssueImport_Marshal(t *testing.T) { } want := `{ - "title": "title", - "body": "body", - "created_at": ` + referenceTimeStr + `, - "closed_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "assignee": "a", - "milestone": 1, - "closed": false, - "labels": [ + "title":"title", + "body":"body", + "created_at":` + referenceTimeStr + `, + "closed_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "assignee":"a", + "milestone":1, + "closed":false, + "labels":[ "l" ] }` @@ -414,7 +417,12 @@ func TestIssueImport_Marshal(t *testing.T) { } func TestIssueImportRequest_Marshal(t *testing.T) { - testJSONMarshal(t, &IssueImportRequest{}, "{}") + testJSONMarshal(t, &IssueImportRequest{}, `{ + "issue":{ + "title":"", + "body":"" + } + }`) u := &IssueImportRequest{ IssueImport: IssueImport{ @@ -437,23 +445,23 @@ func TestIssueImportRequest_Marshal(t *testing.T) { } want := `{ - "issue": { - "title": "title", - "body": "body", - "created_at": ` + referenceTimeStr + `, - "closed_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "assignee": "a", - "milestone": 1, - "closed": false, - "labels": [ + "issue":{ + "title":"title", + "body":"body", + "created_at":` + referenceTimeStr + `, + "closed_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "assignee":"a", + "milestone":1, + "closed":false, + "labels":[ "l" ] }, - "comments": [ + "comments":[ { - "created_at": ` + referenceTimeStr + `, - "body": "body" + "created_at":` + referenceTimeStr + `, + "body":"body" } ] }` diff --git a/github/issues_comments_test.go b/github/issues_comments_test.go index 70f923481b5..02fe8ad1271 100644 --- a/github/issues_comments_test.go +++ b/github/issues_comments_test.go @@ -332,38 +332,38 @@ func TestIssueComment_Marshal(t *testing.T) { } want := `{ - "id": 1, - "node_id": "nid", - "body": "body", - "user": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "id":1, + "node_id":"nid", + "body":"body", + "user":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "reactions": { - "total_count": 1 + "reactions":{ + "total_count":1 }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "author_association": "aa", - "url": "url", - "html_url": "hurl", - "issue_url": "iurl" + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "author_association":"aa", + "url":"url", + "html_url":"hurl", + "issue_url":"iurl" }` testJSONMarshal(t, u, want) diff --git a/github/issues_events_test.go b/github/issues_events_test.go index e8118b6ddcd..c0ac5d08605 100644 --- a/github/issues_events_test.go +++ b/github/issues_events_test.go @@ -139,8 +139,8 @@ func TestRename_Marshal(t *testing.T) { } want := `{ - "from": "from", - "to": "to" + "from":"from", + "to":"to" }` testJSONMarshal(t, u, want) @@ -157,10 +157,10 @@ func TestDismissedReview_Marshal(t *testing.T) { } want := `{ - "state": "state", - "review_id": 1, - "dismissal_message": "dm", - "dismissal_commit_id": "dcid" + "state":"state", + "review_id":1, + "dismissal_message":"dm", + "dismissal_commit_id":"dcid" }` testJSONMarshal(t, u, want) @@ -349,189 +349,189 @@ func TestIssueEvent_Marshal(t *testing.T) { } want := `{ - "id": 1, - "url": "url", - "actor": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "id":1, + "url":"url", + "actor":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "event": "event", - "created_at": ` + referenceTimeStr + `, - "issue": { - "id": 1 + "event":"event", + "created_at":` + referenceTimeStr + `, + "issue":{ + "id":1 }, - "assignee": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "assignee":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "assigner": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "assigner":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "commit_id": "cid", - "milestone": { - "id": 1 + "commit_id":"cid", + "milestone":{ + "id":1 }, - "label": { - "id": 1 + "label":{ + "id":1 }, - "rename": { - "from": "from", - "to": "to" + "rename":{ + "from":"from", + "to":"to" }, - "lock_reason": "lr", - "project_card": { - "id": 1 + "lock_reason":"lr", + "project_card":{ + "id":1 }, - "dismissed_review": { - "state": "state", - "review_id": 1, - "dismissal_message": "dm", - "dismissal_commit_id": "dcid" + "dismissed_review":{ + "state":"state", + "review_id":1, + "dismissal_message":"dm", + "dismissal_commit_id":"dcid" }, - "requested_reviewer": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "requested_reviewer":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "requested_team": { - "id": 1, - "node_id": "n", - "name": "n", - "description": "d", - "url": "u", - "slug": "s", - "permission": "p", - "privacy": "p", - "members_count": 1, - "repos_count": 1, - "members_url": "m", - "repositories_url": "r", - "organization": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "html_url": "h", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e" + "requested_team":{ + "id":1, + "node_id":"n", + "name":"n", + "description":"d", + "url":"u", + "slug":"s", + "permission":"p", + "privacy":"p", + "members_count":1, + "repos_count":1, + "organization":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "html_url":"h", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e" }, - "parent": { - "id": 1, - "node_id": "n", - "name": "n", - "description": "d", - "url": "u", - "slug": "s", - "permission": "p", - "privacy": "p", - "members_count": 1, - "repos_count": 1 + "members_url":"m", + "repositories_url":"r", + "parent":{ + "id":1, + "node_id":"n", + "name":"n", + "description":"d", + "url":"u", + "slug":"s", + "permission":"p", + "privacy":"p", + "members_count":1, + "repos_count":1 }, - "ldap_dn": "l" + "ldap_dn":"l" }, - "performed_via_github_app": { - "id": 1, - "node_id": "n", - "owner": { - "login": "l", - "id": 1, - "node_id": "n", - "url": "u", - "repos_url": "r", - "events_url": "e", - "avatar_url": "a" - }, - "name": "n", - "description": "d", - "html_url": "h", - "external_url": "u" + "review_requester":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "review_requester": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "performed_via_github_app":{ + "id":1, + "node_id":"n", + "owner":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" + }, + "name":"n", + "description":"d", + "external_url":"u", + "html_url":"h" } }` diff --git a/github/issues_labels_test.go b/github/issues_labels_test.go index 88b7be7168e..895a3c002de 100644 --- a/github/issues_labels_test.go +++ b/github/issues_labels_test.go @@ -528,13 +528,13 @@ func TestLabel_Marshal(t *testing.T) { } want := `{ - "id": 1, - "url": "url", - "name": "name", - "color": "color", - "description": "desc", - "default": false, - "node_id": "nid" + "id":1, + "url":"url", + "name":"name", + "color":"color", + "description":"desc", + "default":false, + "node_id":"nid" }` testJSONMarshal(t, u, want) diff --git a/github/issues_milestones_test.go b/github/issues_milestones_test.go index decaf2c1127..002b3a5adae 100644 --- a/github/issues_milestones_test.go +++ b/github/issues_milestones_test.go @@ -292,41 +292,41 @@ func TestMilestone_Marshal(t *testing.T) { } want := `{ - "url": "url", - "html_url": "hurl", - "labels_url": "lurl", - "id": 1, - "number": 1, - "state": "state", - "title": "title", - "description": "desc", - "creator": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "tu", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "url":"url", + "html_url":"hurl", + "labels_url":"lurl", + "id":1, + "number":1, + "state":"state", + "title":"title", + "description":"desc", + "creator":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"tu", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "open_issues": 1, - "closed_issues": 1, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "closed_at": ` + referenceTimeStr + `, - "due_on": ` + referenceTimeStr + `, - "node_id": "nid" + "open_issues":1, + "closed_issues":1, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "closed_at":` + referenceTimeStr + `, + "due_on":` + referenceTimeStr + `, + "node_id":"nid" }` testJSONMarshal(t, u, want) diff --git a/github/issues_test.go b/github/issues_test.go index aa767d6508a..afea436a154 100644 --- a/github/issues_test.go +++ b/github/issues_test.go @@ -484,9 +484,7 @@ func TestLockIssueOptions_Marshal(t *testing.T) { LockReason: "lr", } - want := `{ - "lock_reason": "lr" - }` + want := `{"lock_reason":"lr"}` testJSONMarshal(t, u, want) } @@ -502,11 +500,11 @@ func TestPullRequestLinks_Marshal(t *testing.T) { } want := `{ - "url": "url", - "html_url": "hurl", - "diff_url": "durl", - "patch_url": "purl" - }` + "url":"url", + "html_url":"hurl", + "diff_url":"durl", + "patch_url":"purl" + }` testJSONMarshal(t, u, want) } @@ -525,15 +523,15 @@ func TestIssueRequest_Marshal(t *testing.T) { } want := `{ - "title": "url", - "body": "url", - "labels": [ + "title":"url", + "body":"url", + "labels":[ "l" ], - "assignee": "url", - "state": "url", - "milestone": 1, - "assignees": [ + "assignee":"url", + "state":"url", + "milestone":1, + "assignees":[ "a" ] }` @@ -577,61 +575,61 @@ func TestIssue_Marshal(t *testing.T) { } want := `{ - "id": 1, - "number": 1, - "state": "s", - "locked": false, - "title": "title", - "body": "body", - "author_association": "aa", - "user": { - "id": 1 + "id":1, + "number":1, + "state":"s", + "locked":false, + "title":"title", + "body":"body", + "author_association":"aa", + "user":{ + "id":1 }, - "labels": [ + "labels":[ { - "id": 1 + "id":1 } ], - "assignee": { - "id": 1 + "assignee":{ + "id":1 }, - "comments": 1, - "closed_at": ` + referenceTimeStr + `, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "closed_by": { - "id": 1 + "comments":1, + "closed_at":` + referenceTimeStr + `, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "closed_by":{ + "id":1 }, - "url": "url", - "html_url": "hurl", - "comments_url": "curl", - "events_url": "eurl", - "labels_url": "lurl", - "repository_url": "rurl", - "milestone": { - "id": 1 + "url":"url", + "html_url":"hurl", + "comments_url":"curl", + "events_url":"eurl", + "labels_url":"lurl", + "repository_url":"rurl", + "milestone":{ + "id":1 }, - "pull_request": { - "url": "url" + "pull_request":{ + "url":"url" }, - "repository": { - "id": 1 + "repository":{ + "id":1 }, - "reactions": { - "total_count": 1 + "reactions":{ + "total_count":1 }, - "assignees": [ + "assignees":[ { - "id": 1 + "id":1 } ], - "node_id": "nid", - "text_matches": [ + "node_id":"nid", + "text_matches":[ { - "object_url": "ourl" + "object_url":"ourl" } ], - "active_lock_reason": "alr" + "active_lock_reason":"alr" }` testJSONMarshal(t, u, want) diff --git a/github/issues_timeline_test.go b/github/issues_timeline_test.go index 27c7c115e7b..2da4c18cb79 100644 --- a/github/issues_timeline_test.go +++ b/github/issues_timeline_test.go @@ -77,20 +77,20 @@ func TestSource_Marshal(t *testing.T) { } want := `{ - "id": 1, - "url": "url", - "actor": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" + "id":1, + "url":"url", + "actor":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" }, - "type": "type", - "issue": { - "id": 1 + "type":"type", + "issue":{ + "id":1 } }` @@ -173,83 +173,83 @@ func TestTimeline_Marshal(t *testing.T) { } want := `{ - "id": 1, - "url": "url", - "commit_url": "curl", - "actor": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "id":1, + "url":"url", + "commit_url":"curl", + "actor":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "event": "event", - "commit_id": "cid", - "created_at": ` + referenceTimeStr + `, - "label": { - "id": 1 + "event":"event", + "commit_id":"cid", + "created_at":` + referenceTimeStr + `, + "label":{ + "id":1 }, - "assignee": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "assignee":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "milestone": { - "id": 1 + "milestone":{ + "id":1 }, - "source": { - "id": 1, - "url": "url", - "actor": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" + "source":{ + "id":1, + "url":"url", + "actor":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" }, - "type": "type", - "issue": { - "id": 1 + "type":"type", + "issue":{ + "id":1 } }, - "rename": { - "from": "from", - "to": "to" + "rename":{ + "from":"from", + "to":"to" }, - "project_card": { - "id": 1 + "project_card":{ + "id":1 }, - "state": "state" + "state":"state" }` testJSONMarshal(t, u, want) diff --git a/github/licenses_test.go b/github/licenses_test.go index aaaac15cbac..633c988d6c8 100644 --- a/github/licenses_test.go +++ b/github/licenses_test.go @@ -45,30 +45,36 @@ func TestRepositoryLicense_Marshal(t *testing.T) { }, } want := `{ - "name": "n", - "path": "p", - "sha": "s", - "size": 1, - "url": "u", - "html_url": "h", - "git_url": "g", - "download_url": "d", - "type": "t", - "content": "c", - "encoding": "e", - "license": { - "key": "k", - "name": "n", - "url": "u", - "spdx_id": "s", - "html_url": "h", - "featured": true, - "description": "d", - "implementation": "i", - "permissions": ["p"], - "conditions": ["c"], - "limitations": ["l"], - "body": "b" + "name":"n", + "path":"p", + "sha":"s", + "size":1, + "url":"u", + "html_url":"h", + "git_url":"g", + "download_url":"d", + "type":"t", + "content":"c", + "encoding":"e", + "license":{ + "key":"k", + "name":"n", + "url":"u", + "spdx_id":"s", + "html_url":"h", + "featured":true, + "description":"d", + "implementation":"i", + "permissions":[ + "p" + ], + "conditions":[ + "c" + ], + "limitations":[ + "l" + ], + "body":"b" } }` testJSONMarshal(t, rl, want) @@ -92,19 +98,26 @@ func TestLicense_Marshal(t *testing.T) { Body: String("b"), } want := `{ - "key": "k", - "name": "n", - "url": "u", - "spdx_id": "s", - "html_url": "h", - "featured": true, - "description": "d", - "implementation": "i", - "permissions": ["p"], - "conditions": ["c"], - "limitations": ["l"], - "body": "b" + "key":"k", + "name":"n", + "url":"u", + "spdx_id":"s", + "html_url":"h", + "featured":true, + "description":"d", + "implementation":"i", + "permissions":[ + "p" + ], + "conditions":[ + "c" + ], + "limitations":[ + "l" + ], + "body":"b" }` + testJSONMarshal(t, l, want) } diff --git a/github/markdown_test.go b/github/markdown_test.go index 2b6e7eee48e..3b36a47bfe1 100644 --- a/github/markdown_test.go +++ b/github/markdown_test.go @@ -71,9 +71,9 @@ func TestMarkdownRenderRequest_Marshal(t *testing.T) { } want := `{ - "text": "txt", - "mode": "mode", - "context": "ctx" + "text":"txt", + "mode":"mode", + "context":"ctx" }` testJSONMarshal(t, a, want) diff --git a/github/meta_test.go b/github/meta_test.go index c7b01e298ed..2dfb17c0702 100644 --- a/github/meta_test.go +++ b/github/meta_test.go @@ -40,8 +40,8 @@ func TestAPIMeta_Marshal(t *testing.T) { "dependabot":["d"], "ssh_key_fingerprints":{"a":"f"}, "ssh_keys":["k"], - "api":["a"], - "web":["w"] + "web":["w"], + "api":["a"] }` testJSONMarshal(t, a, want) diff --git a/github/migrations_source_import_test.go b/github/migrations_source_import_test.go index d357ff10b8a..8d430e774b4 100644 --- a/github/migrations_source_import_test.go +++ b/github/migrations_source_import_test.go @@ -345,10 +345,10 @@ func TestLargeFile_Marshal(t *testing.T) { } want := `{ - "ref_name": "rn", - "path": "p", - "oid": "oid", - "size": 1 + "ref_name":"rn", + "path":"p", + "oid":"oid", + "size":1 }` testJSONMarshal(t, u, want) @@ -368,13 +368,13 @@ func TestSourceImportAuthor_Marshal(t *testing.T) { } want := `{ - "id": 1, - "remote_id": "rid", - "remote_name": "rn", - "email": "e", - "name": "n", - "url": "url", - "import_url": "iurl" + "id":1, + "remote_id":"rid", + "remote_name":"rn", + "email":"e", + "name":"n", + "url":"url", + "import_url":"iurl" }` testJSONMarshal(t, u, want) @@ -410,31 +410,31 @@ func TestImport_Marshal(t *testing.T) { } want := `{ - "vcs_url": "vcsurl", - "vcs": "vcs", - "vcs_username": "vcsusr", - "vcs_password": "vcspass", - "tfvc_project": "tfvcp", - "use_lfs": "uselfs", - "has_large_files": false, - "large_files_size": 1, - "large_files_count": 1, - "status": "status", - "commit_count": 1, - "status_text": "statustxt", - "authors_count": 1, - "percent": 1, - "push_percent": 1, - "url": "url", - "html_url": "hurl", - "authors_url": "aurl", - "repository_url": "rurl", - "message": "msg", - "failed_step": "fs", - "human_name": "hn", - "project_choices": [ + "vcs_url":"vcsurl", + "vcs":"vcs", + "vcs_username":"vcsusr", + "vcs_password":"vcspass", + "tfvc_project":"tfvcp", + "use_lfs":"uselfs", + "has_large_files":false, + "large_files_size":1, + "large_files_count":1, + "status":"status", + "commit_count":1, + "status_text":"statustxt", + "authors_count":1, + "percent":1, + "push_percent":1, + "url":"url", + "html_url":"hurl", + "authors_url":"aurl", + "repository_url":"rurl", + "message":"msg", + "failed_step":"fs", + "human_name":"hn", + "project_choices":[ { - "vcs_url": "vcsurl" + "vcs_url":"vcsurl" } ] }` diff --git a/github/migrations_test.go b/github/migrations_test.go index 7ddc6300a8a..7572630fed6 100644 --- a/github/migrations_test.go +++ b/github/migrations_test.go @@ -268,17 +268,17 @@ func TestMigration_Marshal(t *testing.T) { } want := `{ - "id": 1, - "guid": "guid", - "state": "state", - "lock_repositories": false, - "exclude_attachments": false, - "url": "url", - "created_at": "ca", - "updated_at": "ua", - "repositories": [ + "id":1, + "guid":"guid", + "state":"state", + "lock_repositories":false, + "exclude_attachments":false, + "url":"url", + "created_at":"ca", + "updated_at":"ua", + "repositories":[ { - "id": 1 + "id":1 } ] }` @@ -296,11 +296,11 @@ func TestStartMigration_Marshal(t *testing.T) { } want := `{ - "repositories": [ + "repositories":[ "r" ], - "lock_repositories": false, - "exclude_attachments": false + "lock_repositories":false, + "exclude_attachments":false }` testJSONMarshal(t, u, want) diff --git a/github/migrations_user_test.go b/github/migrations_user_test.go index 0a303ce6348..21b20a0bc42 100644 --- a/github/migrations_user_test.go +++ b/github/migrations_user_test.go @@ -266,17 +266,17 @@ func TestUserMigration_Marshal(t *testing.T) { } want := `{ - "id": 1, - "guid": "guid", - "state": "state", - "lock_repositories": false, - "exclude_attachments": false, - "url": "url", - "created_at": "ca", - "updated_at": "ua", - "repositories": [ + "id":1, + "guid":"guid", + "state":"state", + "lock_repositories":false, + "exclude_attachments":false, + "url":"url", + "created_at":"ca", + "updated_at":"ua", + "repositories":[ { - "id": 1 + "id":1 } ] }` @@ -294,11 +294,11 @@ func TestStartUserMigration_Marshal(t *testing.T) { } want := `{ - "repositories": [ + "repositories":[ "r" ], - "lock_repositories": false, - "exclude_attachments": false + "lock_repositories":false, + "exclude_attachments":false }` testJSONMarshal(t, u, want) diff --git a/github/orgs_audit_log.go b/github/orgs_audit_log.go index e2f8fc24ffd..8f845f4901f 100644 --- a/github/orgs_audit_log.go +++ b/github/orgs_audit_log.go @@ -16,7 +16,7 @@ type GetAuditLogOptions struct { Include *string `url:"include,omitempty"` // Event type includes. Can be one of "web", "git", "all". Default: "web". (Optional.) Order *string `url:"order,omitempty"` // The order of audit log events. Can be one of "asc" or "desc". Default: "desc". (Optional.) - ListCursorOptions + ListCursorOptions `url:",omitempty"` } // HookConfig describes metadata about a webhook configuration. diff --git a/github/orgs_audit_log_test.go b/github/orgs_audit_log_test.go index 1a82471face..638c70a5cb7 100644 --- a/github/orgs_audit_log_test.go +++ b/github/orgs_audit_log_test.go @@ -173,8 +173,10 @@ func TestOrganizationService_GetAuditLog(t *testing.T) { }) } -func TestGetAuditLogOptions_Marshal(t *testing.T) { - testJSONMarshal(t, &GetAuditLogOptions{}, "{}") +func TestGetAuditLogOptions_addOptions(t *testing.T) { + url := "some/path" + + testAddURLOptions(t, url, &GetAuditLogOptions{}, url) u := &GetAuditLogOptions{ Phrase: String("p"), @@ -188,17 +190,7 @@ func TestGetAuditLogOptions_Marshal(t *testing.T) { }, } - want := `{ - "phrase": "p", - "include": "i", - "order": "o", - "Page": "p", - "PerPage": 1, - "After": "a", - "Before": "b" - }` - - testJSONMarshal(t, u, want) + testAddURLOptions(t, url, u, url+`?after=a&before=b&include=i&order=o&page=p&per_page=1&phrase=p`) } func TestHookConfig_Marshal(t *testing.T) { @@ -211,9 +203,9 @@ func TestHookConfig_Marshal(t *testing.T) { } want := `{ - "content_type": "ct", - "insecure_ssl": "ct", - "url": "url" + "content_type":"ct", + "insecure_ssl":"ct", + "url":"url" }` testJSONMarshal(t, u, want) @@ -308,101 +300,103 @@ func TestAuditEntry_Marshal(t *testing.T) { } want := `{ - "action": "a", - "active": false, - "active_was": false, - "actor": "ac", - "actor_ip": "aip", - "actor_location": { - "country_code": "alcc" + "actor_ip":"aip", + "action":"a", + "active":false, + "active_was":false, + "actor":"ac", + "actor_location":{ + "country_code":"alcc" }, - "blocked_user": "bu", - "business": "b", - "cancelled_at": ` + referenceTimeStr + `, - "completed_at": ` + referenceTimeStr + `, - "conclusion": "c", - "config": { - "url": "s" + "blocked_user":"bu", + "business":"b", + "cancelled_at":` + referenceTimeStr + `, + "completed_at":` + referenceTimeStr + `, + "conclusion":"c", + "config":{ + "url":"s" }, - "config_was": { - "url": "s" + "config_was":{ + "url":"s" }, - "content_type": "ct", - "created_at": ` + referenceTimeStr + `, - "deploy_key_fingerprint": "dkf", - "_document_id": "did", - "emoji": "e", - "environment_name": "en", - "event": "e", - "events": [ + "content_type":"ct", + "created_at":` + referenceTimeStr + `, + "deploy_key_fingerprint":"dkf", + "_document_id":"did", + "emoji":"e", + "environment_name":"en", + "event":"e", + "events":[ "s" ], - "events_were": [ + "events_were":[ "s" ], - "explanation": "e", - "external_identity_nameid": "ein", - "external_identity_username": "eiu", - "fingerprint": "f", - "hashed_token": "ht", - "head_branch": "hb", - "head_sha": "hsha", - "hook_id": 1, - "is_hosted_runner": false, - "job_name": "jn", - "limited_availability": false, - "message": "m", - "name": "n", - "old_permission": "op", - "old_user": "ou", - "openssh_public_key": "osshpk", - "org": "o", - "org_id": 1, - "permission": "p", - "previous_visibility": "pv", - "programmatic_access_type": "pat", - "pull_request_id": 1, - "pull_request_title": "prt", - "pull_request_url": "pru", - "reasons": [{ - "code": "c", - "message": "m" - }], - "read_only": "ro", - "repo": "r", - "repository": "repo", - "repository_public": false, - "run_attempt": 1, - "runner_group_id": 1, - "runner_group_name": "rgn", - "runner_id": 1, - "runner_labels": [ + "explanation":"e", + "external_identity_nameid":"ein", + "external_identity_username":"eiu", + "fingerprint":"f", + "hashed_token":"ht", + "head_branch":"hb", + "head_sha":"hsha", + "hook_id":1, + "is_hosted_runner":false, + "job_name":"jn", + "limited_availability":false, + "message":"m", + "name":"n", + "old_user":"ou", + "old_permission":"op", + "openssh_public_key":"osshpk", + "org":"o", + "org_id":1, + "permission":"p", + "previous_visibility":"pv", + "programmatic_access_type":"pat", + "pull_request_id":1, + "pull_request_title":"prt", + "pull_request_url":"pru", + "read_only":"ro", + "reasons":[ + { + "code":"c", + "message":"m" + } + ], + "repo":"r", + "repository":"repo", + "repository_public":false, + "run_attempt":1, + "runner_group_id":1, + "runner_group_name":"rgn", + "runner_id":1, + "runner_labels":[ "s" ], - "runner_name": "rn", - "secrets_passed": [ + "runner_name":"rn", + "secrets_passed":[ "s" ], - "source_version": "sv", - "started_at": ` + referenceTimeStr + `, - "target_login": "tl", - "target_version": "tv", - "team": "t", - "@timestamp": ` + referenceTimeStr + `, - "token_id": 1, - "token_scopes": "ts", - "topic": "tp", - "transport_protocol_name": "tpn", - "transport_protocol": 1, - "trigger_id": 1, - "user": "u", - "user_agent": "ua", - "visibility": "v", - "workflow_id": 1, - "workflow_run_id": 1, - "data": { - "old_name": "on", - "old_login": "ol" + "source_version":"sv", + "started_at":` + referenceTimeStr + `, + "target_login":"tl", + "target_version":"tv", + "team":"t", + "@timestamp":` + referenceTimeStr + `, + "token_id":1, + "token_scopes":"ts", + "topic":"tp", + "transport_protocol_name":"tpn", + "transport_protocol":1, + "trigger_id":1, + "user":"u", + "user_agent":"ua", + "visibility":"v", + "workflow_id":1, + "workflow_run_id":1, + "data":{ + "old_name":"on", + "old_login":"ol" } }` diff --git a/github/orgs_members_test.go b/github/orgs_members_test.go index 9526442cda4..c87c70fc3d8 100644 --- a/github/orgs_members_test.go +++ b/github/orgs_members_test.go @@ -892,40 +892,40 @@ func TestMembership_Marshal(t *testing.T) { } want := `{ - "url": "url", - "state": "state", - "role": "email", - "organization_url": "orgurl", - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true + "url":"url", + "state":"state", + "role":"email", + "organization_url":"orgurl", + "organization":{ + "name":"n", + "company":"c", + "blog":"b", + "location":"loc", + "email":"e", + "twitter_username":"tu", + "description":"d", + "billing_email":"be", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"drp", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"marct", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true }, - "user": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" + "user":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "url":"u", + "events_url":"e", + "repos_url":"r" } }` @@ -943,12 +943,10 @@ func TestCreateOrgInvitationOptions_Marshal(t *testing.T) { } want := `{ - "invitee_id": 1, - "email": "email", - "role": "role", - "team_ids": [ - 1 - ] + "invitee_id":1, + "email":"email", + "role":"role", + "team_ids":[1] }` testJSONMarshal(t, u, want) diff --git a/github/orgs_personal_access_tokens_test.go b/github/orgs_personal_access_tokens_test.go index 9426385f4a6..3171e0225ea 100644 --- a/github/orgs_personal_access_tokens_test.go +++ b/github/orgs_personal_access_tokens_test.go @@ -57,7 +57,7 @@ func TestOrganizationsService_ReviewPersonalAccessTokenRequest(t *testing.T) { } func TestReviewPersonalAccessTokenRequestOptions_Marshal(t *testing.T) { - testJSONMarshal(t, &ReviewPersonalAccessTokenRequestOptions{}, "{}") + testJSONMarshal(t, &ReviewPersonalAccessTokenRequestOptions{}, `{"action":""}`) u := &ReviewPersonalAccessTokenRequestOptions{ Action: "a", @@ -65,8 +65,8 @@ func TestReviewPersonalAccessTokenRequestOptions_Marshal(t *testing.T) { } want := `{ - "action": "a", - "reason": "r" + "action":"a", + "reason":"r" }` testJSONMarshal(t, u, want) diff --git a/github/orgs_test.go b/github/orgs_test.go index 98a6b5257e1..624420c5c78 100644 --- a/github/orgs_test.go +++ b/github/orgs_test.go @@ -40,30 +40,29 @@ func TestOrganization_Marshal(t *testing.T) { MembersCanCreatePublicPages: Bool(false), MembersCanCreatePrivatePages: Bool(true), } - want := ` - { - "billing_email": "support@github.com", - "blog": "https://github.com/blog", - "company": "GitHub", - "email": "support@github.com", - "twitter_username": "github", - "location": "San Francisco", - "name": "github", - "description": "GitHub, the company.", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "read", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "all", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - } - ` + want := `{ + "name":"github", + "company":"GitHub", + "blog":"https://github.com/blog", + "location":"San Francisco", + "email":"support@github.com", + "twitter_username":"github", + "description":"GitHub, the company.", + "billing_email":"support@github.com", + "is_verified":true, + "has_organization_projects":true, + "has_repository_projects":true, + "default_repository_permission":"read", + "members_can_create_repositories":true, + "members_can_create_public_repositories":false, + "members_can_create_private_repositories":true, + "members_can_create_internal_repositories":true, + "members_allowed_repository_creation_type":"all", + "members_can_create_pages":true, + "members_can_create_public_pages":false, + "members_can_create_private_pages":true + }` + testJSONMarshal(t, o, want) } @@ -434,10 +433,10 @@ func TestOrganizationInstallations_Marshal(t *testing.T) { Installations: []*Installation{{ID: Int64(1)}}, } want := `{ - "total_count": 1, - "installations": [ + "total_count":1, + "installations":[ { - "id": 1 + "id":1 } ] }` @@ -457,12 +456,12 @@ func TestPlan_Marshal(t *testing.T) { Seats: Int(1), } want := `{ - "name": "name", - "space": 1, - "collaborators": 1, - "private_repos": 1, - "filled_seats": 1, - "seats": 1 + "name":"name", + "space":1, + "collaborators":1, + "private_repos":1, + "filled_seats":1, + "seats":1 }` testJSONMarshal(t, o, want) diff --git a/github/packages_test.go b/github/packages_test.go index c825e6a5429..d3a52d0d32b 100644 --- a/github/packages_test.go +++ b/github/packages_test.go @@ -18,11 +18,11 @@ func TestPackageRegistry_Marshal(t *testing.T) { Vendor: String("vendor"), } want := `{ - "about_url": "aurl", - "name": "name", - "type": "type", - "url": "url", - "vendor": "vendor" + "about_url":"aurl", + "name":"name", + "type":"type", + "url":"url", + "vendor":"vendor" }` testJSONMarshal(t, o, want) @@ -66,37 +66,37 @@ func TestPackageFile_Marshal(t *testing.T) { } want := `{ - "download_url": "durl", - "id": 1, - "name": "name", - "sha256": "sha256", - "sha1": "sha1", - "md5": "md5", - "content_type": "ct", - "state": "state", - "author": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "download_url":"durl", + "id":1, + "name":"name", + "sha256":"sha256", + "sha1":"sha1", + "md5":"md5", + "content_type":"ct", + "state":"state", + "author":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "size": 1, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + ` + "size":1, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + ` }` testJSONMarshal(t, o, want) @@ -139,36 +139,36 @@ func TestPackageRelease_Marshal(t *testing.T) { } want := `{ - "url": "url", - "html_url": "hurl", - "id": 1, - "tag_name": "tn", - "target_commitish": "tcs", - "name": "name", - "draft": true, - "author": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "url":"url", + "html_url":"hurl", + "id":1, + "tag_name":"tn", + "target_commitish":"tcs", + "name":"name", + "draft":true, + "author":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "prerelease": true, - "created_at": ` + referenceTimeStr + `, - "published_at": ` + referenceTimeStr + ` + "prerelease":true, + "created_at":` + referenceTimeStr + `, + "published_at":` + referenceTimeStr + ` }` testJSONMarshal(t, o, want) @@ -283,108 +283,108 @@ func TestPackageVersion_Marshal(t *testing.T) { } want := `{ - "id": 1, - "version": "ver", - "summary": "sum", - "body": "body", - "body_html": "btnhtml", - "release": { - "url": "url", - "html_url": "hurl", - "id": 1, - "tag_name": "tn", - "target_commitish": "tcs", - "name": "name", - "draft": true, - "author": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "id":1, + "version":"ver", + "summary":"sum", + "body":"body", + "body_html":"btnhtml", + "release":{ + "url":"url", + "html_url":"hurl", + "id":1, + "tag_name":"tn", + "target_commitish":"tcs", + "name":"name", + "draft":true, + "author":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "prerelease": true, - "created_at": ` + referenceTimeStr + `, - "published_at": ` + referenceTimeStr + ` + "prerelease":true, + "created_at":` + referenceTimeStr + `, + "published_at":` + referenceTimeStr + ` }, - "manifest": "mani", - "html_url": "hurl", - "tag_name": "tn", - "target_commitish": "tcs", - "target_oid": "tid", - "draft": true, - "prerelease": true, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "package_files": [ + "manifest":"mani", + "html_url":"hurl", + "tag_name":"tn", + "target_commitish":"tcs", + "target_oid":"tid", + "draft":true, + "prerelease":true, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "package_files":[ { - "download_url": "durl", - "id": 1, - "name": "name", - "sha256": "sha256", - "sha1": "sha1", - "md5": "md5", - "content_type": "ct", - "state": "state", - "author": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "download_url":"durl", + "id":1, + "name":"name", + "sha256":"sha256", + "sha1":"sha1", + "md5":"md5", + "content_type":"ct", + "state":"state", + "author":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "size": 1, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + ` + "size":1, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + ` } ], - "author": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "author":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "installation_command": "ic" + "installation_command":"ic" }` testJSONMarshal(t, o, want) @@ -535,144 +535,144 @@ func TestPackage_Marshal(t *testing.T) { } want := `{ - "id": 1, - "name": "name", - "package_type": "pt", - "html_url": "hurl", - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "visibility": "private", - "owner": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "id":1, + "name":"name", + "package_type":"pt", + "html_url":"hurl", + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "owner":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "package_version": { - "id": 1, - "version": "ver", - "summary": "sum", - "body": "body", - "body_html": "btnhtml", - "release": { - "url": "url", - "html_url": "hurl", - "id": 1, - "tag_name": "tn", - "target_commitish": "tcs", - "name": "name", - "draft": true, - "author": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "package_version":{ + "id":1, + "version":"ver", + "summary":"sum", + "body":"body", + "body_html":"btnhtml", + "release":{ + "url":"url", + "html_url":"hurl", + "id":1, + "tag_name":"tn", + "target_commitish":"tcs", + "name":"name", + "draft":true, + "author":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "prerelease": true, - "created_at": ` + referenceTimeStr + `, - "published_at": ` + referenceTimeStr + ` + "prerelease":true, + "created_at":` + referenceTimeStr + `, + "published_at":` + referenceTimeStr + ` }, - "manifest": "mani", - "html_url": "hurl", - "tag_name": "tn", - "target_commitish": "tcs", - "target_oid": "tid", - "draft": true, - "prerelease": true, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "package_files": [ + "manifest":"mani", + "html_url":"hurl", + "tag_name":"tn", + "target_commitish":"tcs", + "target_oid":"tid", + "draft":true, + "prerelease":true, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "package_files":[ { - "download_url": "durl", - "id": 1, - "name": "name", - "sha256": "sha256", - "sha1": "sha1", - "md5": "md5", - "content_type": "ct", - "state": "state", - "author": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "download_url":"durl", + "id":1, + "name":"name", + "sha256":"sha256", + "sha1":"sha1", + "md5":"md5", + "content_type":"ct", + "state":"state", + "author":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "size": 1, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + ` + "size":1, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + ` } ], - "author": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "author":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "installation_command": "ic" + "installation_command":"ic" }, - "registry": { - "about_url": "aurl", - "name": "name", - "type": "type", - "url": "url", - "vendor": "vendor" - } + "registry":{ + "about_url":"aurl", + "name":"name", + "type":"type", + "url":"url", + "vendor":"vendor" + }, + "visibility":"private" }` testJSONMarshal(t, o, want) diff --git a/github/projects_test.go b/github/projects_test.go index 369e121ae03..34555bc5660 100644 --- a/github/projects_test.go +++ b/github/projects_test.go @@ -51,34 +51,34 @@ func TestProject_Marshal(t *testing.T) { }, } want := `{ - "id": 1, - "url": "u", - "html_url": "h", - "columns_url": "c", - "owner_url": "o", - "name": "n", - "body": "b", - "number": 1, - "state": "s", - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "node_id": "n", - "creator": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "url": "u" + "id":1, + "url":"u", + "html_url":"h", + "columns_url":"c", + "owner_url":"o", + "name":"n", + "body":"b", + "number":1, + "state":"s", + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "node_id":"n", + "creator":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "url":"u" } }` testJSONMarshal(t, u, want) @@ -861,11 +861,11 @@ func TestProjectOptions_Marshal(t *testing.T) { } want := `{ - "name": "name", - "body": "body", - "state": "state", - "organization_permission": "op", - "private": false + "name":"name", + "body":"body", + "state":"state", + "organization_permission":"op", + "private":false }` testJSONMarshal(t, u, want) @@ -886,43 +886,39 @@ func TestProjectColumn_Marshal(t *testing.T) { } want := `{ - "id": 1, - "name": "name", - "url": "url", - "project_url": "purl", - "cards_url": "curl", - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "node_id": "onidp" + "id":1, + "name":"name", + "url":"url", + "project_url":"purl", + "cards_url":"curl", + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "node_id":"onidp" }` testJSONMarshal(t, u, want) } func TestProjectColumnOptions_Marshal(t *testing.T) { - testJSONMarshal(t, &ProjectColumnOptions{}, "{}") + testJSONMarshal(t, &ProjectColumnOptions{}, `{"name":""}`) u := &ProjectColumnOptions{ Name: "name", } - want := `{ - "name": "name" - }` + want := `{"name":"name"}` testJSONMarshal(t, u, want) } func TestProjectColumnMoveOptions_Marshal(t *testing.T) { - testJSONMarshal(t, &ProjectColumnMoveOptions{}, "{}") + testJSONMarshal(t, &ProjectColumnMoveOptions{}, `{"position":""}`) u := &ProjectColumnMoveOptions{ Position: "pos", } - want := `{ - "position": "pos" - }` + want := `{"position":"pos"}` testJSONMarshal(t, u, want) } @@ -968,40 +964,40 @@ func TestProjectCard_Marshal(t *testing.T) { } want := `{ - "url": "url", - "column_url": "curl", - "content_url": "conurl", - "id": 1, - "note": "note", - "creator": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "url":"url", + "column_url":"curl", + "content_url":"conurl", + "id":1, + "note":"note", + "creator":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "node_id": "nid", - "archived": true, - "column_id": 1, - "project_id": 1, - "project_url": "purl", - "column_name": "cn", - "previous_column_name": "pcn" + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "node_id":"nid", + "archived":true, + "column_id":1, + "project_id":1, + "project_url":"purl", + "column_name":"cn", + "previous_column_name":"pcn" }` testJSONMarshal(t, u, want) @@ -1018,17 +1014,17 @@ func TestProjectCardOptions_Marshal(t *testing.T) { } want := `{ - "note": "note", - "content_id": 1, - "content_type": "ct", - "archived": false + "note":"note", + "content_id":1, + "content_type":"ct", + "archived":false }` testJSONMarshal(t, u, want) } func TestProjectCardMoveOptions_Marshal(t *testing.T) { - testJSONMarshal(t, &ProjectCardMoveOptions{}, "{}") + testJSONMarshal(t, &ProjectCardMoveOptions{}, `{"position":""}`) u := &ProjectCardMoveOptions{ Position: "pos", @@ -1036,8 +1032,8 @@ func TestProjectCardMoveOptions_Marshal(t *testing.T) { } want := `{ - "position": "pos", - "column_id": 1 + "position":"pos", + "column_id":1 }` testJSONMarshal(t, u, want) @@ -1050,9 +1046,7 @@ func TestProjectCollaboratorOptions_Marshal(t *testing.T) { Permission: String("per"), } - want := `{ - "permission": "per" - }` + want := `{"permission":"per"}` testJSONMarshal(t, u, want) } @@ -1085,26 +1079,26 @@ func TestProjectPermissionLevel_Marshal(t *testing.T) { } want := `{ - "permission": "per", - "user": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "permission":"per", + "user":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" } }` diff --git a/github/pulls_comments_test.go b/github/pulls_comments_test.go index 828651b84ac..c7d5a4a31da 100644 --- a/github/pulls_comments_test.go +++ b/github/pulls_comments_test.go @@ -78,56 +78,56 @@ func TestPullComments_Marshal(t *testing.T) { } want := `{ - "id": 10, - "in_reply_to_id": 8, - "body": "Test comment", - "path": "file1.txt", - "diff_hunk": "@@ -16,33 +16,40 @@ fmt.Println()", - "pull_request_review_id": 42, - "position": 1, - "original_position": 4, - "start_line": 2, - "line": 3, - "original_line": 2, - "original_start_line": 2, - "side": "RIGHT", - "start_side": "LEFT", - "commit_id": "ab", - "original_commit_id": "9c", - "user": { - "login": "ll", - "id": 123, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "url": "u" + "id":10, + "in_reply_to_id":8, + "body":"Test comment", + "path":"file1.txt", + "diff_hunk":"@@ -16,33 +16,40 @@ fmt.Println()", + "pull_request_review_id":42, + "position":1, + "original_position":4, + "start_line":2, + "line":3, + "original_line":2, + "original_start_line":2, + "side":"RIGHT", + "start_side":"LEFT", + "commit_id":"ab", + "original_commit_id":"9c", + "user":{ + "login":"ll", + "id":123, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "url":"u" }, - "reactions": { - "total_count": 1, - "+1": 1, - "-1": 0, - "laugh": 0, - "confused": 0, - "heart": 0, - "hooray": 0, - "rocket": 0, - "eyes": 0, - "url": "u" + "reactions":{ + "total_count":1, + "+1":1, + "-1":0, + "laugh":0, + "confused":0, + "heart":0, + "hooray":0, + "rocket":0, + "eyes":0, + "url":"u" }, - "created_at": "2002-02-10T15:30:00Z", - "updated_at": "2002-02-10T15:30:00Z", - "url": "pullrequestcommentUrl", - "html_url": "pullrequestcommentHTMLUrl", - "pull_request_url": "pullrequestcommentPullRequestURL" + "created_at":"2002-02-10T15:30:00Z", + "updated_at":"2002-02-10T15:30:00Z", + "url":"pullrequestcommentUrl", + "html_url":"pullrequestcommentHTMLUrl", + "pull_request_url":"pullrequestcommentPullRequestURL" }` testJSONMarshal(t, u, want) diff --git a/github/pulls_reviewers_test.go b/github/pulls_reviewers_test.go index 60502445390..76f583bda1f 100644 --- a/github/pulls_reviewers_test.go +++ b/github/pulls_reviewers_test.go @@ -24,11 +24,11 @@ func TestReviewersRequest_Marshal(t *testing.T) { } want := `{ - "node_id": "n", - "reviewers": [ + "node_id":"n", + "reviewers":[ "r" ], - "team_reviewers" : [ + "team_reviewers":[ "t" ] }` @@ -77,40 +77,40 @@ func TestReviewers_Marshal(t *testing.T) { } want := `{ - "users" : [ + "users":[ { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "url": "u" + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "url":"u" } ], - "teams" : [ + "teams":[ { - "id": 1, - "node_id": "node", - "name": "n", - "description": "d", - "url": "u", - "slug": "s", - "permission": "p", - "privacy": "priv", - "members_count": 1, - "repos_count": 1, - "members_url": "m", - "repositories_url": "r", - "ldap_dn": "l" + "id":1, + "node_id":"node", + "name":"n", + "description":"d", + "url":"u", + "slug":"s", + "permission":"p", + "privacy":"priv", + "members_count":1, + "repos_count":1, + "members_url":"m", + "repositories_url":"r", + "ldap_dn":"l" } ] }` diff --git a/github/pulls_reviews_test.go b/github/pulls_reviews_test.go index bafa9f06a3b..8bc0c57bb32 100644 --- a/github/pulls_reviews_test.go +++ b/github/pulls_reviews_test.go @@ -637,9 +637,7 @@ func TestPullRequestReviewDismissalRequest_Marshal(t *testing.T) { Message: String("msg"), } - want := `{ - "message": "msg" - }` + want := `{"message":"msg"}` testJSONMarshal(t, u, want) } @@ -658,13 +656,13 @@ func TestDraftReviewComment_Marshal(t *testing.T) { } want := `{ - "path": "path", - "position": 1, - "body": "body", - "start_side": "ss", - "side": "side", - "start_line": 1, - "line": 1 + "path":"path", + "position":1, + "body":"body", + "start_side":"ss", + "side":"side", + "start_line":1, + "line":1 }` testJSONMarshal(t, u, want) @@ -692,19 +690,19 @@ func TestPullRequestReviewRequest_Marshal(t *testing.T) { } want := `{ - "node_id": "nodeid", - "commit_id": "cid", - "body": "body", - "event": "event", - "comments": [ + "node_id":"nodeid", + "commit_id":"cid", + "body":"body", + "event":"event", + "comments":[ { - "path": "path", - "position": 1, - "body": "body", - "start_side": "ss", - "side": "side", - "start_line": 1, - "line": 1 + "path":"path", + "position":1, + "body":"body", + "start_side":"ss", + "side":"side", + "start_line":1, + "line":1 } ] }` @@ -748,35 +746,35 @@ func TestPullRequestReview_Marshal(t *testing.T) { } want := `{ - "id": 1, - "node_id": "nid", - "user": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "id":1, + "node_id":"nid", + "user":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "body": "body", - "submitted_at": ` + referenceTimeStr + `, - "commit_id": "cid", - "html_url": "hurl", - "pull_request_url": "prurl", - "state": "state", - "author_association": "aa" + "body":"body", + "submitted_at":` + referenceTimeStr + `, + "commit_id":"cid", + "html_url":"hurl", + "pull_request_url":"prurl", + "state":"state", + "author_association":"aa" }` testJSONMarshal(t, u, want) diff --git a/github/pulls_test.go b/github/pulls_test.go index 5a9582b896e..33e95f52a1a 100644 --- a/github/pulls_test.go +++ b/github/pulls_test.go @@ -849,10 +849,10 @@ func TestPullRequestMergeRequest_Marshal(t *testing.T) { } want := `{ - "commit_message": "cm", - "commit_title": "ct", - "merge_method": "mm", - "sha": "sha" + "commit_message":"cm", + "commit_title":"ct", + "merge_method":"mm", + "sha":"sha" }` testJSONMarshal(t, u, want) @@ -868,9 +868,9 @@ func TestPullRequestMergeResult_Marshal(t *testing.T) { } want := `{ - "sha": "sha", - "merged": false, - "message": "msg" + "sha":"sha", + "merged":false, + "message":"msg" }` testJSONMarshal(t, u, want) @@ -888,11 +888,11 @@ func TestPullRequestUpdate_Marshal(t *testing.T) { } want := `{ - "title": "title", - "body": "body", - "state": "state", - "base": "base", - "maintainer_can_modify": false + "title":"title", + "body":"body", + "state":"state", + "base":"base", + "maintainer_can_modify":false }` testJSONMarshal(t, u, want) @@ -907,8 +907,8 @@ func TestPullRequestBranchUpdateResponse_Marshal(t *testing.T) { } want := `{ - "message": "message", - "url": "url" + "message":"message", + "url":"url" }` testJSONMarshal(t, u, want) @@ -921,9 +921,7 @@ func TestPullRequestBranchUpdateOptions_Marshal(t *testing.T) { ExpectedHeadSHA: String("eh"), } - want := `{ - "expected_head_sha": "eh" - }` + want := `{"expected_head_sha":"eh"}` testJSONMarshal(t, u, want) } @@ -943,14 +941,14 @@ func TestNewPullRequest_Marshal(t *testing.T) { } want := `{ - "title": "eh", - "head": "eh", - "head_repo": "eh", - "base": "eh", - "body": "eh", - "issue": 1, - "maintainer_can_modify": false, - "draft": false + "title":"eh", + "head":"eh", + "head_repo":"eh", + "base":"eh", + "body":"eh", + "issue":1, + "maintainer_can_modify":false, + "draft":false }` testJSONMarshal(t, u, want) @@ -987,31 +985,31 @@ func TestPullRequestBranch_Marshal(t *testing.T) { } want := `{ - "label": "label", - "ref": "ref", - "sha": "sha", - "repo": { - "id": 1 + "label":"label", + "ref":"ref", + "sha":"sha", + "repo":{ + "id":1 }, - "user": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "user":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" } }` @@ -1025,9 +1023,7 @@ func TestPRLink_Marshal(t *testing.T) { HRef: String("href"), } - want := `{ - "href": "href" - }` + want := `{"href":"href"}` testJSONMarshal(t, u, want) } @@ -1063,29 +1059,29 @@ func TestPRLinks_Marshal(t *testing.T) { } want := `{ - "self": { - "href": "href" + "self":{ + "href":"href" }, - "html": { - "href": "href" + "html":{ + "href":"href" }, - "issue": { - "href": "href" + "issue":{ + "href":"href" }, - "comments": { - "href": "href" + "comments":{ + "href":"href" }, - "review_comments": { - "href": "href" + "review_comments":{ + "href":"href" }, - "review_comment": { - "href": "href" + "review_comment":{ + "href":"href" }, - "commits": { - "href": "href" + "commits":{ + "href":"href" }, - "statuses": { - "href": "href" + "statuses":{ + "href":"href" } }` @@ -1122,29 +1118,29 @@ func TestPullRequestAutoMerge_Marshal(t *testing.T) { } want := `{ - "enabled_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "enabled_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "merge_method": "mm", - "commit_title": "ct", - "commit_message": "cm" + "merge_method":"mm", + "commit_title":"ct", + "commit_message":"cm" }` testJSONMarshal(t, u, want) @@ -1359,222 +1355,222 @@ func TestPullRequest_Marshal(t *testing.T) { } want := `{ - "id": 1, - "number": 1, - "state": "state", - "locked": false, - "title": "title", - "body": "body", - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "closed_at": ` + referenceTimeStr + `, - "merged_at": ` + referenceTimeStr + `, - "labels": [ + "id":1, + "number":1, + "state":"state", + "locked":false, + "title":"title", + "body":"body", + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "closed_at":` + referenceTimeStr + `, + "merged_at":` + referenceTimeStr + `, + "labels":[ { - "id": 1 + "id":1 } ], - "user": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "user":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "draft": false, - "merged": false, - "mergeable": false, - "mergeable_state": "ms", - "merged_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "draft":false, + "merged":false, + "mergeable":false, + "mergeable_state":"ms", + "merged_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "merge_commit_sha": "mcs", - "rebaseable": false, - "comments": 1, - "commits": 1, - "additions": 1, - "deletions": 1, - "changed_files": 1, - "url": "url", - "html_url": "hurl", - "issue_url": "iurl", - "statuses_url": "surl", - "diff_url": "durl", - "patch_url": "purl", - "commits_url": "curl", - "comments_url": "comurl", - "review_comments_url": "rcurls", - "review_comment_url": "rcurl", - "review_comments": 1, - "assignee": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "merge_commit_sha":"mcs", + "rebaseable":false, + "comments":1, + "commits":1, + "additions":1, + "deletions":1, + "changed_files":1, + "url":"url", + "html_url":"hurl", + "issue_url":"iurl", + "statuses_url":"surl", + "diff_url":"durl", + "patch_url":"purl", + "commits_url":"curl", + "comments_url":"comurl", + "review_comments_url":"rcurls", + "review_comment_url":"rcurl", + "review_comments":1, + "assignee":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "assignees": [ + "assignees":[ { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" } ], - "milestone": { - "id": 1 + "milestone":{ + "id":1 }, - "maintainer_can_modify": true, - "author_association": "aa", - "node_id": "nid", - "requested_reviewers": [ + "maintainer_can_modify":true, + "author_association":"aa", + "node_id":"nid", + "requested_reviewers":[ { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" } ], - "auto_merge": { - "enabled_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "auto_merge":{ + "enabled_by":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "merge_method": "mm", - "commit_title": "ct", - "commit_message": "cm" + "merge_method":"mm", + "commit_title":"ct", + "commit_message":"cm" }, - "requested_teams": [ + "requested_teams":[ { - "id": 1 + "id":1 } ], - "_links": { - "self": { - "href": "href" + "_links":{ + "self":{ + "href":"href" }, - "html": { - "href": "href" + "html":{ + "href":"href" }, - "issue": { - "href": "href" + "issue":{ + "href":"href" }, - "comments": { - "href": "href" + "comments":{ + "href":"href" }, - "review_comments": { - "href": "href" + "review_comments":{ + "href":"href" }, - "review_comment": { - "href": "href" + "review_comment":{ + "href":"href" }, - "commits": { - "href": "href" + "commits":{ + "href":"href" }, - "statuses": { - "href": "href" + "statuses":{ + "href":"href" } }, - "head": { - "ref": "r2", - "repo": { - "id": 2 + "head":{ + "ref":"r2", + "repo":{ + "id":2 } }, - "base": { - "ref": "r2", - "repo": { - "id": 2 + "base":{ + "ref":"r2", + "repo":{ + "id":2 } }, - "active_lock_reason": "alr" + "active_lock_reason":"alr" }` testJSONMarshal(t, u, want) diff --git a/github/pulls_threads_test.go b/github/pulls_threads_test.go index 7c3c8619968..8afe87d6cad 100644 --- a/github/pulls_threads_test.go +++ b/github/pulls_threads_test.go @@ -77,112 +77,112 @@ func TestPullRequestThread_Marshal(t *testing.T) { } want := `{ - "id": 1, - "node_id": "nid", - "comments": [ + "id":1, + "node_id":"nid", + "comments":[ { - "id": 10, - "in_reply_to_id": 8, - "body": "Test comment", - "path": "file1.txt", - "diff_hunk": "@@ -16,33 +16,40 @@ fmt.Println()", - "pull_request_review_id": 42, - "position": 1, - "original_position": 4, - "start_line": 2, - "line": 3, - "original_line": 2, - "original_start_line": 2, - "side": "RIGHT", - "start_side": "LEFT", - "commit_id": "ab", - "original_commit_id": "9c", - "user": { - "login": "ll", - "id": 123, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "url": "u" + "id":10, + "in_reply_to_id":8, + "body":"Test comment", + "path":"file1.txt", + "diff_hunk":"@@ -16,33 +16,40 @@ fmt.Println()", + "pull_request_review_id":42, + "position":1, + "original_position":4, + "start_line":2, + "line":3, + "original_line":2, + "original_start_line":2, + "side":"RIGHT", + "start_side":"LEFT", + "commit_id":"ab", + "original_commit_id":"9c", + "user":{ + "login":"ll", + "id":123, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "url":"u" }, - "reactions": { - "total_count": 1, - "+1": 1, - "-1": 0, - "laugh": 0, - "confused": 0, - "heart": 0, - "hooray": 0, - "rocket": 0, - "eyes": 0, - "url": "u" + "reactions":{ + "total_count":1, + "+1":1, + "-1":0, + "laugh":0, + "confused":0, + "heart":0, + "hooray":0, + "rocket":0, + "eyes":0, + "url":"u" }, - "created_at": "2002-02-10T15:30:00Z", - "updated_at": "2002-02-10T15:30:00Z", - "url": "pullrequestcommentUrl", - "html_url": "pullrequestcommentHTMLUrl", - "pull_request_url": "pullrequestcommentPullRequestURL" + "created_at":"2002-02-10T15:30:00Z", + "updated_at":"2002-02-10T15:30:00Z", + "url":"pullrequestcommentUrl", + "html_url":"pullrequestcommentHTMLUrl", + "pull_request_url":"pullrequestcommentPullRequestURL" }, { - "id": 10, - "in_reply_to_id": 8, - "body": "Test comment", - "path": "file1.txt", - "diff_hunk": "@@ -16,33 +16,40 @@ fmt.Println()", - "pull_request_review_id": 42, - "position": 1, - "original_position": 4, - "start_line": 2, - "line": 3, - "original_line": 2, - "original_start_line": 2, - "side": "RIGHT", - "start_side": "LEFT", - "commit_id": "ab", - "original_commit_id": "9c", - "user": { - "login": "ll", - "id": 123, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "url": "u" + "id":10, + "in_reply_to_id":8, + "body":"Test comment", + "path":"file1.txt", + "diff_hunk":"@@ -16,33 +16,40 @@ fmt.Println()", + "pull_request_review_id":42, + "position":1, + "original_position":4, + "start_line":2, + "line":3, + "original_line":2, + "original_start_line":2, + "side":"RIGHT", + "start_side":"LEFT", + "commit_id":"ab", + "original_commit_id":"9c", + "user":{ + "login":"ll", + "id":123, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "url":"u" }, - "reactions": { - "total_count": 1, - "+1": 1, - "-1": 0, - "laugh": 0, - "confused": 0, - "heart": 0, - "hooray": 0, - "rocket": 0, - "eyes": 0, - "url": "u" + "reactions":{ + "total_count":1, + "+1":1, + "-1":0, + "laugh":0, + "confused":0, + "heart":0, + "hooray":0, + "rocket":0, + "eyes":0, + "url":"u" }, - "created_at": "2002-02-10T15:30:00Z", - "updated_at": "2002-02-10T15:30:00Z", - "url": "pullrequestcommentUrl", - "html_url": "pullrequestcommentHTMLUrl", - "pull_request_url": "pullrequestcommentPullRequestURL" + "created_at":"2002-02-10T15:30:00Z", + "updated_at":"2002-02-10T15:30:00Z", + "url":"pullrequestcommentUrl", + "html_url":"pullrequestcommentHTMLUrl", + "pull_request_url":"pullrequestcommentPullRequestURL" } ] }` diff --git a/github/reactions_test.go b/github/reactions_test.go index e77631e99a1..0c477736efa 100644 --- a/github/reactions_test.go +++ b/github/reactions_test.go @@ -25,9 +25,9 @@ func TestReaction_Marshal(t *testing.T) { } want := `{ - "id": 1, - "node_id": "n", - "content": "+1" + "id":1, + "node_id":"n", + "content":"+1" }` testJSONMarshal(t, r, want) @@ -50,16 +50,16 @@ func TestReactions_Marshal(t *testing.T) { } want := `{ - "total_count": 1, - "+1": 1, - "-1": 1, - "laugh": 1, - "confused": 1, - "heart": 1, - "hooray": 1, - "rocket": 1, - "eyes": 1, - "url": "u" + "total_count":1, + "+1":1, + "-1":1, + "laugh":1, + "confused":1, + "heart":1, + "hooray":1, + "rocket":1, + "eyes":1, + "url":"u" }` testJSONMarshal(t, r, want) diff --git a/github/repos_actions_access_test.go b/github/repos_actions_access_test.go index accfe2abf13..ecdd8877ff4 100644 --- a/github/repos_actions_access_test.go +++ b/github/repos_actions_access_test.go @@ -90,9 +90,7 @@ func TestRepositoryActionsAccessLevel_Marshal(t *testing.T) { AccessLevel: String("enterprise"), } - want := `{ - "access_level": "enterprise" - }` + want := `{"access_level":"enterprise"}` testJSONMarshal(t, u, want) } diff --git a/github/repos_actions_permissions_test.go b/github/repos_actions_permissions_test.go index ecff0d5fbca..552510e8aed 100644 --- a/github/repos_actions_permissions_test.go +++ b/github/repos_actions_permissions_test.go @@ -103,9 +103,9 @@ func TestActionsPermissionsRepository_Marshal(t *testing.T) { } want := `{ - "enabled": true, - "allowed_actions": "all", - "selected_actions_url": "someURL" + "enabled":true, + "allowed_actions":"all", + "selected_actions_url":"someURL" }` testJSONMarshal(t, u, want) diff --git a/github/repos_autolinks_test.go b/github/repos_autolinks_test.go index 37de5b5f5a7..1542f90f154 100644 --- a/github/repos_autolinks_test.go +++ b/github/repos_autolinks_test.go @@ -174,9 +174,9 @@ func TestAutolinkOptions_Marshal(t *testing.T) { } want := `{ - "key_prefix": "kp", - "url_template": "URLT", - "is_alphanumeric": true + "key_prefix":"kp", + "url_template":"URLT", + "is_alphanumeric":true }` testJSONMarshal(t, r, want) @@ -193,10 +193,10 @@ func TestAutolink_Marshal(t *testing.T) { } want := `{ - "id": 1, - "key_prefix": "kp", - "url_template": "URLT", - "is_alphanumeric": true + "id":1, + "key_prefix":"kp", + "url_template":"URLT", + "is_alphanumeric":true }` testJSONMarshal(t, r, want) diff --git a/github/repos_codeowners_test.go b/github/repos_codeowners_test.go index 62c58c5b192..22cbe89463d 100644 --- a/github/repos_codeowners_test.go +++ b/github/repos_codeowners_test.go @@ -76,7 +76,7 @@ func TestRepositoriesService_GetCodeownersErrors(t *testing.T) { } func TestCodeownersErrors_Marshal(t *testing.T) { - testJSONMarshal(t, &CodeownersErrors{}, "{}") + testJSONMarshal(t, &CodeownersErrors{}, `{"errors":null}`) u := &CodeownersErrors{ Errors: []*CodeownersError{ @@ -93,18 +93,18 @@ func TestCodeownersErrors_Marshal(t *testing.T) { } want := `{ - "errors": [ - { - "line": 1, - "column": 1, - "kind": "Invalid pattern", - "source": "***/*.rb @monalisa", - "suggestion": "Did you mean **/*.rb?", - "message": "Invalid pattern on line 3: Did you mean **/*.rb?\n\n ***/*.rb @monalisa\n ^", - "path": ".github/CODEOWNERS" - } - ] - } -` + "errors":[ + { + "line":1, + "column":1, + "kind":"Invalid pattern", + "source":"***/*.rb @monalisa", + "suggestion":"Did you mean **/*.rb?", + "message":"Invalid pattern on line 3: Did you mean **/*.rb?\n\n ***/*.rb @monalisa\n ^", + "path":".github/CODEOWNERS" + } + ] + }` + testJSONMarshal(t, u, want) } diff --git a/github/repos_collaborators_test.go b/github/repos_collaborators_test.go index 5aa0ad90f70..9a92cb33531 100644 --- a/github/repos_collaborators_test.go +++ b/github/repos_collaborators_test.go @@ -369,9 +369,7 @@ func TestRepositoryAddCollaboratorOptions_Marshal(t *testing.T) { Permission: "permission", } - want := `{ - "permission": "permission" - }` + want := `{"permission":"permission"}` testJSONMarshal(t, r, want) } @@ -404,26 +402,26 @@ func TestRepositoryPermissionLevel_Marshal(t *testing.T) { } want := `{ - "permission": "permission", - "user": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "permission":"permission", + "user":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" } }` @@ -488,56 +486,56 @@ func TestCollaboratorInvitation_Marshal(t *testing.T) { } want := `{ - "id": 1, - "repository": { - "id": 1, - "name": "n", - "url": "url" + "id":1, + "repository":{ + "id":1, + "name":"n", + "url":"url" }, - "invitee": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "invitee":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "inviter": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "inviter":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "permissions": "per", - "created_at": ` + referenceTimeStr + `, - "url": "url", - "html_url": "hurl" + "permissions":"per", + "created_at":` + referenceTimeStr + `, + "url":"url", + "html_url":"hurl" }` testJSONMarshal(t, r, want) diff --git a/github/repos_comments_test.go b/github/repos_comments_test.go index 00871cd72fb..6f718be8808 100644 --- a/github/repos_comments_test.go +++ b/github/repos_comments_test.go @@ -295,7 +295,7 @@ func TestRepositoriesService_DeleteComment_invalidOwner(t *testing.T) { } func TestRepositoryComment_Marshal(t *testing.T) { - testJSONMarshal(t, &RepositoryComment{}, "{}") + testJSONMarshal(t, &RepositoryComment{}, `{"body":null}`) r := &RepositoryComment{ HTMLURL: String("hurl"), @@ -343,48 +343,48 @@ func TestRepositoryComment_Marshal(t *testing.T) { } want := `{ - "html_url": "hurl", - "url": "url", - "id": 1, - "node_id": "nid", - "commit_id": "cid", - "user": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "html_url":"hurl", + "url":"url", + "id":1, + "node_id":"nid", + "commit_id":"cid", + "user":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "reactions": { - "total_count": 1, - "+1": 1, - "-1": 1, - "laugh": 1, - "confused": 1, - "heart": 1, - "hooray": 1, - "rocket": 1, - "eyes": 1, - "url": "u" + "reactions":{ + "total_count":1, + "+1":1, + "-1":1, + "laugh":1, + "confused":1, + "heart":1, + "hooray":1, + "rocket":1, + "eyes":1, + "url":"u" }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "body": "body", - "path": "path", - "position": 1 + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "body":"body", + "path":"path", + "position":1 }` testJSONMarshal(t, r, want) diff --git a/github/repos_commits_test.go b/github/repos_commits_test.go index 8fa8eb9f401..c4f5a3a7ddd 100644 --- a/github/repos_commits_test.go +++ b/github/repos_commits_test.go @@ -717,54 +717,54 @@ func TestBranchCommit_Marshal(t *testing.T) { } want := `{ - "name": "n", - "commit": { - "sha": "s", - "author": { - "date": ` + referenceTimeStr + `, - "name": "n", - "email": "e", - "username": "u" + "name":"n", + "commit":{ + "sha":"s", + "author":{ + "date":` + referenceTimeStr + `, + "name":"n", + "email":"e", + "username":"u" }, - "committer": { - "date": ` + referenceTimeStr + `, - "name": "n", - "email": "e", - "username": "u" + "committer":{ + "date":` + referenceTimeStr + `, + "name":"n", + "email":"e", + "username":"u" }, - "message": "m", - "tree": { - "sha": "s", - "tree": [ + "message":"m", + "tree":{ + "sha":"s", + "tree":[ { - "sha": "s", - "path": "p", - "mode": "m", - "type": "t", - "size": 1, - "content": "c", - "url": "u" + "sha":"s", + "path":"p", + "mode":"m", + "type":"t", + "size":1, + "content":"c", + "url":"u" } ], - "truncated": false + "truncated":false }, - "stats": { - "additions": 1, - "deletions": 1, - "total": 1 + "stats":{ + "additions":1, + "deletions":1, + "total":1 }, - "html_url": "h", - "url": "u", - "verification": { - "verified": false, - "reason": "r", - "signature": "s", - "payload": "p" + "html_url":"h", + "url":"u", + "verification":{ + "verified":false, + "reason":"r", + "signature":"s", + "payload":"p" }, - "node_id": "n", - "comment_count": 1 + "node_id":"n", + "comment_count":1 }, - "protected": false + "protected":false }` testJSONMarshal(t, r, want) @@ -798,31 +798,31 @@ func TestCommitsComparison_Marshal(t *testing.T) { } want := `{ - "base_commit": { - "node_id": "nid" + "base_commit":{ + "node_id":"nid" }, - "merge_base_commit": { - "node_id": "nid" + "merge_base_commit":{ + "node_id":"nid" }, - "status": "status", - "ahead_by": 1, - "behind_by": 1, - "total_commits": 1, - "commits": [ + "status":"status", + "ahead_by":1, + "behind_by":1, + "total_commits":1, + "commits":[ { - "node_id": "nid" + "node_id":"nid" } ], - "files": [ + "files":[ { - "sha": "sha" + "sha":"sha" } ], - "html_url": "hurl", - "permalink_url": "purl", - "diff_url": "durl", - "patch_url": "purl", - "url": "url" + "html_url":"hurl", + "permalink_url":"purl", + "diff_url":"durl", + "patch_url":"purl", + "url":"url" }` testJSONMarshal(t, r, want) @@ -846,17 +846,17 @@ func TestCommitFile_Marshal(t *testing.T) { } want := `{ - "sha": "sha", - "filename": "fn", - "additions": 1, - "deletions": 1, - "changes": 1, - "status": "status", - "patch": "patch", - "blob_url": "burl", - "raw_url": "rurl", - "contents_url": "curl", - "previous_filename": "pf" + "sha":"sha", + "filename":"fn", + "additions":1, + "deletions":1, + "changes":1, + "status":"status", + "patch":"patch", + "blob_url":"burl", + "raw_url":"rurl", + "contents_url":"curl", + "previous_filename":"pf" }` testJSONMarshal(t, r, want) @@ -872,9 +872,9 @@ func TestCommitStats_Marshal(t *testing.T) { } want := `{ - "additions": 1, - "deletions": 1, - "total": 1 + "additions":1, + "deletions":1, + "total":1 }` testJSONMarshal(t, r, want) @@ -924,41 +924,41 @@ func TestRepositoryCommit_Marshal(t *testing.T) { } want := `{ - "node_id": "nid", - "sha": "sha", - "commit": { - "message": "m" + "node_id":"nid", + "sha":"sha", + "commit":{ + "message":"m" }, - "author": { - "login": "l" + "author":{ + "login":"l" }, - "committer": { - "login": "l" + "committer":{ + "login":"l" }, - "parents": [ + "parents":[ { - "sha": "s" + "sha":"s" } ], - "html_url": "hurl", - "url": "url", - "comments_url": "curl", - "stats": { - "additions": 104, - "deletions": 4, - "total": 108 + "html_url":"hurl", + "url":"url", + "comments_url":"curl", + "stats":{ + "additions":104, + "deletions":4, + "total":108 }, - "files": [ + "files":[ { - "filename": "f", - "additions": 10, - "deletions": 2, - "changes": 12, - "status": "s", - "patch": "p", - "blob_url": "b", - "raw_url": "r", - "contents_url": "c" + "filename":"f", + "additions":10, + "deletions":2, + "changes":12, + "status":"s", + "patch":"p", + "blob_url":"b", + "raw_url":"r", + "contents_url":"c" } ] }` diff --git a/github/repos_community_health_test.go b/github/repos_community_health_test.go index 6ff88bda5aa..100820b41e8 100644 --- a/github/repos_community_health_test.go +++ b/github/repos_community_health_test.go @@ -134,7 +134,14 @@ func TestRepositoriesService_GetCommunityHealthMetrics(t *testing.T) { } func TestMetric_Marshal(t *testing.T) { - testJSONMarshal(t, &Metric{}, "{}") + testJSONMarshal(t, &Metric{}, `{ + "name":null, + "key":null, + "spdx_id":null, + "url":null, + "html_url":null, + "node_id":null + }`) r := &Metric{ Name: String("name"), @@ -146,19 +153,27 @@ func TestMetric_Marshal(t *testing.T) { } want := `{ - "name": "name", - "key": "key", - "spdx_id": "spdx_id", - "url": "url", - "html_url": "hurl", - "node_id": "node_id" + "name":"name", + "key":"key", + "spdx_id":"spdx_id", + "url":"url", + "html_url":"hurl", + "node_id":"node_id" }` testJSONMarshal(t, r, want) } func TestCommunityHealthFiles_Marshal(t *testing.T) { - testJSONMarshal(t, &CommunityHealthFiles{}, "{}") + testJSONMarshal(t, &CommunityHealthFiles{}, `{ + "code_of_conduct":null, + "code_of_conduct_file":null, + "contributing":null, + "issue_template":null, + "pull_request_template":null, + "license":null, + "readme":null + }`) r := &CommunityHealthFiles{ CodeOfConduct: &Metric{ @@ -208,49 +223,61 @@ func TestCommunityHealthFiles_Marshal(t *testing.T) { } want := `{ - "code_of_conduct": { - "name": "name", - "key": "key", - "url": "url", - "html_url": "hurl" + "code_of_conduct":{ + "name":"name", + "key":"key", + "spdx_id":null, + "url":"url", + "html_url":"hurl", + "node_id":null }, - "code_of_conduct_file": { - "name": "name", - "key": "key", - "url": "url", - "html_url": "hurl" - }, - "contributing": { - "name": "name", - "key": "key", - "url": "url", - "html_url": "hurl" + "code_of_conduct_file":{ + "name":"name", + "key":"key", + "spdx_id":null, + "url":"url", + "html_url":"hurl", + "node_id":null }, - "issue_template": { - "name": "name", - "key": "key", - "url": "url", - "html_url": "hurl" + "contributing":{ + "name":"name", + "key":"key", + "spdx_id":null, + "url":"url", + "html_url":"hurl", + "node_id":null }, - "pull_request_template": { - "name": "name", - "key": "key", - "url": "url", - "html_url": "hurl" + "issue_template":{ + "name":"name", + "key":"key", + "spdx_id":null, + "url":"url", + "html_url":"hurl", + "node_id":null }, - "license": { - "name": "name", - "key": "key", - "spdx_id": "spdx_id", - "url": "url", - "html_url": "hurl", - "node_id": "node_id" + "pull_request_template":{ + "name":"name", + "key":"key", + "spdx_id":null, + "url":"url", + "html_url":"hurl", + "node_id":null }, - "readme": { - "name": "name", - "key": "key", - "url": "url", - "html_url": "hurl" + "license":{ + "name":"name", + "key":"key", + "spdx_id":"spdx_id", + "url":"url", + "html_url":"hurl", + "node_id":"node_id" + }, + "readme":{ + "name":"name", + "key":"key", + "spdx_id":null, + "url":"url", + "html_url":"hurl", + "node_id":null } }` @@ -258,7 +285,14 @@ func TestCommunityHealthFiles_Marshal(t *testing.T) { } func TestCommunityHealthMetrics_Marshal(t *testing.T) { - testJSONMarshal(t, &CommunityHealthMetrics{}, "{}") + testJSONMarshal(t, &CommunityHealthMetrics{}, `{ + "health_percentage":null, + "description":null, + "documentation":null, + "files":null, + "updated_at":null, + "content_reports_enabled":null + }`) r := &CommunityHealthMetrics{ HealthPercentage: Int(1), @@ -315,57 +349,69 @@ func TestCommunityHealthMetrics_Marshal(t *testing.T) { } want := `{ - "health_percentage": 1, - "description": "desc", - "documentation": "docs", - "files": { - "code_of_conduct": { - "name": "name", - "key": "key", - "url": "url", - "html_url": "hurl" + "health_percentage":1, + "description":"desc", + "documentation":"docs", + "files":{ + "code_of_conduct":{ + "name":"name", + "key":"key", + "spdx_id":null, + "url":"url", + "html_url":"hurl", + "node_id":null + }, + "code_of_conduct_file":{ + "name":"name", + "key":"key", + "spdx_id":null, + "url":"url", + "html_url":"hurl", + "node_id":null }, - "code_of_conduct_file": { - "name": "name", - "key": "key", - "url": "url", - "html_url": "hurl" - }, - "contributing": { - "name": "name", - "key": "key", - "url": "url", - "html_url": "hurl" + "contributing":{ + "name":"name", + "key":"key", + "spdx_id":null, + "url":"url", + "html_url":"hurl", + "node_id":null }, - "issue_template": { - "name": "name", - "key": "key", - "url": "url", - "html_url": "hurl" + "issue_template":{ + "name":"name", + "key":"key", + "spdx_id":null, + "url":"url", + "html_url":"hurl", + "node_id":null }, - "pull_request_template": { - "name": "name", - "key": "key", - "url": "url", - "html_url": "hurl" + "pull_request_template":{ + "name":"name", + "key":"key", + "spdx_id":null, + "url":"url", + "html_url":"hurl", + "node_id":null }, - "license": { - "name": "name", - "key": "key", - "spdx_id": "spdx_id", - "url": "url", - "html_url": "hurl", - "node_id": "node_id" + "license":{ + "name":"name", + "key":"key", + "spdx_id":"spdx_id", + "url":"url", + "html_url":"hurl", + "node_id":"node_id" }, - "readme": { - "name": "name", - "key": "key", - "url": "url", - "html_url": "hurl" + "readme":{ + "name":"name", + "key":"key", + "spdx_id":null, + "url":"url", + "html_url":"hurl", + "node_id":null } }, - "updated_at": ` + referenceTimeStr + `, - "content_reports_enabled": true + "updated_at":` + referenceTimeStr + `, + "content_reports_enabled":true }` testJSONMarshal(t, r, want) diff --git a/github/repos_contents_test.go b/github/repos_contents_test.go index 6310e739538..5b7c01c70b7 100644 --- a/github/repos_contents_test.go +++ b/github/repos_contents_test.go @@ -7,6 +7,7 @@ package github import ( "context" + "encoding/base64" "errors" "fmt" "io" @@ -803,26 +804,26 @@ func TestRepositoryContent_Marshal(t *testing.T) { } want := `{ - "type": "type", - "target": "target", - "encoding": "encoding", - "size": 1, - "name": "name", - "path": "path", - "content": "content", - "sha": "sha", - "url": "url", - "git_url": "gurl", - "html_url": "hurl", - "download_url": "durl", - "submodule_git_url": "smgurl" + "type":"type", + "target":"target", + "encoding":"encoding", + "size":1, + "name":"name", + "path":"path", + "content":"content", + "sha":"sha", + "url":"url", + "git_url":"gurl", + "html_url":"hurl", + "download_url":"durl", + "submodule_git_url":"smgurl" }` testJSONMarshal(t, r, want) } func TestRepositoryContentResponse_Marshal(t *testing.T) { - testJSONMarshal(t, &RepositoryContentResponse{}, "{}") + testJSONMarshal(t, &RepositoryContentResponse{}, `{"commit":{}}`) r := &RepositoryContentResponse{ Content: &RepositoryContent{ @@ -888,66 +889,66 @@ func TestRepositoryContentResponse_Marshal(t *testing.T) { } want := `{ - "content": { - "type": "type", - "target": "target", - "encoding": "encoding", - "size": 1, - "name": "name", - "path": "path", - "content": "content", - "sha": "sha", - "url": "url", - "git_url": "gurl", - "html_url": "hurl", - "download_url": "durl", - "submodule_git_url": "smgurl" + "content":{ + "type":"type", + "target":"target", + "encoding":"encoding", + "size":1, + "name":"name", + "path":"path", + "content":"content", + "sha":"sha", + "url":"url", + "git_url":"gurl", + "html_url":"hurl", + "download_url":"durl", + "submodule_git_url":"smgurl" }, - "commit": { - "sha": "s", - "author": { - "date": ` + referenceTimeStr + `, - "name": "n", - "email": "e", - "username": "u" + "commit":{ + "sha":"s", + "author":{ + "date":` + referenceTimeStr + `, + "name":"n", + "email":"e", + "username":"u" }, - "committer": { - "date": ` + referenceTimeStr + `, - "name": "n", - "email": "e", - "username": "u" + "committer":{ + "date":` + referenceTimeStr + `, + "name":"n", + "email":"e", + "username":"u" }, - "message": "m", - "tree": { - "sha": "s", - "tree": [ + "message":"m", + "tree":{ + "sha":"s", + "tree":[ { - "sha": "s", - "path": "p", - "mode": "m", - "type": "t", - "size": 1, - "content": "c", - "url": "u" + "sha":"s", + "path":"p", + "mode":"m", + "type":"t", + "size":1, + "content":"c", + "url":"u" } ], - "truncated": false + "truncated":false }, - "stats": { - "additions": 1, - "deletions": 1, - "total": 1 + "stats":{ + "additions":1, + "deletions":1, + "total":1 }, - "html_url": "h", - "url": "u", - "verification": { - "verified": false, - "reason": "r", - "signature": "s", - "payload": "p" + "html_url":"h", + "url":"u", + "verification":{ + "verified":false, + "reason":"r", + "signature":"s", + "payload":"p" }, - "node_id": "n", - "comment_count": 1 + "node_id":"n", + "comment_count":1 } }` @@ -955,7 +956,7 @@ func TestRepositoryContentResponse_Marshal(t *testing.T) { } func TestRepositoryContentFileOptions_Marshal(t *testing.T) { - testJSONMarshal(t, &RepositoryContentFileOptions{}, "{}") + testJSONMarshal(t, &RepositoryContentFileOptions{}, `{"content":null}`) r := &RepositoryContentFileOptions{ Message: String("type"), @@ -976,22 +977,24 @@ func TestRepositoryContentFileOptions_Marshal(t *testing.T) { }, } + contentValue := base64.StdEncoding.EncodeToString([]byte{1}) + want := `{ - "message": "type", - "content": "AQ==", - "sha": "type", - "branch": "type", - "author": { - "date": ` + referenceTimeStr + `, - "name": "name", - "email": "email", - "username": "login" + "message":"type", + "content":"` + contentValue + `", + "sha":"type", + "branch":"type", + "author":{ + "date":` + referenceTimeStr + `, + "name":"name", + "email":"email", + "username":"login" }, - "committer": { - "date": ` + referenceTimeStr + `, - "name": "name", - "email": "email", - "username": "login" + "committer":{ + "date":` + referenceTimeStr + `, + "name":"name", + "email":"email", + "username":"login" } }` diff --git a/github/repos_deployments_test.go b/github/repos_deployments_test.go index 4ee2c4f1c32..6bef8d9d11a 100644 --- a/github/repos_deployments_test.go +++ b/github/repos_deployments_test.go @@ -307,12 +307,12 @@ func TestDeploymentStatusRequest_Marshal(t *testing.T) { } want := `{ - "state": "state", - "log_url": "logurl", - "description": "desc", - "environment": "env", - "environment_url": "eurl", - "auto_inactive": false + "state":"state", + "log_url":"logurl", + "description":"desc", + "environment":"env", + "environment_url":"eurl", + "auto_inactive":false }` testJSONMarshal(t, r, want) @@ -358,39 +358,39 @@ func TestDeploymentStatus_Marshal(t *testing.T) { } want := `{ - "id": 1, - "state": "state", - "creator": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "id":1, + "state":"state", + "creator":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "description": "desc", - "environment": "env", - "node_id": "nid", - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "target_url": "turl", - "deployment_url": "durl", - "repository_url": "rurl", - "environment_url": "eurl", - "log_url": "lurl", - "url": "url" + "description":"desc", + "environment":"env", + "node_id":"nid", + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "target_url":"turl", + "deployment_url":"durl", + "repository_url":"rurl", + "environment_url":"eurl", + "log_url":"lurl", + "url":"url" }` testJSONMarshal(t, r, want) @@ -412,15 +412,17 @@ func TestDeploymentRequest_Marshal(t *testing.T) { } want := `{ - "ref": "ref", - "task": "task", - "auto_merge": false, - "required_contexts": ["s"], - "payload": "payload", - "environment": "environment", - "description": "description", - "transient_environment": false, - "production_environment": false + "ref":"ref", + "task":"task", + "auto_merge":false, + "required_contexts":[ + "s" + ], + "payload":"payload", + "environment":"environment", + "description":"description", + "transient_environment":false, + "production_environment":false }` testJSONMarshal(t, r, want) @@ -469,39 +471,39 @@ func TestDeployment_Marshal(t *testing.T) { } want := `{ - "url": "url", - "id": 1, - "sha": "sha", - "ref": "ref", - "task": "task", - "payload": "s", - "environment": "env", - "description": "desc", - "creator": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "url":"url", + "id":1, + "sha":"sha", + "ref":"ref", + "task":"task", + "payload":"s", + "environment":"env", + "description":"desc", + "creator":{ + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "statuses_url": "surl", - "repository_url": "rurl", - "node_id": "nid" + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "statuses_url":"surl", + "repository_url":"rurl", + "node_id":"nid" }` testJSONMarshal(t, r, want) diff --git a/github/repos_environments_test.go b/github/repos_environments_test.go index 870c99003a4..5a225355499 100644 --- a/github/repos_environments_test.go +++ b/github/repos_environments_test.go @@ -396,43 +396,43 @@ func TestRepoEnvironment_Marshal(t *testing.T) { want := `{ "total_count":1, "environments":[ - { - "owner":"me", - "repo":"se", - "environment_name":"dev", - "wait_timer":123, - "reviewers":[ - { - "type":"main", - "id":1 - }, - { - "type":"rev", - "id":2 - } - ], - "deployment_branch_policy":{ - "protected_branches":false, - "custom_branch_policies":false - }, - "id":2, - "node_id":"star", - "name":"eg", - "url":"https://hey.in", - "html_url":"htmlurl", - "created_at":` + referenceTimeStr + `, - "updated_at":` + referenceTimeStr + `, - "protection_rules":[ - { - "id":21, - "node_id":"mnb", - "type":"ewq", - "wait_timer":9090 - } - ] - } + { + "owner":"me", + "repo":"se", + "environment_name":"dev", + "wait_timer":123, + "reviewers":[ + { + "type":"main", + "id":1 + }, + { + "type":"rev", + "id":2 + } + ], + "deployment_branch_policy":{ + "protected_branches":false, + "custom_branch_policies":false + }, + "id":2, + "node_id":"star", + "name":"eg", + "url":"https://hey.in", + "html_url":"htmlurl", + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "protection_rules":[ + { + "id":21, + "node_id":"mnb", + "type":"ewq", + "wait_timer":9090 + } + ] + } ] - }` + }` testJSONMarshal(t, repoEnv, want) } @@ -540,8 +540,8 @@ func TestBranchPolicy_Marshal(t *testing.T) { } want := `{ - "protected_branches": false, - "custom_branch_policies": false + "protected_branches":false, + "custom_branch_policies":false }` testJSONMarshal(t, bp, want) diff --git a/github/repos_hooks_deliveries_test.go b/github/repos_hooks_deliveries_test.go index 057d7121df4..26478ea34a6 100644 --- a/github/repos_hooks_deliveries_test.go +++ b/github/repos_hooks_deliveries_test.go @@ -280,11 +280,11 @@ func TestHookRequest_Marshal(t *testing.T) { } want := `{ - "headers": { - "key": "value" + "headers":{ + "key":"value" }, - "payload": { - "key": "value" + "payload":{ + "key":"value" } }` @@ -305,11 +305,11 @@ func TestHookResponse_Marshal(t *testing.T) { } want := `{ - "headers": { - "key": "value" + "headers":{ + "key":"value" }, - "payload": { - "key": "value" + "payload":{ + "key":"value" } }` @@ -347,31 +347,31 @@ func TestHookDelivery_Marshal(t *testing.T) { } want := `{ - "id": 1, - "guid": "guid", - "delivered_at": ` + referenceTimeStr + `, - "redelivery": true, - "duration": 1, - "status": "guid", - "status_code": 1, - "event": "guid", - "action": "guid", - "installation_id": 1, - "repository_id": 1, - "request": { - "headers": { - "key": "value" + "id":1, + "guid":"guid", + "delivered_at":` + referenceTimeStr + `, + "redelivery":true, + "duration":1, + "status":"guid", + "status_code":1, + "event":"guid", + "action":"guid", + "installation_id":1, + "repository_id":1, + "request":{ + "headers":{ + "key":"value" }, - "payload": { - "key": "value" + "payload":{ + "key":"value" } }, - "response": { - "headers": { - "key": "value" + "response":{ + "headers":{ + "key":"value" }, - "payload": { - "key": "value" + "payload":{ + "key":"value" } } }` diff --git a/github/repos_hooks_test.go b/github/repos_hooks_test.go index 84c9f5ee6fa..5a0902e0e7c 100644 --- a/github/repos_hooks_test.go +++ b/github/repos_hooks_test.go @@ -372,65 +372,89 @@ func TestBranchWebHookPayload_Marshal(t *testing.T) { } want := `{ - "action": "action", - "after": "after", - "before": "before", - "commits": [ + "commits":[ { - "added": ["1", "2", "3"], - "author":{ - "email": "abc@gmail.com", - "name": "abc", - "username": "abc_12" - }, - "committer": { - "email": "abc@gmail.com", - "name": "abc", - "username": "abc_12" - }, - "id": "1", - "message": "WebHookCommit", - "modified": ["abc", "efg", "erd"], - "removed": ["cmd", "rti", "duv"] + "message":"WebHookCommit", + "author":{ + "name":"abc", + "email":"abc@gmail.com", + "username":"abc_12" + }, + "id":"1", + "committer":{ + "name":"abc", + "email":"abc@gmail.com", + "username":"abc_12" + }, + "added":[ + "1", + "2", + "3" + ], + "removed":[ + "cmd", + "rti", + "duv" + ], + "modified":[ + "abc", + "efg", + "erd" + ] } ], - "compare": "compare", - "created": true, - "forced": false, - "head_commit": { - "added": ["1", "2", "3"], - "author":{ - "email": "abc@gmail.com", - "name": "abc", - "username": "abc_12" - }, - "committer": { - "email": "abc@gmail.com", - "name": "abc", - "username": "abc_12" - }, - "id": "1", - "message": "WebHookCommit", - "modified": ["abc", "efg", "erd"], - "removed": ["cmd", "rti", "duv"] - }, - "installation": { - "id": 12 + "before":"before", + "action":"action", + "after":"after", + "created":true, + "forced":false, + "compare":"compare", + "repository":{ + "id":321, + "node_id":"node_321" }, - "organization": { - "id" : 22 + "head_commit":{ + "message":"WebHookCommit", + "author":{ + "name":"abc", + "email":"abc@gmail.com", + "username":"abc_12" + }, + "id":"1", + "committer":{ + "name":"abc", + "email":"abc@gmail.com", + "username":"abc_12" + }, + "added":[ + "1", + "2", + "3" + ], + "removed":[ + "cmd", + "rti", + "duv" + ], + "modified":[ + "abc", + "efg", + "erd" + ] }, "pusher":{ - "login": "rd@yahoo.com", - "id": 112 - }, - "repository":{ - "id": 321, - "node_id": "node_321" + "login":"rd@yahoo.com", + "id":112 }, "sender":{ - "login": "st@gmail.com", - "id": 202 + "login":"st@gmail.com", + "id":202 + }, + "installation":{ + "id":12 + }, + "organization":{ + "id":22 } }` @@ -447,9 +471,9 @@ func TestBranchWebHookAuthor_Marshal(t *testing.T) { } want := `{ - "email": "abc@gmail.com", - "name": "abc", - "username": "abc_12" + "name":"abc", + "email":"abc@gmail.com", + "username":"abc_12" }` testJSONMarshal(t, v, want) @@ -477,28 +501,40 @@ func TestBranchWebHookCommit_Marshal(t *testing.T) { } want := `{ - "added": ["1", "2", "3"], + "message":"WebHookCommit", "author":{ - "email": "abc@gmail.com", - "name": "abc", - "username": "abc_12" + "name":"abc", + "email":"abc@gmail.com", + "username":"abc_12" + }, + "id":"1", + "committer":{ + "name":"abc", + "email":"abc@gmail.com", + "username":"abc_12" }, - "committer": { - "email": "abc@gmail.com", - "name": "abc", - "username": "abc_12" - }, - "id": "1", - "message": "WebHookCommit", - "modified": ["abc", "efg", "erd"], - "removed": ["cmd", "rti", "duv"] + "added":[ + "1", + "2", + "3" + ], + "removed":[ + "cmd", + "rti", + "duv" + ], + "modified":[ + "abc", + "efg", + "erd" + ] }` testJSONMarshal(t, v, want) } func TestBranchCreateHookRequest_Marshal(t *testing.T) { - testJSONMarshal(t, &createHookRequest{}, "{}") + testJSONMarshal(t, &createHookRequest{}, `{"name":""}`) v := &createHookRequest{ Name: "abc", @@ -510,12 +546,16 @@ func TestBranchCreateHookRequest_Marshal(t *testing.T) { } want := `{ - "name": "abc", - "active": true, - "events": ["1","2","3"], + "name":"abc", "config":{ - "thing": "@123" - } + "thing":"@123" + }, + "events":[ + "1", + "2", + "3" + ], + "active":true }` testJSONMarshal(t, v, want) @@ -544,22 +584,26 @@ func TestBranchHook_Marshal(t *testing.T) { } want := `{ - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "url": "url", - "id": 1, - "type": "type", - "name": "name", - "test_url": "testurl", - "ping_url": "pingurl", + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "url":"url", + "id":1, + "type":"type", + "name":"name", + "test_url":"testurl", + "ping_url":"pingurl", "last_response":{ - "item": "item" + "item":"item" }, "config":{ - "thing": "@123" + "thing":"@123" }, - "events": ["1","2","3"], - "active": true + "events":[ + "1", + "2", + "3" + ], + "active":true }` testJSONMarshal(t, v, want) diff --git a/github/repos_merging_test.go b/github/repos_merging_test.go index b4c50178ab9..72294221bba 100644 --- a/github/repos_merging_test.go +++ b/github/repos_merging_test.go @@ -73,9 +73,9 @@ func TestRepositoryMergeRequest_Marshal(t *testing.T) { } want := `{ - "base": "base", - "head": "head", - "commit_message": "cm" + "base":"base", + "head":"head", + "commit_message":"cm" }` testJSONMarshal(t, u, want) @@ -137,9 +137,9 @@ func TestRepoMergeUpstreamResult_Marshal(t *testing.T) { } want := `{ - "message": "message", - "merge_type": "merge_type", - "base_branch": "base_branch" + "message":"message", + "merge_type":"merge_type", + "base_branch":"base_branch" }` testJSONMarshal(t, u, want) diff --git a/github/repos_pages_test.go b/github/repos_pages_test.go index 5dd735c00fb..af763a86e2f 100644 --- a/github/repos_pages_test.go +++ b/github/repos_pages_test.go @@ -506,8 +506,8 @@ func TestPagesSource_Marshal(t *testing.T) { } want := `{ - "branch": "branch", - "path": "path" + "branch":"branch", + "path":"path" }` testJSONMarshal(t, u, want) @@ -520,15 +520,13 @@ func TestPagesError_Marshal(t *testing.T) { Message: String("message"), } - want := `{ - "message": "message" - }` + want := `{"message":"message"}` testJSONMarshal(t, u, want) } func TestPagesUpdate_Marshal(t *testing.T) { - testJSONMarshal(t, &PagesUpdate{}, "{}") + testJSONMarshal(t, &PagesUpdate{}, `{"cname":null}`) u := &PagesUpdate{ CNAME: String("cname"), @@ -536,8 +534,10 @@ func TestPagesUpdate_Marshal(t *testing.T) { } want := `{ - "cname": "cname", - "source": { "path": "src" } + "cname":"cname", + "source":{ + "path":"src" + } }` testJSONMarshal(t, u, want) @@ -559,14 +559,14 @@ func TestPages_Marshal(t *testing.T) { } want := `{ - "url": "url", - "status": "status", - "cname": "cname", - "custom_404": false, - "html_url": "hurl", - "source": { - "branch": "branch", - "path": "path" + "url":"url", + "status":"status", + "cname":"cname", + "custom_404":false, + "html_url":"hurl", + "source":{ + "branch":"branch", + "path":"path" } }` @@ -590,18 +590,18 @@ func TestPagesBuild_Marshal(t *testing.T) { } want := `{ - "url": "url", - "status": "status", - "error": { - "message": "message" + "url":"url", + "status":"status", + "error":{ + "message":"message" }, - "pusher": { - "id": 1 + "pusher":{ + "id":1 }, - "commit": "commit", - "duration": 1, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + ` + "commit":"commit", + "duration":1, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + ` }` testJSONMarshal(t, u, want) @@ -650,43 +650,43 @@ func TestPagesHealthCheckResponse_Marshal(t *testing.T) { } want := `{ - "domain": { - "host": "example.com", - "uri": "http://example.com/", - "nameservers": "default", - "dns_resolves": true, - "is_proxied": false, - "is_cloudflare_ip": false, - "is_fastly_ip": false, - "is_old_ip_address": false, - "is_a_record": true, - "has_cname_record": false, - "has_mx_records_present": false, - "is_valid_domain": true, - "is_apex_domain": true, - "should_be_a_record": true, - "is_cname_to_github_user_domain": false, - "is_cname_to_pages_dot_github_dot_com": false, - "is_cname_to_fastly": false, - "is_pointed_to_github_pages_ip": true, - "is_non_github_pages_ip_present": false, - "is_pages_domain": false, - "is_served_by_pages": true, - "is_valid": true, - "reason": "some reason", - "responds_to_https": true, - "enforces_https": true, - "https_error": "some error", - "is_https_eligible": true, - "caa_error": "some error" + "domain":{ + "host":"example.com", + "uri":"http://example.com/", + "nameservers":"default", + "dns_resolves":true, + "is_proxied":false, + "is_cloudflare_ip":false, + "is_fastly_ip":false, + "is_old_ip_address":false, + "is_a_record":true, + "has_cname_record":false, + "has_mx_records_present":false, + "is_valid_domain":true, + "is_apex_domain":true, + "should_be_a_record":true, + "is_cname_to_github_user_domain":false, + "is_cname_to_pages_dot_github_dot_com":false, + "is_cname_to_fastly":false, + "is_pointed_to_github_pages_ip":true, + "is_non_github_pages_ip_present":false, + "is_pages_domain":false, + "is_served_by_pages":true, + "is_valid":true, + "reason":"some reason", + "responds_to_https":true, + "enforces_https":true, + "https_error":"some error", + "is_https_eligible":true, + "caa_error":"some error" }, - "alt_domain": { - "host": "www.example.com", - "uri": "http://www.example.com/", - "nameservers": "default", - "dns_resolves": true + "alt_domain":{ + "host":"www.example.com", + "uri":"http://www.example.com/", + "nameservers":"default", + "dns_resolves":true } - }` + }` testJSONMarshal(t, u, want) } @@ -702,9 +702,9 @@ func TestCreatePagesRequest_Marshal(t *testing.T) { } want := `{ - "source": { - "branch": "branch", - "path": "path" + "source":{ + "branch":"branch", + "path":"path" } }` diff --git a/github/repos_prereceive_hooks_test.go b/github/repos_prereceive_hooks_test.go index b286068047b..49a0b2b2e4a 100644 --- a/github/repos_prereceive_hooks_test.go +++ b/github/repos_prereceive_hooks_test.go @@ -206,10 +206,10 @@ func TestPreReceiveHook_Marshal(t *testing.T) { } want := `{ - "id": 1, - "name": "name", - "enforcement": "e", - "configuration_url": "curl" + "id":1, + "name":"name", + "enforcement":"e", + "configuration_url":"curl" }` testJSONMarshal(t, u, want) diff --git a/github/repos_releases_test.go b/github/repos_releases_test.go index d7efd096d21..ab2f6ceb6a4 100644 --- a/github/repos_releases_test.go +++ b/github/repos_releases_test.go @@ -746,14 +746,14 @@ func TestRepositoryReleaseRequest_Marshal(t *testing.T) { } want := `{ - "tag_name": "tn", - "target_commitish": "tc", - "name": "name", - "body": "body", - "draft": false, - "prerelease": false, - "make_latest": "legacy", - "discussion_category_name": "dcn" + "tag_name":"tn", + "target_commitish":"tc", + "name":"name", + "body":"body", + "draft":false, + "prerelease":false, + "make_latest":"legacy", + "discussion_category_name":"dcn" }` testJSONMarshal(t, u, want) @@ -779,21 +779,21 @@ func TestReleaseAsset_Marshal(t *testing.T) { } want := `{ - "id": 1, - "url": "url", - "name": "name", - "label": "label", - "state": "state", - "content_type": "ct", - "size": 1, - "download_count": 1, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "browser_download_url": "bdu", - "uploader": { - "id": 1 + "id":1, + "url":"url", + "name":"name", + "label":"label", + "state":"state", + "content_type":"ct", + "size":1, + "download_count":1, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "browser_download_url":"bdu", + "uploader":{ + "id":1 }, - "node_id": "nid" + "node_id":"nid" }` testJSONMarshal(t, u, want) @@ -826,39 +826,39 @@ func TestRepositoryRelease_Marshal(t *testing.T) { } want := `{ - "tag_name": "tn", - "target_commitish": "tc", - "name": "name", - "body": "body", - "draft": false, - "prerelease": false, - "make_latest": "legacy", - "discussion_category_name": "dcn", - "id": 1, - "created_at": ` + referenceTimeStr + `, - "published_at": ` + referenceTimeStr + `, - "url": "url", - "html_url": "hurl", - "assets_url": "aurl", - "assets": [ + "tag_name":"tn", + "target_commitish":"tc", + "name":"name", + "body":"body", + "draft":false, + "prerelease":false, + "make_latest":"legacy", + "discussion_category_name":"dcn", + "id":1, + "created_at":` + referenceTimeStr + `, + "published_at":` + referenceTimeStr + `, + "url":"url", + "html_url":"hurl", + "assets_url":"aurl", + "assets":[ { - "id": 1 + "id":1 } ], - "upload_url": "uurl", - "zipball_url": "zurl", - "tarball_url": "turl", - "author": { - "id": 1 + "upload_url":"uurl", + "zipball_url":"zurl", + "tarball_url":"turl", + "author":{ + "id":1 }, - "node_id": "nid" + "node_id":"nid" }` testJSONMarshal(t, u, want) } func TestGenerateNotesOptions_Marshal(t *testing.T) { - testJSONMarshal(t, &GenerateNotesOptions{}, "{}") + testJSONMarshal(t, &GenerateNotesOptions{}, `{"tag_name":""}`) u := &GenerateNotesOptions{ TagName: "tag_name", @@ -867,9 +867,9 @@ func TestGenerateNotesOptions_Marshal(t *testing.T) { } want := `{ - "tag_name": "tag_name", - "previous_tag_name": "previous_tag_name", - "target_commitish": "target_commitish" + "tag_name":"tag_name", + "previous_tag_name":"previous_tag_name", + "target_commitish":"target_commitish" }` testJSONMarshal(t, u, want) diff --git a/github/repos_stats_test.go b/github/repos_stats_test.go index 1babaca6e2a..31835d3e744 100644 --- a/github/repos_stats_test.go +++ b/github/repos_stats_test.go @@ -337,8 +337,12 @@ func TestRepositoryParticipation_Marshal(t *testing.T) { } want := `{ - "all": [1], - "owner": [1] + "all":[ + 1 + ], + "owner":[ + 1 + ] }` testJSONMarshal(t, u, want) @@ -354,11 +358,11 @@ func TestWeeklyCommitActivity_Marshal(t *testing.T) { } want := `{ - "days": [ + "days":[ 1 ], - "total": 1, - "week": ` + referenceTimeStr + ` + "total":1, + "week":` + referenceTimeStr + ` }` testJSONMarshal(t, u, want) @@ -375,10 +379,10 @@ func TestWeeklyStats_Marshal(t *testing.T) { } want := `{ - "w": ` + referenceTimeStr + `, - "a": 1, - "d": 1, - "c": 1 + "w":` + referenceTimeStr + `, + "a":1, + "d":1, + "c":1 }` testJSONMarshal(t, u, want) @@ -401,16 +405,16 @@ func TestContributorStats_Marshal(t *testing.T) { } want := `{ - "author": { - "id": 1 + "author":{ + "id":1 }, - "total": 1, - "weeks": [ + "total":1, + "weeks":[ { - "w": ` + referenceTimeStr + `, - "a": 1, - "d": 1, - "c": 1 + "w":` + referenceTimeStr + `, + "a":1, + "d":1, + "c":1 } ] }` diff --git a/github/repos_statuses_test.go b/github/repos_statuses_test.go index cd9b0db70bb..d2147f1a38e 100644 --- a/github/repos_statuses_test.go +++ b/github/repos_statuses_test.go @@ -168,19 +168,19 @@ func TestRepoStatus_Marshal(t *testing.T) { } want := `{ - "id": 1, - "node_id": "nid", - "url": "url", - "state": "state", - "target_url": "turl", - "description": "desc", - "context": "ctx", - "avatar_url": "aurl", - "creator": { - "id": 1 + "id":1, + "node_id":"nid", + "url":"url", + "state":"state", + "target_url":"turl", + "description":"desc", + "context":"ctx", + "avatar_url":"aurl", + "creator":{ + "id":1 }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + ` + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + ` }` testJSONMarshal(t, u, want) @@ -214,29 +214,29 @@ func TestCombinedStatus_Marshal(t *testing.T) { } want := `{ - "state": "state", - "name": "name", - "sha": "sha", - "total_count": 1, - "statuses": [ + "state":"state", + "name":"name", + "sha":"sha", + "total_count":1, + "statuses":[ { - "id": 1, - "node_id": "nid", - "url": "url", - "state": "state", - "target_url": "turl", - "description": "desc", - "context": "ctx", - "avatar_url": "aurl", - "creator": { - "id": 1 + "id":1, + "node_id":"nid", + "url":"url", + "state":"state", + "target_url":"turl", + "description":"desc", + "context":"ctx", + "avatar_url":"aurl", + "creator":{ + "id":1 }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + ` + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + ` } ], - "commit_url": "curl", - "repository_url": "rurl" + "commit_url":"curl", + "repository_url":"rurl" }` testJSONMarshal(t, u, want) diff --git a/github/repos_tags_test.go b/github/repos_tags_test.go index 0195706fe69..04787935208 100644 --- a/github/repos_tags_test.go +++ b/github/repos_tags_test.go @@ -132,7 +132,10 @@ func TestRepositoriesService_DeleteTagProtection(t *testing.T) { } func TestTagProtection_Marshal(t *testing.T) { - testJSONMarshal(t, &TagProtection{}, "{}") + testJSONMarshal(t, &TagProtection{}, `{ + "id":null, + "pattern":null + }`) u := &TagProtection{ ID: Int64(1), @@ -140,8 +143,8 @@ func TestTagProtection_Marshal(t *testing.T) { } want := `{ - "id": 1, - "pattern": "pattern" + "id":1, + "pattern":"pattern" }` testJSONMarshal(t, u, want) diff --git a/github/repos_test.go b/github/repos_test.go index 7486e488fe6..31870b48aec 100644 --- a/github/repos_test.go +++ b/github/repos_test.go @@ -3861,9 +3861,7 @@ func TestAdvancedSecurity_Marshal(t *testing.T) { Status: String("status"), } - want := `{ - "status": "status" - }` + want := `{"status":"status"}` testJSONMarshal(t, u, want) } @@ -3875,15 +3873,13 @@ func TestAuthorizedActorsOnly_Marshal(t *testing.T) { From: Bool(true), } - want := `{ - "from" : true - }` + want := `{"from":true}` testJSONMarshal(t, u, want) } func TestDispatchRequestOptions_Marshal(t *testing.T) { - testJSONMarshal(t, &DispatchRequestOptions{}, "{}") + testJSONMarshal(t, &DispatchRequestOptions{}, `{"event_type":""}`) cp := json.RawMessage(`{"testKey":"testValue"}`) u := &DispatchRequestOptions{ @@ -3892,17 +3888,17 @@ func TestDispatchRequestOptions_Marshal(t *testing.T) { } want := `{ - "event_type": "test_event_type", - "client_payload": { - "testKey": "testValue" + "event_type":"test_event_type", + "client_payload":{ + "testKey":"testValue" } - }` + }` testJSONMarshal(t, u, want) } func TestTransferRequest_Marshal(t *testing.T) { - testJSONMarshal(t, &TransferRequest{}, "{}") + testJSONMarshal(t, &TransferRequest{}, `{"new_owner":""}`) u := &TransferRequest{ NewOwner: "testOwner", @@ -3911,9 +3907,12 @@ func TestTransferRequest_Marshal(t *testing.T) { } want := `{ - "new_owner": "testOwner", - "new_name": "testName", - "team_ids": [1,2] + "new_owner":"testOwner", + "new_name":"testName", + "team_ids":[ + 1, + 2 + ] }` testJSONMarshal(t, u, want) @@ -3928,8 +3927,8 @@ func TestSignaturesProtectedBranch_Marshal(t *testing.T) { } want := `{ - "url": "https://www.testURL.in", - "enabled": false + "url":"https://www.testURL.in", + "enabled":false }` testJSONMarshal(t, u, want) @@ -3940,8 +3939,8 @@ func TestSignaturesProtectedBranch_Marshal(t *testing.T) { } want2 := `{ - "url": "testURL", - "enabled": true + "url":"testURL", + "enabled":true }` testJSONMarshal(t, u2, want2) @@ -3957,16 +3956,25 @@ func TestDismissalRestrictionsRequest_Marshal(t *testing.T) { } want := `{ - "users": ["user1","user2"], - "teams": ["team1","team2"], - "apps": ["app1","app2"] + "users":[ + "user1", + "user2" + ], + "teams":[ + "team1", + "team2" + ], + "apps":[ + "app1", + "app2" + ] }` testJSONMarshal(t, u, want) } func TestAdminEnforcement_Marshal(t *testing.T) { - testJSONMarshal(t, &AdminEnforcement{}, "{}") + testJSONMarshal(t, &AdminEnforcement{}, `{"enabled":false}`) u := &AdminEnforcement{ URL: String("https://www.test-url.in"), @@ -3974,15 +3982,15 @@ func TestAdminEnforcement_Marshal(t *testing.T) { } want := `{ - "url": "https://www.test-url.in", - "enabled": false + "url":"https://www.test-url.in", + "enabled":false }` testJSONMarshal(t, u, want) } func TestPullRequestReviewsEnforcementUpdate_Marshal(t *testing.T) { - testJSONMarshal(t, &PullRequestReviewsEnforcementUpdate{}, "{}") + testJSONMarshal(t, &PullRequestReviewsEnforcementUpdate{}, `{"required_approving_review_count":0}`) u := &PullRequestReviewsEnforcementUpdate{ BypassPullRequestAllowancesRequest: &BypassPullRequestAllowancesRequest{ @@ -3996,21 +4004,30 @@ func TestPullRequestReviewsEnforcementUpdate_Marshal(t *testing.T) { } want := `{ - "bypass_pull_request_allowances": { - "users": ["user1","user2"], - "teams": ["team1","team2"], - "apps": ["app1","app2"] + "bypass_pull_request_allowances":{ + "users":[ + "user1", + "user2" + ], + "teams":[ + "team1", + "team2" + ], + "apps":[ + "app1", + "app2" + ] }, - "dismiss_stale_reviews": false, - "require_code_owner_reviews": true, - "required_approving_review_count": 2 + "dismiss_stale_reviews":false, + "require_code_owner_reviews":true, + "required_approving_review_count":2 }` testJSONMarshal(t, u, want) } func TestRequiredStatusCheck_Marshal(t *testing.T) { - testJSONMarshal(t, &RequiredStatusCheck{}, "{}") + testJSONMarshal(t, &RequiredStatusCheck{}, `{"context":""}`) u := &RequiredStatusCheck{ Context: "ctx", @@ -4018,8 +4035,8 @@ func TestRequiredStatusCheck_Marshal(t *testing.T) { } want := `{ - "context": "ctx", - "app_id": 1 + "context":"ctx", + "app_id":1 }` testJSONMarshal(t, u, want) @@ -4039,13 +4056,13 @@ func TestRepositoryTag_Marshal(t *testing.T) { } want := `{ - "name": "v0.1", - "commit": { - "sha": "sha", - "url": "url" + "name":"v0.1", + "commit":{ + "sha":"sha", + "url":"url" }, - "zipball_url": "zball", - "tarball_url": "tball" + "zipball_url":"zball", + "tarball_url":"tball" }` testJSONMarshal(t, u, want) diff --git a/github/repos_traffic_test.go b/github/repos_traffic_test.go index e63f9181994..01a38093ffc 100644 --- a/github/repos_traffic_test.go +++ b/github/repos_traffic_test.go @@ -211,9 +211,9 @@ func TestTrafficReferrer_Marshal(t *testing.T) { } want := `{ - "referrer" : "referrer", - "count" : 0, - "uniques" : 0 + "referrer":"referrer", + "count":0, + "uniques":0 }` testJSONMarshal(t, u, want) @@ -233,13 +233,15 @@ func TestTrafficViews_Marshal(t *testing.T) { } want := `{ - "views": [{ - "timestamp": "2016-05-31T16:00:00.000Z", - "count": 7, - "uniques": 6 - }], - "count" : 0, - "uniques" : 0 + "views":[ + { + "timestamp":"2016-05-31T16:00:00Z", + "count":7, + "uniques":6 + } + ], + "count":0, + "uniques":0 }` testJSONMarshal(t, u, want) @@ -259,13 +261,15 @@ func TestTrafficClones_Marshal(t *testing.T) { } want := `{ - "clones": [{ - "timestamp": "2021-10-29T16:00:00.000Z", - "count": 1, - "uniques": 1 - }], - "count" : 0, - "uniques" : 0 + "clones":[ + { + "timestamp":"2021-10-29T16:00:00Z", + "count":1, + "uniques":1 + } + ], + "count":0, + "uniques":0 }` testJSONMarshal(t, u, want) @@ -282,10 +286,10 @@ func TestTrafficPath_Marshal(t *testing.T) { } want := `{ - "path" : "test/path", - "title": "test", - "count": 2, - "uniques": 3 + "path":"test/path", + "title":"test", + "count":2, + "uniques":3 }` testJSONMarshal(t, u, want) @@ -300,25 +304,23 @@ func TestTrafficData_Marshal(t *testing.T) { Uniques: Int(6), } - want := `{ - "timestamp": "2016-05-31T16:00:00.000Z", - "count": 7, - "uniques": 6 - }` + want := `{ + "timestamp":"2016-05-31T16:00:00Z", + "count":7, + "uniques":6 + }` testJSONMarshal(t, u, want) } -func TestTrafficBreakdownOptions_Marshal(t *testing.T) { - testJSONMarshal(t, &TrafficBreakdownOptions{}, "{}") +func TestTrafficBreakdownOptions_addOptions(t *testing.T) { + url := "some/path" + + testAddURLOptions(t, url, &UserListOptions{}, url) u := &TrafficBreakdownOptions{ Per: "day", } - want := `{ - "per": "day" - }` - - testJSONMarshal(t, u, want) + testAddURLOptions(t, url, u, url+`?per=day`) } diff --git a/github/scim_test.go b/github/scim_test.go index 9e5274766aa..3618366d48e 100644 --- a/github/scim_test.go +++ b/github/scim_test.go @@ -345,7 +345,12 @@ func TestSCIMService_DeleteSCIMUserFromOrg(t *testing.T) { func TestSCIMUserAttributes_Marshal(t *testing.T) { testJSONMarshal(t, &SCIMUserAttributes{}, `{ - "userName":"","name":{"givenName":"","familyName":""},"emails":null + "userName":"", + "name":{ + "givenName":"", + "familyName":"" + }, + "emails":null }`) u := &SCIMUserAttributes{ @@ -370,29 +375,35 @@ func TestSCIMUserAttributes_Marshal(t *testing.T) { } want := `{ - "userName": "userName1", - "name": { - "givenName": "Name1", - "familyName": "Fname", - "formatted": "formatted name" + "userName":"userName1", + "name":{ + "givenName":"Name1", + "familyName":"Fname", + "formatted":"formatted name" }, - "displayName": "Name", - "emails": [{ - "value": "value", - "primary": false, - "type": "type" - }], - "schemas": ["schema1"], - "externalId": "id", - "groups": ["group1"], - "active": true + "displayName":"Name", + "emails":[ + { + "value":"value", + "primary":false, + "type":"type" + } + ], + "schemas":[ + "schema1" + ], + "externalId":"id", + "groups":[ + "group1" + ], + "active":true }` testJSONMarshal(t, u, want) } func TestUpdateAttributeForSCIMUserOperations_Marshal(t *testing.T) { - testJSONMarshal(t, &UpdateAttributeForSCIMUserOperations{}, `{}`) + testJSONMarshal(t, &UpdateAttributeForSCIMUserOperations{}, `{"op":""}`) u := &UpdateAttributeForSCIMUserOperations{ Op: "TestOp", @@ -400,15 +411,19 @@ func TestUpdateAttributeForSCIMUserOperations_Marshal(t *testing.T) { } want := `{ - "op": "TestOp", - "path": "path" + "op":"TestOp", + "path":"path" }` testJSONMarshal(t, u, want) } func TestUpdateAttributeForSCIMUserOptions_Marshal(t *testing.T) { - testJSONMarshal(t, &UpdateAttributeForSCIMUserOptions{}, `{}`) + testJSONMarshal(t, &UpdateAttributeForSCIMUserOptions{}, `{ + "operations":{ + "op":"" + } + }`) u := &UpdateAttributeForSCIMUserOptions{ Schemas: []string{"test", "schema"}, @@ -419,10 +434,13 @@ func TestUpdateAttributeForSCIMUserOptions_Marshal(t *testing.T) { } want := `{ - "schemas": ["test", "schema"], - "operations": { - "op": "TestOp", - "path": "path" + "schemas":[ + "test", + "schema" + ], + "operations":{ + "op":"TestOp", + "path":"path" } }` @@ -430,12 +448,6 @@ func TestUpdateAttributeForSCIMUserOptions_Marshal(t *testing.T) { } func TestListSCIMProvisionedIdentitiesOptions_addOptions(t *testing.T) { - testJSONMarshal(t, &ListSCIMProvisionedIdentitiesOptions{}, `{ - "StartIndex": null, - "Count": null, - "Filter": null - }`) - url := "some/path" testAddURLOptions(t, url, &ListSCIMProvisionedIdentitiesOptions{}, url) @@ -464,7 +476,8 @@ func TestListSCIMProvisionedIdentitiesOptions_addOptions(t *testing.T) { func TestSCIMUserName_Marshal(t *testing.T) { testJSONMarshal(t, &SCIMUserName{}, `{ - "givenName":"","familyName":"" + "givenName":"", + "familyName":"" }`) u := &SCIMUserName{ @@ -474,10 +487,11 @@ func TestSCIMUserName_Marshal(t *testing.T) { } want := `{ - "givenName": "Name1", - "familyName": "Fname", - "formatted": "formatted name" + "givenName":"Name1", + "familyName":"Fname", + "formatted":"formatted name" }` + testJSONMarshal(t, u, want) } @@ -490,8 +504,8 @@ func TestSCIMMeta_Marshal(t *testing.T) { } want := `{ - "resourceType": "test", - "location": "test" + "resourceType":"test", + "location":"test" }` testJSONMarshal(t, u, want) @@ -530,28 +544,39 @@ func TestSCIMProvisionedIdentities_Marshal(t *testing.T) { } want := `{ - "schemas": ["test", "schema"], - "totalResults": 1, - "itemsPerPage": 2, - "startIndex": 1, - "Resources": [{ - "userName": "SCIM", - "name": { - "givenName": "scim", - "familyName": "test", - "formatted": "SCIM" - }, - "displayName": "Test SCIM", - "emails": [{ - "value": "test", - "primary": true, - "type": "test" - }], - "schemas": ["schema1"], - "externalId": "id", - "groups": ["group1"], - "active": true - }] + "schemas":[ + "test", + "schema" + ], + "totalResults":1, + "itemsPerPage":2, + "startIndex":1, + "Resources":[ + { + "userName":"SCIM", + "name":{ + "givenName":"scim", + "familyName":"test", + "formatted":"SCIM" + }, + "displayName":"Test SCIM", + "emails":[ + { + "value":"test", + "primary":true, + "type":"test" + } + ], + "schemas":[ + "schema1" + ], + "externalId":"id", + "groups":[ + "group1" + ], + "active":true + } + ] }` testJSONMarshal(t, u, want) diff --git a/github/search.go b/github/search.go index adb832d0d8f..7b952df4a4e 100644 --- a/github/search.go +++ b/github/search.go @@ -54,7 +54,7 @@ type SearchOptions struct { // Whether to retrieve text match metadata with a query TextMatch bool `url:"-"` - ListOptions + ListOptions `url:",omitempty"` } // Common search parameters. diff --git a/github/search_test.go b/github/search_test.go index b7461753605..ebbadff79e9 100644 --- a/github/search_test.go +++ b/github/search_test.go @@ -571,8 +571,10 @@ func TestMatch_Marshal(t *testing.T) { } want := `{ - "text": "txt", - "indices": [1] + "text":"txt", + "indices":[ + 1 + ] }` testJSONMarshal(t, u, want) @@ -595,14 +597,18 @@ func TestTextMatch_Marshal(t *testing.T) { } want := `{ - "object_url": "ourl", - "object_type": "otype", - "property": "prop", - "fragment": "fragment", - "matches": [{ - "text": "txt", - "indices": [1] - }] + "object_url":"ourl", + "object_type":"otype", + "property":"prop", + "fragment":"fragment", + "matches":[ + { + "text":"txt", + "indices":[ + 1 + ] + } + ] }` testJSONMarshal(t, u, want) @@ -624,15 +630,15 @@ func TestTopicResult_Marshal(t *testing.T) { } want := `{ - "name": "name", - "display_name": "displayName", - "short_description": "shortDescription", - "description": "description", - "created_by": "createdBy", - "updated_at": "2021-10-26", - "featured": false, - "curated": true, - "score": 99.9 + "name":"name", + "display_name":"displayName", + "short_description":"shortDescription", + "description":"description", + "created_by":"createdBy", + "updated_at":"2021-10-26", + "featured":false, + "curated":true, + "score":99.9 }` testJSONMarshal(t, u, want) @@ -648,9 +654,13 @@ func TestRepositoriesSearchResult_Marshal(t *testing.T) { } want := `{ - "total_count" : 0, - "incomplete_results" : true, - "items" : [{"id":1}] + "total_count":0, + "incomplete_results":true, + "items":[ + { + "id":1 + } + ] }` testJSONMarshal(t, u, want) @@ -668,9 +678,13 @@ func TestCommitsSearchResult_Marshal(t *testing.T) { } want := `{ - "total_count" : 0, - "incomplete_results" : true, - "items" : [{"sha" : "s"}] + "total_count":0, + "incomplete_results":true, + "items":[ + { + "sha":"s" + } + ] }` testJSONMarshal(t, c, want) @@ -699,11 +713,11 @@ func TestTopicsSearchResult_Marshal(t *testing.T) { } want := `{ - "total_count" : 2, - "incomplete_results" : false, - "items" : [ + "total_count":2, + "incomplete_results":false, + "items":[ { - "name" : "t1", + "name":"t1", "display_name":"tt", "short_description":"t desc", "description":"desc", @@ -746,8 +760,10 @@ func TestLabelResult_Marshal(t *testing.T) { testJSONMarshal(t, u, want) } -func TestSearchOptions_Marshal(t *testing.T) { - testJSONMarshal(t, &SearchOptions{}, "{}") +func TestSearchOptions_addOptions(t *testing.T) { + url := "some/path" + + testAddURLOptions(t, url, &SearchOptions{}, url) u := &SearchOptions{ Sort: "author-date", @@ -759,14 +775,7 @@ func TestSearchOptions_Marshal(t *testing.T) { }, } - want := `{ - "sort": "author-date", - "order": "asc", - "page": 1, - "perPage": 10 - }` - - testJSONMarshal(t, u, want) + testAddURLOptions(t, url, u, url+`?order=asc&page=1&per_page=10&sort=author-date`) } func TestIssuesSearchResult_Marshal(t *testing.T) { @@ -811,65 +820,65 @@ func TestIssuesSearchResult_Marshal(t *testing.T) { } want := `{ - "total_count": 48, - "incomplete_results": false, - "items": [ + "total_count":48, + "incomplete_results":false, + "items":[ { - "id": 1, - "number": 1, - "state": "s", - "locked": false, - "title": "title", - "body": "body", - "author_association": "aa", - "user": { - "id": 1 + "id":1, + "number":1, + "state":"s", + "locked":false, + "title":"title", + "body":"body", + "author_association":"aa", + "user":{ + "id":1 }, - "labels": [ + "labels":[ { - "id": 1 + "id":1 } ], - "assignee": { - "id": 1 + "assignee":{ + "id":1 }, - "comments": 1, - "closed_at": ` + referenceTimeStr + `, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "closed_by": { - "id": 1 + "comments":1, + "closed_at":` + referenceTimeStr + `, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "closed_by":{ + "id":1 }, - "url": "url", - "html_url": "hurl", - "comments_url": "curl", - "events_url": "eurl", - "labels_url": "lurl", - "repository_url": "rurl", - "milestone": { - "id": 1 + "url":"url", + "html_url":"hurl", + "comments_url":"curl", + "events_url":"eurl", + "labels_url":"lurl", + "repository_url":"rurl", + "milestone":{ + "id":1 }, - "pull_request": { - "url": "url" + "pull_request":{ + "url":"url" }, - "repository": { - "id": 1 + "repository":{ + "id":1 }, - "reactions": { - "total_count": 1 + "reactions":{ + "total_count":1 }, - "assignees": [ + "assignees":[ { - "id": 1 + "id":1 } ], - "node_id": "nid", - "text_matches": [ + "node_id":"nid", + "text_matches":[ { - "object_url": "ourl" + "object_url":"ourl" } ], - "active_lock_reason": "alr" + "active_lock_reason":"alr" } ] }` @@ -897,17 +906,17 @@ func TestLabelsSearchResult_Marshal(t *testing.T) { } want := `{ - "total_count": 5, - "incomplete_results": false, - "items": [ + "total_count":5, + "incomplete_results":false, + "items":[ { - "id": 1, - "url": "https://www.test-url.com", - "name": "test name", - "color": "green", - "default": true, - "description": "testDescription", - "score": 1 + "id":1, + "url":"https://www.test-url.com", + "name":"test name", + "color":"green", + "default":true, + "description":"testDescription", + "score":1 } ] }` @@ -932,24 +941,24 @@ func TestCommitResult_Marshal(t *testing.T) { } want := `{ - "sha": "test", - "commit": { - "sha": "test" + "sha":"test", + "commit":{ + "sha":"test" }, - "author": { - "id": 1 + "author":{ + "id":1 }, - "committer": { - "id": 1 + "committer":{ + "id":1 }, - "html_url": "hurl", - "url": "url", - "comments_url": "curl", - "repository": { - "id": 1 + "html_url":"hurl", + "url":"url", + "comments_url":"curl", + "repository":{ + "id":1 }, - "score": 123 - }` + "score":123 + }` testJSONMarshal(t, c, want) } @@ -972,20 +981,20 @@ func TestUsersSearchResult_Marshal(t *testing.T) { } want := `{ - "total_count": 2, - "incomplete_results": false, - "items": [ - { - "login": "loginTest", - "id": 1, - "node_id": "NodeTest", - "avatar_url": "AvatarURLTest", - "html_url": "Hurl", - "gravatar_id": "gravatarIDTest", - "name": "nameTest" - } + "total_count":2, + "incomplete_results":false, + "items":[ + { + "login":"loginTest", + "id":1, + "node_id":"NodeTest", + "avatar_url":"AvatarURLTest", + "html_url":"Hurl", + "gravatar_id":"gravatarIDTest", + "name":"nameTest" + } ] - }` + }` testJSONMarshal(t, u, want) } @@ -1000,9 +1009,13 @@ func TestCodeSearchResult_Marshal(t *testing.T) { } want := `{ - "total_count" : 4, - "incomplete_results" : false, - "items" : [{"name": "n"}] + "total_count":4, + "incomplete_results":false, + "items":[ + { + "name":"n" + } + ] }` testJSONMarshal(t, u, want) diff --git a/github/secret_scanning_test.go b/github/secret_scanning_test.go index 7898d29a38c..82213486381 100644 --- a/github/secret_scanning_test.go +++ b/github/secret_scanning_test.go @@ -509,22 +509,22 @@ func TestSecretScanningAlert_Marshal(t *testing.T) { } want := `{ - "number": 1, - "created_at": ` + referenceTimeStr + `, - "url": "https://api.github.com/teams/2/discussions/3/comments", - "html_url": "https://api.github.com/teams/2/discussions/3/comments", - "locations_url": "https://api.github.com/teams/2/discussions/3/comments", - "state": "test_state", - "resolution": "test_resolution", - "resolved_at": ` + referenceTimeStr + `, - "resolved_by": { - "login": "test", - "id": 10, - "node_id": "A123", - "avatar_url": "https://api.github.com/teams/2/discussions/3/comments" + "number":1, + "created_at":` + referenceTimeStr + `, + "url":"https://api.github.com/teams/2/discussions/3/comments", + "html_url":"https://api.github.com/teams/2/discussions/3/comments", + "locations_url":"https://api.github.com/teams/2/discussions/3/comments", + "state":"test_state", + "resolution":"test_resolution", + "resolved_at":` + referenceTimeStr + `, + "resolved_by":{ + "login":"test", + "id":10, + "node_id":"A123", + "avatar_url":"https://api.github.com/teams/2/discussions/3/comments" }, - "secret_type": "test", - "secret": "test" + "secret_type":"test", + "secret":"test" }` testJSONMarshal(t, u, want) @@ -549,18 +549,18 @@ func TestSecretScanningAlertLocation_Marshal(t *testing.T) { } want := `{ - "type": "test", - "details": { - "path": "test_path", - "start_line": 10, - "end_line": 20, - "start_column": 30, - "end_column": 40, - "blob_sha": "test_sha", - "blob_url": "https://api.github.com/repos/o/r/git/commits/f14d7debf9775f957cf4f1e8176da0786431f72b", - "commit_sha": "test_sha", - "commit_url": "https://api.github.com/repos/o/r/git/commits/f14d7debf9775f957cf4f1e8176da0786431f72b" - } + "type":"test", + "details":{ + "path":"test_path", + "start_line":10, + "end_line":20, + "start_column":30, + "end_column":40, + "blob_sha":"test_sha", + "blob_url":"https://api.github.com/repos/o/r/git/commits/f14d7debf9775f957cf4f1e8176da0786431f72b", + "commit_sha":"test_sha", + "commit_url":"https://api.github.com/repos/o/r/git/commits/f14d7debf9775f957cf4f1e8176da0786431f72b" + } }` testJSONMarshal(t, u, want) @@ -582,15 +582,15 @@ func TestSecretScanningAlertLocationDetails_Marshal(t *testing.T) { } want := `{ - "path": "test_path", - "start_line": 10, - "end_line": 20, - "start_column": 30, - "end_column": 40, - "blob_sha": "test_sha", - "blob_url": "https://api.github.com/repos/o/r/git/commits/f14d7debf9775f957cf4f1e8176da0786431f72b", - "commit_sha": "test_sha", - "commit_url": "https://api.github.com/repos/o/r/git/commits/f14d7debf9775f957cf4f1e8176da0786431f72b" + "path":"test_path", + "start_line":10, + "end_line":20, + "start_column":30, + "end_column":40, + "blob_sha":"test_sha", + "blob_url":"https://api.github.com/repos/o/r/git/commits/f14d7debf9775f957cf4f1e8176da0786431f72b", + "commit_sha":"test_sha", + "commit_url":"https://api.github.com/repos/o/r/git/commits/f14d7debf9775f957cf4f1e8176da0786431f72b" }` testJSONMarshal(t, u, want) diff --git a/github/teams.go b/github/teams.go index 0ee7c200792..e1acdcf800e 100644 --- a/github/teams.go +++ b/github/teams.go @@ -910,7 +910,7 @@ func (s *TeamsService) GetExternalGroup(ctx context.Context, org string, groupID type ListExternalGroupsOptions struct { DisplayName *string `url:"display_name,omitempty"` - ListOptions + ListOptions `url:",omitempty"` } // ListExternalGroups lists external groups in an organization on GitHub. diff --git a/github/teams_discussion_comments_test.go b/github/teams_discussion_comments_test.go index eaac112bf23..f67661075dd 100644 --- a/github/teams_discussion_comments_test.go +++ b/github/teams_discussion_comments_test.go @@ -476,15 +476,15 @@ func TestDiscussionComment_Marshal(t *testing.T) { "updated_at":` + referenceTimeStr + `, "url":"url", "reactions":{ - "total_count": 10, - "+1": 1, - "-1": 1, - "laugh": 1, - "confused": 1, - "heart": 2, - "hooray": 5, - "rocket": 3, - "eyes": 9, + "total_count":10, + "+1":1, + "-1":1, + "laugh":1, + "confused":1, + "heart":2, + "hooray":5, + "rocket":3, + "eyes":9, "url":"url" } }` diff --git a/github/teams_discussions_test.go b/github/teams_discussions_test.go index a9c7434ec1f..c8070c1ab84 100644 --- a/github/teams_discussions_test.go +++ b/github/teams_discussions_test.go @@ -586,42 +586,42 @@ func TestTeamDiscussion_Marshal(t *testing.T) { } want := `{ - "author": { - "login": "author", - "id": 0, - "avatar_url": "https://avatars1.githubusercontent.com/u/0?v=4", - "gravatar_id": "", - "url": "https://api.github.com/users/author", - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + ` + "author":{ + "login":"author", + "id":0, + "avatar_url":"https://avatars1.githubusercontent.com/u/0?v=4", + "gravatar_id":"", + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"https://api.github.com/users/author" }, - "body": "test", - "body_html": "
test
", - "body_version": "version", - "comments_count": 1, - "comments_url": "https://api.github.com/teams/2/discussions/3/comments", - "created_at": ` + referenceTimeStr + `, - "last_edited_at": ` + referenceTimeStr + `, - "html_url": "https://api.github.com/teams/2/discussions/3/comments", - "node_id": "A123", - "number": 10, - "pinned": true, - "private": false, - "team_url": "https://api.github.com/teams/2/discussions/3/comments", - "title": "Test", - "updated_at": ` + referenceTimeStr + `, - "url": "https://api.github.com/teams/2/discussions/3/comments", - "reactions": { - "total_count": 1, - "+1": 2, - "-1": -3, - "laugh": 4, - "confused": 5, - "heart": 6, - "hooray": 7, - "rocket": 8, - "eyes": 9, - "url": "https://api.github.com/teams/2/discussions/3/comments" + "body":"test", + "body_html":"test
", + "body_version":"version", + "comments_count":1, + "comments_url":"https://api.github.com/teams/2/discussions/3/comments", + "created_at":` + referenceTimeStr + `, + "last_edited_at":` + referenceTimeStr + `, + "html_url":"https://api.github.com/teams/2/discussions/3/comments", + "node_id":"A123", + "number":10, + "pinned":true, + "private":false, + "team_url":"https://api.github.com/teams/2/discussions/3/comments", + "title":"Test", + "updated_at":` + referenceTimeStr + `, + "url":"https://api.github.com/teams/2/discussions/3/comments", + "reactions":{ + "total_count":1, + "+1":2, + "-1":-3, + "laugh":4, + "confused":5, + "heart":6, + "hooray":7, + "rocket":8, + "eyes":9, + "url":"https://api.github.com/teams/2/discussions/3/comments" } }` diff --git a/github/teams_members.go b/github/teams_members.go index 58cb79744e1..50a37e5d49e 100644 --- a/github/teams_members.go +++ b/github/teams_members.go @@ -17,7 +17,7 @@ type TeamListTeamMembersOptions struct { // values are "all", "member", "maintainer". Default is "all". Role string `url:"role,omitempty"` - ListOptions + ListOptions `url:",omitempty"` } // ListTeamMembersByID lists all of the users who are members of a team, given a specified diff --git a/github/teams_members_test.go b/github/teams_members_test.go index bdaf1d72173..e43a7ad52c4 100644 --- a/github/teams_members_test.go +++ b/github/teams_members_test.go @@ -797,15 +797,15 @@ func TestTeamAddTeamMembershipOptions_Marshal(t *testing.T) { Role: "role", } - want := `{ - "role": "role" - }` + want := `{"role":"role"}` testJSONMarshal(t, u, want) } -func TestTeamListTeamMembersOptions_Marshal(t *testing.T) { - testJSONMarshal(t, &TeamListTeamMembersOptions{}, "{}") +func TestTeamListTeamMembersOptions_addOptions(t *testing.T) { + url := "some/path" + + testAddURLOptions(t, url, &TeamListTeamMembersOptions{}, url) u := &TeamListTeamMembersOptions{ Role: "role", @@ -815,11 +815,5 @@ func TestTeamListTeamMembersOptions_Marshal(t *testing.T) { }, } - want := `{ - "role": "role", - "Page": 1, - "PerPage": 2 - }` - - testJSONMarshal(t, u, want) + testAddURLOptions(t, url, u, url+`?page=1&per_page=2&role=role`) } diff --git a/github/teams_test.go b/github/teams_test.go index d215605c618..588f3beb54f 100644 --- a/github/teams_test.go +++ b/github/teams_test.go @@ -1587,7 +1587,7 @@ func TestTeamsService_CreateOrUpdateIDPGroupConnectionsBySlug_empty(t *testing.T } func TestNewTeam_Marshal(t *testing.T) { - testJSONMarshal(t, &NewTeam{}, "{}") + testJSONMarshal(t, &NewTeam{}, `{"name":""}`) u := &NewTeam{ Name: "n", @@ -1601,14 +1601,20 @@ func TestNewTeam_Marshal(t *testing.T) { } want := `{ - "name": "n", - "description": "d", - "maintainers": ["m1", "m2"], - "repo_names": ["repo1", "repo2"], - "parent_team_id": 1, - "permission": "perm", - "privacy": "p", - "ldap_dn": "l" + "name":"n", + "description":"d", + "maintainers":[ + "m1", + "m2" + ], + "repo_names":[ + "repo1", + "repo2" + ], + "parent_team_id":1, + "permission":"perm", + "privacy":"p", + "ldap_dn":"l" }` testJSONMarshal(t, u, want) @@ -1658,43 +1664,43 @@ func TestTeams_Marshal(t *testing.T) { } want := `{ - "id": 1, - "node_id": "n", - "name": "n", - "description": "d", - "url": "u", - "slug": "s", - "permission": "p", - "privacy": "p", - "members_count": 1, - "repos_count": 1, - "members_url": "m", - "repositories_url": "r", - "organization": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "html_url": "h", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e" + "id":1, + "node_id":"n", + "name":"n", + "description":"d", + "url":"u", + "slug":"s", + "permission":"p", + "privacy":"p", + "members_count":1, + "repos_count":1, + "organization":{ + "login":"l", + "id":1, + "node_id":"n", + "avatar_url":"a", + "html_url":"h", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e" }, - "parent": { - "id": 1, - "node_id": "n", - "name": "n", - "description": "d", - "url": "u", - "slug": "s", - "permission": "p", - "privacy": "p", - "members_count": 1, - "repos_count": 1 + "members_url":"m", + "repositories_url":"r", + "parent":{ + "id":1, + "node_id":"n", + "name":"n", + "description":"d", + "url":"u", + "slug":"s", + "permission":"p", + "privacy":"p", + "members_count":1, + "repos_count":1 }, - "ldap_dn": "l" + "ldap_dn":"l" }` testJSONMarshal(t, u, want) @@ -1715,8 +1721,8 @@ func TestInvitation_Marshal(t *testing.T) { } want := `{ - "id": 1, - "node_id": "test node", + "id":1, + "node_id":"test node", "login":"login123", "email":"go@github.com", "role":"developer", @@ -1738,8 +1744,8 @@ func TestIDPGroup_Marshal(t *testing.T) { } want := `{ - "group_id": "abc1", - "group_name": "test group", + "group_id":"abc1", + "group_name":"test group", "group_description":"test group descripation" }` @@ -2173,7 +2179,7 @@ func TestTeamsService_RemoveConnectedExternalGroup_notFound(t *testing.T) { } func TestIDPGroupList_Marshal(t *testing.T) { - testJSONMarshal(t, &IDPGroupList{}, "{}") + testJSONMarshal(t, &IDPGroupList{}, `{"groups":null}`) u := &IDPGroupList{ Groups: []*IDPGroup{ @@ -2191,16 +2197,16 @@ func TestIDPGroupList_Marshal(t *testing.T) { } want := `{ - "groups": [ + "groups":[ { - "group_id": "abc1", - "group_name": "test group", - "group_description": "test group descripation" + "group_id":"abc1", + "group_name":"test group", + "group_description":"test group descripation" }, { - "group_id": "abc2", - "group_name": "test group2", - "group_description": "test group descripation2" + "group_id":"abc2", + "group_name":"test group2", + "group_description":"test group descripation2" } ] }` @@ -2219,8 +2225,8 @@ func TestExternalGroupMember_Marshal(t *testing.T) { } want := `{ - "member_id": 1, - "member_login": "test member", + "member_id":1, + "member_login":"test member", "member_name":"test member name", "member_email":"test member email" }` @@ -2256,25 +2262,25 @@ func TestExternalGroup_Marshal(t *testing.T) { } want := `{ - "group_id": 123, - "group_name": "group1", - "updated_at": ` + referenceTimeStr + `, - "teams": [ + "group_id":123, + "group_name":"group1", + "updated_at":` + referenceTimeStr + `, + "teams":[ { - "team_id": 1, - "team_name": "team-test" + "team_id":1, + "team_name":"team-test" }, { - "team_id": 2, - "team_name": "team-test2" + "team_id":2, + "team_name":"team-test2" } ], - "members": [ + "members":[ { - "member_id": 1, - "member_login": "test", - "member_name": "test", - "member_email": "test@github.com" + "member_id":1, + "member_login":"test", + "member_name":"test", + "member_email":"test@github.com" } ] }` @@ -2291,15 +2297,17 @@ func TestExternalGroupTeam_Marshal(t *testing.T) { } want := `{ - "team_id": 123, - "team_name": "test" + "team_id":123, + "team_name":"test" }` testJSONMarshal(t, u, want) } -func TestListExternalGroupsOptions_Marshal(t *testing.T) { - testJSONMarshal(t, &ListExternalGroupsOptions{}, "{}") +func TestListExternalGroupsOptions_addOptions(t *testing.T) { + url := "some/path" + + testAddURLOptions(t, url, &ListExternalGroupsOptions{}, url) u := &ListExternalGroupsOptions{ DisplayName: String("test"), @@ -2309,13 +2317,7 @@ func TestListExternalGroupsOptions_Marshal(t *testing.T) { }, } - want := `{ - "DisplayName": "test", - "page": 1, - "PerPage": 2 - }` - - testJSONMarshal(t, u, want) + testAddURLOptions(t, url, u, url+`?display_name=test&page=1&per_page=2`) } func TestTeamAddTeamRepoOptions_Marshal(t *testing.T) { @@ -2325,9 +2327,7 @@ func TestTeamAddTeamRepoOptions_Marshal(t *testing.T) { Permission: "a", } - want := `{ - "permission": "a" - }` + want := `{"permission":"a"}` testJSONMarshal(t, u, want) } diff --git a/github/users.go b/github/users.go index 1b0670103b3..5452acba859 100644 --- a/github/users.go +++ b/github/users.go @@ -196,7 +196,7 @@ type UserListOptions struct { // Note: Pagination is powered exclusively by the Since parameter, // ListOptions.Page has no effect. // ListOptions.PerPage controls an undocumented GitHub API parameter. - ListOptions + ListOptions `url:",omitempty"` } // ListAll lists all GitHub users. diff --git a/github/users_administration_test.go b/github/users_administration_test.go index 3400edfccac..0f0dda26e68 100644 --- a/github/users_administration_test.go +++ b/github/users_administration_test.go @@ -150,9 +150,7 @@ func TestUserSuspendOptions_Marshal(t *testing.T) { Reason: String("reason"), } - want := `{ - "reason": "reason" - }` + want := `{"reason":"reason"}` testJSONMarshal(t, u, want) } diff --git a/github/users_emails_test.go b/github/users_emails_test.go index 9f7f92bc4dc..e74b573e9c2 100644 --- a/github/users_emails_test.go +++ b/github/users_emails_test.go @@ -132,10 +132,10 @@ func TestUserEmail_Marshal(t *testing.T) { } want := `{ - "email": "qwe@qwe.qwe", - "primary": false, - "verified": true, - "visibility": "yes" + "email":"qwe@qwe.qwe", + "primary":false, + "verified":true, + "visibility":"yes" }` testJSONMarshal(t, u, want) diff --git a/github/users_gpg_keys_test.go b/github/users_gpg_keys_test.go index e0d581fbbc0..bfd38568478 100644 --- a/github/users_gpg_keys_test.go +++ b/github/users_gpg_keys_test.go @@ -199,8 +199,8 @@ func TestGPGEmail_Marshal(t *testing.T) { } want := `{ - "email" : "email@abc.com", - "verified" : false + "email":"email@abc.com", + "verified":false }` testJSONMarshal(t, u, want) @@ -235,27 +235,29 @@ func TestGPGKey_Marshal(t *testing.T) { } want := `{ - "id":1, - "primary_key_id":1, - "key_id":"someKeyID", - "raw_key":"someRawKeyID", - "public_key":"somePublicKey", - "emails":[ - { - "email":"someEmail", - "verified":true - } - ], - "subkeys":[ - {} - ], - "can_sign":true, - "can_encrypt_comms":true, - "can_encrypt_storage":true, - "can_certify":true, - "created_at":"0001-01-01T00:00:00Z", - "expires_at":"0001-01-01T00:00:00Z" - }` + "id":1, + "primary_key_id":1, + "key_id":"someKeyID", + "raw_key":"someRawKeyID", + "public_key":"somePublicKey", + "emails":[ + { + "email":"someEmail", + "verified":true + } + ], + "subkeys":[ + { + + } + ], + "can_sign":true, + "can_encrypt_comms":true, + "can_encrypt_storage":true, + "can_certify":true, + "created_at":"0001-01-01T00:00:00Z", + "expires_at":"0001-01-01T00:00:00Z" + }` testJSONMarshal(t, g, want) } diff --git a/github/users_keys_test.go b/github/users_keys_test.go index f3a8218e598..e536c6e7c12 100644 --- a/github/users_keys_test.go +++ b/github/users_keys_test.go @@ -195,13 +195,13 @@ func TestKey_Marshal(t *testing.T) { } want := `{ - "id": 1, - "key": "abc", - "url": "url", - "title": "title", - "read_only": true, - "verified": true, - "created_at": ` + referenceTimeStr + ` + "id":1, + "key":"abc", + "url":"url", + "title":"title", + "read_only":true, + "verified":true, + "created_at":` + referenceTimeStr + ` }` testJSONMarshal(t, u, want) diff --git a/github/users_projects_test.go b/github/users_projects_test.go index 1a298dedaab..52fa97813da 100644 --- a/github/users_projects_test.go +++ b/github/users_projects_test.go @@ -94,7 +94,7 @@ func TestUsersService_CreateProject(t *testing.T) { } func TestCreateUserProjectOptions_Marshal(t *testing.T) { - testJSONMarshal(t, &CreateUserProjectOptions{}, `{}`) + testJSONMarshal(t, &CreateUserProjectOptions{}, `{"name":""}`) c := CreateUserProjectOptions{ Name: "SomeProject", @@ -102,9 +102,9 @@ func TestCreateUserProjectOptions_Marshal(t *testing.T) { } want := `{ - "name": "SomeProject", - "body": "SomeProjectBody" - }` + "name":"SomeProject", + "body":"SomeProjectBody" + }` testJSONMarshal(t, c, want) } diff --git a/github/users_ssh_signing_keys_test.go b/github/users_ssh_signing_keys_test.go index c7093d7f61e..9fa8e7bf703 100644 --- a/github/users_ssh_signing_keys_test.go +++ b/github/users_ssh_signing_keys_test.go @@ -192,10 +192,10 @@ func TestSSHSigningKey_Marshal(t *testing.T) { } want := `{ - "id": 1, - "key": "abc", - "title": "title", - "created_at": ` + referenceTimeStr + ` + "id":1, + "key":"abc", + "title":"title", + "created_at":` + referenceTimeStr + ` }` testJSONMarshal(t, u, want) diff --git a/github/users_test.go b/github/users_test.go index 80020007e4a..18eb08fa733 100644 --- a/github/users_test.go +++ b/github/users_test.go @@ -39,25 +39,26 @@ func TestUser_Marshal(t *testing.T) { SuspendedAt: &Timestamp{referenceTime}, } want := `{ - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" + "login":"l", + "id":1, + "avatar_url":"a", + "gravatar_id":"g", + "name":"n", + "company":"c", + "blog":"b", + "location":"l", + "email":"e", + "hireable":true, + "bio":"b", + "twitter_username":"t", + "public_repos":1, + "followers":1, + "following":1, + "created_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "url":"u" }` + testJSONMarshal(t, u, want) u2 := &User{ @@ -102,45 +103,46 @@ func TestUser_Marshal(t *testing.T) { } want2 := `{ - "login": "testLogin", - "id": 1, + "login":"testLogin", + "id":1, "node_id":"testNode123", - "avatar_url": "https://www.my-avatar.com", + "avatar_url":"https://www.my-avatar.com", "html_url":"https://www.test-url.com", - "gravatar_id": "testGravatar123", - "name": "myName", - "company": "testCompany", - "blog": "test Blog", - "location": "test location", - "email": "test@test.com", - "hireable": true, - "bio": "my good bio", - "twitter_username": "https://www.twitter.com/test", - "public_repos": 1, + "gravatar_id":"testGravatar123", + "name":"myName", + "company":"testCompany", + "blog":"test Blog", + "location":"test location", + "email":"test@test.com", + "hireable":true, + "bio":"my good bio", + "twitter_username":"https://www.twitter.com/test", + "public_repos":1, "public_gists":2, - "followers": 100, - "following": 29, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "type": "test type", - "site_admin": false, - "total_private_repos": 2, - "owned_private_repos": 1, - "private_gists": 1, - "disk_usage": 1, - "collaborators": 1, - "two_factor_authentication": false, - "plan": { - "name": "silver", - "space": 1024, - "collaborators": 10, - "private_repos": 4, - "filled_seats": 24, - "seats": 1 + "followers":100, + "following":29, + "created_at":` + referenceTimeStr + `, + "updated_at":` + referenceTimeStr + `, + "suspended_at":` + referenceTimeStr + `, + "type":"test type", + "site_admin":false, + "total_private_repos":2, + "owned_private_repos":1, + "private_gists":1, + "disk_usage":1, + "collaborators":1, + "two_factor_authentication":false, + "plan":{ + "name":"silver", + "space":1024, + "collaborators":10, + "private_repos":4, + "filled_seats":24, + "seats":1 }, - "ldap_dn": "test ldap" + "ldap_dn":"test ldap" }` + testJSONMarshal(t, u2, want2) } @@ -460,8 +462,8 @@ func TestUserContext_Marshal(t *testing.T) { } want := `{ - "message" : "message", - "octicon" : "message" + "message":"message", + "octicon":"message" }` testJSONMarshal(t, u, want) @@ -480,10 +482,10 @@ func TestHovercard_Marshal(t *testing.T) { } want := `{ - "contexts" : [ + "contexts":[ { - "message" : "someMessage", - "octicon" : "someOcticon" + "message":"someMessage", + "octicon":"someOcticon" } ] }` @@ -491,8 +493,10 @@ func TestHovercard_Marshal(t *testing.T) { testJSONMarshal(t, h, want) } -func TestUserListOptions_Marshal(t *testing.T) { - testJSONMarshal(t, &UserListOptions{}, "{}") +func TestUserListOptions_addOptions(t *testing.T) { + url := "some/path" + + testAddURLOptions(t, url, &UserListOptions{}, url) u := &UserListOptions{ Since: int64(1900), @@ -502,27 +506,18 @@ func TestUserListOptions_Marshal(t *testing.T) { }, } - want := `{ - "since" : 1900, - "page": 1, - "perPage": 10 - }` - - testJSONMarshal(t, u, want) + testAddURLOptions(t, url, u, url+`?page=1&per_page=10&since=1900`) } -func TestHovercardOptions_Marshal(t *testing.T) { - testJSONMarshal(t, &HovercardOptions{}, "{}") +func TestHovercardOptions_addOptions(t *testing.T) { + url := "some/path" + + testAddURLOptions(t, url, &HovercardOptions{}, url+`?subject_id=&subject_type=`) u := &HovercardOptions{ SubjectType: "subjectType", SubjectID: "subjectID", } - want := `{ - "SubjectType" : "subjectType", - "SubjectID" : "subjectID" - }` - - testJSONMarshal(t, u, want) + testAddURLOptions(t, url, u, url+`?subject_id=subjectID&subject_type=subjectType`) }