github.com/google/go-github/v52@v52.0.0/github/event_types_test.go (about)

     1  // Copyright 2020 The go-github AUTHORS. All rights reserved.
     2  //
     3  // Use of this source code is governed by a BSD-style
     4  // license that can be found in the LICENSE file.
     5  
     6  package github
     7  
     8  import (
     9  	"encoding/json"
    10  	"testing"
    11  )
    12  
    13  func TestEditChange_Marshal_TitleChange(t *testing.T) {
    14  	testJSONMarshal(t, &EditChange{}, "{}")
    15  
    16  	u := &EditChange{
    17  		Title: &EditTitle{
    18  			From: String("TitleFrom"),
    19  		},
    20  		Body: nil,
    21  		Base: nil,
    22  	}
    23  
    24  	want := `{
    25  		"title": {
    26  			"from": "TitleFrom"
    27  		  }
    28  	}`
    29  
    30  	testJSONMarshal(t, u, want)
    31  }
    32  
    33  func TestEditChange_Marshal_BodyChange(t *testing.T) {
    34  	testJSONMarshal(t, &EditChange{}, "{}")
    35  
    36  	u := &EditChange{
    37  		Title: nil,
    38  		Body: &EditBody{
    39  			From: String("BodyFrom"),
    40  		},
    41  		Base: nil,
    42  	}
    43  
    44  	want := `{
    45  		"body": {
    46  			"from": "BodyFrom"
    47  		  }
    48  	}`
    49  
    50  	testJSONMarshal(t, u, want)
    51  }
    52  
    53  func TestEditChange_Marshal_BaseChange(t *testing.T) {
    54  	testJSONMarshal(t, &EditChange{}, "{}")
    55  
    56  	Base := EditBase{
    57  		Ref: &EditRef{
    58  			From: String("BaseRefFrom"),
    59  		},
    60  		SHA: &EditSHA{
    61  			From: String("BaseSHAFrom"),
    62  		},
    63  	}
    64  
    65  	u := &EditChange{
    66  		Title: nil,
    67  		Body:  nil,
    68  		Base:  &Base,
    69  	}
    70  
    71  	want := `{
    72  		"base": {
    73  			"ref": {
    74  				"from": "BaseRefFrom"
    75  			},
    76  			"sha": {
    77  				"from": "BaseSHAFrom"
    78  			}
    79  		}
    80  	}`
    81  
    82  	testJSONMarshal(t, u, want)
    83  }
    84  
    85  func TestEditChange_Marshal_Repo(t *testing.T) {
    86  	testJSONMarshal(t, &EditChange{}, "{}")
    87  
    88  	u := &EditChange{
    89  		Repo: &EditRepo{
    90  			Name: &RepoName{
    91  				From: String("old-repo-name"),
    92  			},
    93  		},
    94  	}
    95  
    96  	want := `{
    97  		"repository": {
    98  			"name": {
    99  				"from": "old-repo-name"
   100  			}
   101  		}
   102  	}`
   103  
   104  	testJSONMarshal(t, u, want)
   105  }
   106  
   107  func TestEditChange_Marshal_TransferFromUser(t *testing.T) {
   108  	testJSONMarshal(t, &EditChange{}, "{}")
   109  
   110  	u := &EditChange{
   111  		Owner: &EditOwner{
   112  			OwnerInfo: &OwnerInfo{
   113  				User: &User{
   114  					Login:     String("l"),
   115  					ID:        Int64(1),
   116  					NodeID:    String("n"),
   117  					URL:       String("u"),
   118  					ReposURL:  String("r"),
   119  					EventsURL: String("e"),
   120  					AvatarURL: String("a"),
   121  				},
   122  			},
   123  		},
   124  	}
   125  
   126  	want := `{
   127  		"owner": {
   128  			"from": {
   129  				"user": {
   130  					"login": "l",
   131            			"id": 1,
   132           		 	"node_id": "n",
   133            			"avatar_url": "a",
   134            			"url": "u",
   135            			"repos_url": "r",
   136            			"events_url": "e"
   137  				}
   138  			}
   139  		}
   140  	}`
   141  
   142  	testJSONMarshal(t, u, want)
   143  }
   144  
   145  func TestEditChange_Marshal_TransferFromOrg(t *testing.T) {
   146  	testJSONMarshal(t, &EditChange{}, "{}")
   147  
   148  	u := &EditChange{
   149  		Owner: &EditOwner{
   150  			OwnerInfo: &OwnerInfo{
   151  				Org: &User{
   152  					Login:     String("l"),
   153  					ID:        Int64(1),
   154  					NodeID:    String("n"),
   155  					URL:       String("u"),
   156  					ReposURL:  String("r"),
   157  					EventsURL: String("e"),
   158  					AvatarURL: String("a"),
   159  				},
   160  			},
   161  		},
   162  	}
   163  
   164  	want := `{
   165  		"owner": {
   166  			"from": {
   167  				"organization": {
   168  					"login": "l",
   169            			"id": 1,
   170           		 	"node_id": "n",
   171            			"avatar_url": "a",
   172            			"url": "u",
   173            			"repos_url": "r",
   174            			"events_url": "e"
   175  				}
   176  			}
   177  		}
   178  	}`
   179  
   180  	testJSONMarshal(t, u, want)
   181  }
   182  
   183  func TestProjectChange_Marshal_NameChange(t *testing.T) {
   184  	testJSONMarshal(t, &ProjectChange{}, "{}")
   185  
   186  	u := &ProjectChange{
   187  		Name: &ProjectName{From: String("NameFrom")},
   188  		Body: nil,
   189  	}
   190  
   191  	want := `{
   192  		"name": {
   193  			"from": "NameFrom"
   194  		  }
   195  	}`
   196  
   197  	testJSONMarshal(t, u, want)
   198  }
   199  
   200  func TestProjectChange_Marshal_BodyChange(t *testing.T) {
   201  	testJSONMarshal(t, &ProjectChange{}, "{}")
   202  
   203  	u := &ProjectChange{
   204  		Name: nil,
   205  		Body: &ProjectBody{From: String("BodyFrom")},
   206  	}
   207  
   208  	want := `{
   209  		"body": {
   210  			"from": "BodyFrom"
   211  		  }
   212  	}`
   213  
   214  	testJSONMarshal(t, u, want)
   215  }
   216  
   217  func TestProjectCardChange_Marshal_NoteChange(t *testing.T) {
   218  	testJSONMarshal(t, &ProjectCardChange{}, "{}")
   219  
   220  	u := &ProjectCardChange{
   221  		Note: &ProjectCardNote{From: String("NoteFrom")},
   222  	}
   223  
   224  	want := `{
   225  		"note": {
   226  			"from": "NoteFrom"
   227  		  }
   228  	}`
   229  
   230  	testJSONMarshal(t, u, want)
   231  }
   232  
   233  func TestProjectColumnChange_Marshal_NameChange(t *testing.T) {
   234  	testJSONMarshal(t, &ProjectColumnChange{}, "{}")
   235  
   236  	u := &ProjectColumnChange{
   237  		Name: &ProjectColumnName{From: String("NameFrom")},
   238  	}
   239  
   240  	want := `{
   241  		"name": {
   242  			"from": "NameFrom"
   243  		  }
   244  	}`
   245  
   246  	testJSONMarshal(t, u, want)
   247  }
   248  
   249  func TestTeamAddEvent_Marshal(t *testing.T) {
   250  	testJSONMarshal(t, &TeamAddEvent{}, "{}")
   251  
   252  	u := &TeamAddEvent{
   253  		Team: &Team{
   254  			ID:              Int64(1),
   255  			NodeID:          String("n"),
   256  			Name:            String("n"),
   257  			Description:     String("d"),
   258  			URL:             String("u"),
   259  			Slug:            String("s"),
   260  			Permission:      String("p"),
   261  			Privacy:         String("p"),
   262  			MembersCount:    Int(1),
   263  			ReposCount:      Int(1),
   264  			MembersURL:      String("m"),
   265  			RepositoriesURL: String("r"),
   266  			Organization: &Organization{
   267  				Login:     String("l"),
   268  				ID:        Int64(1),
   269  				NodeID:    String("n"),
   270  				AvatarURL: String("a"),
   271  				HTMLURL:   String("h"),
   272  				Name:      String("n"),
   273  				Company:   String("c"),
   274  				Blog:      String("b"),
   275  				Location:  String("l"),
   276  				Email:     String("e"),
   277  			},
   278  			Parent: &Team{
   279  				ID:           Int64(1),
   280  				NodeID:       String("n"),
   281  				Name:         String("n"),
   282  				Description:  String("d"),
   283  				URL:          String("u"),
   284  				Slug:         String("s"),
   285  				Permission:   String("p"),
   286  				Privacy:      String("p"),
   287  				MembersCount: Int(1),
   288  				ReposCount:   Int(1),
   289  			},
   290  			LDAPDN: String("l"),
   291  		},
   292  		Repo: &Repository{
   293  			ID:   Int64(1),
   294  			URL:  String("s"),
   295  			Name: String("n"),
   296  		},
   297  		Org: &Organization{
   298  			BillingEmail:                         String("be"),
   299  			Blog:                                 String("b"),
   300  			Company:                              String("c"),
   301  			Email:                                String("e"),
   302  			TwitterUsername:                      String("tu"),
   303  			Location:                             String("loc"),
   304  			Name:                                 String("n"),
   305  			Description:                          String("d"),
   306  			IsVerified:                           Bool(true),
   307  			HasOrganizationProjects:              Bool(true),
   308  			HasRepositoryProjects:                Bool(true),
   309  			DefaultRepoPermission:                String("drp"),
   310  			MembersCanCreateRepos:                Bool(true),
   311  			MembersCanCreateInternalRepos:        Bool(true),
   312  			MembersCanCreatePrivateRepos:         Bool(true),
   313  			MembersCanCreatePublicRepos:          Bool(false),
   314  			MembersAllowedRepositoryCreationType: String("marct"),
   315  			MembersCanCreatePages:                Bool(true),
   316  			MembersCanCreatePublicPages:          Bool(false),
   317  			MembersCanCreatePrivatePages:         Bool(true),
   318  		},
   319  		Sender: &User{
   320  			Login:     String("l"),
   321  			ID:        Int64(1),
   322  			NodeID:    String("n"),
   323  			URL:       String("u"),
   324  			ReposURL:  String("r"),
   325  			EventsURL: String("e"),
   326  			AvatarURL: String("a"),
   327  		},
   328  		Installation: &Installation{
   329  			ID:       Int64(1),
   330  			NodeID:   String("nid"),
   331  			AppID:    Int64(1),
   332  			AppSlug:  String("as"),
   333  			TargetID: Int64(1),
   334  			Account: &User{
   335  				Login:           String("l"),
   336  				ID:              Int64(1),
   337  				URL:             String("u"),
   338  				AvatarURL:       String("a"),
   339  				GravatarID:      String("g"),
   340  				Name:            String("n"),
   341  				Company:         String("c"),
   342  				Blog:            String("b"),
   343  				Location:        String("l"),
   344  				Email:           String("e"),
   345  				Hireable:        Bool(true),
   346  				Bio:             String("b"),
   347  				TwitterUsername: String("t"),
   348  				PublicRepos:     Int(1),
   349  				Followers:       Int(1),
   350  				Following:       Int(1),
   351  				CreatedAt:       &Timestamp{referenceTime},
   352  				SuspendedAt:     &Timestamp{referenceTime},
   353  			},
   354  			AccessTokensURL:     String("atu"),
   355  			RepositoriesURL:     String("ru"),
   356  			HTMLURL:             String("hu"),
   357  			TargetType:          String("tt"),
   358  			SingleFileName:      String("sfn"),
   359  			RepositorySelection: String("rs"),
   360  			Events:              []string{"e"},
   361  			SingleFilePaths:     []string{"s"},
   362  			Permissions: &InstallationPermissions{
   363  				Actions:                       String("a"),
   364  				Administration:                String("ad"),
   365  				Checks:                        String("c"),
   366  				Contents:                      String("co"),
   367  				ContentReferences:             String("cr"),
   368  				Deployments:                   String("d"),
   369  				Environments:                  String("e"),
   370  				Issues:                        String("i"),
   371  				Metadata:                      String("md"),
   372  				Members:                       String("m"),
   373  				OrganizationAdministration:    String("oa"),
   374  				OrganizationHooks:             String("oh"),
   375  				OrganizationPlan:              String("op"),
   376  				OrganizationPreReceiveHooks:   String("opr"),
   377  				OrganizationProjects:          String("op"),
   378  				OrganizationSecrets:           String("os"),
   379  				OrganizationSelfHostedRunners: String("osh"),
   380  				OrganizationUserBlocking:      String("oub"),
   381  				Packages:                      String("pkg"),
   382  				Pages:                         String("pg"),
   383  				PullRequests:                  String("pr"),
   384  				RepositoryHooks:               String("rh"),
   385  				RepositoryProjects:            String("rp"),
   386  				RepositoryPreReceiveHooks:     String("rprh"),
   387  				Secrets:                       String("s"),
   388  				SecretScanningAlerts:          String("ssa"),
   389  				SecurityEvents:                String("se"),
   390  				SingleFile:                    String("sf"),
   391  				Statuses:                      String("s"),
   392  				TeamDiscussions:               String("td"),
   393  				VulnerabilityAlerts:           String("va"),
   394  				Workflows:                     String("w"),
   395  			},
   396  			CreatedAt:              &Timestamp{referenceTime},
   397  			UpdatedAt:              &Timestamp{referenceTime},
   398  			HasMultipleSingleFiles: Bool(false),
   399  			SuspendedBy: &User{
   400  				Login:           String("l"),
   401  				ID:              Int64(1),
   402  				URL:             String("u"),
   403  				AvatarURL:       String("a"),
   404  				GravatarID:      String("g"),
   405  				Name:            String("n"),
   406  				Company:         String("c"),
   407  				Blog:            String("b"),
   408  				Location:        String("l"),
   409  				Email:           String("e"),
   410  				Hireable:        Bool(true),
   411  				Bio:             String("b"),
   412  				TwitterUsername: String("t"),
   413  				PublicRepos:     Int(1),
   414  				Followers:       Int(1),
   415  				Following:       Int(1),
   416  				CreatedAt:       &Timestamp{referenceTime},
   417  				SuspendedAt:     &Timestamp{referenceTime},
   418  			},
   419  			SuspendedAt: &Timestamp{referenceTime},
   420  		},
   421  	}
   422  
   423  	want := `{
   424  		"team": {
   425  			"id": 1,
   426  			"node_id": "n",
   427  			"name": "n",
   428  			"description": "d",
   429  			"url": "u",
   430  			"slug": "s",
   431  			"permission": "p",
   432  			"privacy": "p",
   433  			"members_count": 1,
   434  			"repos_count": 1,
   435  			"organization": {
   436  				"login": "l",
   437  				"id": 1,
   438  				"node_id": "n",
   439  				"avatar_url": "a",
   440  				"html_url": "h",
   441  				"name": "n",
   442  				"company": "c",
   443  				"blog": "b",
   444  				"location": "l",
   445  				"email": "e"
   446  			},
   447  			"members_url": "m",
   448  			"repositories_url": "r",
   449  			"parent": {
   450  				"id": 1,
   451  				"node_id": "n",
   452  				"name": "n",
   453  				"description": "d",
   454  				"url": "u",
   455  				"slug": "s",
   456  				"permission": "p",
   457  				"privacy": "p",
   458  				"members_count": 1,
   459  				"repos_count": 1
   460  			},
   461  			"ldap_dn": "l"
   462  		},
   463  		"repository": {
   464  			"id": 1,
   465  			"name": "n",
   466  			"url": "s"
   467  		},
   468  		"organization": {
   469  			"name": "n",
   470  			"company": "c",
   471  			"blog": "b",
   472  			"location": "loc",
   473  			"email": "e",
   474  			"twitter_username": "tu",
   475  			"description": "d",
   476  			"billing_email": "be",
   477  			"is_verified": true,
   478  			"has_organization_projects": true,
   479  			"has_repository_projects": true,
   480  			"default_repository_permission": "drp",
   481  			"members_can_create_repositories": true,
   482  			"members_can_create_public_repositories": false,
   483  			"members_can_create_private_repositories": true,
   484  			"members_can_create_internal_repositories": true,
   485  			"members_allowed_repository_creation_type": "marct",
   486  			"members_can_create_pages": true,
   487  			"members_can_create_public_pages": false,
   488  			"members_can_create_private_pages": true
   489  		},
   490  		"sender": {
   491  			"login": "l",
   492  			"id": 1,
   493  			"node_id": "n",
   494  			"avatar_url": "a",
   495  			"url": "u",
   496  			"events_url": "e",
   497  			"repos_url": "r"
   498  		},
   499  		"installation": {
   500  			"id": 1,
   501  			"node_id": "nid",
   502  			"app_id": 1,
   503  			"app_slug": "as",
   504  			"target_id": 1,
   505  			"account": {
   506  				"login": "l",
   507  				"id": 1,
   508  				"avatar_url": "a",
   509  				"gravatar_id": "g",
   510  				"name": "n",
   511  				"company": "c",
   512  				"blog": "b",
   513  				"location": "l",
   514  				"email": "e",
   515  				"hireable": true,
   516  				"bio": "b",
   517  				"twitter_username": "t",
   518  				"public_repos": 1,
   519  				"followers": 1,
   520  				"following": 1,
   521  				"created_at": ` + referenceTimeStr + `,
   522  				"suspended_at": ` + referenceTimeStr + `,
   523  				"url": "u"
   524  			},
   525  			"access_tokens_url": "atu",
   526  			"repositories_url": "ru",
   527  			"html_url": "hu",
   528  			"target_type": "tt",
   529  			"single_file_name": "sfn",
   530  			"repository_selection": "rs",
   531  			"events": [
   532  				"e"
   533  			],
   534  			"single_file_paths": [
   535  				"s"
   536  			],
   537  			"permissions": {
   538  				"actions": "a",
   539  				"administration": "ad",
   540  				"checks": "c",
   541  				"contents": "co",
   542  				"content_references": "cr",
   543  				"deployments": "d",
   544  				"environments": "e",
   545  				"issues": "i",
   546  				"metadata": "md",
   547  				"members": "m",
   548  				"organization_administration": "oa",
   549  				"organization_hooks": "oh",
   550  				"organization_plan": "op",
   551  				"organization_pre_receive_hooks": "opr",
   552  				"organization_projects": "op",
   553  				"organization_secrets": "os",
   554  				"organization_self_hosted_runners": "osh",
   555  				"organization_user_blocking": "oub",
   556  				"packages": "pkg",
   557  				"pages": "pg",
   558  				"pull_requests": "pr",
   559  				"repository_hooks": "rh",
   560  				"repository_projects": "rp",
   561  				"repository_pre_receive_hooks": "rprh",
   562  				"secrets": "s",
   563  				"secret_scanning_alerts": "ssa",
   564  				"security_events": "se",
   565  				"single_file": "sf",
   566  				"statuses": "s",
   567  				"team_discussions": "td",
   568  				"vulnerability_alerts": "va",
   569  				"workflows": "w"
   570  			},
   571  			"created_at": ` + referenceTimeStr + `,
   572  			"updated_at": ` + referenceTimeStr + `,
   573  			"has_multiple_single_files": false,
   574  			"suspended_by": {
   575  				"login": "l",
   576  				"id": 1,
   577  				"avatar_url": "a",
   578  				"gravatar_id": "g",
   579  				"name": "n",
   580  				"company": "c",
   581  				"blog": "b",
   582  				"location": "l",
   583  				"email": "e",
   584  				"hireable": true,
   585  				"bio": "b",
   586  				"twitter_username": "t",
   587  				"public_repos": 1,
   588  				"followers": 1,
   589  				"following": 1,
   590  				"created_at": ` + referenceTimeStr + `,
   591  				"suspended_at": ` + referenceTimeStr + `,
   592  				"url": "u"
   593  			},
   594  			"suspended_at": ` + referenceTimeStr + `
   595  		}
   596  	}`
   597  
   598  	testJSONMarshal(t, u, want)
   599  }
   600  
   601  func TestStarEvent_Marshal(t *testing.T) {
   602  	testJSONMarshal(t, &StarEvent{}, "{}")
   603  
   604  	u := &StarEvent{
   605  		Action:    String("a"),
   606  		StarredAt: &Timestamp{referenceTime},
   607  		Org: &Organization{
   608  			BillingEmail:                         String("be"),
   609  			Blog:                                 String("b"),
   610  			Company:                              String("c"),
   611  			Email:                                String("e"),
   612  			TwitterUsername:                      String("tu"),
   613  			Location:                             String("loc"),
   614  			Name:                                 String("n"),
   615  			Description:                          String("d"),
   616  			IsVerified:                           Bool(true),
   617  			HasOrganizationProjects:              Bool(true),
   618  			HasRepositoryProjects:                Bool(true),
   619  			DefaultRepoPermission:                String("drp"),
   620  			MembersCanCreateRepos:                Bool(true),
   621  			MembersCanCreateInternalRepos:        Bool(true),
   622  			MembersCanCreatePrivateRepos:         Bool(true),
   623  			MembersCanCreatePublicRepos:          Bool(false),
   624  			MembersAllowedRepositoryCreationType: String("marct"),
   625  			MembersCanCreatePages:                Bool(true),
   626  			MembersCanCreatePublicPages:          Bool(false),
   627  			MembersCanCreatePrivatePages:         Bool(true),
   628  		},
   629  		Repo: &Repository{
   630  			ID:   Int64(1),
   631  			URL:  String("s"),
   632  			Name: String("n"),
   633  		},
   634  		Sender: &User{
   635  			Login:     String("l"),
   636  			ID:        Int64(1),
   637  			NodeID:    String("n"),
   638  			URL:       String("u"),
   639  			ReposURL:  String("r"),
   640  			EventsURL: String("e"),
   641  			AvatarURL: String("a"),
   642  		},
   643  	}
   644  
   645  	want := `{
   646  		"action": "a",
   647  		"starred_at": ` + referenceTimeStr + `,
   648  		"organization": {
   649  			"name": "n",
   650  			"company": "c",
   651  			"blog": "b",
   652  			"location": "loc",
   653  			"email": "e",
   654  			"twitter_username": "tu",
   655  			"description": "d",
   656  			"billing_email": "be",
   657  			"is_verified": true,
   658  			"has_organization_projects": true,
   659  			"has_repository_projects": true,
   660  			"default_repository_permission": "drp",
   661  			"members_can_create_repositories": true,
   662  			"members_can_create_public_repositories": false,
   663  			"members_can_create_private_repositories": true,
   664  			"members_can_create_internal_repositories": true,
   665  			"members_allowed_repository_creation_type": "marct",
   666  			"members_can_create_pages": true,
   667  			"members_can_create_public_pages": false,
   668  			"members_can_create_private_pages": true
   669  		},
   670  		"repository": {
   671  			"id": 1,
   672  			"name": "n",
   673  			"url": "s"
   674  		},
   675  		"sender": {
   676  			"login": "l",
   677  			"id": 1,
   678  			"node_id": "n",
   679  			"avatar_url": "a",
   680  			"url": "u",
   681  			"events_url": "e",
   682  			"repos_url": "r"
   683  		}
   684  	}`
   685  
   686  	testJSONMarshal(t, u, want)
   687  }
   688  
   689  func TestTeamEvent_Marshal(t *testing.T) {
   690  	testJSONMarshal(t, &TeamEvent{}, "{}")
   691  
   692  	u := &TeamEvent{
   693  		Action: String("a"),
   694  		Team: &Team{
   695  			ID:              Int64(1),
   696  			NodeID:          String("n"),
   697  			Name:            String("n"),
   698  			Description:     String("d"),
   699  			URL:             String("u"),
   700  			Slug:            String("s"),
   701  			Permission:      String("p"),
   702  			Privacy:         String("p"),
   703  			MembersCount:    Int(1),
   704  			ReposCount:      Int(1),
   705  			MembersURL:      String("m"),
   706  			RepositoriesURL: String("r"),
   707  			Organization: &Organization{
   708  				Login:     String("l"),
   709  				ID:        Int64(1),
   710  				NodeID:    String("n"),
   711  				AvatarURL: String("a"),
   712  				HTMLURL:   String("h"),
   713  				Name:      String("n"),
   714  				Company:   String("c"),
   715  				Blog:      String("b"),
   716  				Location:  String("l"),
   717  				Email:     String("e"),
   718  			},
   719  			Parent: &Team{
   720  				ID:           Int64(1),
   721  				NodeID:       String("n"),
   722  				Name:         String("n"),
   723  				Description:  String("d"),
   724  				URL:          String("u"),
   725  				Slug:         String("s"),
   726  				Permission:   String("p"),
   727  				Privacy:      String("p"),
   728  				MembersCount: Int(1),
   729  				ReposCount:   Int(1),
   730  			},
   731  			LDAPDN: String("l"),
   732  		},
   733  		Changes: &TeamChange{
   734  			Description: &TeamDescription{
   735  				From: String("from"),
   736  			},
   737  			Name: &TeamName{
   738  				From: String("from"),
   739  			},
   740  			Privacy: &TeamPrivacy{
   741  				From: String("from"),
   742  			},
   743  			Repository: &TeamRepository{
   744  				Permissions: &TeamPermissions{
   745  					From: &TeamPermissionsFrom{
   746  						Admin: Bool(true),
   747  						Pull:  Bool(true),
   748  						Push:  Bool(true),
   749  					},
   750  				},
   751  			},
   752  		},
   753  		Repo: &Repository{
   754  			ID:   Int64(1),
   755  			URL:  String("s"),
   756  			Name: String("n"),
   757  		},
   758  		Org: &Organization{
   759  			BillingEmail:                         String("be"),
   760  			Blog:                                 String("b"),
   761  			Company:                              String("c"),
   762  			Email:                                String("e"),
   763  			TwitterUsername:                      String("tu"),
   764  			Location:                             String("loc"),
   765  			Name:                                 String("n"),
   766  			Description:                          String("d"),
   767  			IsVerified:                           Bool(true),
   768  			HasOrganizationProjects:              Bool(true),
   769  			HasRepositoryProjects:                Bool(true),
   770  			DefaultRepoPermission:                String("drp"),
   771  			MembersCanCreateRepos:                Bool(true),
   772  			MembersCanCreateInternalRepos:        Bool(true),
   773  			MembersCanCreatePrivateRepos:         Bool(true),
   774  			MembersCanCreatePublicRepos:          Bool(false),
   775  			MembersAllowedRepositoryCreationType: String("marct"),
   776  			MembersCanCreatePages:                Bool(true),
   777  			MembersCanCreatePublicPages:          Bool(false),
   778  			MembersCanCreatePrivatePages:         Bool(true),
   779  		},
   780  		Sender: &User{
   781  			Login:     String("l"),
   782  			ID:        Int64(1),
   783  			NodeID:    String("n"),
   784  			URL:       String("u"),
   785  			ReposURL:  String("r"),
   786  			EventsURL: String("e"),
   787  			AvatarURL: String("a"),
   788  		},
   789  		Installation: &Installation{
   790  			ID:       Int64(1),
   791  			NodeID:   String("nid"),
   792  			AppID:    Int64(1),
   793  			AppSlug:  String("as"),
   794  			TargetID: Int64(1),
   795  			Account: &User{
   796  				Login:           String("l"),
   797  				ID:              Int64(1),
   798  				URL:             String("u"),
   799  				AvatarURL:       String("a"),
   800  				GravatarID:      String("g"),
   801  				Name:            String("n"),
   802  				Company:         String("c"),
   803  				Blog:            String("b"),
   804  				Location:        String("l"),
   805  				Email:           String("e"),
   806  				Hireable:        Bool(true),
   807  				Bio:             String("b"),
   808  				TwitterUsername: String("t"),
   809  				PublicRepos:     Int(1),
   810  				Followers:       Int(1),
   811  				Following:       Int(1),
   812  				CreatedAt:       &Timestamp{referenceTime},
   813  				SuspendedAt:     &Timestamp{referenceTime},
   814  			},
   815  			AccessTokensURL:     String("atu"),
   816  			RepositoriesURL:     String("ru"),
   817  			HTMLURL:             String("hu"),
   818  			TargetType:          String("tt"),
   819  			SingleFileName:      String("sfn"),
   820  			RepositorySelection: String("rs"),
   821  			Events:              []string{"e"},
   822  			SingleFilePaths:     []string{"s"},
   823  			Permissions: &InstallationPermissions{
   824  				Actions:                       String("a"),
   825  				Administration:                String("ad"),
   826  				Checks:                        String("c"),
   827  				Contents:                      String("co"),
   828  				ContentReferences:             String("cr"),
   829  				Deployments:                   String("d"),
   830  				Environments:                  String("e"),
   831  				Issues:                        String("i"),
   832  				Metadata:                      String("md"),
   833  				Members:                       String("m"),
   834  				OrganizationAdministration:    String("oa"),
   835  				OrganizationHooks:             String("oh"),
   836  				OrganizationPlan:              String("op"),
   837  				OrganizationPreReceiveHooks:   String("opr"),
   838  				OrganizationProjects:          String("op"),
   839  				OrganizationSecrets:           String("os"),
   840  				OrganizationSelfHostedRunners: String("osh"),
   841  				OrganizationUserBlocking:      String("oub"),
   842  				Packages:                      String("pkg"),
   843  				Pages:                         String("pg"),
   844  				PullRequests:                  String("pr"),
   845  				RepositoryHooks:               String("rh"),
   846  				RepositoryProjects:            String("rp"),
   847  				RepositoryPreReceiveHooks:     String("rprh"),
   848  				Secrets:                       String("s"),
   849  				SecretScanningAlerts:          String("ssa"),
   850  				SecurityEvents:                String("se"),
   851  				SingleFile:                    String("sf"),
   852  				Statuses:                      String("s"),
   853  				TeamDiscussions:               String("td"),
   854  				VulnerabilityAlerts:           String("va"),
   855  				Workflows:                     String("w"),
   856  			},
   857  			CreatedAt:              &Timestamp{referenceTime},
   858  			UpdatedAt:              &Timestamp{referenceTime},
   859  			HasMultipleSingleFiles: Bool(false),
   860  			SuspendedBy: &User{
   861  				Login:           String("l"),
   862  				ID:              Int64(1),
   863  				URL:             String("u"),
   864  				AvatarURL:       String("a"),
   865  				GravatarID:      String("g"),
   866  				Name:            String("n"),
   867  				Company:         String("c"),
   868  				Blog:            String("b"),
   869  				Location:        String("l"),
   870  				Email:           String("e"),
   871  				Hireable:        Bool(true),
   872  				Bio:             String("b"),
   873  				TwitterUsername: String("t"),
   874  				PublicRepos:     Int(1),
   875  				Followers:       Int(1),
   876  				Following:       Int(1),
   877  				CreatedAt:       &Timestamp{referenceTime},
   878  				SuspendedAt:     &Timestamp{referenceTime},
   879  			},
   880  			SuspendedAt: &Timestamp{referenceTime},
   881  		},
   882  	}
   883  
   884  	want := `{
   885  		"action": "a",
   886  		"team": {
   887  			"id": 1,
   888  			"node_id": "n",
   889  			"name": "n",
   890  			"description": "d",
   891  			"url": "u",
   892  			"slug": "s",
   893  			"permission": "p",
   894  			"privacy": "p",
   895  			"members_count": 1,
   896  			"repos_count": 1,
   897  			"organization": {
   898  				"login": "l",
   899  				"id": 1,
   900  				"node_id": "n",
   901  				"avatar_url": "a",
   902  				"html_url": "h",
   903  				"name": "n",
   904  				"company": "c",
   905  				"blog": "b",
   906  				"location": "l",
   907  				"email": "e"
   908  			},
   909  			"members_url": "m",
   910  			"repositories_url": "r",
   911  			"parent": {
   912  				"id": 1,
   913  				"node_id": "n",
   914  				"name": "n",
   915  				"description": "d",
   916  				"url": "u",
   917  				"slug": "s",
   918  				"permission": "p",
   919  				"privacy": "p",
   920  				"members_count": 1,
   921  				"repos_count": 1
   922  			},
   923  			"ldap_dn": "l"
   924  		},
   925  		"changes": {
   926  			"description": {
   927  				"from": "from"
   928  			},
   929  			"name": {
   930  				"from": "from"
   931  			},
   932  			"privacy": {
   933  				"from": "from"
   934  			},
   935  			"repository": {
   936  				"permissions": {
   937  					"from": {
   938  						"admin": true,
   939  						"pull": true,
   940  						"push": true
   941  					}
   942  				}
   943  			}
   944  		},
   945  		"repository": {
   946  			"id": 1,
   947  			"name": "n",
   948  			"url": "s"
   949  		},
   950  		"organization": {
   951  			"name": "n",
   952  			"company": "c",
   953  			"blog": "b",
   954  			"location": "loc",
   955  			"email": "e",
   956  			"twitter_username": "tu",
   957  			"description": "d",
   958  			"billing_email": "be",
   959  			"is_verified": true,
   960  			"has_organization_projects": true,
   961  			"has_repository_projects": true,
   962  			"default_repository_permission": "drp",
   963  			"members_can_create_repositories": true,
   964  			"members_can_create_public_repositories": false,
   965  			"members_can_create_private_repositories": true,
   966  			"members_can_create_internal_repositories": true,
   967  			"members_allowed_repository_creation_type": "marct",
   968  			"members_can_create_pages": true,
   969  			"members_can_create_public_pages": false,
   970  			"members_can_create_private_pages": true
   971  		},
   972  		"sender": {
   973  			"login": "l",
   974  			"id": 1,
   975  			"node_id": "n",
   976  			"avatar_url": "a",
   977  			"url": "u",
   978  			"events_url": "e",
   979  			"repos_url": "r"
   980  		},
   981  		"installation": {
   982  			"id": 1,
   983  			"node_id": "nid",
   984  			"app_id": 1,
   985  			"app_slug": "as",
   986  			"target_id": 1,
   987  			"account": {
   988  				"login": "l",
   989  				"id": 1,
   990  				"avatar_url": "a",
   991  				"gravatar_id": "g",
   992  				"name": "n",
   993  				"company": "c",
   994  				"blog": "b",
   995  				"location": "l",
   996  				"email": "e",
   997  				"hireable": true,
   998  				"bio": "b",
   999  				"twitter_username": "t",
  1000  				"public_repos": 1,
  1001  				"followers": 1,
  1002  				"following": 1,
  1003  				"created_at": ` + referenceTimeStr + `,
  1004  				"suspended_at": ` + referenceTimeStr + `,
  1005  				"url": "u"
  1006  			},
  1007  			"access_tokens_url": "atu",
  1008  			"repositories_url": "ru",
  1009  			"html_url": "hu",
  1010  			"target_type": "tt",
  1011  			"single_file_name": "sfn",
  1012  			"repository_selection": "rs",
  1013  			"events": [
  1014  				"e"
  1015  			],
  1016  			"single_file_paths": [
  1017  				"s"
  1018  			],
  1019  			"permissions": {
  1020  				"actions": "a",
  1021  				"administration": "ad",
  1022  				"checks": "c",
  1023  				"contents": "co",
  1024  				"content_references": "cr",
  1025  				"deployments": "d",
  1026  				"environments": "e",
  1027  				"issues": "i",
  1028  				"metadata": "md",
  1029  				"members": "m",
  1030  				"organization_administration": "oa",
  1031  				"organization_hooks": "oh",
  1032  				"organization_plan": "op",
  1033  				"organization_pre_receive_hooks": "opr",
  1034  				"organization_projects": "op",
  1035  				"organization_secrets": "os",
  1036  				"organization_self_hosted_runners": "osh",
  1037  				"organization_user_blocking": "oub",
  1038  				"packages": "pkg",
  1039  				"pages": "pg",
  1040  				"pull_requests": "pr",
  1041  				"repository_hooks": "rh",
  1042  				"repository_projects": "rp",
  1043  				"repository_pre_receive_hooks": "rprh",
  1044  				"secrets": "s",
  1045  				"secret_scanning_alerts": "ssa",
  1046  				"security_events": "se",
  1047  				"single_file": "sf",
  1048  				"statuses": "s",
  1049  				"team_discussions": "td",
  1050  				"vulnerability_alerts": "va",
  1051  				"workflows": "w"
  1052  			},
  1053  			"created_at": ` + referenceTimeStr + `,
  1054  			"updated_at": ` + referenceTimeStr + `,
  1055  			"has_multiple_single_files": false,
  1056  			"suspended_by": {
  1057  				"login": "l",
  1058  				"id": 1,
  1059  				"avatar_url": "a",
  1060  				"gravatar_id": "g",
  1061  				"name": "n",
  1062  				"company": "c",
  1063  				"blog": "b",
  1064  				"location": "l",
  1065  				"email": "e",
  1066  				"hireable": true,
  1067  				"bio": "b",
  1068  				"twitter_username": "t",
  1069  				"public_repos": 1,
  1070  				"followers": 1,
  1071  				"following": 1,
  1072  				"created_at": ` + referenceTimeStr + `,
  1073  				"suspended_at": ` + referenceTimeStr + `,
  1074  				"url": "u"
  1075  			},
  1076  			"suspended_at": ` + referenceTimeStr + `
  1077  		}
  1078  	}`
  1079  
  1080  	testJSONMarshal(t, u, want)
  1081  }
  1082  
  1083  func TestInstallationRepositoriesEvent_Marshal(t *testing.T) {
  1084  	testJSONMarshal(t, &InstallationRepositoriesEvent{}, "{}")
  1085  
  1086  	u := &InstallationRepositoriesEvent{
  1087  		Action: String("a"),
  1088  		RepositoriesAdded: []*Repository{
  1089  			{
  1090  				ID:   Int64(1),
  1091  				URL:  String("s"),
  1092  				Name: String("n"),
  1093  			},
  1094  		},
  1095  		RepositoriesRemoved: []*Repository{
  1096  			{
  1097  				ID:   Int64(1),
  1098  				URL:  String("s"),
  1099  				Name: String("n"),
  1100  			},
  1101  		},
  1102  		RepositorySelection: String("rs"),
  1103  		Sender: &User{
  1104  			Login:     String("l"),
  1105  			ID:        Int64(1),
  1106  			NodeID:    String("n"),
  1107  			URL:       String("u"),
  1108  			ReposURL:  String("r"),
  1109  			EventsURL: String("e"),
  1110  			AvatarURL: String("a"),
  1111  		},
  1112  		Installation: &Installation{
  1113  			ID:       Int64(1),
  1114  			NodeID:   String("nid"),
  1115  			AppID:    Int64(1),
  1116  			AppSlug:  String("as"),
  1117  			TargetID: Int64(1),
  1118  			Account: &User{
  1119  				Login:           String("l"),
  1120  				ID:              Int64(1),
  1121  				URL:             String("u"),
  1122  				AvatarURL:       String("a"),
  1123  				GravatarID:      String("g"),
  1124  				Name:            String("n"),
  1125  				Company:         String("c"),
  1126  				Blog:            String("b"),
  1127  				Location:        String("l"),
  1128  				Email:           String("e"),
  1129  				Hireable:        Bool(true),
  1130  				Bio:             String("b"),
  1131  				TwitterUsername: String("t"),
  1132  				PublicRepos:     Int(1),
  1133  				Followers:       Int(1),
  1134  				Following:       Int(1),
  1135  				CreatedAt:       &Timestamp{referenceTime},
  1136  				SuspendedAt:     &Timestamp{referenceTime},
  1137  			},
  1138  			AccessTokensURL:     String("atu"),
  1139  			RepositoriesURL:     String("ru"),
  1140  			HTMLURL:             String("hu"),
  1141  			TargetType:          String("tt"),
  1142  			SingleFileName:      String("sfn"),
  1143  			RepositorySelection: String("rs"),
  1144  			Events:              []string{"e"},
  1145  			SingleFilePaths:     []string{"s"},
  1146  			Permissions: &InstallationPermissions{
  1147  				Actions:                       String("a"),
  1148  				Administration:                String("ad"),
  1149  				Checks:                        String("c"),
  1150  				Contents:                      String("co"),
  1151  				ContentReferences:             String("cr"),
  1152  				Deployments:                   String("d"),
  1153  				Environments:                  String("e"),
  1154  				Issues:                        String("i"),
  1155  				Metadata:                      String("md"),
  1156  				Members:                       String("m"),
  1157  				OrganizationAdministration:    String("oa"),
  1158  				OrganizationHooks:             String("oh"),
  1159  				OrganizationPlan:              String("op"),
  1160  				OrganizationPreReceiveHooks:   String("opr"),
  1161  				OrganizationProjects:          String("op"),
  1162  				OrganizationSecrets:           String("os"),
  1163  				OrganizationSelfHostedRunners: String("osh"),
  1164  				OrganizationUserBlocking:      String("oub"),
  1165  				Packages:                      String("pkg"),
  1166  				Pages:                         String("pg"),
  1167  				PullRequests:                  String("pr"),
  1168  				RepositoryHooks:               String("rh"),
  1169  				RepositoryProjects:            String("rp"),
  1170  				RepositoryPreReceiveHooks:     String("rprh"),
  1171  				Secrets:                       String("s"),
  1172  				SecretScanningAlerts:          String("ssa"),
  1173  				SecurityEvents:                String("se"),
  1174  				SingleFile:                    String("sf"),
  1175  				Statuses:                      String("s"),
  1176  				TeamDiscussions:               String("td"),
  1177  				VulnerabilityAlerts:           String("va"),
  1178  				Workflows:                     String("w"),
  1179  			},
  1180  			CreatedAt:              &Timestamp{referenceTime},
  1181  			UpdatedAt:              &Timestamp{referenceTime},
  1182  			HasMultipleSingleFiles: Bool(false),
  1183  			SuspendedBy: &User{
  1184  				Login:           String("l"),
  1185  				ID:              Int64(1),
  1186  				URL:             String("u"),
  1187  				AvatarURL:       String("a"),
  1188  				GravatarID:      String("g"),
  1189  				Name:            String("n"),
  1190  				Company:         String("c"),
  1191  				Blog:            String("b"),
  1192  				Location:        String("l"),
  1193  				Email:           String("e"),
  1194  				Hireable:        Bool(true),
  1195  				Bio:             String("b"),
  1196  				TwitterUsername: String("t"),
  1197  				PublicRepos:     Int(1),
  1198  				Followers:       Int(1),
  1199  				Following:       Int(1),
  1200  				CreatedAt:       &Timestamp{referenceTime},
  1201  				SuspendedAt:     &Timestamp{referenceTime},
  1202  			},
  1203  			SuspendedAt: &Timestamp{referenceTime},
  1204  		},
  1205  	}
  1206  
  1207  	want := `{
  1208  		"action": "a",
  1209  		"repositories_added": [
  1210  			{
  1211  				"id": 1,
  1212  				"name": "n",
  1213  				"url": "s"
  1214  			}
  1215  		],
  1216  		"repositories_removed": [
  1217  			{
  1218  				"id": 1,
  1219  				"name": "n",
  1220  				"url": "s"
  1221  			}
  1222  		],
  1223  		"repository_selection": "rs",
  1224  		"sender": {
  1225  			"login": "l",
  1226  			"id": 1,
  1227  			"node_id": "n",
  1228  			"avatar_url": "a",
  1229  			"url": "u",
  1230  			"events_url": "e",
  1231  			"repos_url": "r"
  1232  		},
  1233  		"installation": {
  1234  			"id": 1,
  1235  			"node_id": "nid",
  1236  			"app_id": 1,
  1237  			"app_slug": "as",
  1238  			"target_id": 1,
  1239  			"account": {
  1240  				"login": "l",
  1241  				"id": 1,
  1242  				"avatar_url": "a",
  1243  				"gravatar_id": "g",
  1244  				"name": "n",
  1245  				"company": "c",
  1246  				"blog": "b",
  1247  				"location": "l",
  1248  				"email": "e",
  1249  				"hireable": true,
  1250  				"bio": "b",
  1251  				"twitter_username": "t",
  1252  				"public_repos": 1,
  1253  				"followers": 1,
  1254  				"following": 1,
  1255  				"created_at": ` + referenceTimeStr + `,
  1256  				"suspended_at": ` + referenceTimeStr + `,
  1257  				"url": "u"
  1258  			},
  1259  			"access_tokens_url": "atu",
  1260  			"repositories_url": "ru",
  1261  			"html_url": "hu",
  1262  			"target_type": "tt",
  1263  			"single_file_name": "sfn",
  1264  			"repository_selection": "rs",
  1265  			"events": [
  1266  				"e"
  1267  			],
  1268  			"single_file_paths": [
  1269  				"s"
  1270  			],
  1271  			"permissions": {
  1272  				"actions": "a",
  1273  				"administration": "ad",
  1274  				"checks": "c",
  1275  				"contents": "co",
  1276  				"content_references": "cr",
  1277  				"deployments": "d",
  1278  				"environments": "e",
  1279  				"issues": "i",
  1280  				"metadata": "md",
  1281  				"members": "m",
  1282  				"organization_administration": "oa",
  1283  				"organization_hooks": "oh",
  1284  				"organization_plan": "op",
  1285  				"organization_pre_receive_hooks": "opr",
  1286  				"organization_projects": "op",
  1287  				"organization_secrets": "os",
  1288  				"organization_self_hosted_runners": "osh",
  1289  				"organization_user_blocking": "oub",
  1290  				"packages": "pkg",
  1291  				"pages": "pg",
  1292  				"pull_requests": "pr",
  1293  				"repository_hooks": "rh",
  1294  				"repository_projects": "rp",
  1295  				"repository_pre_receive_hooks": "rprh",
  1296  				"secrets": "s",
  1297  				"secret_scanning_alerts": "ssa",
  1298  				"security_events": "se",
  1299  				"single_file": "sf",
  1300  				"statuses": "s",
  1301  				"team_discussions": "td",
  1302  				"vulnerability_alerts": "va",
  1303  				"workflows": "w"
  1304  			},
  1305  			"created_at": ` + referenceTimeStr + `,
  1306  			"updated_at": ` + referenceTimeStr + `,
  1307  			"has_multiple_single_files": false,
  1308  			"suspended_by": {
  1309  				"login": "l",
  1310  				"id": 1,
  1311  				"avatar_url": "a",
  1312  				"gravatar_id": "g",
  1313  				"name": "n",
  1314  				"company": "c",
  1315  				"blog": "b",
  1316  				"location": "l",
  1317  				"email": "e",
  1318  				"hireable": true,
  1319  				"bio": "b",
  1320  				"twitter_username": "t",
  1321  				"public_repos": 1,
  1322  				"followers": 1,
  1323  				"following": 1,
  1324  				"created_at": ` + referenceTimeStr + `,
  1325  				"suspended_at": ` + referenceTimeStr + `,
  1326  				"url": "u"
  1327  			},
  1328  			"suspended_at": ` + referenceTimeStr + `
  1329  		}
  1330  	}`
  1331  
  1332  	testJSONMarshal(t, u, want)
  1333  }
  1334  
  1335  func TestEditTitle_Marshal(t *testing.T) {
  1336  	testJSONMarshal(t, &EditTitle{}, "{}")
  1337  
  1338  	u := &EditTitle{
  1339  		From: String("EditTitleFrom"),
  1340  	}
  1341  
  1342  	want := `{
  1343  		"from": "EditTitleFrom"
  1344  	}`
  1345  
  1346  	testJSONMarshal(t, u, want)
  1347  }
  1348  
  1349  func TestEditBody_Marshal(t *testing.T) {
  1350  	testJSONMarshal(t, &EditBody{}, "{}")
  1351  
  1352  	u := &EditBody{
  1353  		From: String("EditBodyFrom"),
  1354  	}
  1355  
  1356  	want := `{
  1357  		"from": "EditBodyFrom"
  1358  	}`
  1359  
  1360  	testJSONMarshal(t, u, want)
  1361  }
  1362  
  1363  func TestEditBase_Marshal(t *testing.T) {
  1364  	testJSONMarshal(t, &EditBase{}, "{}")
  1365  
  1366  	u := &EditBase{
  1367  		Ref: &EditRef{
  1368  			From: String("EditRefFrom"),
  1369  		},
  1370  		SHA: &EditSHA{
  1371  			From: String("EditSHAFrom"),
  1372  		},
  1373  	}
  1374  
  1375  	want := `{
  1376  		"ref": {
  1377  			"from": "EditRefFrom"
  1378  		},
  1379  		"sha": {
  1380  			"from": "EditSHAFrom"
  1381  		}
  1382  	}`
  1383  
  1384  	testJSONMarshal(t, u, want)
  1385  }
  1386  
  1387  func TestEditRef_Marshal(t *testing.T) {
  1388  	testJSONMarshal(t, &EditRef{}, "{}")
  1389  
  1390  	u := &EditRef{
  1391  		From: String("EditRefFrom"),
  1392  	}
  1393  
  1394  	want := `{
  1395  		"from": "EditRefFrom"
  1396  	}`
  1397  
  1398  	testJSONMarshal(t, u, want)
  1399  }
  1400  
  1401  func TestEditSHA_Marshal(t *testing.T) {
  1402  	testJSONMarshal(t, &EditSHA{}, "{}")
  1403  
  1404  	u := &EditSHA{
  1405  		From: String("EditSHAFrom"),
  1406  	}
  1407  
  1408  	want := `{
  1409  		"from": "EditSHAFrom"
  1410  	}`
  1411  
  1412  	testJSONMarshal(t, u, want)
  1413  }
  1414  
  1415  func TestProjectName_Marshal(t *testing.T) {
  1416  	testJSONMarshal(t, &ProjectName{}, "{}")
  1417  
  1418  	u := &ProjectName{
  1419  		From: String("ProjectNameFrom"),
  1420  	}
  1421  
  1422  	want := `{
  1423  		"from": "ProjectNameFrom"
  1424  	}`
  1425  
  1426  	testJSONMarshal(t, u, want)
  1427  }
  1428  
  1429  func TestProjectBody_Marshal(t *testing.T) {
  1430  	testJSONMarshal(t, &ProjectBody{}, "{}")
  1431  
  1432  	u := &ProjectBody{
  1433  		From: String("ProjectBodyFrom"),
  1434  	}
  1435  
  1436  	want := `{
  1437  		"from": "ProjectBodyFrom"
  1438  	}`
  1439  
  1440  	testJSONMarshal(t, u, want)
  1441  }
  1442  
  1443  func TestProjectCardNote_Marshal(t *testing.T) {
  1444  	testJSONMarshal(t, &ProjectCardNote{}, "{}")
  1445  
  1446  	u := &ProjectCardNote{
  1447  		From: String("ProjectCardNoteFrom"),
  1448  	}
  1449  
  1450  	want := `{
  1451  		"from": "ProjectCardNoteFrom"
  1452  	}`
  1453  
  1454  	testJSONMarshal(t, u, want)
  1455  }
  1456  
  1457  func TestProjectColumnName_Marshal(t *testing.T) {
  1458  	testJSONMarshal(t, &ProjectColumnName{}, "{}")
  1459  
  1460  	u := &ProjectColumnName{
  1461  		From: String("ProjectColumnNameFrom"),
  1462  	}
  1463  
  1464  	want := `{
  1465  		"from": "ProjectColumnNameFrom"
  1466  	}`
  1467  
  1468  	testJSONMarshal(t, u, want)
  1469  }
  1470  
  1471  func TestTeamDescription_Marshal(t *testing.T) {
  1472  	testJSONMarshal(t, &TeamDescription{}, "{}")
  1473  
  1474  	u := &TeamDescription{
  1475  		From: String("TeamDescriptionFrom"),
  1476  	}
  1477  
  1478  	want := `{
  1479  		"from": "TeamDescriptionFrom"
  1480  	}`
  1481  
  1482  	testJSONMarshal(t, u, want)
  1483  }
  1484  
  1485  func TestTeamName_Marshal(t *testing.T) {
  1486  	testJSONMarshal(t, &TeamName{}, "{}")
  1487  
  1488  	u := &TeamName{
  1489  		From: String("TeamNameFrom"),
  1490  	}
  1491  
  1492  	want := `{
  1493  		"from": "TeamNameFrom"
  1494  	}`
  1495  
  1496  	testJSONMarshal(t, u, want)
  1497  }
  1498  
  1499  func TestTeamPrivacy_Marshal(t *testing.T) {
  1500  	testJSONMarshal(t, &TeamPrivacy{}, "{}")
  1501  
  1502  	u := &TeamPrivacy{
  1503  		From: String("TeamPrivacyFrom"),
  1504  	}
  1505  
  1506  	want := `{
  1507  		"from": "TeamPrivacyFrom"
  1508  	}`
  1509  
  1510  	testJSONMarshal(t, u, want)
  1511  }
  1512  
  1513  func TestTeamRepository_Marshal(t *testing.T) {
  1514  	testJSONMarshal(t, &TeamRepository{}, "{}")
  1515  
  1516  	u := &TeamRepository{
  1517  		Permissions: &TeamPermissions{
  1518  			From: &TeamPermissionsFrom{
  1519  				Admin: Bool(true),
  1520  				Pull:  Bool(true),
  1521  				Push:  Bool(true),
  1522  			},
  1523  		},
  1524  	}
  1525  
  1526  	want := `{
  1527  		"permissions": {
  1528  			"from": {
  1529  				"admin": true,
  1530  				"pull": true,
  1531  				"push": true
  1532  			}
  1533  		}
  1534  	}`
  1535  
  1536  	testJSONMarshal(t, u, want)
  1537  }
  1538  
  1539  func TestTeamPermissions_Marshal(t *testing.T) {
  1540  	testJSONMarshal(t, &TeamPermissions{}, "{}")
  1541  
  1542  	u := &TeamPermissions{
  1543  		From: &TeamPermissionsFrom{
  1544  			Admin: Bool(true),
  1545  			Pull:  Bool(true),
  1546  			Push:  Bool(true),
  1547  		},
  1548  	}
  1549  
  1550  	want := `{
  1551  		"from": {
  1552  			"admin": true,
  1553  			"pull": true,
  1554  			"push": true
  1555  		}
  1556  	}`
  1557  
  1558  	testJSONMarshal(t, u, want)
  1559  }
  1560  
  1561  func TestTeamPermissionsFrom_Marshal(t *testing.T) {
  1562  	testJSONMarshal(t, &TeamPermissionsFrom{}, "{}")
  1563  
  1564  	u := &TeamPermissionsFrom{
  1565  		Admin: Bool(true),
  1566  		Pull:  Bool(true),
  1567  		Push:  Bool(true),
  1568  	}
  1569  
  1570  	want := `{
  1571  		"admin": true,
  1572  		"pull": true,
  1573  		"push": true
  1574  	}`
  1575  
  1576  	testJSONMarshal(t, u, want)
  1577  }
  1578  
  1579  func TestRepositoryVulnerabilityAlert_Marshal(t *testing.T) {
  1580  	testJSONMarshal(t, &RepositoryVulnerabilityAlert{}, "{}")
  1581  
  1582  	u := &RepositoryVulnerabilityAlert{
  1583  		ID:                  Int64(1),
  1584  		AffectedRange:       String("ar"),
  1585  		AffectedPackageName: String("apn"),
  1586  		ExternalReference:   String("er"),
  1587  		ExternalIdentifier:  String("ei"),
  1588  		FixedIn:             String("fi"),
  1589  		Dismisser: &User{
  1590  			Login:     String("l"),
  1591  			ID:        Int64(1),
  1592  			NodeID:    String("n"),
  1593  			URL:       String("u"),
  1594  			ReposURL:  String("r"),
  1595  			EventsURL: String("e"),
  1596  			AvatarURL: String("a"),
  1597  		},
  1598  		DismissReason: String("dr"),
  1599  		DismissedAt:   &Timestamp{referenceTime},
  1600  	}
  1601  
  1602  	want := `{
  1603  		"id": 1,
  1604  		"affected_range": "ar",
  1605  		"affected_package_name": "apn",
  1606  		"external_reference": "er",
  1607  		"external_identifier": "ei",
  1608  		"fixed_in": "fi",
  1609  		"dismisser": {
  1610  			"login": "l",
  1611  			"id": 1,
  1612  			"node_id": "n",
  1613  			"avatar_url": "a",
  1614  			"url": "u",
  1615  			"events_url": "e",
  1616  			"repos_url": "r"
  1617  		},
  1618  		"dismiss_reason": "dr",
  1619  		"dismissed_at": ` + referenceTimeStr + `
  1620  	}`
  1621  
  1622  	testJSONMarshal(t, u, want)
  1623  }
  1624  
  1625  func TestPage_Marshal(t *testing.T) {
  1626  	testJSONMarshal(t, &Page{}, "{}")
  1627  
  1628  	u := &Page{
  1629  		PageName: String("p"),
  1630  		Title:    String("t"),
  1631  		Summary:  String("s"),
  1632  		Action:   String("a"),
  1633  		SHA:      String("s"),
  1634  		HTMLURL:  String("h"),
  1635  	}
  1636  
  1637  	want := `{
  1638  		"page_name": "p",
  1639  		"title": "t",
  1640  		"summary": "s",
  1641  		"action": "a",
  1642  		"sha": "s",
  1643  		"html_url": "h"
  1644  	}`
  1645  
  1646  	testJSONMarshal(t, u, want)
  1647  }
  1648  
  1649  func TestTeamChange_Marshal(t *testing.T) {
  1650  	testJSONMarshal(t, &TeamChange{}, "{}")
  1651  
  1652  	u := &TeamChange{
  1653  		Description: &TeamDescription{
  1654  			From: String("DescriptionFrom"),
  1655  		},
  1656  		Name: &TeamName{
  1657  			From: String("NameFrom"),
  1658  		},
  1659  		Privacy: &TeamPrivacy{
  1660  			From: String("PrivacyFrom"),
  1661  		},
  1662  		Repository: &TeamRepository{
  1663  			Permissions: &TeamPermissions{
  1664  				From: &TeamPermissionsFrom{
  1665  					Admin: Bool(false),
  1666  					Pull:  Bool(false),
  1667  					Push:  Bool(false),
  1668  				},
  1669  			},
  1670  		},
  1671  	}
  1672  
  1673  	want := `{
  1674  		"description": {
  1675  			"from": "DescriptionFrom"
  1676  		},
  1677  		"name": {
  1678  			"from": "NameFrom"
  1679  		},
  1680  		"privacy": {
  1681  			"from": "PrivacyFrom"
  1682  		},
  1683  		"repository": {
  1684  			"permissions": {
  1685  				"from": {
  1686  					"admin": false,
  1687  					"pull": false,
  1688  					"push": false
  1689  				}
  1690  			}
  1691  		}
  1692  	}`
  1693  
  1694  	testJSONMarshal(t, u, want)
  1695  }
  1696  
  1697  func TestIssueCommentEvent_Marshal(t *testing.T) {
  1698  	testJSONMarshal(t, &IssueCommentEvent{}, "{}")
  1699  
  1700  	u := &IssueCommentEvent{
  1701  		Action:  String("a"),
  1702  		Issue:   &Issue{ID: Int64(1)},
  1703  		Comment: &IssueComment{ID: Int64(1)},
  1704  		Changes: &EditChange{
  1705  			Title: &EditTitle{
  1706  				From: String("TitleFrom"),
  1707  			},
  1708  			Body: &EditBody{
  1709  				From: String("BodyFrom"),
  1710  			},
  1711  			Base: &EditBase{
  1712  				Ref: &EditRef{
  1713  					From: String("BaseRefFrom"),
  1714  				},
  1715  				SHA: &EditSHA{
  1716  					From: String("BaseSHAFrom"),
  1717  				},
  1718  			},
  1719  		},
  1720  		Repo: &Repository{
  1721  			ID:   Int64(1),
  1722  			URL:  String("s"),
  1723  			Name: String("n"),
  1724  		},
  1725  		Sender: &User{
  1726  			Login:     String("l"),
  1727  			ID:        Int64(1),
  1728  			NodeID:    String("n"),
  1729  			URL:       String("u"),
  1730  			ReposURL:  String("r"),
  1731  			EventsURL: String("e"),
  1732  			AvatarURL: String("a"),
  1733  		},
  1734  		Installation: &Installation{
  1735  			ID:       Int64(1),
  1736  			NodeID:   String("nid"),
  1737  			AppID:    Int64(1),
  1738  			AppSlug:  String("as"),
  1739  			TargetID: Int64(1),
  1740  			Account: &User{
  1741  				Login:           String("l"),
  1742  				ID:              Int64(1),
  1743  				URL:             String("u"),
  1744  				AvatarURL:       String("a"),
  1745  				GravatarID:      String("g"),
  1746  				Name:            String("n"),
  1747  				Company:         String("c"),
  1748  				Blog:            String("b"),
  1749  				Location:        String("l"),
  1750  				Email:           String("e"),
  1751  				Hireable:        Bool(true),
  1752  				Bio:             String("b"),
  1753  				TwitterUsername: String("t"),
  1754  				PublicRepos:     Int(1),
  1755  				Followers:       Int(1),
  1756  				Following:       Int(1),
  1757  				CreatedAt:       &Timestamp{referenceTime},
  1758  				SuspendedAt:     &Timestamp{referenceTime},
  1759  			},
  1760  			AccessTokensURL:     String("atu"),
  1761  			RepositoriesURL:     String("ru"),
  1762  			HTMLURL:             String("hu"),
  1763  			TargetType:          String("tt"),
  1764  			SingleFileName:      String("sfn"),
  1765  			RepositorySelection: String("rs"),
  1766  			Events:              []string{"e"},
  1767  			SingleFilePaths:     []string{"s"},
  1768  			Permissions: &InstallationPermissions{
  1769  				Actions:                       String("a"),
  1770  				Administration:                String("ad"),
  1771  				Checks:                        String("c"),
  1772  				Contents:                      String("co"),
  1773  				ContentReferences:             String("cr"),
  1774  				Deployments:                   String("d"),
  1775  				Environments:                  String("e"),
  1776  				Issues:                        String("i"),
  1777  				Metadata:                      String("md"),
  1778  				Members:                       String("m"),
  1779  				OrganizationAdministration:    String("oa"),
  1780  				OrganizationHooks:             String("oh"),
  1781  				OrganizationPlan:              String("op"),
  1782  				OrganizationPreReceiveHooks:   String("opr"),
  1783  				OrganizationProjects:          String("op"),
  1784  				OrganizationSecrets:           String("os"),
  1785  				OrganizationSelfHostedRunners: String("osh"),
  1786  				OrganizationUserBlocking:      String("oub"),
  1787  				Packages:                      String("pkg"),
  1788  				Pages:                         String("pg"),
  1789  				PullRequests:                  String("pr"),
  1790  				RepositoryHooks:               String("rh"),
  1791  				RepositoryProjects:            String("rp"),
  1792  				RepositoryPreReceiveHooks:     String("rprh"),
  1793  				Secrets:                       String("s"),
  1794  				SecretScanningAlerts:          String("ssa"),
  1795  				SecurityEvents:                String("se"),
  1796  				SingleFile:                    String("sf"),
  1797  				Statuses:                      String("s"),
  1798  				TeamDiscussions:               String("td"),
  1799  				VulnerabilityAlerts:           String("va"),
  1800  				Workflows:                     String("w"),
  1801  			},
  1802  			CreatedAt:              &Timestamp{referenceTime},
  1803  			UpdatedAt:              &Timestamp{referenceTime},
  1804  			HasMultipleSingleFiles: Bool(false),
  1805  			SuspendedBy: &User{
  1806  				Login:           String("l"),
  1807  				ID:              Int64(1),
  1808  				URL:             String("u"),
  1809  				AvatarURL:       String("a"),
  1810  				GravatarID:      String("g"),
  1811  				Name:            String("n"),
  1812  				Company:         String("c"),
  1813  				Blog:            String("b"),
  1814  				Location:        String("l"),
  1815  				Email:           String("e"),
  1816  				Hireable:        Bool(true),
  1817  				Bio:             String("b"),
  1818  				TwitterUsername: String("t"),
  1819  				PublicRepos:     Int(1),
  1820  				Followers:       Int(1),
  1821  				Following:       Int(1),
  1822  				CreatedAt:       &Timestamp{referenceTime},
  1823  				SuspendedAt:     &Timestamp{referenceTime},
  1824  			},
  1825  			SuspendedAt: &Timestamp{referenceTime},
  1826  		},
  1827  		Organization: &Organization{
  1828  			BillingEmail:                         String("be"),
  1829  			Blog:                                 String("b"),
  1830  			Company:                              String("c"),
  1831  			Email:                                String("e"),
  1832  			TwitterUsername:                      String("tu"),
  1833  			Location:                             String("loc"),
  1834  			Name:                                 String("n"),
  1835  			Description:                          String("d"),
  1836  			IsVerified:                           Bool(true),
  1837  			HasOrganizationProjects:              Bool(true),
  1838  			HasRepositoryProjects:                Bool(true),
  1839  			DefaultRepoPermission:                String("drp"),
  1840  			MembersCanCreateRepos:                Bool(true),
  1841  			MembersCanCreateInternalRepos:        Bool(true),
  1842  			MembersCanCreatePrivateRepos:         Bool(true),
  1843  			MembersCanCreatePublicRepos:          Bool(false),
  1844  			MembersAllowedRepositoryCreationType: String("marct"),
  1845  			MembersCanCreatePages:                Bool(true),
  1846  			MembersCanCreatePublicPages:          Bool(false),
  1847  			MembersCanCreatePrivatePages:         Bool(true),
  1848  		},
  1849  	}
  1850  
  1851  	want := `{
  1852  		"action": "a",
  1853  		"issue": {
  1854  			"id": 1
  1855  		},
  1856  		"comment": {
  1857  			"id": 1
  1858  		},
  1859  		"changes": {
  1860  			"title": {
  1861  				"from": "TitleFrom"
  1862  			},
  1863  			"body": {
  1864  				"from": "BodyFrom"
  1865  			},
  1866  			"base": {
  1867  				"ref": {
  1868  					"from": "BaseRefFrom"
  1869  				},
  1870  				"sha": {
  1871  					"from": "BaseSHAFrom"
  1872  				}
  1873  			}
  1874  		},
  1875  		"repository": {
  1876  			"id": 1,
  1877  			"name": "n",
  1878  			"url": "s"
  1879  		},
  1880  		"sender": {
  1881  			"login": "l",
  1882  			"id": 1,
  1883  			"node_id": "n",
  1884  			"avatar_url": "a",
  1885  			"url": "u",
  1886  			"events_url": "e",
  1887  			"repos_url": "r"
  1888  		},
  1889  		"installation": {
  1890  			"id": 1,
  1891  			"node_id": "nid",
  1892  			"app_id": 1,
  1893  			"app_slug": "as",
  1894  			"target_id": 1,
  1895  			"account": {
  1896  				"login": "l",
  1897  				"id": 1,
  1898  				"avatar_url": "a",
  1899  				"gravatar_id": "g",
  1900  				"name": "n",
  1901  				"company": "c",
  1902  				"blog": "b",
  1903  				"location": "l",
  1904  				"email": "e",
  1905  				"hireable": true,
  1906  				"bio": "b",
  1907  				"twitter_username": "t",
  1908  				"public_repos": 1,
  1909  				"followers": 1,
  1910  				"following": 1,
  1911  				"created_at": ` + referenceTimeStr + `,
  1912  				"suspended_at": ` + referenceTimeStr + `,
  1913  				"url": "u"
  1914  			},
  1915  			"access_tokens_url": "atu",
  1916  			"repositories_url": "ru",
  1917  			"html_url": "hu",
  1918  			"target_type": "tt",
  1919  			"single_file_name": "sfn",
  1920  			"repository_selection": "rs",
  1921  			"events": [
  1922  				"e"
  1923  			],
  1924  			"single_file_paths": [
  1925  				"s"
  1926  			],
  1927  			"permissions": {
  1928  				"actions": "a",
  1929  				"administration": "ad",
  1930  				"checks": "c",
  1931  				"contents": "co",
  1932  				"content_references": "cr",
  1933  				"deployments": "d",
  1934  				"environments": "e",
  1935  				"issues": "i",
  1936  				"metadata": "md",
  1937  				"members": "m",
  1938  				"organization_administration": "oa",
  1939  				"organization_hooks": "oh",
  1940  				"organization_plan": "op",
  1941  				"organization_pre_receive_hooks": "opr",
  1942  				"organization_projects": "op",
  1943  				"organization_secrets": "os",
  1944  				"organization_self_hosted_runners": "osh",
  1945  				"organization_user_blocking": "oub",
  1946  				"packages": "pkg",
  1947  				"pages": "pg",
  1948  				"pull_requests": "pr",
  1949  				"repository_hooks": "rh",
  1950  				"repository_projects": "rp",
  1951  				"repository_pre_receive_hooks": "rprh",
  1952  				"secrets": "s",
  1953  				"secret_scanning_alerts": "ssa",
  1954  				"security_events": "se",
  1955  				"single_file": "sf",
  1956  				"statuses": "s",
  1957  				"team_discussions": "td",
  1958  				"vulnerability_alerts": "va",
  1959  				"workflows": "w"
  1960  			},
  1961  			"created_at": ` + referenceTimeStr + `,
  1962  			"updated_at": ` + referenceTimeStr + `,
  1963  			"has_multiple_single_files": false,
  1964  			"suspended_by": {
  1965  				"login": "l",
  1966  				"id": 1,
  1967  				"avatar_url": "a",
  1968  				"gravatar_id": "g",
  1969  				"name": "n",
  1970  				"company": "c",
  1971  				"blog": "b",
  1972  				"location": "l",
  1973  				"email": "e",
  1974  				"hireable": true,
  1975  				"bio": "b",
  1976  				"twitter_username": "t",
  1977  				"public_repos": 1,
  1978  				"followers": 1,
  1979  				"following": 1,
  1980  				"created_at": ` + referenceTimeStr + `,
  1981  				"suspended_at": ` + referenceTimeStr + `,
  1982  				"url": "u"
  1983  			},
  1984  			"suspended_at": ` + referenceTimeStr + `
  1985  		},
  1986  		"organization": {
  1987  			"name": "n",
  1988  			"company": "c",
  1989  			"blog": "b",
  1990  			"location": "loc",
  1991  			"email": "e",
  1992  			"twitter_username": "tu",
  1993  			"description": "d",
  1994  			"billing_email": "be",
  1995  			"is_verified": true,
  1996  			"has_organization_projects": true,
  1997  			"has_repository_projects": true,
  1998  			"default_repository_permission": "drp",
  1999  			"members_can_create_repositories": true,
  2000  			"members_can_create_public_repositories": false,
  2001  			"members_can_create_private_repositories": true,
  2002  			"members_can_create_internal_repositories": true,
  2003  			"members_allowed_repository_creation_type": "marct",
  2004  			"members_can_create_pages": true,
  2005  			"members_can_create_public_pages": false,
  2006  			"members_can_create_private_pages": true
  2007  		}
  2008  	}`
  2009  
  2010  	testJSONMarshal(t, u, want)
  2011  }
  2012  
  2013  func TestIssuesEvent_Marshal(t *testing.T) {
  2014  	testJSONMarshal(t, &IssuesEvent{}, "{}")
  2015  
  2016  	u := &IssuesEvent{
  2017  		Action: String("a"),
  2018  		Issue:  &Issue{ID: Int64(1)},
  2019  		Assignee: &User{
  2020  			Login:     String("l"),
  2021  			ID:        Int64(1),
  2022  			NodeID:    String("n"),
  2023  			URL:       String("u"),
  2024  			ReposURL:  String("r"),
  2025  			EventsURL: String("e"),
  2026  			AvatarURL: String("a"),
  2027  		},
  2028  		Label: &Label{ID: Int64(1)},
  2029  		Changes: &EditChange{
  2030  			Title: &EditTitle{
  2031  				From: String("TitleFrom"),
  2032  			},
  2033  			Body: &EditBody{
  2034  				From: String("BodyFrom"),
  2035  			},
  2036  			Base: &EditBase{
  2037  				Ref: &EditRef{
  2038  					From: String("BaseRefFrom"),
  2039  				},
  2040  				SHA: &EditSHA{
  2041  					From: String("BaseSHAFrom"),
  2042  				},
  2043  			},
  2044  		},
  2045  		Repo: &Repository{
  2046  			ID:   Int64(1),
  2047  			URL:  String("s"),
  2048  			Name: String("n"),
  2049  		},
  2050  		Sender: &User{
  2051  			Login:     String("l"),
  2052  			ID:        Int64(1),
  2053  			NodeID:    String("n"),
  2054  			URL:       String("u"),
  2055  			ReposURL:  String("r"),
  2056  			EventsURL: String("e"),
  2057  			AvatarURL: String("a"),
  2058  		},
  2059  		Installation: &Installation{
  2060  			ID:       Int64(1),
  2061  			NodeID:   String("nid"),
  2062  			AppID:    Int64(1),
  2063  			AppSlug:  String("as"),
  2064  			TargetID: Int64(1),
  2065  			Account: &User{
  2066  				Login:           String("l"),
  2067  				ID:              Int64(1),
  2068  				URL:             String("u"),
  2069  				AvatarURL:       String("a"),
  2070  				GravatarID:      String("g"),
  2071  				Name:            String("n"),
  2072  				Company:         String("c"),
  2073  				Blog:            String("b"),
  2074  				Location:        String("l"),
  2075  				Email:           String("e"),
  2076  				Hireable:        Bool(true),
  2077  				Bio:             String("b"),
  2078  				TwitterUsername: String("t"),
  2079  				PublicRepos:     Int(1),
  2080  				Followers:       Int(1),
  2081  				Following:       Int(1),
  2082  				CreatedAt:       &Timestamp{referenceTime},
  2083  				SuspendedAt:     &Timestamp{referenceTime},
  2084  			},
  2085  			AccessTokensURL:     String("atu"),
  2086  			RepositoriesURL:     String("ru"),
  2087  			HTMLURL:             String("hu"),
  2088  			TargetType:          String("tt"),
  2089  			SingleFileName:      String("sfn"),
  2090  			RepositorySelection: String("rs"),
  2091  			Events:              []string{"e"},
  2092  			SingleFilePaths:     []string{"s"},
  2093  			Permissions: &InstallationPermissions{
  2094  				Actions:                       String("a"),
  2095  				Administration:                String("ad"),
  2096  				Checks:                        String("c"),
  2097  				Contents:                      String("co"),
  2098  				ContentReferences:             String("cr"),
  2099  				Deployments:                   String("d"),
  2100  				Environments:                  String("e"),
  2101  				Issues:                        String("i"),
  2102  				Metadata:                      String("md"),
  2103  				Members:                       String("m"),
  2104  				OrganizationAdministration:    String("oa"),
  2105  				OrganizationHooks:             String("oh"),
  2106  				OrganizationPlan:              String("op"),
  2107  				OrganizationPreReceiveHooks:   String("opr"),
  2108  				OrganizationProjects:          String("op"),
  2109  				OrganizationSecrets:           String("os"),
  2110  				OrganizationSelfHostedRunners: String("osh"),
  2111  				OrganizationUserBlocking:      String("oub"),
  2112  				Packages:                      String("pkg"),
  2113  				Pages:                         String("pg"),
  2114  				PullRequests:                  String("pr"),
  2115  				RepositoryHooks:               String("rh"),
  2116  				RepositoryProjects:            String("rp"),
  2117  				RepositoryPreReceiveHooks:     String("rprh"),
  2118  				Secrets:                       String("s"),
  2119  				SecretScanningAlerts:          String("ssa"),
  2120  				SecurityEvents:                String("se"),
  2121  				SingleFile:                    String("sf"),
  2122  				Statuses:                      String("s"),
  2123  				TeamDiscussions:               String("td"),
  2124  				VulnerabilityAlerts:           String("va"),
  2125  				Workflows:                     String("w"),
  2126  			},
  2127  			CreatedAt:              &Timestamp{referenceTime},
  2128  			UpdatedAt:              &Timestamp{referenceTime},
  2129  			HasMultipleSingleFiles: Bool(false),
  2130  			SuspendedBy: &User{
  2131  				Login:           String("l"),
  2132  				ID:              Int64(1),
  2133  				URL:             String("u"),
  2134  				AvatarURL:       String("a"),
  2135  				GravatarID:      String("g"),
  2136  				Name:            String("n"),
  2137  				Company:         String("c"),
  2138  				Blog:            String("b"),
  2139  				Location:        String("l"),
  2140  				Email:           String("e"),
  2141  				Hireable:        Bool(true),
  2142  				Bio:             String("b"),
  2143  				TwitterUsername: String("t"),
  2144  				PublicRepos:     Int(1),
  2145  				Followers:       Int(1),
  2146  				Following:       Int(1),
  2147  				CreatedAt:       &Timestamp{referenceTime},
  2148  				SuspendedAt:     &Timestamp{referenceTime},
  2149  			},
  2150  			SuspendedAt: &Timestamp{referenceTime},
  2151  		},
  2152  	}
  2153  
  2154  	want := `{
  2155  		"action": "a",
  2156  		"issue": {
  2157  			"id": 1
  2158  		},
  2159  		"assignee": {
  2160  			"login": "l",
  2161  			"id": 1,
  2162  			"node_id": "n",
  2163  			"avatar_url": "a",
  2164  			"url": "u",
  2165  			"events_url": "e",
  2166  			"repos_url": "r"
  2167  		},
  2168  		"label": {
  2169  			"id": 1
  2170  		},
  2171  		"changes": {
  2172  			"title": {
  2173  				"from": "TitleFrom"
  2174  			},
  2175  			"body": {
  2176  				"from": "BodyFrom"
  2177  			},
  2178  			"base": {
  2179  				"ref": {
  2180  					"from": "BaseRefFrom"
  2181  				},
  2182  				"sha": {
  2183  					"from": "BaseSHAFrom"
  2184  				}
  2185  			}
  2186  		},
  2187  		"repository": {
  2188  			"id": 1,
  2189  			"name": "n",
  2190  			"url": "s"
  2191  		},
  2192  		"sender": {
  2193  			"login": "l",
  2194  			"id": 1,
  2195  			"node_id": "n",
  2196  			"avatar_url": "a",
  2197  			"url": "u",
  2198  			"events_url": "e",
  2199  			"repos_url": "r"
  2200  		},
  2201  		"installation": {
  2202  			"id": 1,
  2203  			"node_id": "nid",
  2204  			"app_id": 1,
  2205  			"app_slug": "as",
  2206  			"target_id": 1,
  2207  			"account": {
  2208  				"login": "l",
  2209  				"id": 1,
  2210  				"avatar_url": "a",
  2211  				"gravatar_id": "g",
  2212  				"name": "n",
  2213  				"company": "c",
  2214  				"blog": "b",
  2215  				"location": "l",
  2216  				"email": "e",
  2217  				"hireable": true,
  2218  				"bio": "b",
  2219  				"twitter_username": "t",
  2220  				"public_repos": 1,
  2221  				"followers": 1,
  2222  				"following": 1,
  2223  				"created_at": ` + referenceTimeStr + `,
  2224  				"suspended_at": ` + referenceTimeStr + `,
  2225  				"url": "u"
  2226  			},
  2227  			"access_tokens_url": "atu",
  2228  			"repositories_url": "ru",
  2229  			"html_url": "hu",
  2230  			"target_type": "tt",
  2231  			"single_file_name": "sfn",
  2232  			"repository_selection": "rs",
  2233  			"events": [
  2234  				"e"
  2235  			],
  2236  			"single_file_paths": [
  2237  				"s"
  2238  			],
  2239  			"permissions": {
  2240  				"actions": "a",
  2241  				"administration": "ad",
  2242  				"checks": "c",
  2243  				"contents": "co",
  2244  				"content_references": "cr",
  2245  				"deployments": "d",
  2246  				"environments": "e",
  2247  				"issues": "i",
  2248  				"metadata": "md",
  2249  				"members": "m",
  2250  				"organization_administration": "oa",
  2251  				"organization_hooks": "oh",
  2252  				"organization_plan": "op",
  2253  				"organization_pre_receive_hooks": "opr",
  2254  				"organization_projects": "op",
  2255  				"organization_secrets": "os",
  2256  				"organization_self_hosted_runners": "osh",
  2257  				"organization_user_blocking": "oub",
  2258  				"packages": "pkg",
  2259  				"pages": "pg",
  2260  				"pull_requests": "pr",
  2261  				"repository_hooks": "rh",
  2262  				"repository_projects": "rp",
  2263  				"repository_pre_receive_hooks": "rprh",
  2264  				"secrets": "s",
  2265  				"secret_scanning_alerts": "ssa",
  2266  				"security_events": "se",
  2267  				"single_file": "sf",
  2268  				"statuses": "s",
  2269  				"team_discussions": "td",
  2270  				"vulnerability_alerts": "va",
  2271  				"workflows": "w"
  2272  			},
  2273  			"created_at": ` + referenceTimeStr + `,
  2274  			"updated_at": ` + referenceTimeStr + `,
  2275  			"has_multiple_single_files": false,
  2276  			"suspended_by": {
  2277  				"login": "l",
  2278  				"id": 1,
  2279  				"avatar_url": "a",
  2280  				"gravatar_id": "g",
  2281  				"name": "n",
  2282  				"company": "c",
  2283  				"blog": "b",
  2284  				"location": "l",
  2285  				"email": "e",
  2286  				"hireable": true,
  2287  				"bio": "b",
  2288  				"twitter_username": "t",
  2289  				"public_repos": 1,
  2290  				"followers": 1,
  2291  				"following": 1,
  2292  				"created_at": ` + referenceTimeStr + `,
  2293  				"suspended_at": ` + referenceTimeStr + `,
  2294  				"url": "u"
  2295  			},
  2296  			"suspended_at": ` + referenceTimeStr + `
  2297  		}
  2298  	}`
  2299  
  2300  	testJSONMarshal(t, u, want)
  2301  }
  2302  
  2303  func TestLabelEvent_Marshal(t *testing.T) {
  2304  	testJSONMarshal(t, &LabelEvent{}, "{}")
  2305  
  2306  	u := &LabelEvent{
  2307  		Action: String("a"),
  2308  		Label:  &Label{ID: Int64(1)},
  2309  		Changes: &EditChange{
  2310  			Title: &EditTitle{
  2311  				From: String("TitleFrom"),
  2312  			},
  2313  			Body: &EditBody{
  2314  				From: String("BodyFrom"),
  2315  			},
  2316  			Base: &EditBase{
  2317  				Ref: &EditRef{
  2318  					From: String("BaseRefFrom"),
  2319  				},
  2320  				SHA: &EditSHA{
  2321  					From: String("BaseSHAFrom"),
  2322  				},
  2323  			},
  2324  		},
  2325  		Repo: &Repository{
  2326  			ID:   Int64(1),
  2327  			URL:  String("s"),
  2328  			Name: String("n"),
  2329  		},
  2330  		Org: &Organization{
  2331  			BillingEmail:                         String("be"),
  2332  			Blog:                                 String("b"),
  2333  			Company:                              String("c"),
  2334  			Email:                                String("e"),
  2335  			TwitterUsername:                      String("tu"),
  2336  			Location:                             String("loc"),
  2337  			Name:                                 String("n"),
  2338  			Description:                          String("d"),
  2339  			IsVerified:                           Bool(true),
  2340  			HasOrganizationProjects:              Bool(true),
  2341  			HasRepositoryProjects:                Bool(true),
  2342  			DefaultRepoPermission:                String("drp"),
  2343  			MembersCanCreateRepos:                Bool(true),
  2344  			MembersCanCreateInternalRepos:        Bool(true),
  2345  			MembersCanCreatePrivateRepos:         Bool(true),
  2346  			MembersCanCreatePublicRepos:          Bool(false),
  2347  			MembersAllowedRepositoryCreationType: String("marct"),
  2348  			MembersCanCreatePages:                Bool(true),
  2349  			MembersCanCreatePublicPages:          Bool(false),
  2350  			MembersCanCreatePrivatePages:         Bool(true),
  2351  		},
  2352  		Installation: &Installation{
  2353  			ID:       Int64(1),
  2354  			NodeID:   String("nid"),
  2355  			AppID:    Int64(1),
  2356  			AppSlug:  String("as"),
  2357  			TargetID: Int64(1),
  2358  			Account: &User{
  2359  				Login:           String("l"),
  2360  				ID:              Int64(1),
  2361  				URL:             String("u"),
  2362  				AvatarURL:       String("a"),
  2363  				GravatarID:      String("g"),
  2364  				Name:            String("n"),
  2365  				Company:         String("c"),
  2366  				Blog:            String("b"),
  2367  				Location:        String("l"),
  2368  				Email:           String("e"),
  2369  				Hireable:        Bool(true),
  2370  				Bio:             String("b"),
  2371  				TwitterUsername: String("t"),
  2372  				PublicRepos:     Int(1),
  2373  				Followers:       Int(1),
  2374  				Following:       Int(1),
  2375  				CreatedAt:       &Timestamp{referenceTime},
  2376  				SuspendedAt:     &Timestamp{referenceTime},
  2377  			},
  2378  			AccessTokensURL:     String("atu"),
  2379  			RepositoriesURL:     String("ru"),
  2380  			HTMLURL:             String("hu"),
  2381  			TargetType:          String("tt"),
  2382  			SingleFileName:      String("sfn"),
  2383  			RepositorySelection: String("rs"),
  2384  			Events:              []string{"e"},
  2385  			SingleFilePaths:     []string{"s"},
  2386  			Permissions: &InstallationPermissions{
  2387  				Actions:                       String("a"),
  2388  				Administration:                String("ad"),
  2389  				Checks:                        String("c"),
  2390  				Contents:                      String("co"),
  2391  				ContentReferences:             String("cr"),
  2392  				Deployments:                   String("d"),
  2393  				Environments:                  String("e"),
  2394  				Issues:                        String("i"),
  2395  				Metadata:                      String("md"),
  2396  				Members:                       String("m"),
  2397  				OrganizationAdministration:    String("oa"),
  2398  				OrganizationHooks:             String("oh"),
  2399  				OrganizationPlan:              String("op"),
  2400  				OrganizationPreReceiveHooks:   String("opr"),
  2401  				OrganizationProjects:          String("op"),
  2402  				OrganizationSecrets:           String("os"),
  2403  				OrganizationSelfHostedRunners: String("osh"),
  2404  				OrganizationUserBlocking:      String("oub"),
  2405  				Packages:                      String("pkg"),
  2406  				Pages:                         String("pg"),
  2407  				PullRequests:                  String("pr"),
  2408  				RepositoryHooks:               String("rh"),
  2409  				RepositoryProjects:            String("rp"),
  2410  				RepositoryPreReceiveHooks:     String("rprh"),
  2411  				Secrets:                       String("s"),
  2412  				SecretScanningAlerts:          String("ssa"),
  2413  				SecurityEvents:                String("se"),
  2414  				SingleFile:                    String("sf"),
  2415  				Statuses:                      String("s"),
  2416  				TeamDiscussions:               String("td"),
  2417  				VulnerabilityAlerts:           String("va"),
  2418  				Workflows:                     String("w"),
  2419  			},
  2420  			CreatedAt:              &Timestamp{referenceTime},
  2421  			UpdatedAt:              &Timestamp{referenceTime},
  2422  			HasMultipleSingleFiles: Bool(false),
  2423  			SuspendedBy: &User{
  2424  				Login:           String("l"),
  2425  				ID:              Int64(1),
  2426  				URL:             String("u"),
  2427  				AvatarURL:       String("a"),
  2428  				GravatarID:      String("g"),
  2429  				Name:            String("n"),
  2430  				Company:         String("c"),
  2431  				Blog:            String("b"),
  2432  				Location:        String("l"),
  2433  				Email:           String("e"),
  2434  				Hireable:        Bool(true),
  2435  				Bio:             String("b"),
  2436  				TwitterUsername: String("t"),
  2437  				PublicRepos:     Int(1),
  2438  				Followers:       Int(1),
  2439  				Following:       Int(1),
  2440  				CreatedAt:       &Timestamp{referenceTime},
  2441  				SuspendedAt:     &Timestamp{referenceTime},
  2442  			},
  2443  			SuspendedAt: &Timestamp{referenceTime},
  2444  		},
  2445  	}
  2446  
  2447  	want := `{
  2448  		"action": "a",
  2449  		"label": {
  2450  			"id": 1
  2451  		},
  2452  		"changes": {
  2453  			"title": {
  2454  				"from": "TitleFrom"
  2455  			},
  2456  			"body": {
  2457  				"from": "BodyFrom"
  2458  			},
  2459  			"base": {
  2460  				"ref": {
  2461  					"from": "BaseRefFrom"
  2462  				},
  2463  				"sha": {
  2464  					"from": "BaseSHAFrom"
  2465  				}
  2466  			}
  2467  		},
  2468  		"repository": {
  2469  			"id": 1,
  2470  			"name": "n",
  2471  			"url": "s"
  2472  		},
  2473  		"organization": {
  2474  			"name": "n",
  2475  			"company": "c",
  2476  			"blog": "b",
  2477  			"location": "loc",
  2478  			"email": "e",
  2479  			"twitter_username": "tu",
  2480  			"description": "d",
  2481  			"billing_email": "be",
  2482  			"is_verified": true,
  2483  			"has_organization_projects": true,
  2484  			"has_repository_projects": true,
  2485  			"default_repository_permission": "drp",
  2486  			"members_can_create_repositories": true,
  2487  			"members_can_create_public_repositories": false,
  2488  			"members_can_create_private_repositories": true,
  2489  			"members_can_create_internal_repositories": true,
  2490  			"members_allowed_repository_creation_type": "marct",
  2491  			"members_can_create_pages": true,
  2492  			"members_can_create_public_pages": false,
  2493  			"members_can_create_private_pages": true
  2494  		},
  2495  		"installation": {
  2496  			"id": 1,
  2497  			"node_id": "nid",
  2498  			"app_id": 1,
  2499  			"app_slug": "as",
  2500  			"target_id": 1,
  2501  			"account": {
  2502  				"login": "l",
  2503  				"id": 1,
  2504  				"avatar_url": "a",
  2505  				"gravatar_id": "g",
  2506  				"name": "n",
  2507  				"company": "c",
  2508  				"blog": "b",
  2509  				"location": "l",
  2510  				"email": "e",
  2511  				"hireable": true,
  2512  				"bio": "b",
  2513  				"twitter_username": "t",
  2514  				"public_repos": 1,
  2515  				"followers": 1,
  2516  				"following": 1,
  2517  				"created_at": ` + referenceTimeStr + `,
  2518  				"suspended_at": ` + referenceTimeStr + `,
  2519  				"url": "u"
  2520  			},
  2521  			"access_tokens_url": "atu",
  2522  			"repositories_url": "ru",
  2523  			"html_url": "hu",
  2524  			"target_type": "tt",
  2525  			"single_file_name": "sfn",
  2526  			"repository_selection": "rs",
  2527  			"events": [
  2528  				"e"
  2529  			],
  2530  			"single_file_paths": [
  2531  				"s"
  2532  			],
  2533  			"permissions": {
  2534  				"actions": "a",
  2535  				"administration": "ad",
  2536  				"checks": "c",
  2537  				"contents": "co",
  2538  				"content_references": "cr",
  2539  				"deployments": "d",
  2540  				"environments": "e",
  2541  				"issues": "i",
  2542  				"metadata": "md",
  2543  				"members": "m",
  2544  				"organization_administration": "oa",
  2545  				"organization_hooks": "oh",
  2546  				"organization_plan": "op",
  2547  				"organization_pre_receive_hooks": "opr",
  2548  				"organization_projects": "op",
  2549  				"organization_secrets": "os",
  2550  				"organization_self_hosted_runners": "osh",
  2551  				"organization_user_blocking": "oub",
  2552  				"packages": "pkg",
  2553  				"pages": "pg",
  2554  				"pull_requests": "pr",
  2555  				"repository_hooks": "rh",
  2556  				"repository_projects": "rp",
  2557  				"repository_pre_receive_hooks": "rprh",
  2558  				"secrets": "s",
  2559  				"secret_scanning_alerts": "ssa",
  2560  				"security_events": "se",
  2561  				"single_file": "sf",
  2562  				"statuses": "s",
  2563  				"team_discussions": "td",
  2564  				"vulnerability_alerts": "va",
  2565  				"workflows": "w"
  2566  			},
  2567  			"created_at": ` + referenceTimeStr + `,
  2568  			"updated_at": ` + referenceTimeStr + `,
  2569  			"has_multiple_single_files": false,
  2570  			"suspended_by": {
  2571  				"login": "l",
  2572  				"id": 1,
  2573  				"avatar_url": "a",
  2574  				"gravatar_id": "g",
  2575  				"name": "n",
  2576  				"company": "c",
  2577  				"blog": "b",
  2578  				"location": "l",
  2579  				"email": "e",
  2580  				"hireable": true,
  2581  				"bio": "b",
  2582  				"twitter_username": "t",
  2583  				"public_repos": 1,
  2584  				"followers": 1,
  2585  				"following": 1,
  2586  				"created_at": ` + referenceTimeStr + `,
  2587  				"suspended_at": ` + referenceTimeStr + `,
  2588  				"url": "u"
  2589  			},
  2590  			"suspended_at": ` + referenceTimeStr + `
  2591  		}
  2592  	}`
  2593  
  2594  	testJSONMarshal(t, u, want)
  2595  }
  2596  
  2597  func TestMilestoneEvent_Marshal(t *testing.T) {
  2598  	testJSONMarshal(t, &MilestoneEvent{}, "{}")
  2599  
  2600  	u := &MilestoneEvent{
  2601  		Action:    String("a"),
  2602  		Milestone: &Milestone{ID: Int64(1)},
  2603  		Changes: &EditChange{
  2604  			Title: &EditTitle{
  2605  				From: String("TitleFrom"),
  2606  			},
  2607  			Body: &EditBody{
  2608  				From: String("BodyFrom"),
  2609  			},
  2610  			Base: &EditBase{
  2611  				Ref: &EditRef{
  2612  					From: String("BaseRefFrom"),
  2613  				},
  2614  				SHA: &EditSHA{
  2615  					From: String("BaseSHAFrom"),
  2616  				},
  2617  			},
  2618  		},
  2619  		Repo: &Repository{
  2620  			ID:   Int64(1),
  2621  			URL:  String("s"),
  2622  			Name: String("n"),
  2623  		},
  2624  		Sender: &User{
  2625  			Login:     String("l"),
  2626  			ID:        Int64(1),
  2627  			NodeID:    String("n"),
  2628  			URL:       String("u"),
  2629  			ReposURL:  String("r"),
  2630  			EventsURL: String("e"),
  2631  			AvatarURL: String("a"),
  2632  		},
  2633  		Org: &Organization{
  2634  			BillingEmail:                         String("be"),
  2635  			Blog:                                 String("b"),
  2636  			Company:                              String("c"),
  2637  			Email:                                String("e"),
  2638  			TwitterUsername:                      String("tu"),
  2639  			Location:                             String("loc"),
  2640  			Name:                                 String("n"),
  2641  			Description:                          String("d"),
  2642  			IsVerified:                           Bool(true),
  2643  			HasOrganizationProjects:              Bool(true),
  2644  			HasRepositoryProjects:                Bool(true),
  2645  			DefaultRepoPermission:                String("drp"),
  2646  			MembersCanCreateRepos:                Bool(true),
  2647  			MembersCanCreateInternalRepos:        Bool(true),
  2648  			MembersCanCreatePrivateRepos:         Bool(true),
  2649  			MembersCanCreatePublicRepos:          Bool(false),
  2650  			MembersAllowedRepositoryCreationType: String("marct"),
  2651  			MembersCanCreatePages:                Bool(true),
  2652  			MembersCanCreatePublicPages:          Bool(false),
  2653  			MembersCanCreatePrivatePages:         Bool(true),
  2654  		},
  2655  		Installation: &Installation{
  2656  			ID:       Int64(1),
  2657  			NodeID:   String("nid"),
  2658  			AppID:    Int64(1),
  2659  			AppSlug:  String("as"),
  2660  			TargetID: Int64(1),
  2661  			Account: &User{
  2662  				Login:           String("l"),
  2663  				ID:              Int64(1),
  2664  				URL:             String("u"),
  2665  				AvatarURL:       String("a"),
  2666  				GravatarID:      String("g"),
  2667  				Name:            String("n"),
  2668  				Company:         String("c"),
  2669  				Blog:            String("b"),
  2670  				Location:        String("l"),
  2671  				Email:           String("e"),
  2672  				Hireable:        Bool(true),
  2673  				Bio:             String("b"),
  2674  				TwitterUsername: String("t"),
  2675  				PublicRepos:     Int(1),
  2676  				Followers:       Int(1),
  2677  				Following:       Int(1),
  2678  				CreatedAt:       &Timestamp{referenceTime},
  2679  				SuspendedAt:     &Timestamp{referenceTime},
  2680  			},
  2681  			AccessTokensURL:     String("atu"),
  2682  			RepositoriesURL:     String("ru"),
  2683  			HTMLURL:             String("hu"),
  2684  			TargetType:          String("tt"),
  2685  			SingleFileName:      String("sfn"),
  2686  			RepositorySelection: String("rs"),
  2687  			Events:              []string{"e"},
  2688  			SingleFilePaths:     []string{"s"},
  2689  			Permissions: &InstallationPermissions{
  2690  				Actions:                       String("a"),
  2691  				Administration:                String("ad"),
  2692  				Checks:                        String("c"),
  2693  				Contents:                      String("co"),
  2694  				ContentReferences:             String("cr"),
  2695  				Deployments:                   String("d"),
  2696  				Environments:                  String("e"),
  2697  				Issues:                        String("i"),
  2698  				Metadata:                      String("md"),
  2699  				Members:                       String("m"),
  2700  				OrganizationAdministration:    String("oa"),
  2701  				OrganizationHooks:             String("oh"),
  2702  				OrganizationPlan:              String("op"),
  2703  				OrganizationPreReceiveHooks:   String("opr"),
  2704  				OrganizationProjects:          String("op"),
  2705  				OrganizationSecrets:           String("os"),
  2706  				OrganizationSelfHostedRunners: String("osh"),
  2707  				OrganizationUserBlocking:      String("oub"),
  2708  				Packages:                      String("pkg"),
  2709  				Pages:                         String("pg"),
  2710  				PullRequests:                  String("pr"),
  2711  				RepositoryHooks:               String("rh"),
  2712  				RepositoryProjects:            String("rp"),
  2713  				RepositoryPreReceiveHooks:     String("rprh"),
  2714  				Secrets:                       String("s"),
  2715  				SecretScanningAlerts:          String("ssa"),
  2716  				SecurityEvents:                String("se"),
  2717  				SingleFile:                    String("sf"),
  2718  				Statuses:                      String("s"),
  2719  				TeamDiscussions:               String("td"),
  2720  				VulnerabilityAlerts:           String("va"),
  2721  				Workflows:                     String("w"),
  2722  			},
  2723  			CreatedAt:              &Timestamp{referenceTime},
  2724  			UpdatedAt:              &Timestamp{referenceTime},
  2725  			HasMultipleSingleFiles: Bool(false),
  2726  			SuspendedBy: &User{
  2727  				Login:           String("l"),
  2728  				ID:              Int64(1),
  2729  				URL:             String("u"),
  2730  				AvatarURL:       String("a"),
  2731  				GravatarID:      String("g"),
  2732  				Name:            String("n"),
  2733  				Company:         String("c"),
  2734  				Blog:            String("b"),
  2735  				Location:        String("l"),
  2736  				Email:           String("e"),
  2737  				Hireable:        Bool(true),
  2738  				Bio:             String("b"),
  2739  				TwitterUsername: String("t"),
  2740  				PublicRepos:     Int(1),
  2741  				Followers:       Int(1),
  2742  				Following:       Int(1),
  2743  				CreatedAt:       &Timestamp{referenceTime},
  2744  				SuspendedAt:     &Timestamp{referenceTime},
  2745  			},
  2746  			SuspendedAt: &Timestamp{referenceTime},
  2747  		},
  2748  	}
  2749  
  2750  	want := `{
  2751  		"action": "a",
  2752  		"milestone": {
  2753  			"id": 1
  2754  		},
  2755  		"changes": {
  2756  			"title": {
  2757  				"from": "TitleFrom"
  2758  			},
  2759  			"body": {
  2760  				"from": "BodyFrom"
  2761  			},
  2762  			"base": {
  2763  				"ref": {
  2764  					"from": "BaseRefFrom"
  2765  				},
  2766  				"sha": {
  2767  					"from": "BaseSHAFrom"
  2768  				}
  2769  			}
  2770  		},
  2771  		"repository": {
  2772  			"id": 1,
  2773  			"name": "n",
  2774  			"url": "s"
  2775  		},
  2776  		"sender": {
  2777  			"login": "l",
  2778  			"id": 1,
  2779  			"node_id": "n",
  2780  			"avatar_url": "a",
  2781  			"url": "u",
  2782  			"events_url": "e",
  2783  			"repos_url": "r"
  2784  		},
  2785  		"organization": {
  2786  			"name": "n",
  2787  			"company": "c",
  2788  			"blog": "b",
  2789  			"location": "loc",
  2790  			"email": "e",
  2791  			"twitter_username": "tu",
  2792  			"description": "d",
  2793  			"billing_email": "be",
  2794  			"is_verified": true,
  2795  			"has_organization_projects": true,
  2796  			"has_repository_projects": true,
  2797  			"default_repository_permission": "drp",
  2798  			"members_can_create_repositories": true,
  2799  			"members_can_create_public_repositories": false,
  2800  			"members_can_create_private_repositories": true,
  2801  			"members_can_create_internal_repositories": true,
  2802  			"members_allowed_repository_creation_type": "marct",
  2803  			"members_can_create_pages": true,
  2804  			"members_can_create_public_pages": false,
  2805  			"members_can_create_private_pages": true
  2806  		},
  2807  		"installation": {
  2808  			"id": 1,
  2809  			"node_id": "nid",
  2810  			"app_id": 1,
  2811  			"app_slug": "as",
  2812  			"target_id": 1,
  2813  			"account": {
  2814  				"login": "l",
  2815  				"id": 1,
  2816  				"avatar_url": "a",
  2817  				"gravatar_id": "g",
  2818  				"name": "n",
  2819  				"company": "c",
  2820  				"blog": "b",
  2821  				"location": "l",
  2822  				"email": "e",
  2823  				"hireable": true,
  2824  				"bio": "b",
  2825  				"twitter_username": "t",
  2826  				"public_repos": 1,
  2827  				"followers": 1,
  2828  				"following": 1,
  2829  				"created_at": ` + referenceTimeStr + `,
  2830  				"suspended_at": ` + referenceTimeStr + `,
  2831  				"url": "u"
  2832  			},
  2833  			"access_tokens_url": "atu",
  2834  			"repositories_url": "ru",
  2835  			"html_url": "hu",
  2836  			"target_type": "tt",
  2837  			"single_file_name": "sfn",
  2838  			"repository_selection": "rs",
  2839  			"events": [
  2840  				"e"
  2841  			],
  2842  			"single_file_paths": [
  2843  				"s"
  2844  			],
  2845  			"permissions": {
  2846  				"actions": "a",
  2847  				"administration": "ad",
  2848  				"checks": "c",
  2849  				"contents": "co",
  2850  				"content_references": "cr",
  2851  				"deployments": "d",
  2852  				"environments": "e",
  2853  				"issues": "i",
  2854  				"metadata": "md",
  2855  				"members": "m",
  2856  				"organization_administration": "oa",
  2857  				"organization_hooks": "oh",
  2858  				"organization_plan": "op",
  2859  				"organization_pre_receive_hooks": "opr",
  2860  				"organization_projects": "op",
  2861  				"organization_secrets": "os",
  2862  				"organization_self_hosted_runners": "osh",
  2863  				"organization_user_blocking": "oub",
  2864  				"packages": "pkg",
  2865  				"pages": "pg",
  2866  				"pull_requests": "pr",
  2867  				"repository_hooks": "rh",
  2868  				"repository_projects": "rp",
  2869  				"repository_pre_receive_hooks": "rprh",
  2870  				"secrets": "s",
  2871  				"secret_scanning_alerts": "ssa",
  2872  				"security_events": "se",
  2873  				"single_file": "sf",
  2874  				"statuses": "s",
  2875  				"team_discussions": "td",
  2876  				"vulnerability_alerts": "va",
  2877  				"workflows": "w"
  2878  			},
  2879  			"created_at": ` + referenceTimeStr + `,
  2880  			"updated_at": ` + referenceTimeStr + `,
  2881  			"has_multiple_single_files": false,
  2882  			"suspended_by": {
  2883  				"login": "l",
  2884  				"id": 1,
  2885  				"avatar_url": "a",
  2886  				"gravatar_id": "g",
  2887  				"name": "n",
  2888  				"company": "c",
  2889  				"blog": "b",
  2890  				"location": "l",
  2891  				"email": "e",
  2892  				"hireable": true,
  2893  				"bio": "b",
  2894  				"twitter_username": "t",
  2895  				"public_repos": 1,
  2896  				"followers": 1,
  2897  				"following": 1,
  2898  				"created_at": ` + referenceTimeStr + `,
  2899  				"suspended_at": ` + referenceTimeStr + `,
  2900  				"url": "u"
  2901  			},
  2902  			"suspended_at": ` + referenceTimeStr + `
  2903  		}
  2904  	}`
  2905  
  2906  	testJSONMarshal(t, u, want)
  2907  }
  2908  
  2909  func TestPublicEvent_Marshal(t *testing.T) {
  2910  	testJSONMarshal(t, &PublicEvent{}, "{}")
  2911  
  2912  	u := &PublicEvent{
  2913  		Repo: &Repository{
  2914  			ID:   Int64(1),
  2915  			URL:  String("s"),
  2916  			Name: String("n"),
  2917  		},
  2918  		Sender: &User{
  2919  			Login:     String("l"),
  2920  			ID:        Int64(1),
  2921  			NodeID:    String("n"),
  2922  			URL:       String("u"),
  2923  			ReposURL:  String("r"),
  2924  			EventsURL: String("e"),
  2925  			AvatarURL: String("a"),
  2926  		},
  2927  		Installation: &Installation{
  2928  			ID:       Int64(1),
  2929  			NodeID:   String("nid"),
  2930  			AppID:    Int64(1),
  2931  			AppSlug:  String("as"),
  2932  			TargetID: Int64(1),
  2933  			Account: &User{
  2934  				Login:           String("l"),
  2935  				ID:              Int64(1),
  2936  				URL:             String("u"),
  2937  				AvatarURL:       String("a"),
  2938  				GravatarID:      String("g"),
  2939  				Name:            String("n"),
  2940  				Company:         String("c"),
  2941  				Blog:            String("b"),
  2942  				Location:        String("l"),
  2943  				Email:           String("e"),
  2944  				Hireable:        Bool(true),
  2945  				Bio:             String("b"),
  2946  				TwitterUsername: String("t"),
  2947  				PublicRepos:     Int(1),
  2948  				Followers:       Int(1),
  2949  				Following:       Int(1),
  2950  				CreatedAt:       &Timestamp{referenceTime},
  2951  				SuspendedAt:     &Timestamp{referenceTime},
  2952  			},
  2953  			AccessTokensURL:     String("atu"),
  2954  			RepositoriesURL:     String("ru"),
  2955  			HTMLURL:             String("hu"),
  2956  			TargetType:          String("tt"),
  2957  			SingleFileName:      String("sfn"),
  2958  			RepositorySelection: String("rs"),
  2959  			Events:              []string{"e"},
  2960  			SingleFilePaths:     []string{"s"},
  2961  			Permissions: &InstallationPermissions{
  2962  				Actions:                       String("a"),
  2963  				Administration:                String("ad"),
  2964  				Checks:                        String("c"),
  2965  				Contents:                      String("co"),
  2966  				ContentReferences:             String("cr"),
  2967  				Deployments:                   String("d"),
  2968  				Environments:                  String("e"),
  2969  				Issues:                        String("i"),
  2970  				Metadata:                      String("md"),
  2971  				Members:                       String("m"),
  2972  				OrganizationAdministration:    String("oa"),
  2973  				OrganizationHooks:             String("oh"),
  2974  				OrganizationPlan:              String("op"),
  2975  				OrganizationPreReceiveHooks:   String("opr"),
  2976  				OrganizationProjects:          String("op"),
  2977  				OrganizationSecrets:           String("os"),
  2978  				OrganizationSelfHostedRunners: String("osh"),
  2979  				OrganizationUserBlocking:      String("oub"),
  2980  				Packages:                      String("pkg"),
  2981  				Pages:                         String("pg"),
  2982  				PullRequests:                  String("pr"),
  2983  				RepositoryHooks:               String("rh"),
  2984  				RepositoryProjects:            String("rp"),
  2985  				RepositoryPreReceiveHooks:     String("rprh"),
  2986  				Secrets:                       String("s"),
  2987  				SecretScanningAlerts:          String("ssa"),
  2988  				SecurityEvents:                String("se"),
  2989  				SingleFile:                    String("sf"),
  2990  				Statuses:                      String("s"),
  2991  				TeamDiscussions:               String("td"),
  2992  				VulnerabilityAlerts:           String("va"),
  2993  				Workflows:                     String("w"),
  2994  			},
  2995  			CreatedAt:              &Timestamp{referenceTime},
  2996  			UpdatedAt:              &Timestamp{referenceTime},
  2997  			HasMultipleSingleFiles: Bool(false),
  2998  			SuspendedBy: &User{
  2999  				Login:           String("l"),
  3000  				ID:              Int64(1),
  3001  				URL:             String("u"),
  3002  				AvatarURL:       String("a"),
  3003  				GravatarID:      String("g"),
  3004  				Name:            String("n"),
  3005  				Company:         String("c"),
  3006  				Blog:            String("b"),
  3007  				Location:        String("l"),
  3008  				Email:           String("e"),
  3009  				Hireable:        Bool(true),
  3010  				Bio:             String("b"),
  3011  				TwitterUsername: String("t"),
  3012  				PublicRepos:     Int(1),
  3013  				Followers:       Int(1),
  3014  				Following:       Int(1),
  3015  				CreatedAt:       &Timestamp{referenceTime},
  3016  				SuspendedAt:     &Timestamp{referenceTime},
  3017  			},
  3018  			SuspendedAt: &Timestamp{referenceTime},
  3019  		},
  3020  	}
  3021  
  3022  	want := `{
  3023  		"repository": {
  3024  			"id": 1,
  3025  			"name": "n",
  3026  			"url": "s"
  3027  		},
  3028  		"sender": {
  3029  			"login": "l",
  3030  			"id": 1,
  3031  			"node_id": "n",
  3032  			"avatar_url": "a",
  3033  			"url": "u",
  3034  			"events_url": "e",
  3035  			"repos_url": "r"
  3036  		},
  3037  		"installation": {
  3038  			"id": 1,
  3039  			"node_id": "nid",
  3040  			"app_id": 1,
  3041  			"app_slug": "as",
  3042  			"target_id": 1,
  3043  			"account": {
  3044  				"login": "l",
  3045  				"id": 1,
  3046  				"avatar_url": "a",
  3047  				"gravatar_id": "g",
  3048  				"name": "n",
  3049  				"company": "c",
  3050  				"blog": "b",
  3051  				"location": "l",
  3052  				"email": "e",
  3053  				"hireable": true,
  3054  				"bio": "b",
  3055  				"twitter_username": "t",
  3056  				"public_repos": 1,
  3057  				"followers": 1,
  3058  				"following": 1,
  3059  				"created_at": ` + referenceTimeStr + `,
  3060  				"suspended_at": ` + referenceTimeStr + `,
  3061  				"url": "u"
  3062  			},
  3063  			"access_tokens_url": "atu",
  3064  			"repositories_url": "ru",
  3065  			"html_url": "hu",
  3066  			"target_type": "tt",
  3067  			"single_file_name": "sfn",
  3068  			"repository_selection": "rs",
  3069  			"events": [
  3070  				"e"
  3071  			],
  3072  			"single_file_paths": [
  3073  				"s"
  3074  			],
  3075  			"permissions": {
  3076  				"actions": "a",
  3077  				"administration": "ad",
  3078  				"checks": "c",
  3079  				"contents": "co",
  3080  				"content_references": "cr",
  3081  				"deployments": "d",
  3082  				"environments": "e",
  3083  				"issues": "i",
  3084  				"metadata": "md",
  3085  				"members": "m",
  3086  				"organization_administration": "oa",
  3087  				"organization_hooks": "oh",
  3088  				"organization_plan": "op",
  3089  				"organization_pre_receive_hooks": "opr",
  3090  				"organization_projects": "op",
  3091  				"organization_secrets": "os",
  3092  				"organization_self_hosted_runners": "osh",
  3093  				"organization_user_blocking": "oub",
  3094  				"packages": "pkg",
  3095  				"pages": "pg",
  3096  				"pull_requests": "pr",
  3097  				"repository_hooks": "rh",
  3098  				"repository_projects": "rp",
  3099  				"repository_pre_receive_hooks": "rprh",
  3100  				"secrets": "s",
  3101  				"secret_scanning_alerts": "ssa",
  3102  				"security_events": "se",
  3103  				"single_file": "sf",
  3104  				"statuses": "s",
  3105  				"team_discussions": "td",
  3106  				"vulnerability_alerts": "va",
  3107  				"workflows": "w"
  3108  			},
  3109  			"created_at": ` + referenceTimeStr + `,
  3110  			"updated_at": ` + referenceTimeStr + `,
  3111  			"has_multiple_single_files": false,
  3112  			"suspended_by": {
  3113  				"login": "l",
  3114  				"id": 1,
  3115  				"avatar_url": "a",
  3116  				"gravatar_id": "g",
  3117  				"name": "n",
  3118  				"company": "c",
  3119  				"blog": "b",
  3120  				"location": "l",
  3121  				"email": "e",
  3122  				"hireable": true,
  3123  				"bio": "b",
  3124  				"twitter_username": "t",
  3125  				"public_repos": 1,
  3126  				"followers": 1,
  3127  				"following": 1,
  3128  				"created_at": ` + referenceTimeStr + `,
  3129  				"suspended_at": ` + referenceTimeStr + `,
  3130  				"url": "u"
  3131  			},
  3132  			"suspended_at": ` + referenceTimeStr + `
  3133  		}
  3134  	}`
  3135  
  3136  	testJSONMarshal(t, u, want)
  3137  }
  3138  
  3139  func TestPullRequestReviewEvent_Marshal(t *testing.T) {
  3140  	testJSONMarshal(t, &PullRequestReviewEvent{}, "{}")
  3141  
  3142  	u := &PullRequestReviewEvent{
  3143  		Action:      String("a"),
  3144  		Review:      &PullRequestReview{ID: Int64(1)},
  3145  		PullRequest: &PullRequest{ID: Int64(1)},
  3146  		Repo: &Repository{
  3147  			ID:   Int64(1),
  3148  			URL:  String("s"),
  3149  			Name: String("n"),
  3150  		},
  3151  		Sender: &User{
  3152  			Login:     String("l"),
  3153  			ID:        Int64(1),
  3154  			NodeID:    String("n"),
  3155  			URL:       String("u"),
  3156  			ReposURL:  String("r"),
  3157  			EventsURL: String("e"),
  3158  			AvatarURL: String("a"),
  3159  		},
  3160  		Installation: &Installation{
  3161  			ID:       Int64(1),
  3162  			NodeID:   String("nid"),
  3163  			AppID:    Int64(1),
  3164  			AppSlug:  String("as"),
  3165  			TargetID: Int64(1),
  3166  			Account: &User{
  3167  				Login:           String("l"),
  3168  				ID:              Int64(1),
  3169  				URL:             String("u"),
  3170  				AvatarURL:       String("a"),
  3171  				GravatarID:      String("g"),
  3172  				Name:            String("n"),
  3173  				Company:         String("c"),
  3174  				Blog:            String("b"),
  3175  				Location:        String("l"),
  3176  				Email:           String("e"),
  3177  				Hireable:        Bool(true),
  3178  				Bio:             String("b"),
  3179  				TwitterUsername: String("t"),
  3180  				PublicRepos:     Int(1),
  3181  				Followers:       Int(1),
  3182  				Following:       Int(1),
  3183  				CreatedAt:       &Timestamp{referenceTime},
  3184  				SuspendedAt:     &Timestamp{referenceTime},
  3185  			},
  3186  			AccessTokensURL:     String("atu"),
  3187  			RepositoriesURL:     String("ru"),
  3188  			HTMLURL:             String("hu"),
  3189  			TargetType:          String("tt"),
  3190  			SingleFileName:      String("sfn"),
  3191  			RepositorySelection: String("rs"),
  3192  			Events:              []string{"e"},
  3193  			SingleFilePaths:     []string{"s"},
  3194  			Permissions: &InstallationPermissions{
  3195  				Actions:                       String("a"),
  3196  				Administration:                String("ad"),
  3197  				Checks:                        String("c"),
  3198  				Contents:                      String("co"),
  3199  				ContentReferences:             String("cr"),
  3200  				Deployments:                   String("d"),
  3201  				Environments:                  String("e"),
  3202  				Issues:                        String("i"),
  3203  				Metadata:                      String("md"),
  3204  				Members:                       String("m"),
  3205  				OrganizationAdministration:    String("oa"),
  3206  				OrganizationHooks:             String("oh"),
  3207  				OrganizationPlan:              String("op"),
  3208  				OrganizationPreReceiveHooks:   String("opr"),
  3209  				OrganizationProjects:          String("op"),
  3210  				OrganizationSecrets:           String("os"),
  3211  				OrganizationSelfHostedRunners: String("osh"),
  3212  				OrganizationUserBlocking:      String("oub"),
  3213  				Packages:                      String("pkg"),
  3214  				Pages:                         String("pg"),
  3215  				PullRequests:                  String("pr"),
  3216  				RepositoryHooks:               String("rh"),
  3217  				RepositoryProjects:            String("rp"),
  3218  				RepositoryPreReceiveHooks:     String("rprh"),
  3219  				Secrets:                       String("s"),
  3220  				SecretScanningAlerts:          String("ssa"),
  3221  				SecurityEvents:                String("se"),
  3222  				SingleFile:                    String("sf"),
  3223  				Statuses:                      String("s"),
  3224  				TeamDiscussions:               String("td"),
  3225  				VulnerabilityAlerts:           String("va"),
  3226  				Workflows:                     String("w"),
  3227  			},
  3228  			CreatedAt:              &Timestamp{referenceTime},
  3229  			UpdatedAt:              &Timestamp{referenceTime},
  3230  			HasMultipleSingleFiles: Bool(false),
  3231  			SuspendedBy: &User{
  3232  				Login:           String("l"),
  3233  				ID:              Int64(1),
  3234  				URL:             String("u"),
  3235  				AvatarURL:       String("a"),
  3236  				GravatarID:      String("g"),
  3237  				Name:            String("n"),
  3238  				Company:         String("c"),
  3239  				Blog:            String("b"),
  3240  				Location:        String("l"),
  3241  				Email:           String("e"),
  3242  				Hireable:        Bool(true),
  3243  				Bio:             String("b"),
  3244  				TwitterUsername: String("t"),
  3245  				PublicRepos:     Int(1),
  3246  				Followers:       Int(1),
  3247  				Following:       Int(1),
  3248  				CreatedAt:       &Timestamp{referenceTime},
  3249  				SuspendedAt:     &Timestamp{referenceTime},
  3250  			},
  3251  			SuspendedAt: &Timestamp{referenceTime},
  3252  		},
  3253  		Organization: &Organization{
  3254  			BillingEmail:                         String("be"),
  3255  			Blog:                                 String("b"),
  3256  			Company:                              String("c"),
  3257  			Email:                                String("e"),
  3258  			TwitterUsername:                      String("tu"),
  3259  			Location:                             String("loc"),
  3260  			Name:                                 String("n"),
  3261  			Description:                          String("d"),
  3262  			IsVerified:                           Bool(true),
  3263  			HasOrganizationProjects:              Bool(true),
  3264  			HasRepositoryProjects:                Bool(true),
  3265  			DefaultRepoPermission:                String("drp"),
  3266  			MembersCanCreateRepos:                Bool(true),
  3267  			MembersCanCreateInternalRepos:        Bool(true),
  3268  			MembersCanCreatePrivateRepos:         Bool(true),
  3269  			MembersCanCreatePublicRepos:          Bool(false),
  3270  			MembersAllowedRepositoryCreationType: String("marct"),
  3271  			MembersCanCreatePages:                Bool(true),
  3272  			MembersCanCreatePublicPages:          Bool(false),
  3273  			MembersCanCreatePrivatePages:         Bool(true),
  3274  		},
  3275  	}
  3276  
  3277  	want := `{
  3278  		"action": "a",
  3279  		"review": {
  3280  			"id": 1
  3281  		},
  3282  		"pull_request": {
  3283  			"id": 1
  3284  		},
  3285  		"repository": {
  3286  			"id": 1,
  3287  			"name": "n",
  3288  			"url": "s"
  3289  		},
  3290  		"sender": {
  3291  			"login": "l",
  3292  			"id": 1,
  3293  			"node_id": "n",
  3294  			"avatar_url": "a",
  3295  			"url": "u",
  3296  			"events_url": "e",
  3297  			"repos_url": "r"
  3298  		},
  3299  		"installation": {
  3300  			"id": 1,
  3301  			"node_id": "nid",
  3302  			"app_id": 1,
  3303  			"app_slug": "as",
  3304  			"target_id": 1,
  3305  			"account": {
  3306  				"login": "l",
  3307  				"id": 1,
  3308  				"avatar_url": "a",
  3309  				"gravatar_id": "g",
  3310  				"name": "n",
  3311  				"company": "c",
  3312  				"blog": "b",
  3313  				"location": "l",
  3314  				"email": "e",
  3315  				"hireable": true,
  3316  				"bio": "b",
  3317  				"twitter_username": "t",
  3318  				"public_repos": 1,
  3319  				"followers": 1,
  3320  				"following": 1,
  3321  				"created_at": ` + referenceTimeStr + `,
  3322  				"suspended_at": ` + referenceTimeStr + `,
  3323  				"url": "u"
  3324  			},
  3325  			"access_tokens_url": "atu",
  3326  			"repositories_url": "ru",
  3327  			"html_url": "hu",
  3328  			"target_type": "tt",
  3329  			"single_file_name": "sfn",
  3330  			"repository_selection": "rs",
  3331  			"events": [
  3332  				"e"
  3333  			],
  3334  			"single_file_paths": [
  3335  				"s"
  3336  			],
  3337  			"permissions": {
  3338  				"actions": "a",
  3339  				"administration": "ad",
  3340  				"checks": "c",
  3341  				"contents": "co",
  3342  				"content_references": "cr",
  3343  				"deployments": "d",
  3344  				"environments": "e",
  3345  				"issues": "i",
  3346  				"metadata": "md",
  3347  				"members": "m",
  3348  				"organization_administration": "oa",
  3349  				"organization_hooks": "oh",
  3350  				"organization_plan": "op",
  3351  				"organization_pre_receive_hooks": "opr",
  3352  				"organization_projects": "op",
  3353  				"organization_secrets": "os",
  3354  				"organization_self_hosted_runners": "osh",
  3355  				"organization_user_blocking": "oub",
  3356  				"packages": "pkg",
  3357  				"pages": "pg",
  3358  				"pull_requests": "pr",
  3359  				"repository_hooks": "rh",
  3360  				"repository_projects": "rp",
  3361  				"repository_pre_receive_hooks": "rprh",
  3362  				"secrets": "s",
  3363  				"secret_scanning_alerts": "ssa",
  3364  				"security_events": "se",
  3365  				"single_file": "sf",
  3366  				"statuses": "s",
  3367  				"team_discussions": "td",
  3368  				"vulnerability_alerts": "va",
  3369  				"workflows": "w"
  3370  			},
  3371  			"created_at": ` + referenceTimeStr + `,
  3372  			"updated_at": ` + referenceTimeStr + `,
  3373  			"has_multiple_single_files": false,
  3374  			"suspended_by": {
  3375  				"login": "l",
  3376  				"id": 1,
  3377  				"avatar_url": "a",
  3378  				"gravatar_id": "g",
  3379  				"name": "n",
  3380  				"company": "c",
  3381  				"blog": "b",
  3382  				"location": "l",
  3383  				"email": "e",
  3384  				"hireable": true,
  3385  				"bio": "b",
  3386  				"twitter_username": "t",
  3387  				"public_repos": 1,
  3388  				"followers": 1,
  3389  				"following": 1,
  3390  				"created_at": ` + referenceTimeStr + `,
  3391  				"suspended_at": ` + referenceTimeStr + `,
  3392  				"url": "u"
  3393  			},
  3394  			"suspended_at": ` + referenceTimeStr + `
  3395  		},
  3396  		"organization": {
  3397  			"name": "n",
  3398  			"company": "c",
  3399  			"blog": "b",
  3400  			"location": "loc",
  3401  			"email": "e",
  3402  			"twitter_username": "tu",
  3403  			"description": "d",
  3404  			"billing_email": "be",
  3405  			"is_verified": true,
  3406  			"has_organization_projects": true,
  3407  			"has_repository_projects": true,
  3408  			"default_repository_permission": "drp",
  3409  			"members_can_create_repositories": true,
  3410  			"members_can_create_public_repositories": false,
  3411  			"members_can_create_private_repositories": true,
  3412  			"members_can_create_internal_repositories": true,
  3413  			"members_allowed_repository_creation_type": "marct",
  3414  			"members_can_create_pages": true,
  3415  			"members_can_create_public_pages": false,
  3416  			"members_can_create_private_pages": true
  3417  		}
  3418  	}`
  3419  
  3420  	testJSONMarshal(t, u, want)
  3421  }
  3422  
  3423  func TestPushEvent_Marshal(t *testing.T) {
  3424  	testJSONMarshal(t, &PushEvent{}, "{}")
  3425  
  3426  	u := &PushEvent{
  3427  		PushID: Int64(1),
  3428  		Head:   String("h"),
  3429  		Ref:    String("ref"),
  3430  		Size:   Int(1),
  3431  		Commits: []*HeadCommit{
  3432  			{ID: String("id")},
  3433  		},
  3434  		Before:       String("b"),
  3435  		DistinctSize: Int(1),
  3436  		After:        String("a"),
  3437  		Created:      Bool(true),
  3438  		Deleted:      Bool(true),
  3439  		Forced:       Bool(true),
  3440  		BaseRef:      String("a"),
  3441  		Compare:      String("a"),
  3442  		Repo:         &PushEventRepository{ID: Int64(1)},
  3443  		HeadCommit:   &HeadCommit{ID: String("id")},
  3444  		Pusher: &User{
  3445  			Login:     String("l"),
  3446  			ID:        Int64(1),
  3447  			NodeID:    String("n"),
  3448  			URL:       String("u"),
  3449  			ReposURL:  String("r"),
  3450  			EventsURL: String("e"),
  3451  			AvatarURL: String("a"),
  3452  		},
  3453  		Sender: &User{
  3454  			Login:     String("l"),
  3455  			ID:        Int64(1),
  3456  			NodeID:    String("n"),
  3457  			URL:       String("u"),
  3458  			ReposURL:  String("r"),
  3459  			EventsURL: String("e"),
  3460  			AvatarURL: String("a"),
  3461  		},
  3462  		Installation: &Installation{
  3463  			ID:       Int64(1),
  3464  			NodeID:   String("nid"),
  3465  			AppID:    Int64(1),
  3466  			AppSlug:  String("as"),
  3467  			TargetID: Int64(1),
  3468  			Account: &User{
  3469  				Login:           String("l"),
  3470  				ID:              Int64(1),
  3471  				URL:             String("u"),
  3472  				AvatarURL:       String("a"),
  3473  				GravatarID:      String("g"),
  3474  				Name:            String("n"),
  3475  				Company:         String("c"),
  3476  				Blog:            String("b"),
  3477  				Location:        String("l"),
  3478  				Email:           String("e"),
  3479  				Hireable:        Bool(true),
  3480  				Bio:             String("b"),
  3481  				TwitterUsername: String("t"),
  3482  				PublicRepos:     Int(1),
  3483  				Followers:       Int(1),
  3484  				Following:       Int(1),
  3485  				CreatedAt:       &Timestamp{referenceTime},
  3486  				SuspendedAt:     &Timestamp{referenceTime},
  3487  			},
  3488  			AccessTokensURL:     String("atu"),
  3489  			RepositoriesURL:     String("ru"),
  3490  			HTMLURL:             String("hu"),
  3491  			TargetType:          String("tt"),
  3492  			SingleFileName:      String("sfn"),
  3493  			RepositorySelection: String("rs"),
  3494  			Events:              []string{"e"},
  3495  			SingleFilePaths:     []string{"s"},
  3496  			Permissions: &InstallationPermissions{
  3497  				Actions:                       String("a"),
  3498  				Administration:                String("ad"),
  3499  				Checks:                        String("c"),
  3500  				Contents:                      String("co"),
  3501  				ContentReferences:             String("cr"),
  3502  				Deployments:                   String("d"),
  3503  				Environments:                  String("e"),
  3504  				Issues:                        String("i"),
  3505  				Metadata:                      String("md"),
  3506  				Members:                       String("m"),
  3507  				OrganizationAdministration:    String("oa"),
  3508  				OrganizationHooks:             String("oh"),
  3509  				OrganizationPlan:              String("op"),
  3510  				OrganizationPreReceiveHooks:   String("opr"),
  3511  				OrganizationProjects:          String("op"),
  3512  				OrganizationSecrets:           String("os"),
  3513  				OrganizationSelfHostedRunners: String("osh"),
  3514  				OrganizationUserBlocking:      String("oub"),
  3515  				Packages:                      String("pkg"),
  3516  				Pages:                         String("pg"),
  3517  				PullRequests:                  String("pr"),
  3518  				RepositoryHooks:               String("rh"),
  3519  				RepositoryProjects:            String("rp"),
  3520  				RepositoryPreReceiveHooks:     String("rprh"),
  3521  				Secrets:                       String("s"),
  3522  				SecretScanningAlerts:          String("ssa"),
  3523  				SecurityEvents:                String("se"),
  3524  				SingleFile:                    String("sf"),
  3525  				Statuses:                      String("s"),
  3526  				TeamDiscussions:               String("td"),
  3527  				VulnerabilityAlerts:           String("va"),
  3528  				Workflows:                     String("w"),
  3529  			},
  3530  			CreatedAt:              &Timestamp{referenceTime},
  3531  			UpdatedAt:              &Timestamp{referenceTime},
  3532  			HasMultipleSingleFiles: Bool(false),
  3533  			SuspendedBy: &User{
  3534  				Login:           String("l"),
  3535  				ID:              Int64(1),
  3536  				URL:             String("u"),
  3537  				AvatarURL:       String("a"),
  3538  				GravatarID:      String("g"),
  3539  				Name:            String("n"),
  3540  				Company:         String("c"),
  3541  				Blog:            String("b"),
  3542  				Location:        String("l"),
  3543  				Email:           String("e"),
  3544  				Hireable:        Bool(true),
  3545  				Bio:             String("b"),
  3546  				TwitterUsername: String("t"),
  3547  				PublicRepos:     Int(1),
  3548  				Followers:       Int(1),
  3549  				Following:       Int(1),
  3550  				CreatedAt:       &Timestamp{referenceTime},
  3551  				SuspendedAt:     &Timestamp{referenceTime},
  3552  			},
  3553  			SuspendedAt: &Timestamp{referenceTime},
  3554  		},
  3555  		Organization: &Organization{
  3556  			BillingEmail:                         String("be"),
  3557  			Blog:                                 String("b"),
  3558  			Company:                              String("c"),
  3559  			Email:                                String("e"),
  3560  			TwitterUsername:                      String("tu"),
  3561  			Location:                             String("loc"),
  3562  			Name:                                 String("n"),
  3563  			Description:                          String("d"),
  3564  			IsVerified:                           Bool(true),
  3565  			HasOrganizationProjects:              Bool(true),
  3566  			HasRepositoryProjects:                Bool(true),
  3567  			DefaultRepoPermission:                String("drp"),
  3568  			MembersCanCreateRepos:                Bool(true),
  3569  			MembersCanCreateInternalRepos:        Bool(true),
  3570  			MembersCanCreatePrivateRepos:         Bool(true),
  3571  			MembersCanCreatePublicRepos:          Bool(false),
  3572  			MembersAllowedRepositoryCreationType: String("marct"),
  3573  			MembersCanCreatePages:                Bool(true),
  3574  			MembersCanCreatePublicPages:          Bool(false),
  3575  			MembersCanCreatePrivatePages:         Bool(true),
  3576  		},
  3577  	}
  3578  
  3579  	want := `{
  3580  		"push_id": 1,
  3581  		"head": "h",
  3582  		"ref": "ref",
  3583  		"size": 1,
  3584  		"commits": [
  3585  			{
  3586  				"id": "id"
  3587  			}
  3588  		],
  3589  		"before": "b",
  3590  		"distinct_size": 1,
  3591  		"after": "a",
  3592  		"created": true,
  3593  		"deleted": true,
  3594  		"forced": true,
  3595  		"base_ref": "a",
  3596  		"compare": "a",
  3597  		"repository": {
  3598  			"id": 1
  3599  		},
  3600  		"head_commit": {
  3601  			"id": "id"
  3602  		},
  3603  		"pusher": {
  3604  			"login": "l",
  3605  			"id": 1,
  3606  			"node_id": "n",
  3607  			"avatar_url": "a",
  3608  			"url": "u",
  3609  			"events_url": "e",
  3610  			"repos_url": "r"
  3611  		},
  3612  		"sender": {
  3613  			"login": "l",
  3614  			"id": 1,
  3615  			"node_id": "n",
  3616  			"avatar_url": "a",
  3617  			"url": "u",
  3618  			"events_url": "e",
  3619  			"repos_url": "r"
  3620  		},
  3621  		"installation": {
  3622  			"id": 1,
  3623  			"node_id": "nid",
  3624  			"app_id": 1,
  3625  			"app_slug": "as",
  3626  			"target_id": 1,
  3627  			"account": {
  3628  				"login": "l",
  3629  				"id": 1,
  3630  				"avatar_url": "a",
  3631  				"gravatar_id": "g",
  3632  				"name": "n",
  3633  				"company": "c",
  3634  				"blog": "b",
  3635  				"location": "l",
  3636  				"email": "e",
  3637  				"hireable": true,
  3638  				"bio": "b",
  3639  				"twitter_username": "t",
  3640  				"public_repos": 1,
  3641  				"followers": 1,
  3642  				"following": 1,
  3643  				"created_at": ` + referenceTimeStr + `,
  3644  				"suspended_at": ` + referenceTimeStr + `,
  3645  				"url": "u"
  3646  			},
  3647  			"access_tokens_url": "atu",
  3648  			"repositories_url": "ru",
  3649  			"html_url": "hu",
  3650  			"target_type": "tt",
  3651  			"single_file_name": "sfn",
  3652  			"repository_selection": "rs",
  3653  			"events": [
  3654  				"e"
  3655  			],
  3656  			"single_file_paths": [
  3657  				"s"
  3658  			],
  3659  			"permissions": {
  3660  				"actions": "a",
  3661  				"administration": "ad",
  3662  				"checks": "c",
  3663  				"contents": "co",
  3664  				"content_references": "cr",
  3665  				"deployments": "d",
  3666  				"environments": "e",
  3667  				"issues": "i",
  3668  				"metadata": "md",
  3669  				"members": "m",
  3670  				"organization_administration": "oa",
  3671  				"organization_hooks": "oh",
  3672  				"organization_plan": "op",
  3673  				"organization_pre_receive_hooks": "opr",
  3674  				"organization_projects": "op",
  3675  				"organization_secrets": "os",
  3676  				"organization_self_hosted_runners": "osh",
  3677  				"organization_user_blocking": "oub",
  3678  				"packages": "pkg",
  3679  				"pages": "pg",
  3680  				"pull_requests": "pr",
  3681  				"repository_hooks": "rh",
  3682  				"repository_projects": "rp",
  3683  				"repository_pre_receive_hooks": "rprh",
  3684  				"secrets": "s",
  3685  				"secret_scanning_alerts": "ssa",
  3686  				"security_events": "se",
  3687  				"single_file": "sf",
  3688  				"statuses": "s",
  3689  				"team_discussions": "td",
  3690  				"vulnerability_alerts": "va",
  3691  				"workflows": "w"
  3692  			},
  3693  			"created_at": ` + referenceTimeStr + `,
  3694  			"updated_at": ` + referenceTimeStr + `,
  3695  			"has_multiple_single_files": false,
  3696  			"suspended_by": {
  3697  				"login": "l",
  3698  				"id": 1,
  3699  				"avatar_url": "a",
  3700  				"gravatar_id": "g",
  3701  				"name": "n",
  3702  				"company": "c",
  3703  				"blog": "b",
  3704  				"location": "l",
  3705  				"email": "e",
  3706  				"hireable": true,
  3707  				"bio": "b",
  3708  				"twitter_username": "t",
  3709  				"public_repos": 1,
  3710  				"followers": 1,
  3711  				"following": 1,
  3712  				"created_at": ` + referenceTimeStr + `,
  3713  				"suspended_at": ` + referenceTimeStr + `,
  3714  				"url": "u"
  3715  			},
  3716  			"suspended_at": ` + referenceTimeStr + `
  3717  		},
  3718  		"organization": {
  3719  			"name": "n",
  3720  			"company": "c",
  3721  			"blog": "b",
  3722  			"location": "loc",
  3723  			"email": "e",
  3724  			"twitter_username": "tu",
  3725  			"description": "d",
  3726  			"billing_email": "be",
  3727  			"is_verified": true,
  3728  			"has_organization_projects": true,
  3729  			"has_repository_projects": true,
  3730  			"default_repository_permission": "drp",
  3731  			"members_can_create_repositories": true,
  3732  			"members_can_create_public_repositories": false,
  3733  			"members_can_create_private_repositories": true,
  3734  			"members_can_create_internal_repositories": true,
  3735  			"members_allowed_repository_creation_type": "marct",
  3736  			"members_can_create_pages": true,
  3737  			"members_can_create_public_pages": false,
  3738  			"members_can_create_private_pages": true
  3739  		}
  3740  	}`
  3741  
  3742  	testJSONMarshal(t, u, want)
  3743  }
  3744  
  3745  func TestStatusEvent_Marshal(t *testing.T) {
  3746  	testJSONMarshal(t, &StatusEvent{}, "{}")
  3747  
  3748  	u := &StatusEvent{
  3749  		SHA:         String("sha"),
  3750  		State:       String("s"),
  3751  		Description: String("d"),
  3752  		TargetURL:   String("turl"),
  3753  		Branches: []*Branch{
  3754  			{
  3755  				Name:      String("n"),
  3756  				Commit:    &RepositoryCommit{NodeID: String("nid")},
  3757  				Protected: Bool(false),
  3758  			},
  3759  		},
  3760  		ID:        Int64(1),
  3761  		Name:      String("n"),
  3762  		Context:   String("c"),
  3763  		Commit:    &RepositoryCommit{NodeID: String("nid")},
  3764  		CreatedAt: &Timestamp{referenceTime},
  3765  		UpdatedAt: &Timestamp{referenceTime},
  3766  		Sender: &User{
  3767  			Login:     String("l"),
  3768  			ID:        Int64(1),
  3769  			NodeID:    String("n"),
  3770  			URL:       String("u"),
  3771  			ReposURL:  String("r"),
  3772  			EventsURL: String("e"),
  3773  			AvatarURL: String("a"),
  3774  		},
  3775  		Installation: &Installation{
  3776  			ID:       Int64(1),
  3777  			NodeID:   String("nid"),
  3778  			AppID:    Int64(1),
  3779  			AppSlug:  String("as"),
  3780  			TargetID: Int64(1),
  3781  			Account: &User{
  3782  				Login:           String("l"),
  3783  				ID:              Int64(1),
  3784  				URL:             String("u"),
  3785  				AvatarURL:       String("a"),
  3786  				GravatarID:      String("g"),
  3787  				Name:            String("n"),
  3788  				Company:         String("c"),
  3789  				Blog:            String("b"),
  3790  				Location:        String("l"),
  3791  				Email:           String("e"),
  3792  				Hireable:        Bool(true),
  3793  				Bio:             String("b"),
  3794  				TwitterUsername: String("t"),
  3795  				PublicRepos:     Int(1),
  3796  				Followers:       Int(1),
  3797  				Following:       Int(1),
  3798  				CreatedAt:       &Timestamp{referenceTime},
  3799  				SuspendedAt:     &Timestamp{referenceTime},
  3800  			},
  3801  			AccessTokensURL:     String("atu"),
  3802  			RepositoriesURL:     String("ru"),
  3803  			HTMLURL:             String("hu"),
  3804  			TargetType:          String("tt"),
  3805  			SingleFileName:      String("sfn"),
  3806  			RepositorySelection: String("rs"),
  3807  			Events:              []string{"e"},
  3808  			SingleFilePaths:     []string{"s"},
  3809  			Permissions: &InstallationPermissions{
  3810  				Actions:                       String("a"),
  3811  				Administration:                String("ad"),
  3812  				Checks:                        String("c"),
  3813  				Contents:                      String("co"),
  3814  				ContentReferences:             String("cr"),
  3815  				Deployments:                   String("d"),
  3816  				Environments:                  String("e"),
  3817  				Issues:                        String("i"),
  3818  				Metadata:                      String("md"),
  3819  				Members:                       String("m"),
  3820  				OrganizationAdministration:    String("oa"),
  3821  				OrganizationHooks:             String("oh"),
  3822  				OrganizationPlan:              String("op"),
  3823  				OrganizationPreReceiveHooks:   String("opr"),
  3824  				OrganizationProjects:          String("op"),
  3825  				OrganizationSecrets:           String("os"),
  3826  				OrganizationSelfHostedRunners: String("osh"),
  3827  				OrganizationUserBlocking:      String("oub"),
  3828  				Packages:                      String("pkg"),
  3829  				Pages:                         String("pg"),
  3830  				PullRequests:                  String("pr"),
  3831  				RepositoryHooks:               String("rh"),
  3832  				RepositoryProjects:            String("rp"),
  3833  				RepositoryPreReceiveHooks:     String("rprh"),
  3834  				Secrets:                       String("s"),
  3835  				SecretScanningAlerts:          String("ssa"),
  3836  				SecurityEvents:                String("se"),
  3837  				SingleFile:                    String("sf"),
  3838  				Statuses:                      String("s"),
  3839  				TeamDiscussions:               String("td"),
  3840  				VulnerabilityAlerts:           String("va"),
  3841  				Workflows:                     String("w"),
  3842  			},
  3843  			CreatedAt:              &Timestamp{referenceTime},
  3844  			UpdatedAt:              &Timestamp{referenceTime},
  3845  			HasMultipleSingleFiles: Bool(false),
  3846  			SuspendedBy: &User{
  3847  				Login:           String("l"),
  3848  				ID:              Int64(1),
  3849  				URL:             String("u"),
  3850  				AvatarURL:       String("a"),
  3851  				GravatarID:      String("g"),
  3852  				Name:            String("n"),
  3853  				Company:         String("c"),
  3854  				Blog:            String("b"),
  3855  				Location:        String("l"),
  3856  				Email:           String("e"),
  3857  				Hireable:        Bool(true),
  3858  				Bio:             String("b"),
  3859  				TwitterUsername: String("t"),
  3860  				PublicRepos:     Int(1),
  3861  				Followers:       Int(1),
  3862  				Following:       Int(1),
  3863  				CreatedAt:       &Timestamp{referenceTime},
  3864  				SuspendedAt:     &Timestamp{referenceTime},
  3865  			},
  3866  			SuspendedAt: &Timestamp{referenceTime},
  3867  		},
  3868  	}
  3869  
  3870  	want := `{
  3871  		"sha": "sha",
  3872  		"state": "s",
  3873  		"description": "d",
  3874  		"target_url": "turl",
  3875  		"branches": [
  3876  			{
  3877  				"name": "n",
  3878  				"commit": {
  3879  					"node_id": "nid"
  3880  				},
  3881  				"protected": false
  3882  			}
  3883  		],
  3884  		"id": 1,
  3885  		"name": "n",
  3886  		"context": "c",
  3887  		"commit": {
  3888  			"node_id": "nid"
  3889  		},
  3890  		"created_at": ` + referenceTimeStr + `,
  3891  		"updated_at": ` + referenceTimeStr + `,
  3892  		"sender": {
  3893  			"login": "l",
  3894  			"id": 1,
  3895  			"node_id": "n",
  3896  			"avatar_url": "a",
  3897  			"url": "u",
  3898  			"events_url": "e",
  3899  			"repos_url": "r"
  3900  		},
  3901  		"installation": {
  3902  			"id": 1,
  3903  			"node_id": "nid",
  3904  			"app_id": 1,
  3905  			"app_slug": "as",
  3906  			"target_id": 1,
  3907  			"account": {
  3908  				"login": "l",
  3909  				"id": 1,
  3910  				"avatar_url": "a",
  3911  				"gravatar_id": "g",
  3912  				"name": "n",
  3913  				"company": "c",
  3914  				"blog": "b",
  3915  				"location": "l",
  3916  				"email": "e",
  3917  				"hireable": true,
  3918  				"bio": "b",
  3919  				"twitter_username": "t",
  3920  				"public_repos": 1,
  3921  				"followers": 1,
  3922  				"following": 1,
  3923  				"created_at": ` + referenceTimeStr + `,
  3924  				"suspended_at": ` + referenceTimeStr + `,
  3925  				"url": "u"
  3926  			},
  3927  			"access_tokens_url": "atu",
  3928  			"repositories_url": "ru",
  3929  			"html_url": "hu",
  3930  			"target_type": "tt",
  3931  			"single_file_name": "sfn",
  3932  			"repository_selection": "rs",
  3933  			"events": [
  3934  				"e"
  3935  			],
  3936  			"single_file_paths": [
  3937  				"s"
  3938  			],
  3939  			"permissions": {
  3940  				"actions": "a",
  3941  				"administration": "ad",
  3942  				"checks": "c",
  3943  				"contents": "co",
  3944  				"content_references": "cr",
  3945  				"deployments": "d",
  3946  				"environments": "e",
  3947  				"issues": "i",
  3948  				"metadata": "md",
  3949  				"members": "m",
  3950  				"organization_administration": "oa",
  3951  				"organization_hooks": "oh",
  3952  				"organization_plan": "op",
  3953  				"organization_pre_receive_hooks": "opr",
  3954  				"organization_projects": "op",
  3955  				"organization_secrets": "os",
  3956  				"organization_self_hosted_runners": "osh",
  3957  				"organization_user_blocking": "oub",
  3958  				"packages": "pkg",
  3959  				"pages": "pg",
  3960  				"pull_requests": "pr",
  3961  				"repository_hooks": "rh",
  3962  				"repository_projects": "rp",
  3963  				"repository_pre_receive_hooks": "rprh",
  3964  				"secrets": "s",
  3965  				"secret_scanning_alerts": "ssa",
  3966  				"security_events": "se",
  3967  				"single_file": "sf",
  3968  				"statuses": "s",
  3969  				"team_discussions": "td",
  3970  				"vulnerability_alerts": "va",
  3971  				"workflows": "w"
  3972  			},
  3973  			"created_at": ` + referenceTimeStr + `,
  3974  			"updated_at": ` + referenceTimeStr + `,
  3975  			"has_multiple_single_files": false,
  3976  			"suspended_by": {
  3977  				"login": "l",
  3978  				"id": 1,
  3979  				"avatar_url": "a",
  3980  				"gravatar_id": "g",
  3981  				"name": "n",
  3982  				"company": "c",
  3983  				"blog": "b",
  3984  				"location": "l",
  3985  				"email": "e",
  3986  				"hireable": true,
  3987  				"bio": "b",
  3988  				"twitter_username": "t",
  3989  				"public_repos": 1,
  3990  				"followers": 1,
  3991  				"following": 1,
  3992  				"created_at": ` + referenceTimeStr + `,
  3993  				"suspended_at": ` + referenceTimeStr + `,
  3994  				"url": "u"
  3995  			},
  3996  			"suspended_at": ` + referenceTimeStr + `
  3997  		}
  3998  	}`
  3999  
  4000  	testJSONMarshal(t, u, want)
  4001  }
  4002  
  4003  func TestMarketplacePurchaseEvent_Marshal(t *testing.T) {
  4004  	testJSONMarshal(t, &MarketplacePurchaseEvent{}, "{}")
  4005  
  4006  	u := &MarketplacePurchaseEvent{
  4007  		Action:        String("a"),
  4008  		EffectiveDate: &Timestamp{referenceTime},
  4009  		MarketplacePurchase: &MarketplacePurchase{
  4010  			BillingCycle:    String("bc"),
  4011  			NextBillingDate: &Timestamp{referenceTime},
  4012  			UnitCount:       Int(1),
  4013  			Plan: &MarketplacePlan{
  4014  				URL:                 String("u"),
  4015  				AccountsURL:         String("au"),
  4016  				ID:                  Int64(1),
  4017  				Number:              Int(1),
  4018  				Name:                String("n"),
  4019  				Description:         String("d"),
  4020  				MonthlyPriceInCents: Int(1),
  4021  				YearlyPriceInCents:  Int(1),
  4022  				PriceModel:          String("pm"),
  4023  				UnitName:            String("un"),
  4024  				Bullets:             &[]string{"b"},
  4025  				State:               String("s"),
  4026  				HasFreeTrial:        Bool(false),
  4027  			},
  4028  			OnFreeTrial:     Bool(false),
  4029  			FreeTrialEndsOn: &Timestamp{referenceTime},
  4030  			UpdatedAt:       &Timestamp{referenceTime},
  4031  		},
  4032  		PreviousMarketplacePurchase: &MarketplacePurchase{
  4033  			BillingCycle:    String("bc"),
  4034  			NextBillingDate: &Timestamp{referenceTime},
  4035  			UnitCount:       Int(1),
  4036  			Plan: &MarketplacePlan{
  4037  				URL:                 String("u"),
  4038  				AccountsURL:         String("au"),
  4039  				ID:                  Int64(1),
  4040  				Number:              Int(1),
  4041  				Name:                String("n"),
  4042  				Description:         String("d"),
  4043  				MonthlyPriceInCents: Int(1),
  4044  				YearlyPriceInCents:  Int(1),
  4045  				PriceModel:          String("pm"),
  4046  				UnitName:            String("un"),
  4047  				Bullets:             &[]string{"b"},
  4048  				State:               String("s"),
  4049  				HasFreeTrial:        Bool(false),
  4050  			},
  4051  			OnFreeTrial:     Bool(false),
  4052  			FreeTrialEndsOn: &Timestamp{referenceTime},
  4053  			UpdatedAt:       &Timestamp{referenceTime},
  4054  		},
  4055  		Sender: &User{
  4056  			Login:     String("l"),
  4057  			ID:        Int64(1),
  4058  			NodeID:    String("n"),
  4059  			URL:       String("u"),
  4060  			ReposURL:  String("r"),
  4061  			EventsURL: String("e"),
  4062  			AvatarURL: String("a"),
  4063  		},
  4064  		Installation: &Installation{
  4065  			ID:       Int64(1),
  4066  			NodeID:   String("nid"),
  4067  			AppID:    Int64(1),
  4068  			AppSlug:  String("as"),
  4069  			TargetID: Int64(1),
  4070  			Account: &User{
  4071  				Login:           String("l"),
  4072  				ID:              Int64(1),
  4073  				URL:             String("u"),
  4074  				AvatarURL:       String("a"),
  4075  				GravatarID:      String("g"),
  4076  				Name:            String("n"),
  4077  				Company:         String("c"),
  4078  				Blog:            String("b"),
  4079  				Location:        String("l"),
  4080  				Email:           String("e"),
  4081  				Hireable:        Bool(true),
  4082  				Bio:             String("b"),
  4083  				TwitterUsername: String("t"),
  4084  				PublicRepos:     Int(1),
  4085  				Followers:       Int(1),
  4086  				Following:       Int(1),
  4087  				CreatedAt:       &Timestamp{referenceTime},
  4088  				SuspendedAt:     &Timestamp{referenceTime},
  4089  			},
  4090  			AccessTokensURL:     String("atu"),
  4091  			RepositoriesURL:     String("ru"),
  4092  			HTMLURL:             String("hu"),
  4093  			TargetType:          String("tt"),
  4094  			SingleFileName:      String("sfn"),
  4095  			RepositorySelection: String("rs"),
  4096  			Events:              []string{"e"},
  4097  			SingleFilePaths:     []string{"s"},
  4098  			Permissions: &InstallationPermissions{
  4099  				Actions:                       String("a"),
  4100  				Administration:                String("ad"),
  4101  				Checks:                        String("c"),
  4102  				Contents:                      String("co"),
  4103  				ContentReferences:             String("cr"),
  4104  				Deployments:                   String("d"),
  4105  				Environments:                  String("e"),
  4106  				Issues:                        String("i"),
  4107  				Metadata:                      String("md"),
  4108  				Members:                       String("m"),
  4109  				OrganizationAdministration:    String("oa"),
  4110  				OrganizationHooks:             String("oh"),
  4111  				OrganizationPlan:              String("op"),
  4112  				OrganizationPreReceiveHooks:   String("opr"),
  4113  				OrganizationProjects:          String("op"),
  4114  				OrganizationSecrets:           String("os"),
  4115  				OrganizationSelfHostedRunners: String("osh"),
  4116  				OrganizationUserBlocking:      String("oub"),
  4117  				Packages:                      String("pkg"),
  4118  				Pages:                         String("pg"),
  4119  				PullRequests:                  String("pr"),
  4120  				RepositoryHooks:               String("rh"),
  4121  				RepositoryProjects:            String("rp"),
  4122  				RepositoryPreReceiveHooks:     String("rprh"),
  4123  				Secrets:                       String("s"),
  4124  				SecretScanningAlerts:          String("ssa"),
  4125  				SecurityEvents:                String("se"),
  4126  				SingleFile:                    String("sf"),
  4127  				Statuses:                      String("s"),
  4128  				TeamDiscussions:               String("td"),
  4129  				VulnerabilityAlerts:           String("va"),
  4130  				Workflows:                     String("w"),
  4131  			},
  4132  			CreatedAt:              &Timestamp{referenceTime},
  4133  			UpdatedAt:              &Timestamp{referenceTime},
  4134  			HasMultipleSingleFiles: Bool(false),
  4135  			SuspendedBy: &User{
  4136  				Login:           String("l"),
  4137  				ID:              Int64(1),
  4138  				URL:             String("u"),
  4139  				AvatarURL:       String("a"),
  4140  				GravatarID:      String("g"),
  4141  				Name:            String("n"),
  4142  				Company:         String("c"),
  4143  				Blog:            String("b"),
  4144  				Location:        String("l"),
  4145  				Email:           String("e"),
  4146  				Hireable:        Bool(true),
  4147  				Bio:             String("b"),
  4148  				TwitterUsername: String("t"),
  4149  				PublicRepos:     Int(1),
  4150  				Followers:       Int(1),
  4151  				Following:       Int(1),
  4152  				CreatedAt:       &Timestamp{referenceTime},
  4153  				SuspendedAt:     &Timestamp{referenceTime},
  4154  			},
  4155  			SuspendedAt: &Timestamp{referenceTime},
  4156  		},
  4157  	}
  4158  
  4159  	want := `{
  4160  		"action": "a",
  4161  		"effective_date": ` + referenceTimeStr + `,
  4162  		"marketplace_purchase": {
  4163  			"billing_cycle": "bc",
  4164  			"next_billing_date": ` + referenceTimeStr + `,
  4165  			"unit_count": 1,
  4166  			"plan": {
  4167  				"url": "u",
  4168  				"accounts_url": "au",
  4169  				"id": 1,
  4170  				"number": 1,
  4171  				"name": "n",
  4172  				"description": "d",
  4173  				"monthly_price_in_cents": 1,
  4174  				"yearly_price_in_cents": 1,
  4175  				"price_model": "pm",
  4176  				"unit_name": "un",
  4177  				"bullets": [
  4178  					"b"
  4179  				],
  4180  				"state": "s",
  4181  				"has_free_trial": false
  4182  			},
  4183  			"on_free_trial": false,
  4184  			"free_trial_ends_on": ` + referenceTimeStr + `,
  4185  			"updated_at": ` + referenceTimeStr + `
  4186  		},
  4187  		"previous_marketplace_purchase": {
  4188  			"billing_cycle": "bc",
  4189  			"next_billing_date": ` + referenceTimeStr + `,
  4190  			"unit_count": 1,
  4191  			"plan": {
  4192  				"url": "u",
  4193  				"accounts_url": "au",
  4194  				"id": 1,
  4195  				"number": 1,
  4196  				"name": "n",
  4197  				"description": "d",
  4198  				"monthly_price_in_cents": 1,
  4199  				"yearly_price_in_cents": 1,
  4200  				"price_model": "pm",
  4201  				"unit_name": "un",
  4202  				"bullets": [
  4203  					"b"
  4204  				],
  4205  				"state": "s",
  4206  				"has_free_trial": false
  4207  			},
  4208  			"on_free_trial": false,
  4209  			"free_trial_ends_on": ` + referenceTimeStr + `,
  4210  			"updated_at": ` + referenceTimeStr + `
  4211  		},
  4212  		"sender": {
  4213  			"login": "l",
  4214  			"id": 1,
  4215  			"node_id": "n",
  4216  			"avatar_url": "a",
  4217  			"url": "u",
  4218  			"events_url": "e",
  4219  			"repos_url": "r"
  4220  		},
  4221  		"installation": {
  4222  			"id": 1,
  4223  			"node_id": "nid",
  4224  			"app_id": 1,
  4225  			"app_slug": "as",
  4226  			"target_id": 1,
  4227  			"account": {
  4228  				"login": "l",
  4229  				"id": 1,
  4230  				"avatar_url": "a",
  4231  				"gravatar_id": "g",
  4232  				"name": "n",
  4233  				"company": "c",
  4234  				"blog": "b",
  4235  				"location": "l",
  4236  				"email": "e",
  4237  				"hireable": true,
  4238  				"bio": "b",
  4239  				"twitter_username": "t",
  4240  				"public_repos": 1,
  4241  				"followers": 1,
  4242  				"following": 1,
  4243  				"created_at": ` + referenceTimeStr + `,
  4244  				"suspended_at": ` + referenceTimeStr + `,
  4245  				"url": "u"
  4246  			},
  4247  			"access_tokens_url": "atu",
  4248  			"repositories_url": "ru",
  4249  			"html_url": "hu",
  4250  			"target_type": "tt",
  4251  			"single_file_name": "sfn",
  4252  			"repository_selection": "rs",
  4253  			"events": [
  4254  				"e"
  4255  			],
  4256  			"single_file_paths": [
  4257  				"s"
  4258  			],
  4259  			"permissions": {
  4260  				"actions": "a",
  4261  				"administration": "ad",
  4262  				"checks": "c",
  4263  				"contents": "co",
  4264  				"content_references": "cr",
  4265  				"deployments": "d",
  4266  				"environments": "e",
  4267  				"issues": "i",
  4268  				"metadata": "md",
  4269  				"members": "m",
  4270  				"organization_administration": "oa",
  4271  				"organization_hooks": "oh",
  4272  				"organization_plan": "op",
  4273  				"organization_pre_receive_hooks": "opr",
  4274  				"organization_projects": "op",
  4275  				"organization_secrets": "os",
  4276  				"organization_self_hosted_runners": "osh",
  4277  				"organization_user_blocking": "oub",
  4278  				"packages": "pkg",
  4279  				"pages": "pg",
  4280  				"pull_requests": "pr",
  4281  				"repository_hooks": "rh",
  4282  				"repository_projects": "rp",
  4283  				"repository_pre_receive_hooks": "rprh",
  4284  				"secrets": "s",
  4285  				"secret_scanning_alerts": "ssa",
  4286  				"security_events": "se",
  4287  				"single_file": "sf",
  4288  				"statuses": "s",
  4289  				"team_discussions": "td",
  4290  				"vulnerability_alerts": "va",
  4291  				"workflows": "w"
  4292  			},
  4293  			"created_at": ` + referenceTimeStr + `,
  4294  			"updated_at": ` + referenceTimeStr + `,
  4295  			"has_multiple_single_files": false,
  4296  			"suspended_by": {
  4297  				"login": "l",
  4298  				"id": 1,
  4299  				"avatar_url": "a",
  4300  				"gravatar_id": "g",
  4301  				"name": "n",
  4302  				"company": "c",
  4303  				"blog": "b",
  4304  				"location": "l",
  4305  				"email": "e",
  4306  				"hireable": true,
  4307  				"bio": "b",
  4308  				"twitter_username": "t",
  4309  				"public_repos": 1,
  4310  				"followers": 1,
  4311  				"following": 1,
  4312  				"created_at": ` + referenceTimeStr + `,
  4313  				"suspended_at": ` + referenceTimeStr + `,
  4314  				"url": "u"
  4315  			},
  4316  			"suspended_at": ` + referenceTimeStr + `
  4317  		}
  4318  	}`
  4319  
  4320  	testJSONMarshal(t, u, want)
  4321  }
  4322  
  4323  func TestOrganizationEvent_Marshal(t *testing.T) {
  4324  	testJSONMarshal(t, &OrganizationEvent{}, "{}")
  4325  
  4326  	u := &OrganizationEvent{
  4327  		Action:     String("a"),
  4328  		Invitation: &Invitation{ID: Int64(1)},
  4329  		Membership: &Membership{
  4330  			URL:             String("url"),
  4331  			State:           String("s"),
  4332  			Role:            String("r"),
  4333  			OrganizationURL: String("ou"),
  4334  			Organization: &Organization{
  4335  				BillingEmail:                         String("be"),
  4336  				Blog:                                 String("b"),
  4337  				Company:                              String("c"),
  4338  				Email:                                String("e"),
  4339  				TwitterUsername:                      String("tu"),
  4340  				Location:                             String("loc"),
  4341  				Name:                                 String("n"),
  4342  				Description:                          String("d"),
  4343  				IsVerified:                           Bool(true),
  4344  				HasOrganizationProjects:              Bool(true),
  4345  				HasRepositoryProjects:                Bool(true),
  4346  				DefaultRepoPermission:                String("drp"),
  4347  				MembersCanCreateRepos:                Bool(true),
  4348  				MembersCanCreateInternalRepos:        Bool(true),
  4349  				MembersCanCreatePrivateRepos:         Bool(true),
  4350  				MembersCanCreatePublicRepos:          Bool(false),
  4351  				MembersAllowedRepositoryCreationType: String("marct"),
  4352  				MembersCanCreatePages:                Bool(true),
  4353  				MembersCanCreatePublicPages:          Bool(false),
  4354  				MembersCanCreatePrivatePages:         Bool(true),
  4355  			},
  4356  			User: &User{
  4357  				Login:     String("l"),
  4358  				ID:        Int64(1),
  4359  				NodeID:    String("n"),
  4360  				URL:       String("u"),
  4361  				ReposURL:  String("r"),
  4362  				EventsURL: String("e"),
  4363  				AvatarURL: String("a"),
  4364  			},
  4365  		},
  4366  		Organization: &Organization{
  4367  			BillingEmail:                         String("be"),
  4368  			Blog:                                 String("b"),
  4369  			Company:                              String("c"),
  4370  			Email:                                String("e"),
  4371  			TwitterUsername:                      String("tu"),
  4372  			Location:                             String("loc"),
  4373  			Name:                                 String("n"),
  4374  			Description:                          String("d"),
  4375  			IsVerified:                           Bool(true),
  4376  			HasOrganizationProjects:              Bool(true),
  4377  			HasRepositoryProjects:                Bool(true),
  4378  			DefaultRepoPermission:                String("drp"),
  4379  			MembersCanCreateRepos:                Bool(true),
  4380  			MembersCanCreateInternalRepos:        Bool(true),
  4381  			MembersCanCreatePrivateRepos:         Bool(true),
  4382  			MembersCanCreatePublicRepos:          Bool(false),
  4383  			MembersAllowedRepositoryCreationType: String("marct"),
  4384  			MembersCanCreatePages:                Bool(true),
  4385  			MembersCanCreatePublicPages:          Bool(false),
  4386  			MembersCanCreatePrivatePages:         Bool(true),
  4387  		},
  4388  		Sender: &User{
  4389  			Login:     String("l"),
  4390  			ID:        Int64(1),
  4391  			NodeID:    String("n"),
  4392  			URL:       String("u"),
  4393  			ReposURL:  String("r"),
  4394  			EventsURL: String("e"),
  4395  			AvatarURL: String("a"),
  4396  		},
  4397  		Installation: &Installation{
  4398  			ID:       Int64(1),
  4399  			NodeID:   String("nid"),
  4400  			AppID:    Int64(1),
  4401  			AppSlug:  String("as"),
  4402  			TargetID: Int64(1),
  4403  			Account: &User{
  4404  				Login:           String("l"),
  4405  				ID:              Int64(1),
  4406  				URL:             String("u"),
  4407  				AvatarURL:       String("a"),
  4408  				GravatarID:      String("g"),
  4409  				Name:            String("n"),
  4410  				Company:         String("c"),
  4411  				Blog:            String("b"),
  4412  				Location:        String("l"),
  4413  				Email:           String("e"),
  4414  				Hireable:        Bool(true),
  4415  				Bio:             String("b"),
  4416  				TwitterUsername: String("t"),
  4417  				PublicRepos:     Int(1),
  4418  				Followers:       Int(1),
  4419  				Following:       Int(1),
  4420  				CreatedAt:       &Timestamp{referenceTime},
  4421  				SuspendedAt:     &Timestamp{referenceTime},
  4422  			},
  4423  			AccessTokensURL:     String("atu"),
  4424  			RepositoriesURL:     String("ru"),
  4425  			HTMLURL:             String("hu"),
  4426  			TargetType:          String("tt"),
  4427  			SingleFileName:      String("sfn"),
  4428  			RepositorySelection: String("rs"),
  4429  			Events:              []string{"e"},
  4430  			SingleFilePaths:     []string{"s"},
  4431  			Permissions: &InstallationPermissions{
  4432  				Actions:                       String("a"),
  4433  				Administration:                String("ad"),
  4434  				Checks:                        String("c"),
  4435  				Contents:                      String("co"),
  4436  				ContentReferences:             String("cr"),
  4437  				Deployments:                   String("d"),
  4438  				Environments:                  String("e"),
  4439  				Issues:                        String("i"),
  4440  				Metadata:                      String("md"),
  4441  				Members:                       String("m"),
  4442  				OrganizationAdministration:    String("oa"),
  4443  				OrganizationHooks:             String("oh"),
  4444  				OrganizationPlan:              String("op"),
  4445  				OrganizationPreReceiveHooks:   String("opr"),
  4446  				OrganizationProjects:          String("op"),
  4447  				OrganizationSecrets:           String("os"),
  4448  				OrganizationSelfHostedRunners: String("osh"),
  4449  				OrganizationUserBlocking:      String("oub"),
  4450  				Packages:                      String("pkg"),
  4451  				Pages:                         String("pg"),
  4452  				PullRequests:                  String("pr"),
  4453  				RepositoryHooks:               String("rh"),
  4454  				RepositoryProjects:            String("rp"),
  4455  				RepositoryPreReceiveHooks:     String("rprh"),
  4456  				Secrets:                       String("s"),
  4457  				SecretScanningAlerts:          String("ssa"),
  4458  				SecurityEvents:                String("se"),
  4459  				SingleFile:                    String("sf"),
  4460  				Statuses:                      String("s"),
  4461  				TeamDiscussions:               String("td"),
  4462  				VulnerabilityAlerts:           String("va"),
  4463  				Workflows:                     String("w"),
  4464  			},
  4465  			CreatedAt:              &Timestamp{referenceTime},
  4466  			UpdatedAt:              &Timestamp{referenceTime},
  4467  			HasMultipleSingleFiles: Bool(false),
  4468  			SuspendedBy: &User{
  4469  				Login:           String("l"),
  4470  				ID:              Int64(1),
  4471  				URL:             String("u"),
  4472  				AvatarURL:       String("a"),
  4473  				GravatarID:      String("g"),
  4474  				Name:            String("n"),
  4475  				Company:         String("c"),
  4476  				Blog:            String("b"),
  4477  				Location:        String("l"),
  4478  				Email:           String("e"),
  4479  				Hireable:        Bool(true),
  4480  				Bio:             String("b"),
  4481  				TwitterUsername: String("t"),
  4482  				PublicRepos:     Int(1),
  4483  				Followers:       Int(1),
  4484  				Following:       Int(1),
  4485  				CreatedAt:       &Timestamp{referenceTime},
  4486  				SuspendedAt:     &Timestamp{referenceTime},
  4487  			},
  4488  			SuspendedAt: &Timestamp{referenceTime},
  4489  		},
  4490  	}
  4491  
  4492  	want := `{
  4493  		"action": "a",
  4494  		"invitation": {
  4495  			"id": 1
  4496  		},
  4497  		"membership": {
  4498  			"url": "url",
  4499  			"state": "s",
  4500  			"role": "r",
  4501  			"organization_url": "ou",
  4502  			"organization": {
  4503  				"name": "n",
  4504  				"company": "c",
  4505  				"blog": "b",
  4506  				"location": "loc",
  4507  				"email": "e",
  4508  				"twitter_username": "tu",
  4509  				"description": "d",
  4510  				"billing_email": "be",
  4511  				"is_verified": true,
  4512  				"has_organization_projects": true,
  4513  				"has_repository_projects": true,
  4514  				"default_repository_permission": "drp",
  4515  				"members_can_create_repositories": true,
  4516  				"members_can_create_public_repositories": false,
  4517  				"members_can_create_private_repositories": true,
  4518  				"members_can_create_internal_repositories": true,
  4519  				"members_allowed_repository_creation_type": "marct",
  4520  				"members_can_create_pages": true,
  4521  				"members_can_create_public_pages": false,
  4522  				"members_can_create_private_pages": true
  4523  			},
  4524  			"user": {
  4525  				"login": "l",
  4526  				"id": 1,
  4527  				"node_id": "n",
  4528  				"avatar_url": "a",
  4529  				"url": "u",
  4530  				"events_url": "e",
  4531  				"repos_url": "r"
  4532  			}
  4533  		},
  4534  		"organization": {
  4535  			"name": "n",
  4536  			"company": "c",
  4537  			"blog": "b",
  4538  			"location": "loc",
  4539  			"email": "e",
  4540  			"twitter_username": "tu",
  4541  			"description": "d",
  4542  			"billing_email": "be",
  4543  			"is_verified": true,
  4544  			"has_organization_projects": true,
  4545  			"has_repository_projects": true,
  4546  			"default_repository_permission": "drp",
  4547  			"members_can_create_repositories": true,
  4548  			"members_can_create_public_repositories": false,
  4549  			"members_can_create_private_repositories": true,
  4550  			"members_can_create_internal_repositories": true,
  4551  			"members_allowed_repository_creation_type": "marct",
  4552  			"members_can_create_pages": true,
  4553  			"members_can_create_public_pages": false,
  4554  			"members_can_create_private_pages": true
  4555  		},
  4556  		"sender": {
  4557  			"login": "l",
  4558  			"id": 1,
  4559  			"node_id": "n",
  4560  			"avatar_url": "a",
  4561  			"url": "u",
  4562  			"events_url": "e",
  4563  			"repos_url": "r"
  4564  		},
  4565  		"installation": {
  4566  			"id": 1,
  4567  			"node_id": "nid",
  4568  			"app_id": 1,
  4569  			"app_slug": "as",
  4570  			"target_id": 1,
  4571  			"account": {
  4572  				"login": "l",
  4573  				"id": 1,
  4574  				"avatar_url": "a",
  4575  				"gravatar_id": "g",
  4576  				"name": "n",
  4577  				"company": "c",
  4578  				"blog": "b",
  4579  				"location": "l",
  4580  				"email": "e",
  4581  				"hireable": true,
  4582  				"bio": "b",
  4583  				"twitter_username": "t",
  4584  				"public_repos": 1,
  4585  				"followers": 1,
  4586  				"following": 1,
  4587  				"created_at": ` + referenceTimeStr + `,
  4588  				"suspended_at": ` + referenceTimeStr + `,
  4589  				"url": "u"
  4590  			},
  4591  			"access_tokens_url": "atu",
  4592  			"repositories_url": "ru",
  4593  			"html_url": "hu",
  4594  			"target_type": "tt",
  4595  			"single_file_name": "sfn",
  4596  			"repository_selection": "rs",
  4597  			"events": [
  4598  				"e"
  4599  			],
  4600  			"single_file_paths": [
  4601  				"s"
  4602  			],
  4603  			"permissions": {
  4604  				"actions": "a",
  4605  				"administration": "ad",
  4606  				"checks": "c",
  4607  				"contents": "co",
  4608  				"content_references": "cr",
  4609  				"deployments": "d",
  4610  				"environments": "e",
  4611  				"issues": "i",
  4612  				"metadata": "md",
  4613  				"members": "m",
  4614  				"organization_administration": "oa",
  4615  				"organization_hooks": "oh",
  4616  				"organization_plan": "op",
  4617  				"organization_pre_receive_hooks": "opr",
  4618  				"organization_projects": "op",
  4619  				"organization_secrets": "os",
  4620  				"organization_self_hosted_runners": "osh",
  4621  				"organization_user_blocking": "oub",
  4622  				"packages": "pkg",
  4623  				"pages": "pg",
  4624  				"pull_requests": "pr",
  4625  				"repository_hooks": "rh",
  4626  				"repository_projects": "rp",
  4627  				"repository_pre_receive_hooks": "rprh",
  4628  				"secrets": "s",
  4629  				"secret_scanning_alerts": "ssa",
  4630  				"security_events": "se",
  4631  				"single_file": "sf",
  4632  				"statuses": "s",
  4633  				"team_discussions": "td",
  4634  				"vulnerability_alerts": "va",
  4635  				"workflows": "w"
  4636  			},
  4637  			"created_at": ` + referenceTimeStr + `,
  4638  			"updated_at": ` + referenceTimeStr + `,
  4639  			"has_multiple_single_files": false,
  4640  			"suspended_by": {
  4641  				"login": "l",
  4642  				"id": 1,
  4643  				"avatar_url": "a",
  4644  				"gravatar_id": "g",
  4645  				"name": "n",
  4646  				"company": "c",
  4647  				"blog": "b",
  4648  				"location": "l",
  4649  				"email": "e",
  4650  				"hireable": true,
  4651  				"bio": "b",
  4652  				"twitter_username": "t",
  4653  				"public_repos": 1,
  4654  				"followers": 1,
  4655  				"following": 1,
  4656  				"created_at": ` + referenceTimeStr + `,
  4657  				"suspended_at": ` + referenceTimeStr + `,
  4658  				"url": "u"
  4659  			},
  4660  			"suspended_at": ` + referenceTimeStr + `
  4661  		}
  4662  	}`
  4663  
  4664  	testJSONMarshal(t, u, want)
  4665  }
  4666  
  4667  func TestPageBuildEvent_Marshal(t *testing.T) {
  4668  	testJSONMarshal(t, &PageBuildEvent{}, "{}")
  4669  
  4670  	u := &PageBuildEvent{
  4671  		Build: &PagesBuild{URL: String("url")},
  4672  		ID:    Int64(1),
  4673  		Repo: &Repository{
  4674  			ID:   Int64(1),
  4675  			URL:  String("s"),
  4676  			Name: String("n"),
  4677  		},
  4678  		Sender: &User{
  4679  			Login:     String("l"),
  4680  			ID:        Int64(1),
  4681  			NodeID:    String("n"),
  4682  			URL:       String("u"),
  4683  			ReposURL:  String("r"),
  4684  			EventsURL: String("e"),
  4685  			AvatarURL: String("a"),
  4686  		},
  4687  		Installation: &Installation{
  4688  			ID:       Int64(1),
  4689  			NodeID:   String("nid"),
  4690  			AppID:    Int64(1),
  4691  			AppSlug:  String("as"),
  4692  			TargetID: Int64(1),
  4693  			Account: &User{
  4694  				Login:           String("l"),
  4695  				ID:              Int64(1),
  4696  				URL:             String("u"),
  4697  				AvatarURL:       String("a"),
  4698  				GravatarID:      String("g"),
  4699  				Name:            String("n"),
  4700  				Company:         String("c"),
  4701  				Blog:            String("b"),
  4702  				Location:        String("l"),
  4703  				Email:           String("e"),
  4704  				Hireable:        Bool(true),
  4705  				Bio:             String("b"),
  4706  				TwitterUsername: String("t"),
  4707  				PublicRepos:     Int(1),
  4708  				Followers:       Int(1),
  4709  				Following:       Int(1),
  4710  				CreatedAt:       &Timestamp{referenceTime},
  4711  				SuspendedAt:     &Timestamp{referenceTime},
  4712  			},
  4713  			AccessTokensURL:     String("atu"),
  4714  			RepositoriesURL:     String("ru"),
  4715  			HTMLURL:             String("hu"),
  4716  			TargetType:          String("tt"),
  4717  			SingleFileName:      String("sfn"),
  4718  			RepositorySelection: String("rs"),
  4719  			Events:              []string{"e"},
  4720  			SingleFilePaths:     []string{"s"},
  4721  			Permissions: &InstallationPermissions{
  4722  				Actions:                       String("a"),
  4723  				Administration:                String("ad"),
  4724  				Checks:                        String("c"),
  4725  				Contents:                      String("co"),
  4726  				ContentReferences:             String("cr"),
  4727  				Deployments:                   String("d"),
  4728  				Environments:                  String("e"),
  4729  				Issues:                        String("i"),
  4730  				Metadata:                      String("md"),
  4731  				Members:                       String("m"),
  4732  				OrganizationAdministration:    String("oa"),
  4733  				OrganizationHooks:             String("oh"),
  4734  				OrganizationPlan:              String("op"),
  4735  				OrganizationPreReceiveHooks:   String("opr"),
  4736  				OrganizationProjects:          String("op"),
  4737  				OrganizationSecrets:           String("os"),
  4738  				OrganizationSelfHostedRunners: String("osh"),
  4739  				OrganizationUserBlocking:      String("oub"),
  4740  				Packages:                      String("pkg"),
  4741  				Pages:                         String("pg"),
  4742  				PullRequests:                  String("pr"),
  4743  				RepositoryHooks:               String("rh"),
  4744  				RepositoryProjects:            String("rp"),
  4745  				RepositoryPreReceiveHooks:     String("rprh"),
  4746  				Secrets:                       String("s"),
  4747  				SecretScanningAlerts:          String("ssa"),
  4748  				SecurityEvents:                String("se"),
  4749  				SingleFile:                    String("sf"),
  4750  				Statuses:                      String("s"),
  4751  				TeamDiscussions:               String("td"),
  4752  				VulnerabilityAlerts:           String("va"),
  4753  				Workflows:                     String("w"),
  4754  			},
  4755  			CreatedAt:              &Timestamp{referenceTime},
  4756  			UpdatedAt:              &Timestamp{referenceTime},
  4757  			HasMultipleSingleFiles: Bool(false),
  4758  			SuspendedBy: &User{
  4759  				Login:           String("l"),
  4760  				ID:              Int64(1),
  4761  				URL:             String("u"),
  4762  				AvatarURL:       String("a"),
  4763  				GravatarID:      String("g"),
  4764  				Name:            String("n"),
  4765  				Company:         String("c"),
  4766  				Blog:            String("b"),
  4767  				Location:        String("l"),
  4768  				Email:           String("e"),
  4769  				Hireable:        Bool(true),
  4770  				Bio:             String("b"),
  4771  				TwitterUsername: String("t"),
  4772  				PublicRepos:     Int(1),
  4773  				Followers:       Int(1),
  4774  				Following:       Int(1),
  4775  				CreatedAt:       &Timestamp{referenceTime},
  4776  				SuspendedAt:     &Timestamp{referenceTime},
  4777  			},
  4778  			SuspendedAt: &Timestamp{referenceTime},
  4779  		},
  4780  	}
  4781  
  4782  	want := `{
  4783  		"build": {
  4784  			"url": "url"
  4785  		},
  4786  		"id": 1,
  4787  		"repository": {
  4788  			"id": 1,
  4789  			"name": "n",
  4790  			"url": "s"
  4791  		},
  4792  		"sender": {
  4793  			"login": "l",
  4794  			"id": 1,
  4795  			"node_id": "n",
  4796  			"avatar_url": "a",
  4797  			"url": "u",
  4798  			"events_url": "e",
  4799  			"repos_url": "r"
  4800  		},
  4801  		"installation": {
  4802  			"id": 1,
  4803  			"node_id": "nid",
  4804  			"app_id": 1,
  4805  			"app_slug": "as",
  4806  			"target_id": 1,
  4807  			"account": {
  4808  				"login": "l",
  4809  				"id": 1,
  4810  				"avatar_url": "a",
  4811  				"gravatar_id": "g",
  4812  				"name": "n",
  4813  				"company": "c",
  4814  				"blog": "b",
  4815  				"location": "l",
  4816  				"email": "e",
  4817  				"hireable": true,
  4818  				"bio": "b",
  4819  				"twitter_username": "t",
  4820  				"public_repos": 1,
  4821  				"followers": 1,
  4822  				"following": 1,
  4823  				"created_at": ` + referenceTimeStr + `,
  4824  				"suspended_at": ` + referenceTimeStr + `,
  4825  				"url": "u"
  4826  			},
  4827  			"access_tokens_url": "atu",
  4828  			"repositories_url": "ru",
  4829  			"html_url": "hu",
  4830  			"target_type": "tt",
  4831  			"single_file_name": "sfn",
  4832  			"repository_selection": "rs",
  4833  			"events": [
  4834  				"e"
  4835  			],
  4836  			"single_file_paths": [
  4837  				"s"
  4838  			],
  4839  			"permissions": {
  4840  				"actions": "a",
  4841  				"administration": "ad",
  4842  				"checks": "c",
  4843  				"contents": "co",
  4844  				"content_references": "cr",
  4845  				"deployments": "d",
  4846  				"environments": "e",
  4847  				"issues": "i",
  4848  				"metadata": "md",
  4849  				"members": "m",
  4850  				"organization_administration": "oa",
  4851  				"organization_hooks": "oh",
  4852  				"organization_plan": "op",
  4853  				"organization_pre_receive_hooks": "opr",
  4854  				"organization_projects": "op",
  4855  				"organization_secrets": "os",
  4856  				"organization_self_hosted_runners": "osh",
  4857  				"organization_user_blocking": "oub",
  4858  				"packages": "pkg",
  4859  				"pages": "pg",
  4860  				"pull_requests": "pr",
  4861  				"repository_hooks": "rh",
  4862  				"repository_projects": "rp",
  4863  				"repository_pre_receive_hooks": "rprh",
  4864  				"secrets": "s",
  4865  				"secret_scanning_alerts": "ssa",
  4866  				"security_events": "se",
  4867  				"single_file": "sf",
  4868  				"statuses": "s",
  4869  				"team_discussions": "td",
  4870  				"vulnerability_alerts": "va",
  4871  				"workflows": "w"
  4872  			},
  4873  			"created_at": ` + referenceTimeStr + `,
  4874  			"updated_at": ` + referenceTimeStr + `,
  4875  			"has_multiple_single_files": false,
  4876  			"suspended_by": {
  4877  				"login": "l",
  4878  				"id": 1,
  4879  				"avatar_url": "a",
  4880  				"gravatar_id": "g",
  4881  				"name": "n",
  4882  				"company": "c",
  4883  				"blog": "b",
  4884  				"location": "l",
  4885  				"email": "e",
  4886  				"hireable": true,
  4887  				"bio": "b",
  4888  				"twitter_username": "t",
  4889  				"public_repos": 1,
  4890  				"followers": 1,
  4891  				"following": 1,
  4892  				"created_at": ` + referenceTimeStr + `,
  4893  				"suspended_at": ` + referenceTimeStr + `,
  4894  				"url": "u"
  4895  			},
  4896  			"suspended_at": ` + referenceTimeStr + `
  4897  		}
  4898  	}`
  4899  
  4900  	testJSONMarshal(t, u, want)
  4901  }
  4902  
  4903  func TestCommitCommentEvent_Marshal(t *testing.T) {
  4904  	testJSONMarshal(t, &CommitCommentEvent{}, "{}")
  4905  
  4906  	u := &CommitCommentEvent{
  4907  		Comment: &RepositoryComment{
  4908  			HTMLURL:  String("hurl"),
  4909  			URL:      String("url"),
  4910  			ID:       Int64(1),
  4911  			NodeID:   String("nid"),
  4912  			CommitID: String("cid"),
  4913  			User: &User{
  4914  				Login:     String("l"),
  4915  				ID:        Int64(1),
  4916  				NodeID:    String("n"),
  4917  				URL:       String("u"),
  4918  				ReposURL:  String("r"),
  4919  				EventsURL: String("e"),
  4920  				AvatarURL: String("a"),
  4921  			},
  4922  			Reactions: &Reactions{
  4923  				TotalCount: Int(1),
  4924  				PlusOne:    Int(1),
  4925  				MinusOne:   Int(1),
  4926  				Laugh:      Int(1),
  4927  				Confused:   Int(1),
  4928  				Heart:      Int(1),
  4929  				Hooray:     Int(1),
  4930  				Rocket:     Int(1),
  4931  				Eyes:       Int(1),
  4932  				URL:        String("url"),
  4933  			},
  4934  			CreatedAt: &Timestamp{referenceTime},
  4935  			UpdatedAt: &Timestamp{referenceTime},
  4936  			Body:      String("b"),
  4937  			Path:      String("path"),
  4938  			Position:  Int(1),
  4939  		},
  4940  		Action: String("a"),
  4941  		Repo: &Repository{
  4942  			ID:   Int64(1),
  4943  			URL:  String("s"),
  4944  			Name: String("n"),
  4945  		},
  4946  		Sender: &User{
  4947  			Login:     String("l"),
  4948  			ID:        Int64(1),
  4949  			NodeID:    String("n"),
  4950  			URL:       String("u"),
  4951  			ReposURL:  String("r"),
  4952  			EventsURL: String("e"),
  4953  			AvatarURL: String("a"),
  4954  		},
  4955  		Installation: &Installation{
  4956  			ID:       Int64(1),
  4957  			NodeID:   String("nid"),
  4958  			AppID:    Int64(1),
  4959  			AppSlug:  String("as"),
  4960  			TargetID: Int64(1),
  4961  			Account: &User{
  4962  				Login:           String("l"),
  4963  				ID:              Int64(1),
  4964  				URL:             String("u"),
  4965  				AvatarURL:       String("a"),
  4966  				GravatarID:      String("g"),
  4967  				Name:            String("n"),
  4968  				Company:         String("c"),
  4969  				Blog:            String("b"),
  4970  				Location:        String("l"),
  4971  				Email:           String("e"),
  4972  				Hireable:        Bool(true),
  4973  				Bio:             String("b"),
  4974  				TwitterUsername: String("t"),
  4975  				PublicRepos:     Int(1),
  4976  				Followers:       Int(1),
  4977  				Following:       Int(1),
  4978  				CreatedAt:       &Timestamp{referenceTime},
  4979  				SuspendedAt:     &Timestamp{referenceTime},
  4980  			},
  4981  			AccessTokensURL:     String("atu"),
  4982  			RepositoriesURL:     String("ru"),
  4983  			HTMLURL:             String("hu"),
  4984  			TargetType:          String("tt"),
  4985  			SingleFileName:      String("sfn"),
  4986  			RepositorySelection: String("rs"),
  4987  			Events:              []string{"e"},
  4988  			SingleFilePaths:     []string{"s"},
  4989  			Permissions: &InstallationPermissions{
  4990  				Actions:                       String("a"),
  4991  				Administration:                String("ad"),
  4992  				Checks:                        String("c"),
  4993  				Contents:                      String("co"),
  4994  				ContentReferences:             String("cr"),
  4995  				Deployments:                   String("d"),
  4996  				Environments:                  String("e"),
  4997  				Issues:                        String("i"),
  4998  				Metadata:                      String("md"),
  4999  				Members:                       String("m"),
  5000  				OrganizationAdministration:    String("oa"),
  5001  				OrganizationHooks:             String("oh"),
  5002  				OrganizationPlan:              String("op"),
  5003  				OrganizationPreReceiveHooks:   String("opr"),
  5004  				OrganizationProjects:          String("op"),
  5005  				OrganizationSecrets:           String("os"),
  5006  				OrganizationSelfHostedRunners: String("osh"),
  5007  				OrganizationUserBlocking:      String("oub"),
  5008  				Packages:                      String("pkg"),
  5009  				Pages:                         String("pg"),
  5010  				PullRequests:                  String("pr"),
  5011  				RepositoryHooks:               String("rh"),
  5012  				RepositoryProjects:            String("rp"),
  5013  				RepositoryPreReceiveHooks:     String("rprh"),
  5014  				Secrets:                       String("s"),
  5015  				SecretScanningAlerts:          String("ssa"),
  5016  				SecurityEvents:                String("se"),
  5017  				SingleFile:                    String("sf"),
  5018  				Statuses:                      String("s"),
  5019  				TeamDiscussions:               String("td"),
  5020  				VulnerabilityAlerts:           String("va"),
  5021  				Workflows:                     String("w"),
  5022  			},
  5023  			CreatedAt:              &Timestamp{referenceTime},
  5024  			UpdatedAt:              &Timestamp{referenceTime},
  5025  			HasMultipleSingleFiles: Bool(false),
  5026  			SuspendedBy: &User{
  5027  				Login:           String("l"),
  5028  				ID:              Int64(1),
  5029  				URL:             String("u"),
  5030  				AvatarURL:       String("a"),
  5031  				GravatarID:      String("g"),
  5032  				Name:            String("n"),
  5033  				Company:         String("c"),
  5034  				Blog:            String("b"),
  5035  				Location:        String("l"),
  5036  				Email:           String("e"),
  5037  				Hireable:        Bool(true),
  5038  				Bio:             String("b"),
  5039  				TwitterUsername: String("t"),
  5040  				PublicRepos:     Int(1),
  5041  				Followers:       Int(1),
  5042  				Following:       Int(1),
  5043  				CreatedAt:       &Timestamp{referenceTime},
  5044  				SuspendedAt:     &Timestamp{referenceTime},
  5045  			},
  5046  			SuspendedAt: &Timestamp{referenceTime},
  5047  		},
  5048  	}
  5049  
  5050  	want := `{
  5051  		"comment": {
  5052  			"html_url": "hurl",
  5053  			"url": "url",
  5054  			"id": 1,
  5055  			"node_id": "nid",
  5056  			"commit_id": "cid",
  5057  			"user": {
  5058  				"login": "l",
  5059  				"id": 1,
  5060  				"node_id": "n",
  5061  				"avatar_url": "a",
  5062  				"url": "u",
  5063  				"events_url": "e",
  5064  				"repos_url": "r"
  5065  			},
  5066  			"reactions": {
  5067  				"total_count": 1,
  5068  				"+1": 1,
  5069  				"-1": 1,
  5070  				"laugh": 1,
  5071  				"confused": 1,
  5072  				"heart": 1,
  5073  				"hooray": 1,
  5074  				"rocket": 1,
  5075  				"eyes": 1,
  5076  				"url": "url"
  5077  			},
  5078  			"created_at": ` + referenceTimeStr + `,
  5079  			"updated_at": ` + referenceTimeStr + `,
  5080  			"body": "b",
  5081  			"path": "path",
  5082  			"position": 1
  5083  		},
  5084  		"action": "a",
  5085  		"repository": {
  5086  			"id": 1,
  5087  			"name": "n",
  5088  			"url": "s"
  5089  		},
  5090  		"sender": {
  5091  			"login": "l",
  5092  			"id": 1,
  5093  			"node_id": "n",
  5094  			"avatar_url": "a",
  5095  			"url": "u",
  5096  			"events_url": "e",
  5097  			"repos_url": "r"
  5098  		},
  5099  		"installation": {
  5100  			"id": 1,
  5101  			"node_id": "nid",
  5102  			"app_id": 1,
  5103  			"app_slug": "as",
  5104  			"target_id": 1,
  5105  			"account": {
  5106  				"login": "l",
  5107  				"id": 1,
  5108  				"avatar_url": "a",
  5109  				"gravatar_id": "g",
  5110  				"name": "n",
  5111  				"company": "c",
  5112  				"blog": "b",
  5113  				"location": "l",
  5114  				"email": "e",
  5115  				"hireable": true,
  5116  				"bio": "b",
  5117  				"twitter_username": "t",
  5118  				"public_repos": 1,
  5119  				"followers": 1,
  5120  				"following": 1,
  5121  				"created_at": ` + referenceTimeStr + `,
  5122  				"suspended_at": ` + referenceTimeStr + `,
  5123  				"url": "u"
  5124  			},
  5125  			"access_tokens_url": "atu",
  5126  			"repositories_url": "ru",
  5127  			"html_url": "hu",
  5128  			"target_type": "tt",
  5129  			"single_file_name": "sfn",
  5130  			"repository_selection": "rs",
  5131  			"events": [
  5132  				"e"
  5133  			],
  5134  			"single_file_paths": [
  5135  				"s"
  5136  			],
  5137  			"permissions": {
  5138  				"actions": "a",
  5139  				"administration": "ad",
  5140  				"checks": "c",
  5141  				"contents": "co",
  5142  				"content_references": "cr",
  5143  				"deployments": "d",
  5144  				"environments": "e",
  5145  				"issues": "i",
  5146  				"metadata": "md",
  5147  				"members": "m",
  5148  				"organization_administration": "oa",
  5149  				"organization_hooks": "oh",
  5150  				"organization_plan": "op",
  5151  				"organization_pre_receive_hooks": "opr",
  5152  				"organization_projects": "op",
  5153  				"organization_secrets": "os",
  5154  				"organization_self_hosted_runners": "osh",
  5155  				"organization_user_blocking": "oub",
  5156  				"packages": "pkg",
  5157  				"pages": "pg",
  5158  				"pull_requests": "pr",
  5159  				"repository_hooks": "rh",
  5160  				"repository_projects": "rp",
  5161  				"repository_pre_receive_hooks": "rprh",
  5162  				"secrets": "s",
  5163  				"secret_scanning_alerts": "ssa",
  5164  				"security_events": "se",
  5165  				"single_file": "sf",
  5166  				"statuses": "s",
  5167  				"team_discussions": "td",
  5168  				"vulnerability_alerts": "va",
  5169  				"workflows": "w"
  5170  			},
  5171  			"created_at": ` + referenceTimeStr + `,
  5172  			"updated_at": ` + referenceTimeStr + `,
  5173  			"has_multiple_single_files": false,
  5174  			"suspended_by": {
  5175  				"login": "l",
  5176  				"id": 1,
  5177  				"avatar_url": "a",
  5178  				"gravatar_id": "g",
  5179  				"name": "n",
  5180  				"company": "c",
  5181  				"blog": "b",
  5182  				"location": "l",
  5183  				"email": "e",
  5184  				"hireable": true,
  5185  				"bio": "b",
  5186  				"twitter_username": "t",
  5187  				"public_repos": 1,
  5188  				"followers": 1,
  5189  				"following": 1,
  5190  				"created_at": ` + referenceTimeStr + `,
  5191  				"suspended_at": ` + referenceTimeStr + `,
  5192  				"url": "u"
  5193  			},
  5194  			"suspended_at": ` + referenceTimeStr + `
  5195  		}
  5196  	}`
  5197  
  5198  	testJSONMarshal(t, u, want)
  5199  }
  5200  
  5201  func TestDeploymentEvent_Marshal(t *testing.T) {
  5202  	testJSONMarshal(t, &DeploymentEvent{}, "{}")
  5203  
  5204  	l := make(map[string]interface{})
  5205  	l["key"] = "value"
  5206  
  5207  	jsonMsg, _ := json.Marshal(&l)
  5208  
  5209  	u := &DeploymentEvent{
  5210  		Deployment: &Deployment{
  5211  			URL:         String("url"),
  5212  			ID:          Int64(1),
  5213  			SHA:         String("sha"),
  5214  			Ref:         String("ref"),
  5215  			Task:        String("t"),
  5216  			Payload:     jsonMsg,
  5217  			Environment: String("e"),
  5218  			Description: String("d"),
  5219  			Creator: &User{
  5220  				Login:     String("l"),
  5221  				ID:        Int64(1),
  5222  				NodeID:    String("n"),
  5223  				URL:       String("u"),
  5224  				ReposURL:  String("r"),
  5225  				EventsURL: String("e"),
  5226  				AvatarURL: String("a"),
  5227  			},
  5228  			CreatedAt:     &Timestamp{referenceTime},
  5229  			UpdatedAt:     &Timestamp{referenceTime},
  5230  			StatusesURL:   String("surl"),
  5231  			RepositoryURL: String("rurl"),
  5232  			NodeID:        String("nid"),
  5233  		},
  5234  		Repo: &Repository{
  5235  			ID:   Int64(1),
  5236  			URL:  String("s"),
  5237  			Name: String("n"),
  5238  		},
  5239  		Sender: &User{
  5240  			Login:     String("l"),
  5241  			ID:        Int64(1),
  5242  			NodeID:    String("n"),
  5243  			URL:       String("u"),
  5244  			ReposURL:  String("r"),
  5245  			EventsURL: String("e"),
  5246  			AvatarURL: String("a"),
  5247  		},
  5248  		Installation: &Installation{
  5249  			ID:       Int64(1),
  5250  			NodeID:   String("nid"),
  5251  			AppID:    Int64(1),
  5252  			AppSlug:  String("as"),
  5253  			TargetID: Int64(1),
  5254  			Account: &User{
  5255  				Login:           String("l"),
  5256  				ID:              Int64(1),
  5257  				URL:             String("u"),
  5258  				AvatarURL:       String("a"),
  5259  				GravatarID:      String("g"),
  5260  				Name:            String("n"),
  5261  				Company:         String("c"),
  5262  				Blog:            String("b"),
  5263  				Location:        String("l"),
  5264  				Email:           String("e"),
  5265  				Hireable:        Bool(true),
  5266  				Bio:             String("b"),
  5267  				TwitterUsername: String("t"),
  5268  				PublicRepos:     Int(1),
  5269  				Followers:       Int(1),
  5270  				Following:       Int(1),
  5271  				CreatedAt:       &Timestamp{referenceTime},
  5272  				SuspendedAt:     &Timestamp{referenceTime},
  5273  			},
  5274  			AccessTokensURL:     String("atu"),
  5275  			RepositoriesURL:     String("ru"),
  5276  			HTMLURL:             String("hu"),
  5277  			TargetType:          String("tt"),
  5278  			SingleFileName:      String("sfn"),
  5279  			RepositorySelection: String("rs"),
  5280  			Events:              []string{"e"},
  5281  			SingleFilePaths:     []string{"s"},
  5282  			Permissions: &InstallationPermissions{
  5283  				Actions:                       String("a"),
  5284  				Administration:                String("ad"),
  5285  				Checks:                        String("c"),
  5286  				Contents:                      String("co"),
  5287  				ContentReferences:             String("cr"),
  5288  				Deployments:                   String("d"),
  5289  				Environments:                  String("e"),
  5290  				Issues:                        String("i"),
  5291  				Metadata:                      String("md"),
  5292  				Members:                       String("m"),
  5293  				OrganizationAdministration:    String("oa"),
  5294  				OrganizationHooks:             String("oh"),
  5295  				OrganizationPlan:              String("op"),
  5296  				OrganizationPreReceiveHooks:   String("opr"),
  5297  				OrganizationProjects:          String("op"),
  5298  				OrganizationSecrets:           String("os"),
  5299  				OrganizationSelfHostedRunners: String("osh"),
  5300  				OrganizationUserBlocking:      String("oub"),
  5301  				Packages:                      String("pkg"),
  5302  				Pages:                         String("pg"),
  5303  				PullRequests:                  String("pr"),
  5304  				RepositoryHooks:               String("rh"),
  5305  				RepositoryProjects:            String("rp"),
  5306  				RepositoryPreReceiveHooks:     String("rprh"),
  5307  				Secrets:                       String("s"),
  5308  				SecretScanningAlerts:          String("ssa"),
  5309  				SecurityEvents:                String("se"),
  5310  				SingleFile:                    String("sf"),
  5311  				Statuses:                      String("s"),
  5312  				TeamDiscussions:               String("td"),
  5313  				VulnerabilityAlerts:           String("va"),
  5314  				Workflows:                     String("w"),
  5315  			},
  5316  			CreatedAt:              &Timestamp{referenceTime},
  5317  			UpdatedAt:              &Timestamp{referenceTime},
  5318  			HasMultipleSingleFiles: Bool(false),
  5319  			SuspendedBy: &User{
  5320  				Login:           String("l"),
  5321  				ID:              Int64(1),
  5322  				URL:             String("u"),
  5323  				AvatarURL:       String("a"),
  5324  				GravatarID:      String("g"),
  5325  				Name:            String("n"),
  5326  				Company:         String("c"),
  5327  				Blog:            String("b"),
  5328  				Location:        String("l"),
  5329  				Email:           String("e"),
  5330  				Hireable:        Bool(true),
  5331  				Bio:             String("b"),
  5332  				TwitterUsername: String("t"),
  5333  				PublicRepos:     Int(1),
  5334  				Followers:       Int(1),
  5335  				Following:       Int(1),
  5336  				CreatedAt:       &Timestamp{referenceTime},
  5337  				SuspendedAt:     &Timestamp{referenceTime},
  5338  			},
  5339  			SuspendedAt: &Timestamp{referenceTime},
  5340  		},
  5341  	}
  5342  
  5343  	want := `{
  5344  		"deployment": {
  5345  			"url": "url",
  5346  			"id": 1,
  5347  			"sha": "sha",
  5348  			"ref": "ref",
  5349  			"task": "t",
  5350  			"payload": {
  5351  				"key": "value"
  5352  			},
  5353  			"environment": "e",
  5354  			"description": "d",
  5355  			"creator": {
  5356  				"login": "l",
  5357  				"id": 1,
  5358  				"node_id": "n",
  5359  				"avatar_url": "a",
  5360  				"url": "u",
  5361  				"events_url": "e",
  5362  				"repos_url": "r"
  5363  			},
  5364  			"created_at": ` + referenceTimeStr + `,
  5365  			"updated_at": ` + referenceTimeStr + `,
  5366  			"statuses_url": "surl",
  5367  			"repository_url": "rurl",
  5368  			"node_id": "nid"
  5369  		},
  5370  		"repository": {
  5371  			"id": 1,
  5372  			"name": "n",
  5373  			"url": "s"
  5374  		},
  5375  		"sender": {
  5376  			"login": "l",
  5377  			"id": 1,
  5378  			"node_id": "n",
  5379  			"avatar_url": "a",
  5380  			"url": "u",
  5381  			"events_url": "e",
  5382  			"repos_url": "r"
  5383  		},
  5384  		"installation": {
  5385  			"id": 1,
  5386  			"node_id": "nid",
  5387  			"app_id": 1,
  5388  			"app_slug": "as",
  5389  			"target_id": 1,
  5390  			"account": {
  5391  				"login": "l",
  5392  				"id": 1,
  5393  				"avatar_url": "a",
  5394  				"gravatar_id": "g",
  5395  				"name": "n",
  5396  				"company": "c",
  5397  				"blog": "b",
  5398  				"location": "l",
  5399  				"email": "e",
  5400  				"hireable": true,
  5401  				"bio": "b",
  5402  				"twitter_username": "t",
  5403  				"public_repos": 1,
  5404  				"followers": 1,
  5405  				"following": 1,
  5406  				"created_at": ` + referenceTimeStr + `,
  5407  				"suspended_at": ` + referenceTimeStr + `,
  5408  				"url": "u"
  5409  			},
  5410  			"access_tokens_url": "atu",
  5411  			"repositories_url": "ru",
  5412  			"html_url": "hu",
  5413  			"target_type": "tt",
  5414  			"single_file_name": "sfn",
  5415  			"repository_selection": "rs",
  5416  			"events": [
  5417  				"e"
  5418  			],
  5419  			"single_file_paths": [
  5420  				"s"
  5421  			],
  5422  			"permissions": {
  5423  				"actions": "a",
  5424  				"administration": "ad",
  5425  				"checks": "c",
  5426  				"contents": "co",
  5427  				"content_references": "cr",
  5428  				"deployments": "d",
  5429  				"environments": "e",
  5430  				"issues": "i",
  5431  				"metadata": "md",
  5432  				"members": "m",
  5433  				"organization_administration": "oa",
  5434  				"organization_hooks": "oh",
  5435  				"organization_plan": "op",
  5436  				"organization_pre_receive_hooks": "opr",
  5437  				"organization_projects": "op",
  5438  				"organization_secrets": "os",
  5439  				"organization_self_hosted_runners": "osh",
  5440  				"organization_user_blocking": "oub",
  5441  				"packages": "pkg",
  5442  				"pages": "pg",
  5443  				"pull_requests": "pr",
  5444  				"repository_hooks": "rh",
  5445  				"repository_projects": "rp",
  5446  				"repository_pre_receive_hooks": "rprh",
  5447  				"secrets": "s",
  5448  				"secret_scanning_alerts": "ssa",
  5449  				"security_events": "se",
  5450  				"single_file": "sf",
  5451  				"statuses": "s",
  5452  				"team_discussions": "td",
  5453  				"vulnerability_alerts": "va",
  5454  				"workflows": "w"
  5455  			},
  5456  			"created_at": ` + referenceTimeStr + `,
  5457  			"updated_at": ` + referenceTimeStr + `,
  5458  			"has_multiple_single_files": false,
  5459  			"suspended_by": {
  5460  				"login": "l",
  5461  				"id": 1,
  5462  				"avatar_url": "a",
  5463  				"gravatar_id": "g",
  5464  				"name": "n",
  5465  				"company": "c",
  5466  				"blog": "b",
  5467  				"location": "l",
  5468  				"email": "e",
  5469  				"hireable": true,
  5470  				"bio": "b",
  5471  				"twitter_username": "t",
  5472  				"public_repos": 1,
  5473  				"followers": 1,
  5474  				"following": 1,
  5475  				"created_at": ` + referenceTimeStr + `,
  5476  				"suspended_at": ` + referenceTimeStr + `,
  5477  				"url": "u"
  5478  			},
  5479  			"suspended_at": ` + referenceTimeStr + `
  5480  		}
  5481  	}`
  5482  
  5483  	testJSONMarshal(t, u, want)
  5484  }
  5485  
  5486  func TestDeploymentStatusEvent_Marshal(t *testing.T) {
  5487  	testJSONMarshal(t, &DeploymentStatusEvent{}, "{}")
  5488  
  5489  	l := make(map[string]interface{})
  5490  	l["key"] = "value"
  5491  
  5492  	jsonMsg, _ := json.Marshal(&l)
  5493  
  5494  	u := &DeploymentStatusEvent{
  5495  		Deployment: &Deployment{
  5496  			URL:         String("url"),
  5497  			ID:          Int64(1),
  5498  			SHA:         String("sha"),
  5499  			Ref:         String("ref"),
  5500  			Task:        String("t"),
  5501  			Payload:     jsonMsg,
  5502  			Environment: String("e"),
  5503  			Description: String("d"),
  5504  			Creator: &User{
  5505  				Login:     String("l"),
  5506  				ID:        Int64(1),
  5507  				NodeID:    String("n"),
  5508  				URL:       String("u"),
  5509  				ReposURL:  String("r"),
  5510  				EventsURL: String("e"),
  5511  				AvatarURL: String("a"),
  5512  			},
  5513  			CreatedAt:     &Timestamp{referenceTime},
  5514  			UpdatedAt:     &Timestamp{referenceTime},
  5515  			StatusesURL:   String("surl"),
  5516  			RepositoryURL: String("rurl"),
  5517  			NodeID:        String("nid"),
  5518  		},
  5519  		DeploymentStatus: &DeploymentStatus{
  5520  			ID:    Int64(1),
  5521  			State: String("s"),
  5522  			Creator: &User{
  5523  				Login:     String("l"),
  5524  				ID:        Int64(1),
  5525  				NodeID:    String("n"),
  5526  				URL:       String("u"),
  5527  				ReposURL:  String("r"),
  5528  				EventsURL: String("e"),
  5529  				AvatarURL: String("a"),
  5530  			},
  5531  			Description:    String("s"),
  5532  			Environment:    String("s"),
  5533  			NodeID:         String("s"),
  5534  			CreatedAt:      &Timestamp{referenceTime},
  5535  			UpdatedAt:      &Timestamp{referenceTime},
  5536  			TargetURL:      String("s"),
  5537  			DeploymentURL:  String("s"),
  5538  			RepositoryURL:  String("s"),
  5539  			EnvironmentURL: String("s"),
  5540  			LogURL:         String("s"),
  5541  			URL:            String("s"),
  5542  		},
  5543  		Repo: &Repository{
  5544  			ID:   Int64(1),
  5545  			URL:  String("s"),
  5546  			Name: String("n"),
  5547  		},
  5548  		Sender: &User{
  5549  			Login:     String("l"),
  5550  			ID:        Int64(1),
  5551  			NodeID:    String("n"),
  5552  			URL:       String("u"),
  5553  			ReposURL:  String("r"),
  5554  			EventsURL: String("e"),
  5555  			AvatarURL: String("a"),
  5556  		},
  5557  		Installation: &Installation{
  5558  			ID:       Int64(1),
  5559  			NodeID:   String("nid"),
  5560  			AppID:    Int64(1),
  5561  			AppSlug:  String("as"),
  5562  			TargetID: Int64(1),
  5563  			Account: &User{
  5564  				Login:           String("l"),
  5565  				ID:              Int64(1),
  5566  				URL:             String("u"),
  5567  				AvatarURL:       String("a"),
  5568  				GravatarID:      String("g"),
  5569  				Name:            String("n"),
  5570  				Company:         String("c"),
  5571  				Blog:            String("b"),
  5572  				Location:        String("l"),
  5573  				Email:           String("e"),
  5574  				Hireable:        Bool(true),
  5575  				Bio:             String("b"),
  5576  				TwitterUsername: String("t"),
  5577  				PublicRepos:     Int(1),
  5578  				Followers:       Int(1),
  5579  				Following:       Int(1),
  5580  				CreatedAt:       &Timestamp{referenceTime},
  5581  				SuspendedAt:     &Timestamp{referenceTime},
  5582  			},
  5583  			AccessTokensURL:     String("atu"),
  5584  			RepositoriesURL:     String("ru"),
  5585  			HTMLURL:             String("hu"),
  5586  			TargetType:          String("tt"),
  5587  			SingleFileName:      String("sfn"),
  5588  			RepositorySelection: String("rs"),
  5589  			Events:              []string{"e"},
  5590  			SingleFilePaths:     []string{"s"},
  5591  			Permissions: &InstallationPermissions{
  5592  				Actions:                       String("a"),
  5593  				Administration:                String("ad"),
  5594  				Checks:                        String("c"),
  5595  				Contents:                      String("co"),
  5596  				ContentReferences:             String("cr"),
  5597  				Deployments:                   String("d"),
  5598  				Environments:                  String("e"),
  5599  				Issues:                        String("i"),
  5600  				Metadata:                      String("md"),
  5601  				Members:                       String("m"),
  5602  				OrganizationAdministration:    String("oa"),
  5603  				OrganizationHooks:             String("oh"),
  5604  				OrganizationPlan:              String("op"),
  5605  				OrganizationPreReceiveHooks:   String("opr"),
  5606  				OrganizationProjects:          String("op"),
  5607  				OrganizationSecrets:           String("os"),
  5608  				OrganizationSelfHostedRunners: String("osh"),
  5609  				OrganizationUserBlocking:      String("oub"),
  5610  				Packages:                      String("pkg"),
  5611  				Pages:                         String("pg"),
  5612  				PullRequests:                  String("pr"),
  5613  				RepositoryHooks:               String("rh"),
  5614  				RepositoryProjects:            String("rp"),
  5615  				RepositoryPreReceiveHooks:     String("rprh"),
  5616  				Secrets:                       String("s"),
  5617  				SecretScanningAlerts:          String("ssa"),
  5618  				SecurityEvents:                String("se"),
  5619  				SingleFile:                    String("sf"),
  5620  				Statuses:                      String("s"),
  5621  				TeamDiscussions:               String("td"),
  5622  				VulnerabilityAlerts:           String("va"),
  5623  				Workflows:                     String("w"),
  5624  			},
  5625  			CreatedAt:              &Timestamp{referenceTime},
  5626  			UpdatedAt:              &Timestamp{referenceTime},
  5627  			HasMultipleSingleFiles: Bool(false),
  5628  			SuspendedBy: &User{
  5629  				Login:           String("l"),
  5630  				ID:              Int64(1),
  5631  				URL:             String("u"),
  5632  				AvatarURL:       String("a"),
  5633  				GravatarID:      String("g"),
  5634  				Name:            String("n"),
  5635  				Company:         String("c"),
  5636  				Blog:            String("b"),
  5637  				Location:        String("l"),
  5638  				Email:           String("e"),
  5639  				Hireable:        Bool(true),
  5640  				Bio:             String("b"),
  5641  				TwitterUsername: String("t"),
  5642  				PublicRepos:     Int(1),
  5643  				Followers:       Int(1),
  5644  				Following:       Int(1),
  5645  				CreatedAt:       &Timestamp{referenceTime},
  5646  				SuspendedAt:     &Timestamp{referenceTime},
  5647  			},
  5648  			SuspendedAt: &Timestamp{referenceTime},
  5649  		},
  5650  	}
  5651  
  5652  	want := `{
  5653  		"deployment": {
  5654  			"url": "url",
  5655  			"id": 1,
  5656  			"sha": "sha",
  5657  			"ref": "ref",
  5658  			"task": "t",
  5659  			"payload": {
  5660  				"key": "value"
  5661  			},
  5662  			"environment": "e",
  5663  			"description": "d",
  5664  			"creator": {
  5665  				"login": "l",
  5666  				"id": 1,
  5667  				"node_id": "n",
  5668  				"avatar_url": "a",
  5669  				"url": "u",
  5670  				"events_url": "e",
  5671  				"repos_url": "r"
  5672  			},
  5673  			"created_at": ` + referenceTimeStr + `,
  5674  			"updated_at": ` + referenceTimeStr + `,
  5675  			"statuses_url": "surl",
  5676  			"repository_url": "rurl",
  5677  			"node_id": "nid"
  5678  		},
  5679  		"deployment_status": {
  5680  			"id": 1,
  5681  			"state": "s",
  5682  			"creator": {
  5683  				"login": "l",
  5684  				"id": 1,
  5685  				"node_id": "n",
  5686  				"avatar_url": "a",
  5687  				"url": "u",
  5688  				"events_url": "e",
  5689  				"repos_url": "r"
  5690  			},
  5691  			"description": "s",
  5692  			"environment": "s",
  5693  			"node_id": "s",
  5694  			"created_at": ` + referenceTimeStr + `,
  5695  			"updated_at": ` + referenceTimeStr + `,
  5696  			"target_url": "s",
  5697  			"deployment_url": "s",
  5698  			"repository_url": "s",
  5699  			"environment_url": "s",
  5700  			"log_url": "s",
  5701  			"url": "s"
  5702  		},
  5703  		"repository": {
  5704  			"id": 1,
  5705  			"name": "n",
  5706  			"url": "s"
  5707  		},
  5708  		"sender": {
  5709  			"login": "l",
  5710  			"id": 1,
  5711  			"node_id": "n",
  5712  			"avatar_url": "a",
  5713  			"url": "u",
  5714  			"events_url": "e",
  5715  			"repos_url": "r"
  5716  		},
  5717  		"installation": {
  5718  			"id": 1,
  5719  			"node_id": "nid",
  5720  			"app_id": 1,
  5721  			"app_slug": "as",
  5722  			"target_id": 1,
  5723  			"account": {
  5724  				"login": "l",
  5725  				"id": 1,
  5726  				"avatar_url": "a",
  5727  				"gravatar_id": "g",
  5728  				"name": "n",
  5729  				"company": "c",
  5730  				"blog": "b",
  5731  				"location": "l",
  5732  				"email": "e",
  5733  				"hireable": true,
  5734  				"bio": "b",
  5735  				"twitter_username": "t",
  5736  				"public_repos": 1,
  5737  				"followers": 1,
  5738  				"following": 1,
  5739  				"created_at": ` + referenceTimeStr + `,
  5740  				"suspended_at": ` + referenceTimeStr + `,
  5741  				"url": "u"
  5742  			},
  5743  			"access_tokens_url": "atu",
  5744  			"repositories_url": "ru",
  5745  			"html_url": "hu",
  5746  			"target_type": "tt",
  5747  			"single_file_name": "sfn",
  5748  			"repository_selection": "rs",
  5749  			"events": [
  5750  				"e"
  5751  			],
  5752  			"single_file_paths": [
  5753  				"s"
  5754  			],
  5755  			"permissions": {
  5756  				"actions": "a",
  5757  				"administration": "ad",
  5758  				"checks": "c",
  5759  				"contents": "co",
  5760  				"content_references": "cr",
  5761  				"deployments": "d",
  5762  				"environments": "e",
  5763  				"issues": "i",
  5764  				"metadata": "md",
  5765  				"members": "m",
  5766  				"organization_administration": "oa",
  5767  				"organization_hooks": "oh",
  5768  				"organization_plan": "op",
  5769  				"organization_pre_receive_hooks": "opr",
  5770  				"organization_projects": "op",
  5771  				"organization_secrets": "os",
  5772  				"organization_self_hosted_runners": "osh",
  5773  				"organization_user_blocking": "oub",
  5774  				"packages": "pkg",
  5775  				"pages": "pg",
  5776  				"pull_requests": "pr",
  5777  				"repository_hooks": "rh",
  5778  				"repository_projects": "rp",
  5779  				"repository_pre_receive_hooks": "rprh",
  5780  				"secrets": "s",
  5781  				"secret_scanning_alerts": "ssa",
  5782  				"security_events": "se",
  5783  				"single_file": "sf",
  5784  				"statuses": "s",
  5785  				"team_discussions": "td",
  5786  				"vulnerability_alerts": "va",
  5787  				"workflows": "w"
  5788  			},
  5789  			"created_at": ` + referenceTimeStr + `,
  5790  			"updated_at": ` + referenceTimeStr + `,
  5791  			"has_multiple_single_files": false,
  5792  			"suspended_by": {
  5793  				"login": "l",
  5794  				"id": 1,
  5795  				"avatar_url": "a",
  5796  				"gravatar_id": "g",
  5797  				"name": "n",
  5798  				"company": "c",
  5799  				"blog": "b",
  5800  				"location": "l",
  5801  				"email": "e",
  5802  				"hireable": true,
  5803  				"bio": "b",
  5804  				"twitter_username": "t",
  5805  				"public_repos": 1,
  5806  				"followers": 1,
  5807  				"following": 1,
  5808  				"created_at": ` + referenceTimeStr + `,
  5809  				"suspended_at": ` + referenceTimeStr + `,
  5810  				"url": "u"
  5811  			},
  5812  			"suspended_at": ` + referenceTimeStr + `
  5813  		}
  5814  	}`
  5815  
  5816  	testJSONMarshal(t, u, want)
  5817  }
  5818  
  5819  func TestDiscussionCommentEvent_Marshal(t *testing.T) {
  5820  	testJSONMarshal(t, &DiscussionCommentEvent{}, "{}")
  5821  
  5822  	u := &DiscussionCommentEvent{
  5823  		Comment: &CommentDiscussion{
  5824  			AuthorAssociation: String("aa"),
  5825  			Body:              String("bo"),
  5826  			ChildCommentCount: Int(1),
  5827  			CreatedAt:         &Timestamp{referenceTime},
  5828  			DiscussionID:      Int64(1),
  5829  			HTMLURL:           String("hurl"),
  5830  			ID:                Int64(1),
  5831  			NodeID:            String("nid"),
  5832  			ParentID:          Int64(1),
  5833  			Reactions: &Reactions{
  5834  				TotalCount: Int(1),
  5835  				PlusOne:    Int(1),
  5836  				MinusOne:   Int(1),
  5837  				Laugh:      Int(1),
  5838  				Confused:   Int(1),
  5839  				Heart:      Int(1),
  5840  				Hooray:     Int(1),
  5841  				Rocket:     Int(1),
  5842  				Eyes:       Int(1),
  5843  				URL:        String("url"),
  5844  			},
  5845  			RepositoryURL: String("rurl"),
  5846  			UpdatedAt:     &Timestamp{referenceTime},
  5847  			User: &User{
  5848  				Login:     String("l"),
  5849  				ID:        Int64(1),
  5850  				NodeID:    String("n"),
  5851  				URL:       String("u"),
  5852  				ReposURL:  String("r"),
  5853  				EventsURL: String("e"),
  5854  				AvatarURL: String("a"),
  5855  			},
  5856  		},
  5857  		Discussion: &Discussion{
  5858  			RepositoryURL: String("rurl"),
  5859  			DiscussionCategory: &DiscussionCategory{
  5860  				ID:           Int64(1),
  5861  				NodeID:       String("nid"),
  5862  				RepositoryID: Int64(1),
  5863  				Emoji:        String("emoji"),
  5864  				Name:         String("name"),
  5865  				Description:  String("description"),
  5866  				CreatedAt:    &Timestamp{referenceTime},
  5867  				UpdatedAt:    &Timestamp{referenceTime},
  5868  				Slug:         String("slug"),
  5869  				IsAnswerable: Bool(false),
  5870  			},
  5871  			HTMLURL: String("hurl"),
  5872  			ID:      Int64(1),
  5873  			NodeID:  String("nurl"),
  5874  			Number:  Int(1),
  5875  			Title:   String("title"),
  5876  			User: &User{
  5877  				Login:     String("l"),
  5878  				ID:        Int64(1),
  5879  				NodeID:    String("n"),
  5880  				URL:       String("u"),
  5881  				ReposURL:  String("r"),
  5882  				EventsURL: String("e"),
  5883  				AvatarURL: String("a"),
  5884  			},
  5885  			State:             String("st"),
  5886  			Locked:            Bool(false),
  5887  			Comments:          Int(1),
  5888  			CreatedAt:         &Timestamp{referenceTime},
  5889  			UpdatedAt:         &Timestamp{referenceTime},
  5890  			AuthorAssociation: String("aa"),
  5891  			Body:              String("bo"),
  5892  		},
  5893  		Repo: &Repository{
  5894  			ID:   Int64(1),
  5895  			URL:  String("s"),
  5896  			Name: String("n"),
  5897  		},
  5898  		Org: &Organization{
  5899  			BillingEmail:                         String("be"),
  5900  			Blog:                                 String("b"),
  5901  			Company:                              String("c"),
  5902  			Email:                                String("e"),
  5903  			TwitterUsername:                      String("tu"),
  5904  			Location:                             String("loc"),
  5905  			Name:                                 String("n"),
  5906  			Description:                          String("d"),
  5907  			IsVerified:                           Bool(true),
  5908  			HasOrganizationProjects:              Bool(true),
  5909  			HasRepositoryProjects:                Bool(true),
  5910  			DefaultRepoPermission:                String("drp"),
  5911  			MembersCanCreateRepos:                Bool(true),
  5912  			MembersCanCreateInternalRepos:        Bool(true),
  5913  			MembersCanCreatePrivateRepos:         Bool(true),
  5914  			MembersCanCreatePublicRepos:          Bool(false),
  5915  			MembersAllowedRepositoryCreationType: String("marct"),
  5916  			MembersCanCreatePages:                Bool(true),
  5917  			MembersCanCreatePublicPages:          Bool(false),
  5918  			MembersCanCreatePrivatePages:         Bool(true),
  5919  		},
  5920  		Sender: &User{
  5921  			Login:     String("l"),
  5922  			ID:        Int64(1),
  5923  			NodeID:    String("n"),
  5924  			URL:       String("u"),
  5925  			ReposURL:  String("r"),
  5926  			EventsURL: String("e"),
  5927  			AvatarURL: String("a"),
  5928  		},
  5929  		Installation: &Installation{
  5930  			ID:       Int64(1),
  5931  			NodeID:   String("nid"),
  5932  			AppID:    Int64(1),
  5933  			AppSlug:  String("as"),
  5934  			TargetID: Int64(1),
  5935  			Account: &User{
  5936  				Login:           String("l"),
  5937  				ID:              Int64(1),
  5938  				URL:             String("u"),
  5939  				AvatarURL:       String("a"),
  5940  				GravatarID:      String("g"),
  5941  				Name:            String("n"),
  5942  				Company:         String("c"),
  5943  				Blog:            String("b"),
  5944  				Location:        String("l"),
  5945  				Email:           String("e"),
  5946  				Hireable:        Bool(true),
  5947  				Bio:             String("b"),
  5948  				TwitterUsername: String("t"),
  5949  				PublicRepos:     Int(1),
  5950  				Followers:       Int(1),
  5951  				Following:       Int(1),
  5952  				CreatedAt:       &Timestamp{referenceTime},
  5953  				SuspendedAt:     &Timestamp{referenceTime},
  5954  			},
  5955  			AccessTokensURL:     String("atu"),
  5956  			RepositoriesURL:     String("ru"),
  5957  			HTMLURL:             String("hu"),
  5958  			TargetType:          String("tt"),
  5959  			SingleFileName:      String("sfn"),
  5960  			RepositorySelection: String("rs"),
  5961  			Events:              []string{"e"},
  5962  			SingleFilePaths:     []string{"s"},
  5963  			Permissions: &InstallationPermissions{
  5964  				Actions:                       String("a"),
  5965  				Administration:                String("ad"),
  5966  				Checks:                        String("c"),
  5967  				Contents:                      String("co"),
  5968  				ContentReferences:             String("cr"),
  5969  				Deployments:                   String("d"),
  5970  				Environments:                  String("e"),
  5971  				Issues:                        String("i"),
  5972  				Metadata:                      String("md"),
  5973  				Members:                       String("m"),
  5974  				OrganizationAdministration:    String("oa"),
  5975  				OrganizationHooks:             String("oh"),
  5976  				OrganizationPlan:              String("op"),
  5977  				OrganizationPreReceiveHooks:   String("opr"),
  5978  				OrganizationProjects:          String("op"),
  5979  				OrganizationSecrets:           String("os"),
  5980  				OrganizationSelfHostedRunners: String("osh"),
  5981  				OrganizationUserBlocking:      String("oub"),
  5982  				Packages:                      String("pkg"),
  5983  				Pages:                         String("pg"),
  5984  				PullRequests:                  String("pr"),
  5985  				RepositoryHooks:               String("rh"),
  5986  				RepositoryProjects:            String("rp"),
  5987  				RepositoryPreReceiveHooks:     String("rprh"),
  5988  				Secrets:                       String("s"),
  5989  				SecretScanningAlerts:          String("ssa"),
  5990  				SecurityEvents:                String("se"),
  5991  				SingleFile:                    String("sf"),
  5992  				Statuses:                      String("s"),
  5993  				TeamDiscussions:               String("td"),
  5994  				VulnerabilityAlerts:           String("va"),
  5995  				Workflows:                     String("w"),
  5996  			},
  5997  			CreatedAt:              &Timestamp{referenceTime},
  5998  			UpdatedAt:              &Timestamp{referenceTime},
  5999  			HasMultipleSingleFiles: Bool(false),
  6000  			SuspendedBy: &User{
  6001  				Login:           String("l"),
  6002  				ID:              Int64(1),
  6003  				URL:             String("u"),
  6004  				AvatarURL:       String("a"),
  6005  				GravatarID:      String("g"),
  6006  				Name:            String("n"),
  6007  				Company:         String("c"),
  6008  				Blog:            String("b"),
  6009  				Location:        String("l"),
  6010  				Email:           String("e"),
  6011  				Hireable:        Bool(true),
  6012  				Bio:             String("b"),
  6013  				TwitterUsername: String("t"),
  6014  				PublicRepos:     Int(1),
  6015  				Followers:       Int(1),
  6016  				Following:       Int(1),
  6017  				CreatedAt:       &Timestamp{referenceTime},
  6018  				SuspendedAt:     &Timestamp{referenceTime},
  6019  			},
  6020  			SuspendedAt: &Timestamp{referenceTime},
  6021  		},
  6022  	}
  6023  
  6024  	want := `{
  6025  		"comment": {
  6026  			"author_association": "aa",
  6027  			"body": "bo",
  6028  			"child_comment_count": 1,
  6029  			"created_at": ` + referenceTimeStr + `,
  6030  			"discussion_id": 1,
  6031  			"html_url": "hurl",
  6032  			"id": 1,
  6033  			"node_id": "nid",
  6034  			"parent_id": 1,
  6035  			"reactions": {
  6036  				"total_count": 1,
  6037  				"+1": 1,
  6038  				"-1": 1,
  6039  				"laugh": 1,
  6040  				"confused": 1,
  6041  				"heart": 1,
  6042  				"hooray": 1,
  6043  				"rocket": 1,
  6044  				"eyes": 1,
  6045  				"url": "url"
  6046  			},
  6047  			"repository_url": "rurl",
  6048  			"updated_at": ` + referenceTimeStr + `,
  6049  			"user": {
  6050  				"login": "l",
  6051  				"id": 1,
  6052  				"node_id": "n",
  6053  				"avatar_url": "a",
  6054  				"url": "u",
  6055  				"events_url": "e",
  6056  				"repos_url": "r"
  6057  			}
  6058  		},
  6059  		"discussion": {
  6060  			"repository_url": "rurl",
  6061  			"category": {
  6062  				"id": 1,
  6063  				"node_id": "nid",
  6064  				"repository_id": 1,
  6065  				"emoji": "emoji",
  6066  				"name": "name",
  6067  				"description": "description",
  6068  				"created_at": ` + referenceTimeStr + `,
  6069  				"updated_at": ` + referenceTimeStr + `,
  6070  				"slug": "slug",
  6071  				"is_answerable": false
  6072  			},
  6073  			"html_url": "hurl",
  6074  			"id": 1,
  6075  			"node_id": "nurl",
  6076  			"number": 1,
  6077  			"title": "title",
  6078  			"user": {
  6079  				"login": "l",
  6080  				"id": 1,
  6081  				"node_id": "n",
  6082  				"avatar_url": "a",
  6083  				"url": "u",
  6084  				"events_url": "e",
  6085  				"repos_url": "r"
  6086  			},
  6087  			"state": "st",
  6088  			"locked": false,
  6089  			"comments": 1,
  6090  			"created_at": ` + referenceTimeStr + `,
  6091  			"updated_at": ` + referenceTimeStr + `,
  6092  			"author_association": "aa",
  6093  			"body": "bo"
  6094  		},
  6095  		"repository": {
  6096  			"id": 1,
  6097  			"name": "n",
  6098  			"url": "s"
  6099  		},
  6100  		"organization": {
  6101  			"name": "n",
  6102  			"company": "c",
  6103  			"blog": "b",
  6104  			"location": "loc",
  6105  			"email": "e",
  6106  			"twitter_username": "tu",
  6107  			"description": "d",
  6108  			"billing_email": "be",
  6109  			"is_verified": true,
  6110  			"has_organization_projects": true,
  6111  			"has_repository_projects": true,
  6112  			"default_repository_permission": "drp",
  6113  			"members_can_create_repositories": true,
  6114  			"members_can_create_public_repositories": false,
  6115  			"members_can_create_private_repositories": true,
  6116  			"members_can_create_internal_repositories": true,
  6117  			"members_allowed_repository_creation_type": "marct",
  6118  			"members_can_create_pages": true,
  6119  			"members_can_create_public_pages": false,
  6120  			"members_can_create_private_pages": true
  6121  		},
  6122  		"sender": {
  6123  			"login": "l",
  6124  			"id": 1,
  6125  			"node_id": "n",
  6126  			"avatar_url": "a",
  6127  			"url": "u",
  6128  			"events_url": "e",
  6129  			"repos_url": "r"
  6130  		},
  6131  		"installation": {
  6132  			"id": 1,
  6133  			"node_id": "nid",
  6134  			"app_id": 1,
  6135  			"app_slug": "as",
  6136  			"target_id": 1,
  6137  			"account": {
  6138  				"login": "l",
  6139  				"id": 1,
  6140  				"avatar_url": "a",
  6141  				"gravatar_id": "g",
  6142  				"name": "n",
  6143  				"company": "c",
  6144  				"blog": "b",
  6145  				"location": "l",
  6146  				"email": "e",
  6147  				"hireable": true,
  6148  				"bio": "b",
  6149  				"twitter_username": "t",
  6150  				"public_repos": 1,
  6151  				"followers": 1,
  6152  				"following": 1,
  6153  				"created_at": ` + referenceTimeStr + `,
  6154  				"suspended_at": ` + referenceTimeStr + `,
  6155  				"url": "u"
  6156  			},
  6157  			"access_tokens_url": "atu",
  6158  			"repositories_url": "ru",
  6159  			"html_url": "hu",
  6160  			"target_type": "tt",
  6161  			"single_file_name": "sfn",
  6162  			"repository_selection": "rs",
  6163  			"events": [
  6164  				"e"
  6165  			],
  6166  			"single_file_paths": [
  6167  				"s"
  6168  			],
  6169  			"permissions": {
  6170  				"actions": "a",
  6171  				"administration": "ad",
  6172  				"checks": "c",
  6173  				"contents": "co",
  6174  				"content_references": "cr",
  6175  				"deployments": "d",
  6176  				"environments": "e",
  6177  				"issues": "i",
  6178  				"metadata": "md",
  6179  				"members": "m",
  6180  				"organization_administration": "oa",
  6181  				"organization_hooks": "oh",
  6182  				"organization_plan": "op",
  6183  				"organization_pre_receive_hooks": "opr",
  6184  				"organization_projects": "op",
  6185  				"organization_secrets": "os",
  6186  				"organization_self_hosted_runners": "osh",
  6187  				"organization_user_blocking": "oub",
  6188  				"packages": "pkg",
  6189  				"pages": "pg",
  6190  				"pull_requests": "pr",
  6191  				"repository_hooks": "rh",
  6192  				"repository_projects": "rp",
  6193  				"repository_pre_receive_hooks": "rprh",
  6194  				"secrets": "s",
  6195  				"secret_scanning_alerts": "ssa",
  6196  				"security_events": "se",
  6197  				"single_file": "sf",
  6198  				"statuses": "s",
  6199  				"team_discussions": "td",
  6200  				"vulnerability_alerts": "va",
  6201  				"workflows": "w"
  6202  			},
  6203  			"created_at": ` + referenceTimeStr + `,
  6204  			"updated_at": ` + referenceTimeStr + `,
  6205  			"has_multiple_single_files": false,
  6206  			"suspended_by": {
  6207  				"login": "l",
  6208  				"id": 1,
  6209  				"avatar_url": "a",
  6210  				"gravatar_id": "g",
  6211  				"name": "n",
  6212  				"company": "c",
  6213  				"blog": "b",
  6214  				"location": "l",
  6215  				"email": "e",
  6216  				"hireable": true,
  6217  				"bio": "b",
  6218  				"twitter_username": "t",
  6219  				"public_repos": 1,
  6220  				"followers": 1,
  6221  				"following": 1,
  6222  				"created_at": ` + referenceTimeStr + `,
  6223  				"suspended_at": ` + referenceTimeStr + `,
  6224  				"url": "u"
  6225  			},
  6226  			"suspended_at": ` + referenceTimeStr + `
  6227  		}
  6228  	}`
  6229  
  6230  	testJSONMarshal(t, u, want)
  6231  }
  6232  
  6233  func TestDiscussionEvent_Marshal(t *testing.T) {
  6234  	testJSONMarshal(t, &DiscussionEvent{}, "{}")
  6235  
  6236  	u := &DiscussionEvent{
  6237  		Discussion: &Discussion{
  6238  			RepositoryURL: String("rurl"),
  6239  			DiscussionCategory: &DiscussionCategory{
  6240  				ID:           Int64(1),
  6241  				NodeID:       String("nid"),
  6242  				RepositoryID: Int64(1),
  6243  				Emoji:        String("emoji"),
  6244  				Name:         String("name"),
  6245  				Description:  String("description"),
  6246  				CreatedAt:    &Timestamp{referenceTime},
  6247  				UpdatedAt:    &Timestamp{referenceTime},
  6248  				Slug:         String("slug"),
  6249  				IsAnswerable: Bool(false),
  6250  			},
  6251  			HTMLURL: String("hurl"),
  6252  			ID:      Int64(1),
  6253  			NodeID:  String("nurl"),
  6254  			Number:  Int(1),
  6255  			Title:   String("title"),
  6256  			User: &User{
  6257  				Login:     String("l"),
  6258  				ID:        Int64(1),
  6259  				NodeID:    String("n"),
  6260  				URL:       String("u"),
  6261  				ReposURL:  String("r"),
  6262  				EventsURL: String("e"),
  6263  				AvatarURL: String("a"),
  6264  			},
  6265  			State:             String("st"),
  6266  			Locked:            Bool(false),
  6267  			Comments:          Int(1),
  6268  			CreatedAt:         &Timestamp{referenceTime},
  6269  			UpdatedAt:         &Timestamp{referenceTime},
  6270  			AuthorAssociation: String("aa"),
  6271  			Body:              String("bo"),
  6272  		},
  6273  		Repo: &Repository{
  6274  			ID:   Int64(1),
  6275  			URL:  String("s"),
  6276  			Name: String("n"),
  6277  		},
  6278  		Org: &Organization{
  6279  			BillingEmail:                         String("be"),
  6280  			Blog:                                 String("b"),
  6281  			Company:                              String("c"),
  6282  			Email:                                String("e"),
  6283  			TwitterUsername:                      String("tu"),
  6284  			Location:                             String("loc"),
  6285  			Name:                                 String("n"),
  6286  			Description:                          String("d"),
  6287  			IsVerified:                           Bool(true),
  6288  			HasOrganizationProjects:              Bool(true),
  6289  			HasRepositoryProjects:                Bool(true),
  6290  			DefaultRepoPermission:                String("drp"),
  6291  			MembersCanCreateRepos:                Bool(true),
  6292  			MembersCanCreateInternalRepos:        Bool(true),
  6293  			MembersCanCreatePrivateRepos:         Bool(true),
  6294  			MembersCanCreatePublicRepos:          Bool(false),
  6295  			MembersAllowedRepositoryCreationType: String("marct"),
  6296  			MembersCanCreatePages:                Bool(true),
  6297  			MembersCanCreatePublicPages:          Bool(false),
  6298  			MembersCanCreatePrivatePages:         Bool(true),
  6299  		},
  6300  		Sender: &User{
  6301  			Login:     String("l"),
  6302  			ID:        Int64(1),
  6303  			NodeID:    String("n"),
  6304  			URL:       String("u"),
  6305  			ReposURL:  String("r"),
  6306  			EventsURL: String("e"),
  6307  			AvatarURL: String("a"),
  6308  		},
  6309  		Installation: &Installation{
  6310  			ID:       Int64(1),
  6311  			NodeID:   String("nid"),
  6312  			AppID:    Int64(1),
  6313  			AppSlug:  String("as"),
  6314  			TargetID: Int64(1),
  6315  			Account: &User{
  6316  				Login:           String("l"),
  6317  				ID:              Int64(1),
  6318  				URL:             String("u"),
  6319  				AvatarURL:       String("a"),
  6320  				GravatarID:      String("g"),
  6321  				Name:            String("n"),
  6322  				Company:         String("c"),
  6323  				Blog:            String("b"),
  6324  				Location:        String("l"),
  6325  				Email:           String("e"),
  6326  				Hireable:        Bool(true),
  6327  				Bio:             String("b"),
  6328  				TwitterUsername: String("t"),
  6329  				PublicRepos:     Int(1),
  6330  				Followers:       Int(1),
  6331  				Following:       Int(1),
  6332  				CreatedAt:       &Timestamp{referenceTime},
  6333  				SuspendedAt:     &Timestamp{referenceTime},
  6334  			},
  6335  			AccessTokensURL:     String("atu"),
  6336  			RepositoriesURL:     String("ru"),
  6337  			HTMLURL:             String("hu"),
  6338  			TargetType:          String("tt"),
  6339  			SingleFileName:      String("sfn"),
  6340  			RepositorySelection: String("rs"),
  6341  			Events:              []string{"e"},
  6342  			SingleFilePaths:     []string{"s"},
  6343  			Permissions: &InstallationPermissions{
  6344  				Actions:                       String("a"),
  6345  				Administration:                String("ad"),
  6346  				Checks:                        String("c"),
  6347  				Contents:                      String("co"),
  6348  				ContentReferences:             String("cr"),
  6349  				Deployments:                   String("d"),
  6350  				Environments:                  String("e"),
  6351  				Issues:                        String("i"),
  6352  				Metadata:                      String("md"),
  6353  				Members:                       String("m"),
  6354  				OrganizationAdministration:    String("oa"),
  6355  				OrganizationHooks:             String("oh"),
  6356  				OrganizationPlan:              String("op"),
  6357  				OrganizationPreReceiveHooks:   String("opr"),
  6358  				OrganizationProjects:          String("op"),
  6359  				OrganizationSecrets:           String("os"),
  6360  				OrganizationSelfHostedRunners: String("osh"),
  6361  				OrganizationUserBlocking:      String("oub"),
  6362  				Packages:                      String("pkg"),
  6363  				Pages:                         String("pg"),
  6364  				PullRequests:                  String("pr"),
  6365  				RepositoryHooks:               String("rh"),
  6366  				RepositoryProjects:            String("rp"),
  6367  				RepositoryPreReceiveHooks:     String("rprh"),
  6368  				Secrets:                       String("s"),
  6369  				SecretScanningAlerts:          String("ssa"),
  6370  				SecurityEvents:                String("se"),
  6371  				SingleFile:                    String("sf"),
  6372  				Statuses:                      String("s"),
  6373  				TeamDiscussions:               String("td"),
  6374  				VulnerabilityAlerts:           String("va"),
  6375  				Workflows:                     String("w"),
  6376  			},
  6377  			CreatedAt:              &Timestamp{referenceTime},
  6378  			UpdatedAt:              &Timestamp{referenceTime},
  6379  			HasMultipleSingleFiles: Bool(false),
  6380  			SuspendedBy: &User{
  6381  				Login:           String("l"),
  6382  				ID:              Int64(1),
  6383  				URL:             String("u"),
  6384  				AvatarURL:       String("a"),
  6385  				GravatarID:      String("g"),
  6386  				Name:            String("n"),
  6387  				Company:         String("c"),
  6388  				Blog:            String("b"),
  6389  				Location:        String("l"),
  6390  				Email:           String("e"),
  6391  				Hireable:        Bool(true),
  6392  				Bio:             String("b"),
  6393  				TwitterUsername: String("t"),
  6394  				PublicRepos:     Int(1),
  6395  				Followers:       Int(1),
  6396  				Following:       Int(1),
  6397  				CreatedAt:       &Timestamp{referenceTime},
  6398  				SuspendedAt:     &Timestamp{referenceTime},
  6399  			},
  6400  			SuspendedAt: &Timestamp{referenceTime},
  6401  		},
  6402  	}
  6403  
  6404  	want := `{
  6405  		"discussion": {
  6406  			"repository_url": "rurl",
  6407  			"category": {
  6408  				"id": 1,
  6409  				"node_id": "nid",
  6410  				"repository_id": 1,
  6411  				"emoji": "emoji",
  6412  				"name": "name",
  6413  				"description": "description",
  6414  				"created_at": ` + referenceTimeStr + `,
  6415  				"updated_at": ` + referenceTimeStr + `,
  6416  				"slug": "slug",
  6417  				"is_answerable": false
  6418  			},
  6419  			"html_url": "hurl",
  6420  			"id": 1,
  6421  			"node_id": "nurl",
  6422  			"number": 1,
  6423  			"title": "title",
  6424  			"user": {
  6425  				"login": "l",
  6426  				"id": 1,
  6427  				"node_id": "n",
  6428  				"avatar_url": "a",
  6429  				"url": "u",
  6430  				"events_url": "e",
  6431  				"repos_url": "r"
  6432  			},
  6433  			"state": "st",
  6434  			"locked": false,
  6435  			"comments": 1,
  6436  			"created_at": ` + referenceTimeStr + `,
  6437  			"updated_at": ` + referenceTimeStr + `,
  6438  			"author_association": "aa",
  6439  			"body": "bo"
  6440  		},
  6441  		"repository": {
  6442  			"id": 1,
  6443  			"name": "n",
  6444  			"url": "s"
  6445  		},
  6446  		"organization": {
  6447  			"name": "n",
  6448  			"company": "c",
  6449  			"blog": "b",
  6450  			"location": "loc",
  6451  			"email": "e",
  6452  			"twitter_username": "tu",
  6453  			"description": "d",
  6454  			"billing_email": "be",
  6455  			"is_verified": true,
  6456  			"has_organization_projects": true,
  6457  			"has_repository_projects": true,
  6458  			"default_repository_permission": "drp",
  6459  			"members_can_create_repositories": true,
  6460  			"members_can_create_public_repositories": false,
  6461  			"members_can_create_private_repositories": true,
  6462  			"members_can_create_internal_repositories": true,
  6463  			"members_allowed_repository_creation_type": "marct",
  6464  			"members_can_create_pages": true,
  6465  			"members_can_create_public_pages": false,
  6466  			"members_can_create_private_pages": true
  6467  		},
  6468  		"sender": {
  6469  			"login": "l",
  6470  			"id": 1,
  6471  			"node_id": "n",
  6472  			"avatar_url": "a",
  6473  			"url": "u",
  6474  			"events_url": "e",
  6475  			"repos_url": "r"
  6476  		},
  6477  		"installation": {
  6478  			"id": 1,
  6479  			"node_id": "nid",
  6480  			"app_id": 1,
  6481  			"app_slug": "as",
  6482  			"target_id": 1,
  6483  			"account": {
  6484  				"login": "l",
  6485  				"id": 1,
  6486  				"avatar_url": "a",
  6487  				"gravatar_id": "g",
  6488  				"name": "n",
  6489  				"company": "c",
  6490  				"blog": "b",
  6491  				"location": "l",
  6492  				"email": "e",
  6493  				"hireable": true,
  6494  				"bio": "b",
  6495  				"twitter_username": "t",
  6496  				"public_repos": 1,
  6497  				"followers": 1,
  6498  				"following": 1,
  6499  				"created_at": ` + referenceTimeStr + `,
  6500  				"suspended_at": ` + referenceTimeStr + `,
  6501  				"url": "u"
  6502  			},
  6503  			"access_tokens_url": "atu",
  6504  			"repositories_url": "ru",
  6505  			"html_url": "hu",
  6506  			"target_type": "tt",
  6507  			"single_file_name": "sfn",
  6508  			"repository_selection": "rs",
  6509  			"events": [
  6510  				"e"
  6511  			],
  6512  			"single_file_paths": [
  6513  				"s"
  6514  			],
  6515  			"permissions": {
  6516  				"actions": "a",
  6517  				"administration": "ad",
  6518  				"checks": "c",
  6519  				"contents": "co",
  6520  				"content_references": "cr",
  6521  				"deployments": "d",
  6522  				"environments": "e",
  6523  				"issues": "i",
  6524  				"metadata": "md",
  6525  				"members": "m",
  6526  				"organization_administration": "oa",
  6527  				"organization_hooks": "oh",
  6528  				"organization_plan": "op",
  6529  				"organization_pre_receive_hooks": "opr",
  6530  				"organization_projects": "op",
  6531  				"organization_secrets": "os",
  6532  				"organization_self_hosted_runners": "osh",
  6533  				"organization_user_blocking": "oub",
  6534  				"packages": "pkg",
  6535  				"pages": "pg",
  6536  				"pull_requests": "pr",
  6537  				"repository_hooks": "rh",
  6538  				"repository_projects": "rp",
  6539  				"repository_pre_receive_hooks": "rprh",
  6540  				"secrets": "s",
  6541  				"secret_scanning_alerts": "ssa",
  6542  				"security_events": "se",
  6543  				"single_file": "sf",
  6544  				"statuses": "s",
  6545  				"team_discussions": "td",
  6546  				"vulnerability_alerts": "va",
  6547  				"workflows": "w"
  6548  			},
  6549  			"created_at": ` + referenceTimeStr + `,
  6550  			"updated_at": ` + referenceTimeStr + `,
  6551  			"has_multiple_single_files": false,
  6552  			"suspended_by": {
  6553  				"login": "l",
  6554  				"id": 1,
  6555  				"avatar_url": "a",
  6556  				"gravatar_id": "g",
  6557  				"name": "n",
  6558  				"company": "c",
  6559  				"blog": "b",
  6560  				"location": "l",
  6561  				"email": "e",
  6562  				"hireable": true,
  6563  				"bio": "b",
  6564  				"twitter_username": "t",
  6565  				"public_repos": 1,
  6566  				"followers": 1,
  6567  				"following": 1,
  6568  				"created_at": ` + referenceTimeStr + `,
  6569  				"suspended_at": ` + referenceTimeStr + `,
  6570  				"url": "u"
  6571  			},
  6572  			"suspended_at": ` + referenceTimeStr + `
  6573  		}
  6574  	}`
  6575  
  6576  	testJSONMarshal(t, u, want)
  6577  }
  6578  
  6579  func TestPackageEvent_Marshal(t *testing.T) {
  6580  	testJSONMarshal(t, &PackageEvent{}, "{}")
  6581  
  6582  	u := &PackageEvent{
  6583  		Action: String("a"),
  6584  		Package: &Package{
  6585  			ID:          Int64(1),
  6586  			Name:        String("n"),
  6587  			PackageType: String("pt"),
  6588  			HTMLURL:     String("hurl"),
  6589  			CreatedAt:   &Timestamp{referenceTime},
  6590  			UpdatedAt:   &Timestamp{referenceTime},
  6591  			Owner: &User{
  6592  				Login:     String("l"),
  6593  				ID:        Int64(1),
  6594  				NodeID:    String("n"),
  6595  				URL:       String("u"),
  6596  				ReposURL:  String("r"),
  6597  				EventsURL: String("e"),
  6598  				AvatarURL: String("a"),
  6599  			},
  6600  			PackageVersion: &PackageVersion{ID: Int64(1)},
  6601  			Registry:       &PackageRegistry{Name: String("n")},
  6602  		},
  6603  		Repo: &Repository{
  6604  			ID:   Int64(1),
  6605  			URL:  String("s"),
  6606  			Name: String("n"),
  6607  		},
  6608  		Org: &Organization{
  6609  			BillingEmail:                         String("be"),
  6610  			Blog:                                 String("b"),
  6611  			Company:                              String("c"),
  6612  			Email:                                String("e"),
  6613  			TwitterUsername:                      String("tu"),
  6614  			Location:                             String("loc"),
  6615  			Name:                                 String("n"),
  6616  			Description:                          String("d"),
  6617  			IsVerified:                           Bool(true),
  6618  			HasOrganizationProjects:              Bool(true),
  6619  			HasRepositoryProjects:                Bool(true),
  6620  			DefaultRepoPermission:                String("drp"),
  6621  			MembersCanCreateRepos:                Bool(true),
  6622  			MembersCanCreateInternalRepos:        Bool(true),
  6623  			MembersCanCreatePrivateRepos:         Bool(true),
  6624  			MembersCanCreatePublicRepos:          Bool(false),
  6625  			MembersAllowedRepositoryCreationType: String("marct"),
  6626  			MembersCanCreatePages:                Bool(true),
  6627  			MembersCanCreatePublicPages:          Bool(false),
  6628  			MembersCanCreatePrivatePages:         Bool(true),
  6629  		},
  6630  		Sender: &User{
  6631  			Login:     String("l"),
  6632  			ID:        Int64(1),
  6633  			NodeID:    String("n"),
  6634  			URL:       String("u"),
  6635  			ReposURL:  String("r"),
  6636  			EventsURL: String("e"),
  6637  			AvatarURL: String("a"),
  6638  		},
  6639  	}
  6640  
  6641  	want := `{
  6642  		"action": "a",
  6643  		"package": {
  6644  			"id": 1,
  6645  			"name": "n",
  6646  			"package_type": "pt",
  6647  			"html_url": "hurl",
  6648  			"created_at": ` + referenceTimeStr + `,
  6649  			"updated_at": ` + referenceTimeStr + `,
  6650  			"owner": {
  6651  				"login": "l",
  6652  				"id": 1,
  6653  				"node_id": "n",
  6654  				"avatar_url": "a",
  6655  				"url": "u",
  6656  				"events_url": "e",
  6657  				"repos_url": "r"
  6658  			},
  6659  			"package_version": {
  6660  				"id": 1
  6661  			},
  6662  			"registry": {
  6663  				"name": "n"
  6664  			}
  6665  		},
  6666  		"repository": {
  6667  			"id": 1,
  6668  			"name": "n",
  6669  			"url": "s"
  6670  		},
  6671  		"organization": {
  6672  			"name": "n",
  6673  			"company": "c",
  6674  			"blog": "b",
  6675  			"location": "loc",
  6676  			"email": "e",
  6677  			"twitter_username": "tu",
  6678  			"description": "d",
  6679  			"billing_email": "be",
  6680  			"is_verified": true,
  6681  			"has_organization_projects": true,
  6682  			"has_repository_projects": true,
  6683  			"default_repository_permission": "drp",
  6684  			"members_can_create_repositories": true,
  6685  			"members_can_create_public_repositories": false,
  6686  			"members_can_create_private_repositories": true,
  6687  			"members_can_create_internal_repositories": true,
  6688  			"members_allowed_repository_creation_type": "marct",
  6689  			"members_can_create_pages": true,
  6690  			"members_can_create_public_pages": false,
  6691  			"members_can_create_private_pages": true
  6692  		},
  6693  		"sender": {
  6694  			"login": "l",
  6695  			"id": 1,
  6696  			"node_id": "n",
  6697  			"avatar_url": "a",
  6698  			"url": "u",
  6699  			"events_url": "e",
  6700  			"repos_url": "r"
  6701  		}
  6702  	}`
  6703  
  6704  	testJSONMarshal(t, u, want)
  6705  }
  6706  
  6707  func TestPingEvent_Marshal(t *testing.T) {
  6708  	testJSONMarshal(t, &PingEvent{}, "{}")
  6709  
  6710  	l := make(map[string]interface{})
  6711  	l["key"] = "value"
  6712  
  6713  	u := &PingEvent{
  6714  		Zen:    String("z"),
  6715  		HookID: Int64(1),
  6716  		Hook: &Hook{
  6717  			CreatedAt:    &Timestamp{referenceTime},
  6718  			UpdatedAt:    &Timestamp{referenceTime},
  6719  			URL:          String("url"),
  6720  			ID:           Int64(1),
  6721  			Type:         String("t"),
  6722  			Name:         String("n"),
  6723  			TestURL:      String("tu"),
  6724  			PingURL:      String("pu"),
  6725  			LastResponse: l,
  6726  			Config:       l,
  6727  			Events:       []string{"a"},
  6728  			Active:       Bool(true),
  6729  		},
  6730  		Installation: &Installation{
  6731  			ID:       Int64(1),
  6732  			NodeID:   String("nid"),
  6733  			AppID:    Int64(1),
  6734  			AppSlug:  String("as"),
  6735  			TargetID: Int64(1),
  6736  			Account: &User{
  6737  				Login:           String("l"),
  6738  				ID:              Int64(1),
  6739  				URL:             String("u"),
  6740  				AvatarURL:       String("a"),
  6741  				GravatarID:      String("g"),
  6742  				Name:            String("n"),
  6743  				Company:         String("c"),
  6744  				Blog:            String("b"),
  6745  				Location:        String("l"),
  6746  				Email:           String("e"),
  6747  				Hireable:        Bool(true),
  6748  				Bio:             String("b"),
  6749  				TwitterUsername: String("t"),
  6750  				PublicRepos:     Int(1),
  6751  				Followers:       Int(1),
  6752  				Following:       Int(1),
  6753  				CreatedAt:       &Timestamp{referenceTime},
  6754  				SuspendedAt:     &Timestamp{referenceTime},
  6755  			},
  6756  			AccessTokensURL:     String("atu"),
  6757  			RepositoriesURL:     String("ru"),
  6758  			HTMLURL:             String("hu"),
  6759  			TargetType:          String("tt"),
  6760  			SingleFileName:      String("sfn"),
  6761  			RepositorySelection: String("rs"),
  6762  			Events:              []string{"e"},
  6763  			SingleFilePaths:     []string{"s"},
  6764  			Permissions: &InstallationPermissions{
  6765  				Actions:                       String("a"),
  6766  				Administration:                String("ad"),
  6767  				Checks:                        String("c"),
  6768  				Contents:                      String("co"),
  6769  				ContentReferences:             String("cr"),
  6770  				Deployments:                   String("d"),
  6771  				Environments:                  String("e"),
  6772  				Issues:                        String("i"),
  6773  				Metadata:                      String("md"),
  6774  				Members:                       String("m"),
  6775  				OrganizationAdministration:    String("oa"),
  6776  				OrganizationHooks:             String("oh"),
  6777  				OrganizationPlan:              String("op"),
  6778  				OrganizationPreReceiveHooks:   String("opr"),
  6779  				OrganizationProjects:          String("op"),
  6780  				OrganizationSecrets:           String("os"),
  6781  				OrganizationSelfHostedRunners: String("osh"),
  6782  				OrganizationUserBlocking:      String("oub"),
  6783  				Packages:                      String("pkg"),
  6784  				Pages:                         String("pg"),
  6785  				PullRequests:                  String("pr"),
  6786  				RepositoryHooks:               String("rh"),
  6787  				RepositoryProjects:            String("rp"),
  6788  				RepositoryPreReceiveHooks:     String("rprh"),
  6789  				Secrets:                       String("s"),
  6790  				SecretScanningAlerts:          String("ssa"),
  6791  				SecurityEvents:                String("se"),
  6792  				SingleFile:                    String("sf"),
  6793  				Statuses:                      String("s"),
  6794  				TeamDiscussions:               String("td"),
  6795  				VulnerabilityAlerts:           String("va"),
  6796  				Workflows:                     String("w"),
  6797  			},
  6798  			CreatedAt:              &Timestamp{referenceTime},
  6799  			UpdatedAt:              &Timestamp{referenceTime},
  6800  			HasMultipleSingleFiles: Bool(false),
  6801  			SuspendedBy: &User{
  6802  				Login:           String("l"),
  6803  				ID:              Int64(1),
  6804  				URL:             String("u"),
  6805  				AvatarURL:       String("a"),
  6806  				GravatarID:      String("g"),
  6807  				Name:            String("n"),
  6808  				Company:         String("c"),
  6809  				Blog:            String("b"),
  6810  				Location:        String("l"),
  6811  				Email:           String("e"),
  6812  				Hireable:        Bool(true),
  6813  				Bio:             String("b"),
  6814  				TwitterUsername: String("t"),
  6815  				PublicRepos:     Int(1),
  6816  				Followers:       Int(1),
  6817  				Following:       Int(1),
  6818  				CreatedAt:       &Timestamp{referenceTime},
  6819  				SuspendedAt:     &Timestamp{referenceTime},
  6820  			},
  6821  			SuspendedAt: &Timestamp{referenceTime},
  6822  		},
  6823  	}
  6824  
  6825  	want := `{
  6826  		"zen": "z",
  6827  		"hook_id": 1,
  6828  		"hook": {
  6829  			"created_at": ` + referenceTimeStr + `,
  6830  			"updated_at": ` + referenceTimeStr + `,
  6831  			"url": "url",
  6832  			"id": 1,
  6833  			"type": "t",
  6834  			"name": "n",
  6835  			"test_url": "tu",
  6836  			"ping_url": "pu",
  6837  			"last_response": {
  6838  				"key": "value"
  6839  			},
  6840  			"config": {
  6841  				"key": "value"
  6842  			},
  6843  			"events": [
  6844  				"a"
  6845  			],
  6846  			"active": true
  6847  		},
  6848  		"installation": {
  6849  			"id": 1,
  6850  			"node_id": "nid",
  6851  			"app_id": 1,
  6852  			"app_slug": "as",
  6853  			"target_id": 1,
  6854  			"account": {
  6855  				"login": "l",
  6856  				"id": 1,
  6857  				"avatar_url": "a",
  6858  				"gravatar_id": "g",
  6859  				"name": "n",
  6860  				"company": "c",
  6861  				"blog": "b",
  6862  				"location": "l",
  6863  				"email": "e",
  6864  				"hireable": true,
  6865  				"bio": "b",
  6866  				"twitter_username": "t",
  6867  				"public_repos": 1,
  6868  				"followers": 1,
  6869  				"following": 1,
  6870  				"created_at": ` + referenceTimeStr + `,
  6871  				"suspended_at": ` + referenceTimeStr + `,
  6872  				"url": "u"
  6873  			},
  6874  			"access_tokens_url": "atu",
  6875  			"repositories_url": "ru",
  6876  			"html_url": "hu",
  6877  			"target_type": "tt",
  6878  			"single_file_name": "sfn",
  6879  			"repository_selection": "rs",
  6880  			"events": [
  6881  				"e"
  6882  			],
  6883  			"single_file_paths": [
  6884  				"s"
  6885  			],
  6886  			"permissions": {
  6887  				"actions": "a",
  6888  				"administration": "ad",
  6889  				"checks": "c",
  6890  				"contents": "co",
  6891  				"content_references": "cr",
  6892  				"deployments": "d",
  6893  				"environments": "e",
  6894  				"issues": "i",
  6895  				"metadata": "md",
  6896  				"members": "m",
  6897  				"organization_administration": "oa",
  6898  				"organization_hooks": "oh",
  6899  				"organization_plan": "op",
  6900  				"organization_pre_receive_hooks": "opr",
  6901  				"organization_projects": "op",
  6902  				"organization_secrets": "os",
  6903  				"organization_self_hosted_runners": "osh",
  6904  				"organization_user_blocking": "oub",
  6905  				"packages": "pkg",
  6906  				"pages": "pg",
  6907  				"pull_requests": "pr",
  6908  				"repository_hooks": "rh",
  6909  				"repository_projects": "rp",
  6910  				"repository_pre_receive_hooks": "rprh",
  6911  				"secrets": "s",
  6912  				"secret_scanning_alerts": "ssa",
  6913  				"security_events": "se",
  6914  				"single_file": "sf",
  6915  				"statuses": "s",
  6916  				"team_discussions": "td",
  6917  				"vulnerability_alerts": "va",
  6918  				"workflows": "w"
  6919  			},
  6920  			"created_at": ` + referenceTimeStr + `,
  6921  			"updated_at": ` + referenceTimeStr + `,
  6922  			"has_multiple_single_files": false,
  6923  			"suspended_by": {
  6924  				"login": "l",
  6925  				"id": 1,
  6926  				"avatar_url": "a",
  6927  				"gravatar_id": "g",
  6928  				"name": "n",
  6929  				"company": "c",
  6930  				"blog": "b",
  6931  				"location": "l",
  6932  				"email": "e",
  6933  				"hireable": true,
  6934  				"bio": "b",
  6935  				"twitter_username": "t",
  6936  				"public_repos": 1,
  6937  				"followers": 1,
  6938  				"following": 1,
  6939  				"created_at": ` + referenceTimeStr + `,
  6940  				"suspended_at": ` + referenceTimeStr + `,
  6941  				"url": "u"
  6942  			},
  6943  			"suspended_at": ` + referenceTimeStr + `
  6944  		}
  6945  	}`
  6946  
  6947  	testJSONMarshal(t, u, want)
  6948  }
  6949  
  6950  func TestRepositoryDispatchEvent_Marshal(t *testing.T) {
  6951  	testJSONMarshal(t, &RepositoryDispatchEvent{}, "{}")
  6952  
  6953  	l := make(map[string]interface{})
  6954  	l["key"] = "value"
  6955  
  6956  	jsonMsg, _ := json.Marshal(&l)
  6957  
  6958  	u := &RepositoryDispatchEvent{
  6959  		Action:        String("a"),
  6960  		Branch:        String("b"),
  6961  		ClientPayload: jsonMsg,
  6962  		Repo: &Repository{
  6963  
  6964  			ID:   Int64(1),
  6965  			URL:  String("s"),
  6966  			Name: String("n"),
  6967  		},
  6968  		Org: &Organization{
  6969  			BillingEmail:                         String("be"),
  6970  			Blog:                                 String("b"),
  6971  			Company:                              String("c"),
  6972  			Email:                                String("e"),
  6973  			TwitterUsername:                      String("tu"),
  6974  			Location:                             String("loc"),
  6975  			Name:                                 String("n"),
  6976  			Description:                          String("d"),
  6977  			IsVerified:                           Bool(true),
  6978  			HasOrganizationProjects:              Bool(true),
  6979  			HasRepositoryProjects:                Bool(true),
  6980  			DefaultRepoPermission:                String("drp"),
  6981  			MembersCanCreateRepos:                Bool(true),
  6982  			MembersCanCreateInternalRepos:        Bool(true),
  6983  			MembersCanCreatePrivateRepos:         Bool(true),
  6984  			MembersCanCreatePublicRepos:          Bool(false),
  6985  			MembersAllowedRepositoryCreationType: String("marct"),
  6986  			MembersCanCreatePages:                Bool(true),
  6987  			MembersCanCreatePublicPages:          Bool(false),
  6988  			MembersCanCreatePrivatePages:         Bool(true),
  6989  		},
  6990  		Sender: &User{
  6991  			Login:     String("l"),
  6992  			ID:        Int64(1),
  6993  			NodeID:    String("n"),
  6994  			URL:       String("u"),
  6995  			ReposURL:  String("r"),
  6996  			EventsURL: String("e"),
  6997  			AvatarURL: String("a"),
  6998  		},
  6999  		Installation: &Installation{
  7000  			ID:       Int64(1),
  7001  			NodeID:   String("nid"),
  7002  			AppID:    Int64(1),
  7003  			AppSlug:  String("as"),
  7004  			TargetID: Int64(1),
  7005  			Account: &User{
  7006  				Login:           String("l"),
  7007  				ID:              Int64(1),
  7008  				URL:             String("u"),
  7009  				AvatarURL:       String("a"),
  7010  				GravatarID:      String("g"),
  7011  				Name:            String("n"),
  7012  				Company:         String("c"),
  7013  				Blog:            String("b"),
  7014  				Location:        String("l"),
  7015  				Email:           String("e"),
  7016  				Hireable:        Bool(true),
  7017  				Bio:             String("b"),
  7018  				TwitterUsername: String("t"),
  7019  				PublicRepos:     Int(1),
  7020  				Followers:       Int(1),
  7021  				Following:       Int(1),
  7022  				CreatedAt:       &Timestamp{referenceTime},
  7023  				SuspendedAt:     &Timestamp{referenceTime},
  7024  			},
  7025  			AccessTokensURL:     String("atu"),
  7026  			RepositoriesURL:     String("ru"),
  7027  			HTMLURL:             String("hu"),
  7028  			TargetType:          String("tt"),
  7029  			SingleFileName:      String("sfn"),
  7030  			RepositorySelection: String("rs"),
  7031  			Events:              []string{"e"},
  7032  			SingleFilePaths:     []string{"s"},
  7033  			Permissions: &InstallationPermissions{
  7034  				Actions:                       String("a"),
  7035  				Administration:                String("ad"),
  7036  				Checks:                        String("c"),
  7037  				Contents:                      String("co"),
  7038  				ContentReferences:             String("cr"),
  7039  				Deployments:                   String("d"),
  7040  				Environments:                  String("e"),
  7041  				Issues:                        String("i"),
  7042  				Metadata:                      String("md"),
  7043  				Members:                       String("m"),
  7044  				OrganizationAdministration:    String("oa"),
  7045  				OrganizationHooks:             String("oh"),
  7046  				OrganizationPlan:              String("op"),
  7047  				OrganizationPreReceiveHooks:   String("opr"),
  7048  				OrganizationProjects:          String("op"),
  7049  				OrganizationSecrets:           String("os"),
  7050  				OrganizationSelfHostedRunners: String("osh"),
  7051  				OrganizationUserBlocking:      String("oub"),
  7052  				Packages:                      String("pkg"),
  7053  				Pages:                         String("pg"),
  7054  				PullRequests:                  String("pr"),
  7055  				RepositoryHooks:               String("rh"),
  7056  				RepositoryProjects:            String("rp"),
  7057  				RepositoryPreReceiveHooks:     String("rprh"),
  7058  				Secrets:                       String("s"),
  7059  				SecretScanningAlerts:          String("ssa"),
  7060  				SecurityEvents:                String("se"),
  7061  				SingleFile:                    String("sf"),
  7062  				Statuses:                      String("s"),
  7063  				TeamDiscussions:               String("td"),
  7064  				VulnerabilityAlerts:           String("va"),
  7065  				Workflows:                     String("w"),
  7066  			},
  7067  			CreatedAt:              &Timestamp{referenceTime},
  7068  			UpdatedAt:              &Timestamp{referenceTime},
  7069  			HasMultipleSingleFiles: Bool(false),
  7070  			SuspendedBy: &User{
  7071  				Login:           String("l"),
  7072  				ID:              Int64(1),
  7073  				URL:             String("u"),
  7074  				AvatarURL:       String("a"),
  7075  				GravatarID:      String("g"),
  7076  				Name:            String("n"),
  7077  				Company:         String("c"),
  7078  				Blog:            String("b"),
  7079  				Location:        String("l"),
  7080  				Email:           String("e"),
  7081  				Hireable:        Bool(true),
  7082  				Bio:             String("b"),
  7083  				TwitterUsername: String("t"),
  7084  				PublicRepos:     Int(1),
  7085  				Followers:       Int(1),
  7086  				Following:       Int(1),
  7087  				CreatedAt:       &Timestamp{referenceTime},
  7088  				SuspendedAt:     &Timestamp{referenceTime},
  7089  			},
  7090  			SuspendedAt: &Timestamp{referenceTime},
  7091  		},
  7092  	}
  7093  
  7094  	want := `{
  7095  		"action": "a",
  7096  		"branch": "b",
  7097  		"client_payload": {
  7098  			"key": "value"
  7099  		},
  7100  		"repository": {
  7101  			"id": 1,
  7102  			"name": "n",
  7103  			"url": "s"
  7104  		},
  7105  		"organization": {
  7106  			"name": "n",
  7107  			"company": "c",
  7108  			"blog": "b",
  7109  			"location": "loc",
  7110  			"email": "e",
  7111  			"twitter_username": "tu",
  7112  			"description": "d",
  7113  			"billing_email": "be",
  7114  			"is_verified": true,
  7115  			"has_organization_projects": true,
  7116  			"has_repository_projects": true,
  7117  			"default_repository_permission": "drp",
  7118  			"members_can_create_repositories": true,
  7119  			"members_can_create_public_repositories": false,
  7120  			"members_can_create_private_repositories": true,
  7121  			"members_can_create_internal_repositories": true,
  7122  			"members_allowed_repository_creation_type": "marct",
  7123  			"members_can_create_pages": true,
  7124  			"members_can_create_public_pages": false,
  7125  			"members_can_create_private_pages": true
  7126  		},
  7127  		"sender": {
  7128  			"login": "l",
  7129  			"id": 1,
  7130  			"node_id": "n",
  7131  			"avatar_url": "a",
  7132  			"url": "u",
  7133  			"events_url": "e",
  7134  			"repos_url": "r"
  7135  		},
  7136  		"installation": {
  7137  			"id": 1,
  7138  			"node_id": "nid",
  7139  			"app_id": 1,
  7140  			"app_slug": "as",
  7141  			"target_id": 1,
  7142  			"account": {
  7143  				"login": "l",
  7144  				"id": 1,
  7145  				"avatar_url": "a",
  7146  				"gravatar_id": "g",
  7147  				"name": "n",
  7148  				"company": "c",
  7149  				"blog": "b",
  7150  				"location": "l",
  7151  				"email": "e",
  7152  				"hireable": true,
  7153  				"bio": "b",
  7154  				"twitter_username": "t",
  7155  				"public_repos": 1,
  7156  				"followers": 1,
  7157  				"following": 1,
  7158  				"created_at": ` + referenceTimeStr + `,
  7159  				"suspended_at": ` + referenceTimeStr + `,
  7160  				"url": "u"
  7161  			},
  7162  			"access_tokens_url": "atu",
  7163  			"repositories_url": "ru",
  7164  			"html_url": "hu",
  7165  			"target_type": "tt",
  7166  			"single_file_name": "sfn",
  7167  			"repository_selection": "rs",
  7168  			"events": [
  7169  				"e"
  7170  			],
  7171  			"single_file_paths": [
  7172  				"s"
  7173  			],
  7174  			"permissions": {
  7175  				"actions": "a",
  7176  				"administration": "ad",
  7177  				"checks": "c",
  7178  				"contents": "co",
  7179  				"content_references": "cr",
  7180  				"deployments": "d",
  7181  				"environments": "e",
  7182  				"issues": "i",
  7183  				"metadata": "md",
  7184  				"members": "m",
  7185  				"organization_administration": "oa",
  7186  				"organization_hooks": "oh",
  7187  				"organization_plan": "op",
  7188  				"organization_pre_receive_hooks": "opr",
  7189  				"organization_projects": "op",
  7190  				"organization_secrets": "os",
  7191  				"organization_self_hosted_runners": "osh",
  7192  				"organization_user_blocking": "oub",
  7193  				"packages": "pkg",
  7194  				"pages": "pg",
  7195  				"pull_requests": "pr",
  7196  				"repository_hooks": "rh",
  7197  				"repository_projects": "rp",
  7198  				"repository_pre_receive_hooks": "rprh",
  7199  				"secrets": "s",
  7200  				"secret_scanning_alerts": "ssa",
  7201  				"security_events": "se",
  7202  				"single_file": "sf",
  7203  				"statuses": "s",
  7204  				"team_discussions": "td",
  7205  				"vulnerability_alerts": "va",
  7206  				"workflows": "w"
  7207  			},
  7208  			"created_at": ` + referenceTimeStr + `,
  7209  			"updated_at": ` + referenceTimeStr + `,
  7210  			"has_multiple_single_files": false,
  7211  			"suspended_by": {
  7212  				"login": "l",
  7213  				"id": 1,
  7214  				"avatar_url": "a",
  7215  				"gravatar_id": "g",
  7216  				"name": "n",
  7217  				"company": "c",
  7218  				"blog": "b",
  7219  				"location": "l",
  7220  				"email": "e",
  7221  				"hireable": true,
  7222  				"bio": "b",
  7223  				"twitter_username": "t",
  7224  				"public_repos": 1,
  7225  				"followers": 1,
  7226  				"following": 1,
  7227  				"created_at": ` + referenceTimeStr + `,
  7228  				"suspended_at": ` + referenceTimeStr + `,
  7229  				"url": "u"
  7230  			},
  7231  			"suspended_at": ` + referenceTimeStr + `
  7232  		}
  7233  	}`
  7234  
  7235  	testJSONMarshal(t, u, want)
  7236  }
  7237  
  7238  func TestRepositoryImportEvent_Marshal(t *testing.T) {
  7239  	testJSONMarshal(t, &RepositoryImportEvent{}, "{}")
  7240  
  7241  	u := &RepositoryImportEvent{
  7242  		Status: String("success"),
  7243  		Repo: &Repository{
  7244  			ID:   Int64(1),
  7245  			URL:  String("s"),
  7246  			Name: String("n"),
  7247  		},
  7248  		Org: &Organization{
  7249  			BillingEmail:                         String("be"),
  7250  			Blog:                                 String("b"),
  7251  			Company:                              String("c"),
  7252  			Email:                                String("e"),
  7253  			TwitterUsername:                      String("tu"),
  7254  			Location:                             String("loc"),
  7255  			Name:                                 String("n"),
  7256  			Description:                          String("d"),
  7257  			IsVerified:                           Bool(true),
  7258  			HasOrganizationProjects:              Bool(true),
  7259  			HasRepositoryProjects:                Bool(true),
  7260  			DefaultRepoPermission:                String("drp"),
  7261  			MembersCanCreateRepos:                Bool(true),
  7262  			MembersCanCreateInternalRepos:        Bool(true),
  7263  			MembersCanCreatePrivateRepos:         Bool(true),
  7264  			MembersCanCreatePublicRepos:          Bool(false),
  7265  			MembersAllowedRepositoryCreationType: String("marct"),
  7266  			MembersCanCreatePages:                Bool(true),
  7267  			MembersCanCreatePublicPages:          Bool(false),
  7268  			MembersCanCreatePrivatePages:         Bool(true),
  7269  		},
  7270  		Sender: &User{
  7271  			Login:     String("l"),
  7272  			ID:        Int64(1),
  7273  			NodeID:    String("n"),
  7274  			URL:       String("u"),
  7275  			ReposURL:  String("r"),
  7276  			EventsURL: String("e"),
  7277  			AvatarURL: String("a"),
  7278  		},
  7279  	}
  7280  
  7281  	want := `{
  7282  		"status": "success",
  7283  		"repository": {
  7284  			"id": 1,
  7285  			"name": "n",
  7286  			"url": "s"
  7287  		},
  7288  		"organization": {
  7289  			"name": "n",
  7290  			"company": "c",
  7291  			"blog": "b",
  7292  			"location": "loc",
  7293  			"email": "e",
  7294  			"twitter_username": "tu",
  7295  			"description": "d",
  7296  			"billing_email": "be",
  7297  			"is_verified": true,
  7298  			"has_organization_projects": true,
  7299  			"has_repository_projects": true,
  7300  			"default_repository_permission": "drp",
  7301  			"members_can_create_repositories": true,
  7302  			"members_can_create_public_repositories": false,
  7303  			"members_can_create_private_repositories": true,
  7304  			"members_can_create_internal_repositories": true,
  7305  			"members_allowed_repository_creation_type": "marct",
  7306  			"members_can_create_pages": true,
  7307  			"members_can_create_public_pages": false,
  7308  			"members_can_create_private_pages": true
  7309  		},
  7310  		"sender": {
  7311  			"login": "l",
  7312  			"id": 1,
  7313  			"node_id": "n",
  7314  			"avatar_url": "a",
  7315  			"url": "u",
  7316  			"events_url": "e",
  7317  			"repos_url": "r"
  7318  		}
  7319  	}`
  7320  
  7321  	testJSONMarshal(t, u, want)
  7322  }
  7323  
  7324  func TestRepositoryEvent_Marshal(t *testing.T) {
  7325  	testJSONMarshal(t, &RepositoryEvent{}, "{}")
  7326  
  7327  	u := &RepositoryEvent{
  7328  		Action: String("a"),
  7329  		Repo: &Repository{
  7330  			ID:   Int64(1),
  7331  			URL:  String("s"),
  7332  			Name: String("n"),
  7333  		},
  7334  		Org: &Organization{
  7335  			BillingEmail:                         String("be"),
  7336  			Blog:                                 String("b"),
  7337  			Company:                              String("c"),
  7338  			Email:                                String("e"),
  7339  			TwitterUsername:                      String("tu"),
  7340  			Location:                             String("loc"),
  7341  			Name:                                 String("n"),
  7342  			Description:                          String("d"),
  7343  			IsVerified:                           Bool(true),
  7344  			HasOrganizationProjects:              Bool(true),
  7345  			HasRepositoryProjects:                Bool(true),
  7346  			DefaultRepoPermission:                String("drp"),
  7347  			MembersCanCreateRepos:                Bool(true),
  7348  			MembersCanCreateInternalRepos:        Bool(true),
  7349  			MembersCanCreatePrivateRepos:         Bool(true),
  7350  			MembersCanCreatePublicRepos:          Bool(false),
  7351  			MembersAllowedRepositoryCreationType: String("marct"),
  7352  			MembersCanCreatePages:                Bool(true),
  7353  			MembersCanCreatePublicPages:          Bool(false),
  7354  			MembersCanCreatePrivatePages:         Bool(true),
  7355  		},
  7356  		Sender: &User{
  7357  			Login:     String("l"),
  7358  			ID:        Int64(1),
  7359  			NodeID:    String("n"),
  7360  			URL:       String("u"),
  7361  			ReposURL:  String("r"),
  7362  			EventsURL: String("e"),
  7363  			AvatarURL: String("a"),
  7364  		},
  7365  		Installation: &Installation{
  7366  			ID:       Int64(1),
  7367  			NodeID:   String("nid"),
  7368  			AppID:    Int64(1),
  7369  			AppSlug:  String("as"),
  7370  			TargetID: Int64(1),
  7371  			Account: &User{
  7372  				Login:           String("l"),
  7373  				ID:              Int64(1),
  7374  				URL:             String("u"),
  7375  				AvatarURL:       String("a"),
  7376  				GravatarID:      String("g"),
  7377  				Name:            String("n"),
  7378  				Company:         String("c"),
  7379  				Blog:            String("b"),
  7380  				Location:        String("l"),
  7381  				Email:           String("e"),
  7382  				Hireable:        Bool(true),
  7383  				Bio:             String("b"),
  7384  				TwitterUsername: String("t"),
  7385  				PublicRepos:     Int(1),
  7386  				Followers:       Int(1),
  7387  				Following:       Int(1),
  7388  				CreatedAt:       &Timestamp{referenceTime},
  7389  				SuspendedAt:     &Timestamp{referenceTime},
  7390  			},
  7391  			AccessTokensURL:     String("atu"),
  7392  			RepositoriesURL:     String("ru"),
  7393  			HTMLURL:             String("hu"),
  7394  			TargetType:          String("tt"),
  7395  			SingleFileName:      String("sfn"),
  7396  			RepositorySelection: String("rs"),
  7397  			Events:              []string{"e"},
  7398  			SingleFilePaths:     []string{"s"},
  7399  			Permissions: &InstallationPermissions{
  7400  				Actions:                       String("a"),
  7401  				Administration:                String("ad"),
  7402  				Checks:                        String("c"),
  7403  				Contents:                      String("co"),
  7404  				ContentReferences:             String("cr"),
  7405  				Deployments:                   String("d"),
  7406  				Environments:                  String("e"),
  7407  				Issues:                        String("i"),
  7408  				Metadata:                      String("md"),
  7409  				Members:                       String("m"),
  7410  				OrganizationAdministration:    String("oa"),
  7411  				OrganizationHooks:             String("oh"),
  7412  				OrganizationPlan:              String("op"),
  7413  				OrganizationPreReceiveHooks:   String("opr"),
  7414  				OrganizationProjects:          String("op"),
  7415  				OrganizationSecrets:           String("os"),
  7416  				OrganizationSelfHostedRunners: String("osh"),
  7417  				OrganizationUserBlocking:      String("oub"),
  7418  				Packages:                      String("pkg"),
  7419  				Pages:                         String("pg"),
  7420  				PullRequests:                  String("pr"),
  7421  				RepositoryHooks:               String("rh"),
  7422  				RepositoryProjects:            String("rp"),
  7423  				RepositoryPreReceiveHooks:     String("rprh"),
  7424  				Secrets:                       String("s"),
  7425  				SecretScanningAlerts:          String("ssa"),
  7426  				SecurityEvents:                String("se"),
  7427  				SingleFile:                    String("sf"),
  7428  				Statuses:                      String("s"),
  7429  				TeamDiscussions:               String("td"),
  7430  				VulnerabilityAlerts:           String("va"),
  7431  				Workflows:                     String("w"),
  7432  			},
  7433  			CreatedAt:              &Timestamp{referenceTime},
  7434  			UpdatedAt:              &Timestamp{referenceTime},
  7435  			HasMultipleSingleFiles: Bool(false),
  7436  			SuspendedBy: &User{
  7437  				Login:           String("l"),
  7438  				ID:              Int64(1),
  7439  				URL:             String("u"),
  7440  				AvatarURL:       String("a"),
  7441  				GravatarID:      String("g"),
  7442  				Name:            String("n"),
  7443  				Company:         String("c"),
  7444  				Blog:            String("b"),
  7445  				Location:        String("l"),
  7446  				Email:           String("e"),
  7447  				Hireable:        Bool(true),
  7448  				Bio:             String("b"),
  7449  				TwitterUsername: String("t"),
  7450  				PublicRepos:     Int(1),
  7451  				Followers:       Int(1),
  7452  				Following:       Int(1),
  7453  				CreatedAt:       &Timestamp{referenceTime},
  7454  				SuspendedAt:     &Timestamp{referenceTime},
  7455  			},
  7456  			SuspendedAt: &Timestamp{referenceTime},
  7457  		},
  7458  	}
  7459  
  7460  	want := `{
  7461  		"action": "a",
  7462  		"repository": {
  7463  			"id": 1,
  7464  			"name": "n",
  7465  			"url": "s"
  7466  		},
  7467  		"organization": {
  7468  			"name": "n",
  7469  			"company": "c",
  7470  			"blog": "b",
  7471  			"location": "loc",
  7472  			"email": "e",
  7473  			"twitter_username": "tu",
  7474  			"description": "d",
  7475  			"billing_email": "be",
  7476  			"is_verified": true,
  7477  			"has_organization_projects": true,
  7478  			"has_repository_projects": true,
  7479  			"default_repository_permission": "drp",
  7480  			"members_can_create_repositories": true,
  7481  			"members_can_create_public_repositories": false,
  7482  			"members_can_create_private_repositories": true,
  7483  			"members_can_create_internal_repositories": true,
  7484  			"members_allowed_repository_creation_type": "marct",
  7485  			"members_can_create_pages": true,
  7486  			"members_can_create_public_pages": false,
  7487  			"members_can_create_private_pages": true
  7488  		},
  7489  		"sender": {
  7490  			"login": "l",
  7491  			"id": 1,
  7492  			"node_id": "n",
  7493  			"avatar_url": "a",
  7494  			"url": "u",
  7495  			"events_url": "e",
  7496  			"repos_url": "r"
  7497  		},
  7498  		"installation": {
  7499  			"id": 1,
  7500  			"node_id": "nid",
  7501  			"app_id": 1,
  7502  			"app_slug": "as",
  7503  			"target_id": 1,
  7504  			"account": {
  7505  				"login": "l",
  7506  				"id": 1,
  7507  				"avatar_url": "a",
  7508  				"gravatar_id": "g",
  7509  				"name": "n",
  7510  				"company": "c",
  7511  				"blog": "b",
  7512  				"location": "l",
  7513  				"email": "e",
  7514  				"hireable": true,
  7515  				"bio": "b",
  7516  				"twitter_username": "t",
  7517  				"public_repos": 1,
  7518  				"followers": 1,
  7519  				"following": 1,
  7520  				"created_at": ` + referenceTimeStr + `,
  7521  				"suspended_at": ` + referenceTimeStr + `,
  7522  				"url": "u"
  7523  			},
  7524  			"access_tokens_url": "atu",
  7525  			"repositories_url": "ru",
  7526  			"html_url": "hu",
  7527  			"target_type": "tt",
  7528  			"single_file_name": "sfn",
  7529  			"repository_selection": "rs",
  7530  			"events": [
  7531  				"e"
  7532  			],
  7533  			"single_file_paths": [
  7534  				"s"
  7535  			],
  7536  			"permissions": {
  7537  				"actions": "a",
  7538  				"administration": "ad",
  7539  				"checks": "c",
  7540  				"contents": "co",
  7541  				"content_references": "cr",
  7542  				"deployments": "d",
  7543  				"environments": "e",
  7544  				"issues": "i",
  7545  				"metadata": "md",
  7546  				"members": "m",
  7547  				"organization_administration": "oa",
  7548  				"organization_hooks": "oh",
  7549  				"organization_plan": "op",
  7550  				"organization_pre_receive_hooks": "opr",
  7551  				"organization_projects": "op",
  7552  				"organization_secrets": "os",
  7553  				"organization_self_hosted_runners": "osh",
  7554  				"organization_user_blocking": "oub",
  7555  				"packages": "pkg",
  7556  				"pages": "pg",
  7557  				"pull_requests": "pr",
  7558  				"repository_hooks": "rh",
  7559  				"repository_projects": "rp",
  7560  				"repository_pre_receive_hooks": "rprh",
  7561  				"secrets": "s",
  7562  				"secret_scanning_alerts": "ssa",
  7563  				"security_events": "se",
  7564  				"single_file": "sf",
  7565  				"statuses": "s",
  7566  				"team_discussions": "td",
  7567  				"vulnerability_alerts": "va",
  7568  				"workflows": "w"
  7569  			},
  7570  			"created_at": ` + referenceTimeStr + `,
  7571  			"updated_at": ` + referenceTimeStr + `,
  7572  			"has_multiple_single_files": false,
  7573  			"suspended_by": {
  7574  				"login": "l",
  7575  				"id": 1,
  7576  				"avatar_url": "a",
  7577  				"gravatar_id": "g",
  7578  				"name": "n",
  7579  				"company": "c",
  7580  				"blog": "b",
  7581  				"location": "l",
  7582  				"email": "e",
  7583  				"hireable": true,
  7584  				"bio": "b",
  7585  				"twitter_username": "t",
  7586  				"public_repos": 1,
  7587  				"followers": 1,
  7588  				"following": 1,
  7589  				"created_at": ` + referenceTimeStr + `,
  7590  				"suspended_at": ` + referenceTimeStr + `,
  7591  				"url": "u"
  7592  			},
  7593  			"suspended_at": ` + referenceTimeStr + `
  7594  		}
  7595  	}`
  7596  
  7597  	testJSONMarshal(t, u, want)
  7598  }
  7599  
  7600  func TestReleaseEvent_Marshal(t *testing.T) {
  7601  	testJSONMarshal(t, &ReleaseEvent{}, "{}")
  7602  
  7603  	u := &ReleaseEvent{
  7604  		Action: String("a"),
  7605  		Release: &RepositoryRelease{
  7606  			Name:                   String("n"),
  7607  			DiscussionCategoryName: String("dcn"),
  7608  			ID:                     Int64(2),
  7609  			CreatedAt:              &Timestamp{referenceTime},
  7610  			PublishedAt:            &Timestamp{referenceTime},
  7611  			URL:                    String("url"),
  7612  			HTMLURL:                String("htmlurl"),
  7613  			AssetsURL:              String("assetsurl"),
  7614  			Assets:                 []*ReleaseAsset{{ID: Int64(1)}},
  7615  			UploadURL:              String("uploadurl"),
  7616  			ZipballURL:             String("zipballurl"),
  7617  			TarballURL:             String("tarballurl"),
  7618  			Author:                 &User{Name: String("octocat")},
  7619  			NodeID:                 String("nid"),
  7620  		},
  7621  		Repo: &Repository{
  7622  			ID:   Int64(1),
  7623  			URL:  String("s"),
  7624  			Name: String("n"),
  7625  		},
  7626  		Sender: &User{
  7627  			Login:     String("l"),
  7628  			ID:        Int64(1),
  7629  			NodeID:    String("n"),
  7630  			URL:       String("u"),
  7631  			ReposURL:  String("r"),
  7632  			EventsURL: String("e"),
  7633  			AvatarURL: String("a"),
  7634  		},
  7635  		Installation: &Installation{
  7636  			ID:       Int64(1),
  7637  			NodeID:   String("nid"),
  7638  			AppID:    Int64(1),
  7639  			AppSlug:  String("as"),
  7640  			TargetID: Int64(1),
  7641  			Account: &User{
  7642  				Login:           String("l"),
  7643  				ID:              Int64(1),
  7644  				URL:             String("u"),
  7645  				AvatarURL:       String("a"),
  7646  				GravatarID:      String("g"),
  7647  				Name:            String("n"),
  7648  				Company:         String("c"),
  7649  				Blog:            String("b"),
  7650  				Location:        String("l"),
  7651  				Email:           String("e"),
  7652  				Hireable:        Bool(true),
  7653  				Bio:             String("b"),
  7654  				TwitterUsername: String("t"),
  7655  				PublicRepos:     Int(1),
  7656  				Followers:       Int(1),
  7657  				Following:       Int(1),
  7658  				CreatedAt:       &Timestamp{referenceTime},
  7659  				SuspendedAt:     &Timestamp{referenceTime},
  7660  			},
  7661  			AccessTokensURL:     String("atu"),
  7662  			RepositoriesURL:     String("ru"),
  7663  			HTMLURL:             String("hu"),
  7664  			TargetType:          String("tt"),
  7665  			SingleFileName:      String("sfn"),
  7666  			RepositorySelection: String("rs"),
  7667  			Events:              []string{"e"},
  7668  			SingleFilePaths:     []string{"s"},
  7669  			Permissions: &InstallationPermissions{
  7670  				Actions:                       String("a"),
  7671  				Administration:                String("ad"),
  7672  				Checks:                        String("c"),
  7673  				Contents:                      String("co"),
  7674  				ContentReferences:             String("cr"),
  7675  				Deployments:                   String("d"),
  7676  				Environments:                  String("e"),
  7677  				Issues:                        String("i"),
  7678  				Metadata:                      String("md"),
  7679  				Members:                       String("m"),
  7680  				OrganizationAdministration:    String("oa"),
  7681  				OrganizationHooks:             String("oh"),
  7682  				OrganizationPlan:              String("op"),
  7683  				OrganizationPreReceiveHooks:   String("opr"),
  7684  				OrganizationProjects:          String("op"),
  7685  				OrganizationSecrets:           String("os"),
  7686  				OrganizationSelfHostedRunners: String("osh"),
  7687  				OrganizationUserBlocking:      String("oub"),
  7688  				Packages:                      String("pkg"),
  7689  				Pages:                         String("pg"),
  7690  				PullRequests:                  String("pr"),
  7691  				RepositoryHooks:               String("rh"),
  7692  				RepositoryProjects:            String("rp"),
  7693  				RepositoryPreReceiveHooks:     String("rprh"),
  7694  				Secrets:                       String("s"),
  7695  				SecretScanningAlerts:          String("ssa"),
  7696  				SecurityEvents:                String("se"),
  7697  				SingleFile:                    String("sf"),
  7698  				Statuses:                      String("s"),
  7699  				TeamDiscussions:               String("td"),
  7700  				VulnerabilityAlerts:           String("va"),
  7701  				Workflows:                     String("w"),
  7702  			},
  7703  			CreatedAt:              &Timestamp{referenceTime},
  7704  			UpdatedAt:              &Timestamp{referenceTime},
  7705  			HasMultipleSingleFiles: Bool(false),
  7706  			SuspendedBy: &User{
  7707  				Login:           String("l"),
  7708  				ID:              Int64(1),
  7709  				URL:             String("u"),
  7710  				AvatarURL:       String("a"),
  7711  				GravatarID:      String("g"),
  7712  				Name:            String("n"),
  7713  				Company:         String("c"),
  7714  				Blog:            String("b"),
  7715  				Location:        String("l"),
  7716  				Email:           String("e"),
  7717  				Hireable:        Bool(true),
  7718  				Bio:             String("b"),
  7719  				TwitterUsername: String("t"),
  7720  				PublicRepos:     Int(1),
  7721  				Followers:       Int(1),
  7722  				Following:       Int(1),
  7723  				CreatedAt:       &Timestamp{referenceTime},
  7724  				SuspendedAt:     &Timestamp{referenceTime},
  7725  			},
  7726  			SuspendedAt: &Timestamp{referenceTime},
  7727  		},
  7728  	}
  7729  
  7730  	want := `{
  7731  		"action": "a",
  7732  		"release": {
  7733  			"name": "n",
  7734  			"discussion_category_name": "dcn",
  7735  			"id": 2,
  7736  			"created_at": ` + referenceTimeStr + `,
  7737  			"published_at": ` + referenceTimeStr + `,
  7738  			"url": "url",
  7739  			"html_url": "htmlurl",
  7740  			"assets_url": "assetsurl",
  7741  			"assets": [
  7742  				{
  7743  					"id": 1
  7744  				}
  7745  			],
  7746  			"upload_url": "uploadurl",
  7747  			"zipball_url": "zipballurl",
  7748  			"tarball_url": "tarballurl",
  7749  			"author": {
  7750  				"name": "octocat"
  7751  			},
  7752  			"node_id": "nid"
  7753  		},
  7754  		"repository": {
  7755  			"id": 1,
  7756  			"name": "n",
  7757  			"url": "s"
  7758  		},
  7759  		"sender": {
  7760  			"login": "l",
  7761  			"id": 1,
  7762  			"node_id": "n",
  7763  			"avatar_url": "a",
  7764  			"url": "u",
  7765  			"events_url": "e",
  7766  			"repos_url": "r"
  7767  		},
  7768  		"installation": {
  7769  			"id": 1,
  7770  			"node_id": "nid",
  7771  			"app_id": 1,
  7772  			"app_slug": "as",
  7773  			"target_id": 1,
  7774  			"account": {
  7775  				"login": "l",
  7776  				"id": 1,
  7777  				"avatar_url": "a",
  7778  				"gravatar_id": "g",
  7779  				"name": "n",
  7780  				"company": "c",
  7781  				"blog": "b",
  7782  				"location": "l",
  7783  				"email": "e",
  7784  				"hireable": true,
  7785  				"bio": "b",
  7786  				"twitter_username": "t",
  7787  				"public_repos": 1,
  7788  				"followers": 1,
  7789  				"following": 1,
  7790  				"created_at": ` + referenceTimeStr + `,
  7791  				"suspended_at": ` + referenceTimeStr + `,
  7792  				"url": "u"
  7793  			},
  7794  			"access_tokens_url": "atu",
  7795  			"repositories_url": "ru",
  7796  			"html_url": "hu",
  7797  			"target_type": "tt",
  7798  			"single_file_name": "sfn",
  7799  			"repository_selection": "rs",
  7800  			"events": [
  7801  				"e"
  7802  			],
  7803  			"single_file_paths": [
  7804  				"s"
  7805  			],
  7806  			"permissions": {
  7807  				"actions": "a",
  7808  				"administration": "ad",
  7809  				"checks": "c",
  7810  				"contents": "co",
  7811  				"content_references": "cr",
  7812  				"deployments": "d",
  7813  				"environments": "e",
  7814  				"issues": "i",
  7815  				"metadata": "md",
  7816  				"members": "m",
  7817  				"organization_administration": "oa",
  7818  				"organization_hooks": "oh",
  7819  				"organization_plan": "op",
  7820  				"organization_pre_receive_hooks": "opr",
  7821  				"organization_projects": "op",
  7822  				"organization_secrets": "os",
  7823  				"organization_self_hosted_runners": "osh",
  7824  				"organization_user_blocking": "oub",
  7825  				"packages": "pkg",
  7826  				"pages": "pg",
  7827  				"pull_requests": "pr",
  7828  				"repository_hooks": "rh",
  7829  				"repository_projects": "rp",
  7830  				"repository_pre_receive_hooks": "rprh",
  7831  				"secrets": "s",
  7832  				"secret_scanning_alerts": "ssa",
  7833  				"security_events": "se",
  7834  				"single_file": "sf",
  7835  				"statuses": "s",
  7836  				"team_discussions": "td",
  7837  				"vulnerability_alerts": "va",
  7838  				"workflows": "w"
  7839  			},
  7840  			"created_at": ` + referenceTimeStr + `,
  7841  			"updated_at": ` + referenceTimeStr + `,
  7842  			"has_multiple_single_files": false,
  7843  			"suspended_by": {
  7844  				"login": "l",
  7845  				"id": 1,
  7846  				"avatar_url": "a",
  7847  				"gravatar_id": "g",
  7848  				"name": "n",
  7849  				"company": "c",
  7850  				"blog": "b",
  7851  				"location": "l",
  7852  				"email": "e",
  7853  				"hireable": true,
  7854  				"bio": "b",
  7855  				"twitter_username": "t",
  7856  				"public_repos": 1,
  7857  				"followers": 1,
  7858  				"following": 1,
  7859  				"created_at": ` + referenceTimeStr + `,
  7860  				"suspended_at": ` + referenceTimeStr + `,
  7861  				"url": "u"
  7862  			},
  7863  			"suspended_at": ` + referenceTimeStr + `
  7864  		}
  7865  	}`
  7866  
  7867  	testJSONMarshal(t, u, want)
  7868  }
  7869  
  7870  func TestContentReferenceEvent_Marshal(t *testing.T) {
  7871  	testJSONMarshal(t, &ContentReferenceEvent{}, "{}")
  7872  
  7873  	u := &ContentReferenceEvent{
  7874  		Action: String("a"),
  7875  		ContentReference: &ContentReference{
  7876  			ID:        Int64(1),
  7877  			NodeID:    String("nid"),
  7878  			Reference: String("ref"),
  7879  		},
  7880  		Repo: &Repository{
  7881  			ID:   Int64(1),
  7882  			URL:  String("s"),
  7883  			Name: String("n"),
  7884  		},
  7885  		Sender: &User{
  7886  			Login:     String("l"),
  7887  			ID:        Int64(1),
  7888  			NodeID:    String("n"),
  7889  			URL:       String("u"),
  7890  			ReposURL:  String("r"),
  7891  			EventsURL: String("e"),
  7892  			AvatarURL: String("a"),
  7893  		},
  7894  		Installation: &Installation{
  7895  			ID:       Int64(1),
  7896  			NodeID:   String("nid"),
  7897  			AppID:    Int64(1),
  7898  			AppSlug:  String("as"),
  7899  			TargetID: Int64(1),
  7900  			Account: &User{
  7901  				Login:           String("l"),
  7902  				ID:              Int64(1),
  7903  				URL:             String("u"),
  7904  				AvatarURL:       String("a"),
  7905  				GravatarID:      String("g"),
  7906  				Name:            String("n"),
  7907  				Company:         String("c"),
  7908  				Blog:            String("b"),
  7909  				Location:        String("l"),
  7910  				Email:           String("e"),
  7911  				Hireable:        Bool(true),
  7912  				Bio:             String("b"),
  7913  				TwitterUsername: String("t"),
  7914  				PublicRepos:     Int(1),
  7915  				Followers:       Int(1),
  7916  				Following:       Int(1),
  7917  				CreatedAt:       &Timestamp{referenceTime},
  7918  				SuspendedAt:     &Timestamp{referenceTime},
  7919  			},
  7920  			AccessTokensURL:     String("atu"),
  7921  			RepositoriesURL:     String("ru"),
  7922  			HTMLURL:             String("hu"),
  7923  			TargetType:          String("tt"),
  7924  			SingleFileName:      String("sfn"),
  7925  			RepositorySelection: String("rs"),
  7926  			Events:              []string{"e"},
  7927  			SingleFilePaths:     []string{"s"},
  7928  			Permissions: &InstallationPermissions{
  7929  				Actions:                       String("a"),
  7930  				Administration:                String("ad"),
  7931  				Checks:                        String("c"),
  7932  				Contents:                      String("co"),
  7933  				ContentReferences:             String("cr"),
  7934  				Deployments:                   String("d"),
  7935  				Environments:                  String("e"),
  7936  				Issues:                        String("i"),
  7937  				Metadata:                      String("md"),
  7938  				Members:                       String("m"),
  7939  				OrganizationAdministration:    String("oa"),
  7940  				OrganizationHooks:             String("oh"),
  7941  				OrganizationPlan:              String("op"),
  7942  				OrganizationPreReceiveHooks:   String("opr"),
  7943  				OrganizationProjects:          String("op"),
  7944  				OrganizationSecrets:           String("os"),
  7945  				OrganizationSelfHostedRunners: String("osh"),
  7946  				OrganizationUserBlocking:      String("oub"),
  7947  				Packages:                      String("pkg"),
  7948  				Pages:                         String("pg"),
  7949  				PullRequests:                  String("pr"),
  7950  				RepositoryHooks:               String("rh"),
  7951  				RepositoryProjects:            String("rp"),
  7952  				RepositoryPreReceiveHooks:     String("rprh"),
  7953  				Secrets:                       String("s"),
  7954  				SecretScanningAlerts:          String("ssa"),
  7955  				SecurityEvents:                String("se"),
  7956  				SingleFile:                    String("sf"),
  7957  				Statuses:                      String("s"),
  7958  				TeamDiscussions:               String("td"),
  7959  				VulnerabilityAlerts:           String("va"),
  7960  				Workflows:                     String("w"),
  7961  			},
  7962  			CreatedAt:              &Timestamp{referenceTime},
  7963  			UpdatedAt:              &Timestamp{referenceTime},
  7964  			HasMultipleSingleFiles: Bool(false),
  7965  			SuspendedBy: &User{
  7966  				Login:           String("l"),
  7967  				ID:              Int64(1),
  7968  				URL:             String("u"),
  7969  				AvatarURL:       String("a"),
  7970  				GravatarID:      String("g"),
  7971  				Name:            String("n"),
  7972  				Company:         String("c"),
  7973  				Blog:            String("b"),
  7974  				Location:        String("l"),
  7975  				Email:           String("e"),
  7976  				Hireable:        Bool(true),
  7977  				Bio:             String("b"),
  7978  				TwitterUsername: String("t"),
  7979  				PublicRepos:     Int(1),
  7980  				Followers:       Int(1),
  7981  				Following:       Int(1),
  7982  				CreatedAt:       &Timestamp{referenceTime},
  7983  				SuspendedAt:     &Timestamp{referenceTime},
  7984  			},
  7985  			SuspendedAt: &Timestamp{referenceTime},
  7986  		},
  7987  	}
  7988  
  7989  	want := `{
  7990  		"action": "a",
  7991  		"content_reference": {
  7992  			"id": 1,
  7993  			"node_id": "nid",
  7994  			"reference": "ref"
  7995  		},
  7996  		"repository": {
  7997  			"id": 1,
  7998  			"name": "n",
  7999  			"url": "s"
  8000  		},
  8001  		"sender": {
  8002  			"login": "l",
  8003  			"id": 1,
  8004  			"node_id": "n",
  8005  			"avatar_url": "a",
  8006  			"url": "u",
  8007  			"events_url": "e",
  8008  			"repos_url": "r"
  8009  		},
  8010  		"installation": {
  8011  			"id": 1,
  8012  			"node_id": "nid",
  8013  			"app_id": 1,
  8014  			"app_slug": "as",
  8015  			"target_id": 1,
  8016  			"account": {
  8017  				"login": "l",
  8018  				"id": 1,
  8019  				"avatar_url": "a",
  8020  				"gravatar_id": "g",
  8021  				"name": "n",
  8022  				"company": "c",
  8023  				"blog": "b",
  8024  				"location": "l",
  8025  				"email": "e",
  8026  				"hireable": true,
  8027  				"bio": "b",
  8028  				"twitter_username": "t",
  8029  				"public_repos": 1,
  8030  				"followers": 1,
  8031  				"following": 1,
  8032  				"created_at": ` + referenceTimeStr + `,
  8033  				"suspended_at": ` + referenceTimeStr + `,
  8034  				"url": "u"
  8035  			},
  8036  			"access_tokens_url": "atu",
  8037  			"repositories_url": "ru",
  8038  			"html_url": "hu",
  8039  			"target_type": "tt",
  8040  			"single_file_name": "sfn",
  8041  			"repository_selection": "rs",
  8042  			"events": [
  8043  				"e"
  8044  			],
  8045  			"single_file_paths": [
  8046  				"s"
  8047  			],
  8048  			"permissions": {
  8049  				"actions": "a",
  8050  				"administration": "ad",
  8051  				"checks": "c",
  8052  				"contents": "co",
  8053  				"content_references": "cr",
  8054  				"deployments": "d",
  8055  				"environments": "e",
  8056  				"issues": "i",
  8057  				"metadata": "md",
  8058  				"members": "m",
  8059  				"organization_administration": "oa",
  8060  				"organization_hooks": "oh",
  8061  				"organization_plan": "op",
  8062  				"organization_pre_receive_hooks": "opr",
  8063  				"organization_projects": "op",
  8064  				"organization_secrets": "os",
  8065  				"organization_self_hosted_runners": "osh",
  8066  				"organization_user_blocking": "oub",
  8067  				"packages": "pkg",
  8068  				"pages": "pg",
  8069  				"pull_requests": "pr",
  8070  				"repository_hooks": "rh",
  8071  				"repository_projects": "rp",
  8072  				"repository_pre_receive_hooks": "rprh",
  8073  				"secrets": "s",
  8074  				"secret_scanning_alerts": "ssa",
  8075  				"security_events": "se",
  8076  				"single_file": "sf",
  8077  				"statuses": "s",
  8078  				"team_discussions": "td",
  8079  				"vulnerability_alerts": "va",
  8080  				"workflows": "w"
  8081  			},
  8082  			"created_at": ` + referenceTimeStr + `,
  8083  			"updated_at": ` + referenceTimeStr + `,
  8084  			"has_multiple_single_files": false,
  8085  			"suspended_by": {
  8086  				"login": "l",
  8087  				"id": 1,
  8088  				"avatar_url": "a",
  8089  				"gravatar_id": "g",
  8090  				"name": "n",
  8091  				"company": "c",
  8092  				"blog": "b",
  8093  				"location": "l",
  8094  				"email": "e",
  8095  				"hireable": true,
  8096  				"bio": "b",
  8097  				"twitter_username": "t",
  8098  				"public_repos": 1,
  8099  				"followers": 1,
  8100  				"following": 1,
  8101  				"created_at": ` + referenceTimeStr + `,
  8102  				"suspended_at": ` + referenceTimeStr + `,
  8103  				"url": "u"
  8104  			},
  8105  			"suspended_at": ` + referenceTimeStr + `
  8106  		}
  8107  	}`
  8108  
  8109  	testJSONMarshal(t, u, want)
  8110  }
  8111  
  8112  func TestMemberEvent_Marshal(t *testing.T) {
  8113  	testJSONMarshal(t, &MemberEvent{}, "{}")
  8114  
  8115  	u := &MemberEvent{
  8116  		Action: String("a"),
  8117  		Member: &User{
  8118  			Login:     String("l"),
  8119  			ID:        Int64(1),
  8120  			NodeID:    String("n"),
  8121  			URL:       String("u"),
  8122  			ReposURL:  String("r"),
  8123  			EventsURL: String("e"),
  8124  			AvatarURL: String("a"),
  8125  		},
  8126  		Repo: &Repository{
  8127  			ID:   Int64(1),
  8128  			URL:  String("s"),
  8129  			Name: String("n"),
  8130  		},
  8131  		Sender: &User{
  8132  			Login:     String("l"),
  8133  			ID:        Int64(1),
  8134  			NodeID:    String("n"),
  8135  			URL:       String("u"),
  8136  			ReposURL:  String("r"),
  8137  			EventsURL: String("e"),
  8138  			AvatarURL: String("a"),
  8139  		},
  8140  		Installation: &Installation{
  8141  			ID:       Int64(1),
  8142  			NodeID:   String("nid"),
  8143  			AppID:    Int64(1),
  8144  			AppSlug:  String("as"),
  8145  			TargetID: Int64(1),
  8146  			Account: &User{
  8147  				Login:           String("l"),
  8148  				ID:              Int64(1),
  8149  				URL:             String("u"),
  8150  				AvatarURL:       String("a"),
  8151  				GravatarID:      String("g"),
  8152  				Name:            String("n"),
  8153  				Company:         String("c"),
  8154  				Blog:            String("b"),
  8155  				Location:        String("l"),
  8156  				Email:           String("e"),
  8157  				Hireable:        Bool(true),
  8158  				Bio:             String("b"),
  8159  				TwitterUsername: String("t"),
  8160  				PublicRepos:     Int(1),
  8161  				Followers:       Int(1),
  8162  				Following:       Int(1),
  8163  				CreatedAt:       &Timestamp{referenceTime},
  8164  				SuspendedAt:     &Timestamp{referenceTime},
  8165  			},
  8166  			AccessTokensURL:     String("atu"),
  8167  			RepositoriesURL:     String("ru"),
  8168  			HTMLURL:             String("hu"),
  8169  			TargetType:          String("tt"),
  8170  			SingleFileName:      String("sfn"),
  8171  			RepositorySelection: String("rs"),
  8172  			Events:              []string{"e"},
  8173  			SingleFilePaths:     []string{"s"},
  8174  			Permissions: &InstallationPermissions{
  8175  				Actions:                       String("a"),
  8176  				Administration:                String("ad"),
  8177  				Checks:                        String("c"),
  8178  				Contents:                      String("co"),
  8179  				ContentReferences:             String("cr"),
  8180  				Deployments:                   String("d"),
  8181  				Environments:                  String("e"),
  8182  				Issues:                        String("i"),
  8183  				Metadata:                      String("md"),
  8184  				Members:                       String("m"),
  8185  				OrganizationAdministration:    String("oa"),
  8186  				OrganizationHooks:             String("oh"),
  8187  				OrganizationPlan:              String("op"),
  8188  				OrganizationPreReceiveHooks:   String("opr"),
  8189  				OrganizationProjects:          String("op"),
  8190  				OrganizationSecrets:           String("os"),
  8191  				OrganizationSelfHostedRunners: String("osh"),
  8192  				OrganizationUserBlocking:      String("oub"),
  8193  				Packages:                      String("pkg"),
  8194  				Pages:                         String("pg"),
  8195  				PullRequests:                  String("pr"),
  8196  				RepositoryHooks:               String("rh"),
  8197  				RepositoryProjects:            String("rp"),
  8198  				RepositoryPreReceiveHooks:     String("rprh"),
  8199  				Secrets:                       String("s"),
  8200  				SecretScanningAlerts:          String("ssa"),
  8201  				SecurityEvents:                String("se"),
  8202  				SingleFile:                    String("sf"),
  8203  				Statuses:                      String("s"),
  8204  				TeamDiscussions:               String("td"),
  8205  				VulnerabilityAlerts:           String("va"),
  8206  				Workflows:                     String("w"),
  8207  			},
  8208  			CreatedAt:              &Timestamp{referenceTime},
  8209  			UpdatedAt:              &Timestamp{referenceTime},
  8210  			HasMultipleSingleFiles: Bool(false),
  8211  			SuspendedBy: &User{
  8212  				Login:           String("l"),
  8213  				ID:              Int64(1),
  8214  				URL:             String("u"),
  8215  				AvatarURL:       String("a"),
  8216  				GravatarID:      String("g"),
  8217  				Name:            String("n"),
  8218  				Company:         String("c"),
  8219  				Blog:            String("b"),
  8220  				Location:        String("l"),
  8221  				Email:           String("e"),
  8222  				Hireable:        Bool(true),
  8223  				Bio:             String("b"),
  8224  				TwitterUsername: String("t"),
  8225  				PublicRepos:     Int(1),
  8226  				Followers:       Int(1),
  8227  				Following:       Int(1),
  8228  				CreatedAt:       &Timestamp{referenceTime},
  8229  				SuspendedAt:     &Timestamp{referenceTime},
  8230  			},
  8231  			SuspendedAt: &Timestamp{referenceTime},
  8232  		},
  8233  	}
  8234  
  8235  	want := `{
  8236  		"action": "a",
  8237  		"member": {
  8238  			"login": "l",
  8239  			"id": 1,
  8240  			"node_id": "n",
  8241  			"avatar_url": "a",
  8242  			"url": "u",
  8243  			"events_url": "e",
  8244  			"repos_url": "r"
  8245  		},
  8246  		"repository": {
  8247  			"id": 1,
  8248  			"name": "n",
  8249  			"url": "s"
  8250  		},
  8251  		"sender": {
  8252  			"login": "l",
  8253  			"id": 1,
  8254  			"node_id": "n",
  8255  			"avatar_url": "a",
  8256  			"url": "u",
  8257  			"events_url": "e",
  8258  			"repos_url": "r"
  8259  		},
  8260  		"installation": {
  8261  			"id": 1,
  8262  			"node_id": "nid",
  8263  			"app_id": 1,
  8264  			"app_slug": "as",
  8265  			"target_id": 1,
  8266  			"account": {
  8267  				"login": "l",
  8268  				"id": 1,
  8269  				"avatar_url": "a",
  8270  				"gravatar_id": "g",
  8271  				"name": "n",
  8272  				"company": "c",
  8273  				"blog": "b",
  8274  				"location": "l",
  8275  				"email": "e",
  8276  				"hireable": true,
  8277  				"bio": "b",
  8278  				"twitter_username": "t",
  8279  				"public_repos": 1,
  8280  				"followers": 1,
  8281  				"following": 1,
  8282  				"created_at": ` + referenceTimeStr + `,
  8283  				"suspended_at": ` + referenceTimeStr + `,
  8284  				"url": "u"
  8285  			},
  8286  			"access_tokens_url": "atu",
  8287  			"repositories_url": "ru",
  8288  			"html_url": "hu",
  8289  			"target_type": "tt",
  8290  			"single_file_name": "sfn",
  8291  			"repository_selection": "rs",
  8292  			"events": [
  8293  				"e"
  8294  			],
  8295  			"single_file_paths": [
  8296  				"s"
  8297  			],
  8298  			"permissions": {
  8299  				"actions": "a",
  8300  				"administration": "ad",
  8301  				"checks": "c",
  8302  				"contents": "co",
  8303  				"content_references": "cr",
  8304  				"deployments": "d",
  8305  				"environments": "e",
  8306  				"issues": "i",
  8307  				"metadata": "md",
  8308  				"members": "m",
  8309  				"organization_administration": "oa",
  8310  				"organization_hooks": "oh",
  8311  				"organization_plan": "op",
  8312  				"organization_pre_receive_hooks": "opr",
  8313  				"organization_projects": "op",
  8314  				"organization_secrets": "os",
  8315  				"organization_self_hosted_runners": "osh",
  8316  				"organization_user_blocking": "oub",
  8317  				"packages": "pkg",
  8318  				"pages": "pg",
  8319  				"pull_requests": "pr",
  8320  				"repository_hooks": "rh",
  8321  				"repository_projects": "rp",
  8322  				"repository_pre_receive_hooks": "rprh",
  8323  				"secrets": "s",
  8324  				"secret_scanning_alerts": "ssa",
  8325  				"security_events": "se",
  8326  				"single_file": "sf",
  8327  				"statuses": "s",
  8328  				"team_discussions": "td",
  8329  				"vulnerability_alerts": "va",
  8330  				"workflows": "w"
  8331  			},
  8332  			"created_at": ` + referenceTimeStr + `,
  8333  			"updated_at": ` + referenceTimeStr + `,
  8334  			"has_multiple_single_files": false,
  8335  			"suspended_by": {
  8336  				"login": "l",
  8337  				"id": 1,
  8338  				"avatar_url": "a",
  8339  				"gravatar_id": "g",
  8340  				"name": "n",
  8341  				"company": "c",
  8342  				"blog": "b",
  8343  				"location": "l",
  8344  				"email": "e",
  8345  				"hireable": true,
  8346  				"bio": "b",
  8347  				"twitter_username": "t",
  8348  				"public_repos": 1,
  8349  				"followers": 1,
  8350  				"following": 1,
  8351  				"created_at": ` + referenceTimeStr + `,
  8352  				"suspended_at": ` + referenceTimeStr + `,
  8353  				"url": "u"
  8354  			},
  8355  			"suspended_at": ` + referenceTimeStr + `
  8356  		}
  8357  	}`
  8358  
  8359  	testJSONMarshal(t, u, want)
  8360  }
  8361  
  8362  func TestMembershipEvent_Marshal(t *testing.T) {
  8363  	testJSONMarshal(t, &MembershipEvent{}, "{}")
  8364  
  8365  	u := &MembershipEvent{
  8366  		Action: String("a"),
  8367  		Scope:  String("s"),
  8368  		Member: &User{
  8369  			Login:     String("l"),
  8370  			ID:        Int64(1),
  8371  			NodeID:    String("n"),
  8372  			URL:       String("u"),
  8373  			ReposURL:  String("r"),
  8374  			EventsURL: String("e"),
  8375  			AvatarURL: String("a"),
  8376  		},
  8377  		Team: &Team{
  8378  			ID:              Int64(1),
  8379  			NodeID:          String("n"),
  8380  			Name:            String("n"),
  8381  			Description:     String("d"),
  8382  			URL:             String("u"),
  8383  			Slug:            String("s"),
  8384  			Permission:      String("p"),
  8385  			Privacy:         String("p"),
  8386  			MembersCount:    Int(1),
  8387  			ReposCount:      Int(1),
  8388  			MembersURL:      String("m"),
  8389  			RepositoriesURL: String("r"),
  8390  			Organization: &Organization{
  8391  				Login:     String("l"),
  8392  				ID:        Int64(1),
  8393  				NodeID:    String("n"),
  8394  				AvatarURL: String("a"),
  8395  				HTMLURL:   String("h"),
  8396  				Name:      String("n"),
  8397  				Company:   String("c"),
  8398  				Blog:      String("b"),
  8399  				Location:  String("l"),
  8400  				Email:     String("e"),
  8401  			},
  8402  			Parent: &Team{
  8403  				ID:           Int64(1),
  8404  				NodeID:       String("n"),
  8405  				Name:         String("n"),
  8406  				Description:  String("d"),
  8407  				URL:          String("u"),
  8408  				Slug:         String("s"),
  8409  				Permission:   String("p"),
  8410  				Privacy:      String("p"),
  8411  				MembersCount: Int(1),
  8412  				ReposCount:   Int(1),
  8413  			},
  8414  			LDAPDN: String("l"),
  8415  		},
  8416  		Org: &Organization{
  8417  			BillingEmail:                         String("be"),
  8418  			Blog:                                 String("b"),
  8419  			Company:                              String("c"),
  8420  			Email:                                String("e"),
  8421  			TwitterUsername:                      String("tu"),
  8422  			Location:                             String("loc"),
  8423  			Name:                                 String("n"),
  8424  			Description:                          String("d"),
  8425  			IsVerified:                           Bool(true),
  8426  			HasOrganizationProjects:              Bool(true),
  8427  			HasRepositoryProjects:                Bool(true),
  8428  			DefaultRepoPermission:                String("drp"),
  8429  			MembersCanCreateRepos:                Bool(true),
  8430  			MembersCanCreateInternalRepos:        Bool(true),
  8431  			MembersCanCreatePrivateRepos:         Bool(true),
  8432  			MembersCanCreatePublicRepos:          Bool(false),
  8433  			MembersAllowedRepositoryCreationType: String("marct"),
  8434  			MembersCanCreatePages:                Bool(true),
  8435  			MembersCanCreatePublicPages:          Bool(false),
  8436  			MembersCanCreatePrivatePages:         Bool(true),
  8437  		},
  8438  		Sender: &User{
  8439  			Login:     String("l"),
  8440  			ID:        Int64(1),
  8441  			NodeID:    String("n"),
  8442  			URL:       String("u"),
  8443  			ReposURL:  String("r"),
  8444  			EventsURL: String("e"),
  8445  			AvatarURL: String("a"),
  8446  		},
  8447  		Installation: &Installation{
  8448  			ID:       Int64(1),
  8449  			NodeID:   String("nid"),
  8450  			AppID:    Int64(1),
  8451  			AppSlug:  String("as"),
  8452  			TargetID: Int64(1),
  8453  			Account: &User{
  8454  				Login:           String("l"),
  8455  				ID:              Int64(1),
  8456  				URL:             String("u"),
  8457  				AvatarURL:       String("a"),
  8458  				GravatarID:      String("g"),
  8459  				Name:            String("n"),
  8460  				Company:         String("c"),
  8461  				Blog:            String("b"),
  8462  				Location:        String("l"),
  8463  				Email:           String("e"),
  8464  				Hireable:        Bool(true),
  8465  				Bio:             String("b"),
  8466  				TwitterUsername: String("t"),
  8467  				PublicRepos:     Int(1),
  8468  				Followers:       Int(1),
  8469  				Following:       Int(1),
  8470  				CreatedAt:       &Timestamp{referenceTime},
  8471  				SuspendedAt:     &Timestamp{referenceTime},
  8472  			},
  8473  			AccessTokensURL:     String("atu"),
  8474  			RepositoriesURL:     String("ru"),
  8475  			HTMLURL:             String("hu"),
  8476  			TargetType:          String("tt"),
  8477  			SingleFileName:      String("sfn"),
  8478  			RepositorySelection: String("rs"),
  8479  			Events:              []string{"e"},
  8480  			SingleFilePaths:     []string{"s"},
  8481  			Permissions: &InstallationPermissions{
  8482  				Actions:                       String("a"),
  8483  				Administration:                String("ad"),
  8484  				Checks:                        String("c"),
  8485  				Contents:                      String("co"),
  8486  				ContentReferences:             String("cr"),
  8487  				Deployments:                   String("d"),
  8488  				Environments:                  String("e"),
  8489  				Issues:                        String("i"),
  8490  				Metadata:                      String("md"),
  8491  				Members:                       String("m"),
  8492  				OrganizationAdministration:    String("oa"),
  8493  				OrganizationHooks:             String("oh"),
  8494  				OrganizationPlan:              String("op"),
  8495  				OrganizationPreReceiveHooks:   String("opr"),
  8496  				OrganizationProjects:          String("op"),
  8497  				OrganizationSecrets:           String("os"),
  8498  				OrganizationSelfHostedRunners: String("osh"),
  8499  				OrganizationUserBlocking:      String("oub"),
  8500  				Packages:                      String("pkg"),
  8501  				Pages:                         String("pg"),
  8502  				PullRequests:                  String("pr"),
  8503  				RepositoryHooks:               String("rh"),
  8504  				RepositoryProjects:            String("rp"),
  8505  				RepositoryPreReceiveHooks:     String("rprh"),
  8506  				Secrets:                       String("s"),
  8507  				SecretScanningAlerts:          String("ssa"),
  8508  				SecurityEvents:                String("se"),
  8509  				SingleFile:                    String("sf"),
  8510  				Statuses:                      String("s"),
  8511  				TeamDiscussions:               String("td"),
  8512  				VulnerabilityAlerts:           String("va"),
  8513  				Workflows:                     String("w"),
  8514  			},
  8515  			CreatedAt:              &Timestamp{referenceTime},
  8516  			UpdatedAt:              &Timestamp{referenceTime},
  8517  			HasMultipleSingleFiles: Bool(false),
  8518  			SuspendedBy: &User{
  8519  				Login:           String("l"),
  8520  				ID:              Int64(1),
  8521  				URL:             String("u"),
  8522  				AvatarURL:       String("a"),
  8523  				GravatarID:      String("g"),
  8524  				Name:            String("n"),
  8525  				Company:         String("c"),
  8526  				Blog:            String("b"),
  8527  				Location:        String("l"),
  8528  				Email:           String("e"),
  8529  				Hireable:        Bool(true),
  8530  				Bio:             String("b"),
  8531  				TwitterUsername: String("t"),
  8532  				PublicRepos:     Int(1),
  8533  				Followers:       Int(1),
  8534  				Following:       Int(1),
  8535  				CreatedAt:       &Timestamp{referenceTime},
  8536  				SuspendedAt:     &Timestamp{referenceTime},
  8537  			},
  8538  			SuspendedAt: &Timestamp{referenceTime},
  8539  		},
  8540  	}
  8541  
  8542  	want := `{
  8543  		"action": "a",
  8544  		"scope": "s",
  8545  		"member": {
  8546  			"login": "l",
  8547  			"id": 1,
  8548  			"node_id": "n",
  8549  			"avatar_url": "a",
  8550  			"url": "u",
  8551  			"events_url": "e",
  8552  			"repos_url": "r"
  8553  		},
  8554  		"team": {
  8555  			"id": 1,
  8556  			"node_id": "n",
  8557  			"name": "n",
  8558  			"description": "d",
  8559  			"url": "u",
  8560  			"slug": "s",
  8561  			"permission": "p",
  8562  			"privacy": "p",
  8563  			"members_count": 1,
  8564  			"repos_count": 1,
  8565  			"organization": {
  8566  				"login": "l",
  8567  				"id": 1,
  8568  				"node_id": "n",
  8569  				"avatar_url": "a",
  8570  				"html_url": "h",
  8571  				"name": "n",
  8572  				"company": "c",
  8573  				"blog": "b",
  8574  				"location": "l",
  8575  				"email": "e"
  8576  			},
  8577  			"members_url": "m",
  8578  			"repositories_url": "r",
  8579  			"parent": {
  8580  				"id": 1,
  8581  				"node_id": "n",
  8582  				"name": "n",
  8583  				"description": "d",
  8584  				"url": "u",
  8585  				"slug": "s",
  8586  				"permission": "p",
  8587  				"privacy": "p",
  8588  				"members_count": 1,
  8589  				"repos_count": 1
  8590  			},
  8591  			"ldap_dn": "l"
  8592  		},
  8593  		"organization": {
  8594  			"name": "n",
  8595  			"company": "c",
  8596  			"blog": "b",
  8597  			"location": "loc",
  8598  			"email": "e",
  8599  			"twitter_username": "tu",
  8600  			"description": "d",
  8601  			"billing_email": "be",
  8602  			"is_verified": true,
  8603  			"has_organization_projects": true,
  8604  			"has_repository_projects": true,
  8605  			"default_repository_permission": "drp",
  8606  			"members_can_create_repositories": true,
  8607  			"members_can_create_public_repositories": false,
  8608  			"members_can_create_private_repositories": true,
  8609  			"members_can_create_internal_repositories": true,
  8610  			"members_allowed_repository_creation_type": "marct",
  8611  			"members_can_create_pages": true,
  8612  			"members_can_create_public_pages": false,
  8613  			"members_can_create_private_pages": true
  8614  		},
  8615  		"sender": {
  8616  			"login": "l",
  8617  			"id": 1,
  8618  			"node_id": "n",
  8619  			"avatar_url": "a",
  8620  			"url": "u",
  8621  			"events_url": "e",
  8622  			"repos_url": "r"
  8623  		},
  8624  		"installation": {
  8625  			"id": 1,
  8626  			"node_id": "nid",
  8627  			"app_id": 1,
  8628  			"app_slug": "as",
  8629  			"target_id": 1,
  8630  			"account": {
  8631  				"login": "l",
  8632  				"id": 1,
  8633  				"avatar_url": "a",
  8634  				"gravatar_id": "g",
  8635  				"name": "n",
  8636  				"company": "c",
  8637  				"blog": "b",
  8638  				"location": "l",
  8639  				"email": "e",
  8640  				"hireable": true,
  8641  				"bio": "b",
  8642  				"twitter_username": "t",
  8643  				"public_repos": 1,
  8644  				"followers": 1,
  8645  				"following": 1,
  8646  				"created_at": ` + referenceTimeStr + `,
  8647  				"suspended_at": ` + referenceTimeStr + `,
  8648  				"url": "u"
  8649  			},
  8650  			"access_tokens_url": "atu",
  8651  			"repositories_url": "ru",
  8652  			"html_url": "hu",
  8653  			"target_type": "tt",
  8654  			"single_file_name": "sfn",
  8655  			"repository_selection": "rs",
  8656  			"events": [
  8657  				"e"
  8658  			],
  8659  			"single_file_paths": [
  8660  				"s"
  8661  			],
  8662  			"permissions": {
  8663  				"actions": "a",
  8664  				"administration": "ad",
  8665  				"checks": "c",
  8666  				"contents": "co",
  8667  				"content_references": "cr",
  8668  				"deployments": "d",
  8669  				"environments": "e",
  8670  				"issues": "i",
  8671  				"metadata": "md",
  8672  				"members": "m",
  8673  				"organization_administration": "oa",
  8674  				"organization_hooks": "oh",
  8675  				"organization_plan": "op",
  8676  				"organization_pre_receive_hooks": "opr",
  8677  				"organization_projects": "op",
  8678  				"organization_secrets": "os",
  8679  				"organization_self_hosted_runners": "osh",
  8680  				"organization_user_blocking": "oub",
  8681  				"packages": "pkg",
  8682  				"pages": "pg",
  8683  				"pull_requests": "pr",
  8684  				"repository_hooks": "rh",
  8685  				"repository_projects": "rp",
  8686  				"repository_pre_receive_hooks": "rprh",
  8687  				"secrets": "s",
  8688  				"secret_scanning_alerts": "ssa",
  8689  				"security_events": "se",
  8690  				"single_file": "sf",
  8691  				"statuses": "s",
  8692  				"team_discussions": "td",
  8693  				"vulnerability_alerts": "va",
  8694  				"workflows": "w"
  8695  			},
  8696  			"created_at": ` + referenceTimeStr + `,
  8697  			"updated_at": ` + referenceTimeStr + `,
  8698  			"has_multiple_single_files": false,
  8699  			"suspended_by": {
  8700  				"login": "l",
  8701  				"id": 1,
  8702  				"avatar_url": "a",
  8703  				"gravatar_id": "g",
  8704  				"name": "n",
  8705  				"company": "c",
  8706  				"blog": "b",
  8707  				"location": "l",
  8708  				"email": "e",
  8709  				"hireable": true,
  8710  				"bio": "b",
  8711  				"twitter_username": "t",
  8712  				"public_repos": 1,
  8713  				"followers": 1,
  8714  				"following": 1,
  8715  				"created_at": ` + referenceTimeStr + `,
  8716  				"suspended_at": ` + referenceTimeStr + `,
  8717  				"url": "u"
  8718  			},
  8719  			"suspended_at": ` + referenceTimeStr + `
  8720  		}
  8721  	}`
  8722  
  8723  	testJSONMarshal(t, u, want)
  8724  }
  8725  
  8726  func TestMergeGroupEvent_Marshal(t *testing.T) {
  8727  	testJSONMarshal(t, &MergeGroupEvent{}, "{}")
  8728  
  8729  	u := &MergeGroupEvent{
  8730  		Action: String("a"),
  8731  		MergeGroup: &MergeGroup{
  8732  			HeadSHA:    String("hs"),
  8733  			HeadRef:    String("hr"),
  8734  			BaseSHA:    String("bs"),
  8735  			BaseRef:    String("br"),
  8736  			HeadCommit: &Commit{NodeID: String("nid")},
  8737  		},
  8738  		Repo: &Repository{
  8739  			ID:   Int64(1),
  8740  			URL:  String("s"),
  8741  			Name: String("n"),
  8742  		},
  8743  		Org: &Organization{
  8744  			BillingEmail:                         String("be"),
  8745  			Blog:                                 String("b"),
  8746  			Company:                              String("c"),
  8747  			Email:                                String("e"),
  8748  			TwitterUsername:                      String("tu"),
  8749  			Location:                             String("loc"),
  8750  			Name:                                 String("n"),
  8751  			Description:                          String("d"),
  8752  			IsVerified:                           Bool(true),
  8753  			HasOrganizationProjects:              Bool(true),
  8754  			HasRepositoryProjects:                Bool(true),
  8755  			DefaultRepoPermission:                String("drp"),
  8756  			MembersCanCreateRepos:                Bool(true),
  8757  			MembersCanCreateInternalRepos:        Bool(true),
  8758  			MembersCanCreatePrivateRepos:         Bool(true),
  8759  			MembersCanCreatePublicRepos:          Bool(false),
  8760  			MembersAllowedRepositoryCreationType: String("marct"),
  8761  			MembersCanCreatePages:                Bool(true),
  8762  			MembersCanCreatePublicPages:          Bool(false),
  8763  			MembersCanCreatePrivatePages:         Bool(true),
  8764  		},
  8765  		Sender: &User{
  8766  			Login:     String("l"),
  8767  			ID:        Int64(1),
  8768  			NodeID:    String("n"),
  8769  			URL:       String("u"),
  8770  			ReposURL:  String("r"),
  8771  			EventsURL: String("e"),
  8772  			AvatarURL: String("a"),
  8773  		},
  8774  		Installation: &Installation{
  8775  			ID:       Int64(1),
  8776  			NodeID:   String("nid"),
  8777  			AppID:    Int64(1),
  8778  			AppSlug:  String("as"),
  8779  			TargetID: Int64(1),
  8780  			Account: &User{
  8781  				Login:           String("l"),
  8782  				ID:              Int64(1),
  8783  				URL:             String("u"),
  8784  				AvatarURL:       String("a"),
  8785  				GravatarID:      String("g"),
  8786  				Name:            String("n"),
  8787  				Company:         String("c"),
  8788  				Blog:            String("b"),
  8789  				Location:        String("l"),
  8790  				Email:           String("e"),
  8791  				Hireable:        Bool(true),
  8792  				Bio:             String("b"),
  8793  				TwitterUsername: String("t"),
  8794  				PublicRepos:     Int(1),
  8795  				Followers:       Int(1),
  8796  				Following:       Int(1),
  8797  				CreatedAt:       &Timestamp{referenceTime},
  8798  				SuspendedAt:     &Timestamp{referenceTime},
  8799  			},
  8800  			AccessTokensURL:     String("atu"),
  8801  			RepositoriesURL:     String("ru"),
  8802  			HTMLURL:             String("hu"),
  8803  			TargetType:          String("tt"),
  8804  			SingleFileName:      String("sfn"),
  8805  			RepositorySelection: String("rs"),
  8806  			Events:              []string{"e"},
  8807  			SingleFilePaths:     []string{"s"},
  8808  			Permissions: &InstallationPermissions{
  8809  				Actions:                       String("a"),
  8810  				Administration:                String("ad"),
  8811  				Checks:                        String("c"),
  8812  				Contents:                      String("co"),
  8813  				ContentReferences:             String("cr"),
  8814  				Deployments:                   String("d"),
  8815  				Environments:                  String("e"),
  8816  				Issues:                        String("i"),
  8817  				Metadata:                      String("md"),
  8818  				Members:                       String("m"),
  8819  				OrganizationAdministration:    String("oa"),
  8820  				OrganizationHooks:             String("oh"),
  8821  				OrganizationPlan:              String("op"),
  8822  				OrganizationPreReceiveHooks:   String("opr"),
  8823  				OrganizationProjects:          String("op"),
  8824  				OrganizationSecrets:           String("os"),
  8825  				OrganizationSelfHostedRunners: String("osh"),
  8826  				OrganizationUserBlocking:      String("oub"),
  8827  				Packages:                      String("pkg"),
  8828  				Pages:                         String("pg"),
  8829  				PullRequests:                  String("pr"),
  8830  				RepositoryHooks:               String("rh"),
  8831  				RepositoryProjects:            String("rp"),
  8832  				RepositoryPreReceiveHooks:     String("rprh"),
  8833  				Secrets:                       String("s"),
  8834  				SecretScanningAlerts:          String("ssa"),
  8835  				SecurityEvents:                String("se"),
  8836  				SingleFile:                    String("sf"),
  8837  				Statuses:                      String("s"),
  8838  				TeamDiscussions:               String("td"),
  8839  				VulnerabilityAlerts:           String("va"),
  8840  				Workflows:                     String("w"),
  8841  			},
  8842  			CreatedAt:              &Timestamp{referenceTime},
  8843  			UpdatedAt:              &Timestamp{referenceTime},
  8844  			HasMultipleSingleFiles: Bool(false),
  8845  			SuspendedBy: &User{
  8846  				Login:           String("l"),
  8847  				ID:              Int64(1),
  8848  				URL:             String("u"),
  8849  				AvatarURL:       String("a"),
  8850  				GravatarID:      String("g"),
  8851  				Name:            String("n"),
  8852  				Company:         String("c"),
  8853  				Blog:            String("b"),
  8854  				Location:        String("l"),
  8855  				Email:           String("e"),
  8856  				Hireable:        Bool(true),
  8857  				Bio:             String("b"),
  8858  				TwitterUsername: String("t"),
  8859  				PublicRepos:     Int(1),
  8860  				Followers:       Int(1),
  8861  				Following:       Int(1),
  8862  				CreatedAt:       &Timestamp{referenceTime},
  8863  				SuspendedAt:     &Timestamp{referenceTime},
  8864  			},
  8865  			SuspendedAt: &Timestamp{referenceTime},
  8866  		},
  8867  	}
  8868  
  8869  	want := `{
  8870  		"action": "a",
  8871  		"merge_group": {
  8872  			"head_sha": "hs",
  8873  			"head_ref": "hr",
  8874  			"base_sha": "bs",
  8875  			"base_ref": "br",
  8876  			"head_commit": {
  8877  				"node_id": "nid"
  8878  			}
  8879  		},
  8880  		"repository": {
  8881  			"id": 1,
  8882  			"name": "n",
  8883  			"url": "s"
  8884  		},
  8885  		"organization": {
  8886  			"name": "n",
  8887  			"company": "c",
  8888  			"blog": "b",
  8889  			"location": "loc",
  8890  			"email": "e",
  8891  			"twitter_username": "tu",
  8892  			"description": "d",
  8893  			"billing_email": "be",
  8894  			"is_verified": true,
  8895  			"has_organization_projects": true,
  8896  			"has_repository_projects": true,
  8897  			"default_repository_permission": "drp",
  8898  			"members_can_create_repositories": true,
  8899  			"members_can_create_public_repositories": false,
  8900  			"members_can_create_private_repositories": true,
  8901  			"members_can_create_internal_repositories": true,
  8902  			"members_allowed_repository_creation_type": "marct",
  8903  			"members_can_create_pages": true,
  8904  			"members_can_create_public_pages": false,
  8905  			"members_can_create_private_pages": true
  8906  		},
  8907  		"sender": {
  8908  			"login": "l",
  8909  			"id": 1,
  8910  			"node_id": "n",
  8911  			"avatar_url": "a",
  8912  			"url": "u",
  8913  			"events_url": "e",
  8914  			"repos_url": "r"
  8915  		},
  8916  		"installation": {
  8917  			"id": 1,
  8918  			"node_id": "nid",
  8919  			"app_id": 1,
  8920  			"app_slug": "as",
  8921  			"target_id": 1,
  8922  			"account": {
  8923  				"login": "l",
  8924  				"id": 1,
  8925  				"avatar_url": "a",
  8926  				"gravatar_id": "g",
  8927  				"name": "n",
  8928  				"company": "c",
  8929  				"blog": "b",
  8930  				"location": "l",
  8931  				"email": "e",
  8932  				"hireable": true,
  8933  				"bio": "b",
  8934  				"twitter_username": "t",
  8935  				"public_repos": 1,
  8936  				"followers": 1,
  8937  				"following": 1,
  8938  				"created_at": ` + referenceTimeStr + `,
  8939  				"suspended_at": ` + referenceTimeStr + `,
  8940  				"url": "u"
  8941  			},
  8942  			"access_tokens_url": "atu",
  8943  			"repositories_url": "ru",
  8944  			"html_url": "hu",
  8945  			"target_type": "tt",
  8946  			"single_file_name": "sfn",
  8947  			"repository_selection": "rs",
  8948  			"events": [
  8949  				"e"
  8950  			],
  8951  			"single_file_paths": [
  8952  				"s"
  8953  			],
  8954  			"permissions": {
  8955  				"actions": "a",
  8956  				"administration": "ad",
  8957  				"checks": "c",
  8958  				"contents": "co",
  8959  				"content_references": "cr",
  8960  				"deployments": "d",
  8961  				"environments": "e",
  8962  				"issues": "i",
  8963  				"metadata": "md",
  8964  				"members": "m",
  8965  				"organization_administration": "oa",
  8966  				"organization_hooks": "oh",
  8967  				"organization_plan": "op",
  8968  				"organization_pre_receive_hooks": "opr",
  8969  				"organization_projects": "op",
  8970  				"organization_secrets": "os",
  8971  				"organization_self_hosted_runners": "osh",
  8972  				"organization_user_blocking": "oub",
  8973  				"packages": "pkg",
  8974  				"pages": "pg",
  8975  				"pull_requests": "pr",
  8976  				"repository_hooks": "rh",
  8977  				"repository_projects": "rp",
  8978  				"repository_pre_receive_hooks": "rprh",
  8979  				"secrets": "s",
  8980  				"secret_scanning_alerts": "ssa",
  8981  				"security_events": "se",
  8982  				"single_file": "sf",
  8983  				"statuses": "s",
  8984  				"team_discussions": "td",
  8985  				"vulnerability_alerts": "va",
  8986  				"workflows": "w"
  8987  			},
  8988  			"created_at": ` + referenceTimeStr + `,
  8989  			"updated_at": ` + referenceTimeStr + `,
  8990  			"has_multiple_single_files": false,
  8991  			"suspended_by": {
  8992  				"login": "l",
  8993  				"id": 1,
  8994  				"avatar_url": "a",
  8995  				"gravatar_id": "g",
  8996  				"name": "n",
  8997  				"company": "c",
  8998  				"blog": "b",
  8999  				"location": "l",
  9000  				"email": "e",
  9001  				"hireable": true,
  9002  				"bio": "b",
  9003  				"twitter_username": "t",
  9004  				"public_repos": 1,
  9005  				"followers": 1,
  9006  				"following": 1,
  9007  				"created_at": ` + referenceTimeStr + `,
  9008  				"suspended_at": ` + referenceTimeStr + `,
  9009  				"url": "u"
  9010  			},
  9011  			"suspended_at": ` + referenceTimeStr + `
  9012  		}
  9013  	}`
  9014  
  9015  	testJSONMarshal(t, u, want)
  9016  }
  9017  
  9018  func TestOrgBlockEvent_Marshal(t *testing.T) {
  9019  	testJSONMarshal(t, &OrgBlockEvent{}, "{}")
  9020  
  9021  	u := &OrgBlockEvent{
  9022  		Action: String("a"),
  9023  		BlockedUser: &User{
  9024  			Login:     String("l"),
  9025  			ID:        Int64(1),
  9026  			NodeID:    String("n"),
  9027  			URL:       String("u"),
  9028  			ReposURL:  String("r"),
  9029  			EventsURL: String("e"),
  9030  			AvatarURL: String("a"),
  9031  		},
  9032  		Organization: &Organization{
  9033  			BillingEmail:                         String("be"),
  9034  			Blog:                                 String("b"),
  9035  			Company:                              String("c"),
  9036  			Email:                                String("e"),
  9037  			TwitterUsername:                      String("tu"),
  9038  			Location:                             String("loc"),
  9039  			Name:                                 String("n"),
  9040  			Description:                          String("d"),
  9041  			IsVerified:                           Bool(true),
  9042  			HasOrganizationProjects:              Bool(true),
  9043  			HasRepositoryProjects:                Bool(true),
  9044  			DefaultRepoPermission:                String("drp"),
  9045  			MembersCanCreateRepos:                Bool(true),
  9046  			MembersCanCreateInternalRepos:        Bool(true),
  9047  			MembersCanCreatePrivateRepos:         Bool(true),
  9048  			MembersCanCreatePublicRepos:          Bool(false),
  9049  			MembersAllowedRepositoryCreationType: String("marct"),
  9050  			MembersCanCreatePages:                Bool(true),
  9051  			MembersCanCreatePublicPages:          Bool(false),
  9052  			MembersCanCreatePrivatePages:         Bool(true),
  9053  		},
  9054  		Sender: &User{
  9055  			Login:     String("l"),
  9056  			ID:        Int64(1),
  9057  			NodeID:    String("n"),
  9058  			URL:       String("u"),
  9059  			ReposURL:  String("r"),
  9060  			EventsURL: String("e"),
  9061  			AvatarURL: String("a"),
  9062  		},
  9063  		Installation: &Installation{
  9064  			ID:       Int64(1),
  9065  			NodeID:   String("nid"),
  9066  			AppID:    Int64(1),
  9067  			AppSlug:  String("as"),
  9068  			TargetID: Int64(1),
  9069  			Account: &User{
  9070  				Login:           String("l"),
  9071  				ID:              Int64(1),
  9072  				URL:             String("u"),
  9073  				AvatarURL:       String("a"),
  9074  				GravatarID:      String("g"),
  9075  				Name:            String("n"),
  9076  				Company:         String("c"),
  9077  				Blog:            String("b"),
  9078  				Location:        String("l"),
  9079  				Email:           String("e"),
  9080  				Hireable:        Bool(true),
  9081  				Bio:             String("b"),
  9082  				TwitterUsername: String("t"),
  9083  				PublicRepos:     Int(1),
  9084  				Followers:       Int(1),
  9085  				Following:       Int(1),
  9086  				CreatedAt:       &Timestamp{referenceTime},
  9087  				SuspendedAt:     &Timestamp{referenceTime},
  9088  			},
  9089  			AccessTokensURL:     String("atu"),
  9090  			RepositoriesURL:     String("ru"),
  9091  			HTMLURL:             String("hu"),
  9092  			TargetType:          String("tt"),
  9093  			SingleFileName:      String("sfn"),
  9094  			RepositorySelection: String("rs"),
  9095  			Events:              []string{"e"},
  9096  			SingleFilePaths:     []string{"s"},
  9097  			Permissions: &InstallationPermissions{
  9098  				Actions:                       String("a"),
  9099  				Administration:                String("ad"),
  9100  				Checks:                        String("c"),
  9101  				Contents:                      String("co"),
  9102  				ContentReferences:             String("cr"),
  9103  				Deployments:                   String("d"),
  9104  				Environments:                  String("e"),
  9105  				Issues:                        String("i"),
  9106  				Metadata:                      String("md"),
  9107  				Members:                       String("m"),
  9108  				OrganizationAdministration:    String("oa"),
  9109  				OrganizationHooks:             String("oh"),
  9110  				OrganizationPlan:              String("op"),
  9111  				OrganizationPreReceiveHooks:   String("opr"),
  9112  				OrganizationProjects:          String("op"),
  9113  				OrganizationSecrets:           String("os"),
  9114  				OrganizationSelfHostedRunners: String("osh"),
  9115  				OrganizationUserBlocking:      String("oub"),
  9116  				Packages:                      String("pkg"),
  9117  				Pages:                         String("pg"),
  9118  				PullRequests:                  String("pr"),
  9119  				RepositoryHooks:               String("rh"),
  9120  				RepositoryProjects:            String("rp"),
  9121  				RepositoryPreReceiveHooks:     String("rprh"),
  9122  				Secrets:                       String("s"),
  9123  				SecretScanningAlerts:          String("ssa"),
  9124  				SecurityEvents:                String("se"),
  9125  				SingleFile:                    String("sf"),
  9126  				Statuses:                      String("s"),
  9127  				TeamDiscussions:               String("td"),
  9128  				VulnerabilityAlerts:           String("va"),
  9129  				Workflows:                     String("w"),
  9130  			},
  9131  			CreatedAt:              &Timestamp{referenceTime},
  9132  			UpdatedAt:              &Timestamp{referenceTime},
  9133  			HasMultipleSingleFiles: Bool(false),
  9134  			SuspendedBy: &User{
  9135  				Login:           String("l"),
  9136  				ID:              Int64(1),
  9137  				URL:             String("u"),
  9138  				AvatarURL:       String("a"),
  9139  				GravatarID:      String("g"),
  9140  				Name:            String("n"),
  9141  				Company:         String("c"),
  9142  				Blog:            String("b"),
  9143  				Location:        String("l"),
  9144  				Email:           String("e"),
  9145  				Hireable:        Bool(true),
  9146  				Bio:             String("b"),
  9147  				TwitterUsername: String("t"),
  9148  				PublicRepos:     Int(1),
  9149  				Followers:       Int(1),
  9150  				Following:       Int(1),
  9151  				CreatedAt:       &Timestamp{referenceTime},
  9152  				SuspendedAt:     &Timestamp{referenceTime},
  9153  			},
  9154  			SuspendedAt: &Timestamp{referenceTime},
  9155  		},
  9156  	}
  9157  
  9158  	want := `{
  9159  		"action": "a",
  9160  		"blocked_user": {
  9161  			"login": "l",
  9162  			"id": 1,
  9163  			"node_id": "n",
  9164  			"avatar_url": "a",
  9165  			"url": "u",
  9166  			"events_url": "e",
  9167  			"repos_url": "r"
  9168  		},
  9169  		"organization": {
  9170  			"name": "n",
  9171  			"company": "c",
  9172  			"blog": "b",
  9173  			"location": "loc",
  9174  			"email": "e",
  9175  			"twitter_username": "tu",
  9176  			"description": "d",
  9177  			"billing_email": "be",
  9178  			"is_verified": true,
  9179  			"has_organization_projects": true,
  9180  			"has_repository_projects": true,
  9181  			"default_repository_permission": "drp",
  9182  			"members_can_create_repositories": true,
  9183  			"members_can_create_public_repositories": false,
  9184  			"members_can_create_private_repositories": true,
  9185  			"members_can_create_internal_repositories": true,
  9186  			"members_allowed_repository_creation_type": "marct",
  9187  			"members_can_create_pages": true,
  9188  			"members_can_create_public_pages": false,
  9189  			"members_can_create_private_pages": true
  9190  		},
  9191  		"sender": {
  9192  			"login": "l",
  9193  			"id": 1,
  9194  			"node_id": "n",
  9195  			"avatar_url": "a",
  9196  			"url": "u",
  9197  			"events_url": "e",
  9198  			"repos_url": "r"
  9199  		},
  9200  		"installation": {
  9201  			"id": 1,
  9202  			"node_id": "nid",
  9203  			"app_id": 1,
  9204  			"app_slug": "as",
  9205  			"target_id": 1,
  9206  			"account": {
  9207  				"login": "l",
  9208  				"id": 1,
  9209  				"avatar_url": "a",
  9210  				"gravatar_id": "g",
  9211  				"name": "n",
  9212  				"company": "c",
  9213  				"blog": "b",
  9214  				"location": "l",
  9215  				"email": "e",
  9216  				"hireable": true,
  9217  				"bio": "b",
  9218  				"twitter_username": "t",
  9219  				"public_repos": 1,
  9220  				"followers": 1,
  9221  				"following": 1,
  9222  				"created_at": ` + referenceTimeStr + `,
  9223  				"suspended_at": ` + referenceTimeStr + `,
  9224  				"url": "u"
  9225  			},
  9226  			"access_tokens_url": "atu",
  9227  			"repositories_url": "ru",
  9228  			"html_url": "hu",
  9229  			"target_type": "tt",
  9230  			"single_file_name": "sfn",
  9231  			"repository_selection": "rs",
  9232  			"events": [
  9233  				"e"
  9234  			],
  9235  			"single_file_paths": [
  9236  				"s"
  9237  			],
  9238  			"permissions": {
  9239  				"actions": "a",
  9240  				"administration": "ad",
  9241  				"checks": "c",
  9242  				"contents": "co",
  9243  				"content_references": "cr",
  9244  				"deployments": "d",
  9245  				"environments": "e",
  9246  				"issues": "i",
  9247  				"metadata": "md",
  9248  				"members": "m",
  9249  				"organization_administration": "oa",
  9250  				"organization_hooks": "oh",
  9251  				"organization_plan": "op",
  9252  				"organization_pre_receive_hooks": "opr",
  9253  				"organization_projects": "op",
  9254  				"organization_secrets": "os",
  9255  				"organization_self_hosted_runners": "osh",
  9256  				"organization_user_blocking": "oub",
  9257  				"packages": "pkg",
  9258  				"pages": "pg",
  9259  				"pull_requests": "pr",
  9260  				"repository_hooks": "rh",
  9261  				"repository_projects": "rp",
  9262  				"repository_pre_receive_hooks": "rprh",
  9263  				"secrets": "s",
  9264  				"secret_scanning_alerts": "ssa",
  9265  				"security_events": "se",
  9266  				"single_file": "sf",
  9267  				"statuses": "s",
  9268  				"team_discussions": "td",
  9269  				"vulnerability_alerts": "va",
  9270  				"workflows": "w"
  9271  			},
  9272  			"created_at": ` + referenceTimeStr + `,
  9273  			"updated_at": ` + referenceTimeStr + `,
  9274  			"has_multiple_single_files": false,
  9275  			"suspended_by": {
  9276  				"login": "l",
  9277  				"id": 1,
  9278  				"avatar_url": "a",
  9279  				"gravatar_id": "g",
  9280  				"name": "n",
  9281  				"company": "c",
  9282  				"blog": "b",
  9283  				"location": "l",
  9284  				"email": "e",
  9285  				"hireable": true,
  9286  				"bio": "b",
  9287  				"twitter_username": "t",
  9288  				"public_repos": 1,
  9289  				"followers": 1,
  9290  				"following": 1,
  9291  				"created_at": ` + referenceTimeStr + `,
  9292  				"suspended_at": ` + referenceTimeStr + `,
  9293  				"url": "u"
  9294  			},
  9295  			"suspended_at": ` + referenceTimeStr + `
  9296  		}
  9297  	}`
  9298  
  9299  	testJSONMarshal(t, u, want)
  9300  }
  9301  
  9302  func TestGollumEvent_Marshal(t *testing.T) {
  9303  	testJSONMarshal(t, &GollumEvent{}, "{}")
  9304  
  9305  	u := &GollumEvent{
  9306  		Pages: []*Page{
  9307  			{
  9308  				PageName: String("pn"),
  9309  				Title:    String("t"),
  9310  				Summary:  String("s"),
  9311  				Action:   String("a"),
  9312  				SHA:      String("sha"),
  9313  				HTMLURL:  String("hu"),
  9314  			},
  9315  		},
  9316  		Repo: &Repository{
  9317  			ID:   Int64(1),
  9318  			URL:  String("s"),
  9319  			Name: String("n"),
  9320  		},
  9321  		Sender: &User{
  9322  			Login:     String("l"),
  9323  			ID:        Int64(1),
  9324  			NodeID:    String("n"),
  9325  			URL:       String("u"),
  9326  			ReposURL:  String("r"),
  9327  			EventsURL: String("e"),
  9328  			AvatarURL: String("a"),
  9329  		},
  9330  		Installation: &Installation{
  9331  			ID:       Int64(1),
  9332  			NodeID:   String("nid"),
  9333  			AppID:    Int64(1),
  9334  			AppSlug:  String("as"),
  9335  			TargetID: Int64(1),
  9336  			Account: &User{
  9337  				Login:           String("l"),
  9338  				ID:              Int64(1),
  9339  				URL:             String("u"),
  9340  				AvatarURL:       String("a"),
  9341  				GravatarID:      String("g"),
  9342  				Name:            String("n"),
  9343  				Company:         String("c"),
  9344  				Blog:            String("b"),
  9345  				Location:        String("l"),
  9346  				Email:           String("e"),
  9347  				Hireable:        Bool(true),
  9348  				Bio:             String("b"),
  9349  				TwitterUsername: String("t"),
  9350  				PublicRepos:     Int(1),
  9351  				Followers:       Int(1),
  9352  				Following:       Int(1),
  9353  				CreatedAt:       &Timestamp{referenceTime},
  9354  				SuspendedAt:     &Timestamp{referenceTime},
  9355  			},
  9356  			AccessTokensURL:     String("atu"),
  9357  			RepositoriesURL:     String("ru"),
  9358  			HTMLURL:             String("hu"),
  9359  			TargetType:          String("tt"),
  9360  			SingleFileName:      String("sfn"),
  9361  			RepositorySelection: String("rs"),
  9362  			Events:              []string{"e"},
  9363  			SingleFilePaths:     []string{"s"},
  9364  			Permissions: &InstallationPermissions{
  9365  				Actions:                       String("a"),
  9366  				Administration:                String("ad"),
  9367  				Checks:                        String("c"),
  9368  				Contents:                      String("co"),
  9369  				ContentReferences:             String("cr"),
  9370  				Deployments:                   String("d"),
  9371  				Environments:                  String("e"),
  9372  				Issues:                        String("i"),
  9373  				Metadata:                      String("md"),
  9374  				Members:                       String("m"),
  9375  				OrganizationAdministration:    String("oa"),
  9376  				OrganizationHooks:             String("oh"),
  9377  				OrganizationPlan:              String("op"),
  9378  				OrganizationPreReceiveHooks:   String("opr"),
  9379  				OrganizationProjects:          String("op"),
  9380  				OrganizationSecrets:           String("os"),
  9381  				OrganizationSelfHostedRunners: String("osh"),
  9382  				OrganizationUserBlocking:      String("oub"),
  9383  				Packages:                      String("pkg"),
  9384  				Pages:                         String("pg"),
  9385  				PullRequests:                  String("pr"),
  9386  				RepositoryHooks:               String("rh"),
  9387  				RepositoryProjects:            String("rp"),
  9388  				RepositoryPreReceiveHooks:     String("rprh"),
  9389  				Secrets:                       String("s"),
  9390  				SecretScanningAlerts:          String("ssa"),
  9391  				SecurityEvents:                String("se"),
  9392  				SingleFile:                    String("sf"),
  9393  				Statuses:                      String("s"),
  9394  				TeamDiscussions:               String("td"),
  9395  				VulnerabilityAlerts:           String("va"),
  9396  				Workflows:                     String("w"),
  9397  			},
  9398  			CreatedAt:              &Timestamp{referenceTime},
  9399  			UpdatedAt:              &Timestamp{referenceTime},
  9400  			HasMultipleSingleFiles: Bool(false),
  9401  			SuspendedBy: &User{
  9402  				Login:           String("l"),
  9403  				ID:              Int64(1),
  9404  				URL:             String("u"),
  9405  				AvatarURL:       String("a"),
  9406  				GravatarID:      String("g"),
  9407  				Name:            String("n"),
  9408  				Company:         String("c"),
  9409  				Blog:            String("b"),
  9410  				Location:        String("l"),
  9411  				Email:           String("e"),
  9412  				Hireable:        Bool(true),
  9413  				Bio:             String("b"),
  9414  				TwitterUsername: String("t"),
  9415  				PublicRepos:     Int(1),
  9416  				Followers:       Int(1),
  9417  				Following:       Int(1),
  9418  				CreatedAt:       &Timestamp{referenceTime},
  9419  				SuspendedAt:     &Timestamp{referenceTime},
  9420  			},
  9421  			SuspendedAt: &Timestamp{referenceTime},
  9422  		},
  9423  	}
  9424  
  9425  	want := `{
  9426  		"pages": [
  9427  			{
  9428  				"page_name": "pn",
  9429  				"title": "t",
  9430  				"summary": "s",
  9431  				"action": "a",
  9432  				"sha": "sha",
  9433  				"html_url": "hu"
  9434  			}
  9435  		],
  9436  		"repository": {
  9437  			"id": 1,
  9438  			"name": "n",
  9439  			"url": "s"
  9440  		},
  9441  		"sender": {
  9442  			"login": "l",
  9443  			"id": 1,
  9444  			"node_id": "n",
  9445  			"avatar_url": "a",
  9446  			"url": "u",
  9447  			"events_url": "e",
  9448  			"repos_url": "r"
  9449  		},
  9450  		"installation": {
  9451  			"id": 1,
  9452  			"node_id": "nid",
  9453  			"app_id": 1,
  9454  			"app_slug": "as",
  9455  			"target_id": 1,
  9456  			"account": {
  9457  				"login": "l",
  9458  				"id": 1,
  9459  				"avatar_url": "a",
  9460  				"gravatar_id": "g",
  9461  				"name": "n",
  9462  				"company": "c",
  9463  				"blog": "b",
  9464  				"location": "l",
  9465  				"email": "e",
  9466  				"hireable": true,
  9467  				"bio": "b",
  9468  				"twitter_username": "t",
  9469  				"public_repos": 1,
  9470  				"followers": 1,
  9471  				"following": 1,
  9472  				"created_at": ` + referenceTimeStr + `,
  9473  				"suspended_at": ` + referenceTimeStr + `,
  9474  				"url": "u"
  9475  			},
  9476  			"access_tokens_url": "atu",
  9477  			"repositories_url": "ru",
  9478  			"html_url": "hu",
  9479  			"target_type": "tt",
  9480  			"single_file_name": "sfn",
  9481  			"repository_selection": "rs",
  9482  			"events": [
  9483  				"e"
  9484  			],
  9485  			"single_file_paths": [
  9486  				"s"
  9487  			],
  9488  			"permissions": {
  9489  				"actions": "a",
  9490  				"administration": "ad",
  9491  				"checks": "c",
  9492  				"contents": "co",
  9493  				"content_references": "cr",
  9494  				"deployments": "d",
  9495  				"environments": "e",
  9496  				"issues": "i",
  9497  				"metadata": "md",
  9498  				"members": "m",
  9499  				"organization_administration": "oa",
  9500  				"organization_hooks": "oh",
  9501  				"organization_plan": "op",
  9502  				"organization_pre_receive_hooks": "opr",
  9503  				"organization_projects": "op",
  9504  				"organization_secrets": "os",
  9505  				"organization_self_hosted_runners": "osh",
  9506  				"organization_user_blocking": "oub",
  9507  				"packages": "pkg",
  9508  				"pages": "pg",
  9509  				"pull_requests": "pr",
  9510  				"repository_hooks": "rh",
  9511  				"repository_projects": "rp",
  9512  				"repository_pre_receive_hooks": "rprh",
  9513  				"secrets": "s",
  9514  				"secret_scanning_alerts": "ssa",
  9515  				"security_events": "se",
  9516  				"single_file": "sf",
  9517  				"statuses": "s",
  9518  				"team_discussions": "td",
  9519  				"vulnerability_alerts": "va",
  9520  				"workflows": "w"
  9521  			},
  9522  			"created_at": ` + referenceTimeStr + `,
  9523  			"updated_at": ` + referenceTimeStr + `,
  9524  			"has_multiple_single_files": false,
  9525  			"suspended_by": {
  9526  				"login": "l",
  9527  				"id": 1,
  9528  				"avatar_url": "a",
  9529  				"gravatar_id": "g",
  9530  				"name": "n",
  9531  				"company": "c",
  9532  				"blog": "b",
  9533  				"location": "l",
  9534  				"email": "e",
  9535  				"hireable": true,
  9536  				"bio": "b",
  9537  				"twitter_username": "t",
  9538  				"public_repos": 1,
  9539  				"followers": 1,
  9540  				"following": 1,
  9541  				"created_at": ` + referenceTimeStr + `,
  9542  				"suspended_at": ` + referenceTimeStr + `,
  9543  				"url": "u"
  9544  			},
  9545  			"suspended_at": ` + referenceTimeStr + `
  9546  		}
  9547  	}`
  9548  
  9549  	testJSONMarshal(t, u, want)
  9550  }
  9551  
  9552  func TestWorkflowRunEvent_Marshal(t *testing.T) {
  9553  	testJSONMarshal(t, &WorkflowRunEvent{}, "{}")
  9554  
  9555  	u := &WorkflowRunEvent{
  9556  		Action: String("a"),
  9557  		Workflow: &Workflow{
  9558  			ID:        Int64(1),
  9559  			NodeID:    String("nid"),
  9560  			Name:      String("n"),
  9561  			Path:      String("p"),
  9562  			State:     String("s"),
  9563  			CreatedAt: &Timestamp{referenceTime},
  9564  			UpdatedAt: &Timestamp{referenceTime},
  9565  			URL:       String("u"),
  9566  			HTMLURL:   String("h"),
  9567  			BadgeURL:  String("b"),
  9568  		},
  9569  		WorkflowRun: &WorkflowRun{
  9570  			ID:         Int64(1),
  9571  			Name:       String("n"),
  9572  			NodeID:     String("nid"),
  9573  			HeadBranch: String("hb"),
  9574  			HeadSHA:    String("hs"),
  9575  			RunNumber:  Int(1),
  9576  			RunAttempt: Int(1),
  9577  			Event:      String("e"),
  9578  			Status:     String("s"),
  9579  			Conclusion: String("c"),
  9580  			WorkflowID: Int64(1),
  9581  			URL:        String("u"),
  9582  			HTMLURL:    String("h"),
  9583  			PullRequests: []*PullRequest{
  9584  				{
  9585  					URL:    String("u"),
  9586  					ID:     Int64(1),
  9587  					Number: Int(1),
  9588  					Head: &PullRequestBranch{
  9589  						Ref: String("r"),
  9590  						SHA: String("s"),
  9591  						Repo: &Repository{
  9592  							ID:   Int64(1),
  9593  							URL:  String("s"),
  9594  							Name: String("n"),
  9595  						},
  9596  					},
  9597  					Base: &PullRequestBranch{
  9598  						Ref: String("r"),
  9599  						SHA: String("s"),
  9600  						Repo: &Repository{
  9601  							ID:   Int64(1),
  9602  							URL:  String("u"),
  9603  							Name: String("n"),
  9604  						},
  9605  					},
  9606  				},
  9607  			},
  9608  			CreatedAt:          &Timestamp{referenceTime},
  9609  			UpdatedAt:          &Timestamp{referenceTime},
  9610  			RunStartedAt:       &Timestamp{referenceTime},
  9611  			JobsURL:            String("j"),
  9612  			LogsURL:            String("l"),
  9613  			CheckSuiteURL:      String("c"),
  9614  			ArtifactsURL:       String("a"),
  9615  			CancelURL:          String("c"),
  9616  			RerunURL:           String("r"),
  9617  			PreviousAttemptURL: String("p"),
  9618  			HeadCommit: &HeadCommit{
  9619  				Message: String("m"),
  9620  				Author: &CommitAuthor{
  9621  					Name:  String("n"),
  9622  					Email: String("e"),
  9623  					Login: String("l"),
  9624  				},
  9625  				URL:       String("u"),
  9626  				Distinct:  Bool(false),
  9627  				SHA:       String("s"),
  9628  				ID:        String("i"),
  9629  				TreeID:    String("tid"),
  9630  				Timestamp: &Timestamp{referenceTime},
  9631  				Committer: &CommitAuthor{
  9632  					Name:  String("n"),
  9633  					Email: String("e"),
  9634  					Login: String("l"),
  9635  				},
  9636  			},
  9637  			WorkflowURL: String("w"),
  9638  			Repository: &Repository{
  9639  				ID:   Int64(1),
  9640  				URL:  String("u"),
  9641  				Name: String("n"),
  9642  			},
  9643  			HeadRepository: &Repository{
  9644  				ID:   Int64(1),
  9645  				URL:  String("u"),
  9646  				Name: String("n"),
  9647  			},
  9648  		},
  9649  		Org: &Organization{
  9650  			BillingEmail:                         String("be"),
  9651  			Blog:                                 String("b"),
  9652  			Company:                              String("c"),
  9653  			Email:                                String("e"),
  9654  			TwitterUsername:                      String("tu"),
  9655  			Location:                             String("loc"),
  9656  			Name:                                 String("n"),
  9657  			Description:                          String("d"),
  9658  			IsVerified:                           Bool(true),
  9659  			HasOrganizationProjects:              Bool(true),
  9660  			HasRepositoryProjects:                Bool(true),
  9661  			DefaultRepoPermission:                String("drp"),
  9662  			MembersCanCreateRepos:                Bool(true),
  9663  			MembersCanCreateInternalRepos:        Bool(true),
  9664  			MembersCanCreatePrivateRepos:         Bool(true),
  9665  			MembersCanCreatePublicRepos:          Bool(false),
  9666  			MembersAllowedRepositoryCreationType: String("marct"),
  9667  			MembersCanCreatePages:                Bool(true),
  9668  			MembersCanCreatePublicPages:          Bool(false),
  9669  			MembersCanCreatePrivatePages:         Bool(true),
  9670  		},
  9671  		Repo: &Repository{
  9672  			ID:   Int64(1),
  9673  			URL:  String("s"),
  9674  			Name: String("n"),
  9675  		},
  9676  		Sender: &User{
  9677  			Login:     String("l"),
  9678  			ID:        Int64(1),
  9679  			NodeID:    String("n"),
  9680  			URL:       String("u"),
  9681  			ReposURL:  String("r"),
  9682  			EventsURL: String("e"),
  9683  			AvatarURL: String("a"),
  9684  		},
  9685  	}
  9686  
  9687  	want := `{
  9688  		"action": "a",
  9689  		"workflow": {
  9690  			"id": 1,
  9691  			"node_id": "nid",
  9692  			"name": "n",
  9693  			"path": "p",
  9694  			"state": "s",
  9695  			"created_at": ` + referenceTimeStr + `,
  9696  			"updated_at": ` + referenceTimeStr + `,
  9697  			"url": "u",
  9698  			"html_url": "h",
  9699  			"badge_url": "b"
  9700  		},
  9701  		"workflow_run": {
  9702  			"id": 1,
  9703  			"name": "n",
  9704  			"node_id": "nid",
  9705  			"head_branch": "hb",
  9706  			"head_sha": "hs",
  9707  			"run_number": 1,
  9708  			"run_attempt": 1,
  9709  			"event": "e",
  9710  			"status": "s",
  9711  			"conclusion": "c",
  9712  			"workflow_id": 1,
  9713  			"url": "u",
  9714  			"html_url": "h",
  9715  			"pull_requests": [
  9716  				{
  9717  					"id": 1,
  9718  					"number": 1,
  9719  					"url": "u",
  9720  					"head": {
  9721  						"ref": "r",
  9722  						"sha": "s",
  9723  						"repo": {
  9724  							"id": 1,
  9725  							"name": "n",
  9726  							"url": "s"
  9727  						}
  9728  					},
  9729  					"base": {
  9730  						"ref": "r",
  9731  						"sha": "s",
  9732  						"repo": {
  9733  							"id": 1,
  9734  							"name": "n",
  9735  							"url": "u"
  9736  						}
  9737  					}
  9738  				}
  9739  			],
  9740  			"created_at": ` + referenceTimeStr + `,
  9741  			"updated_at": ` + referenceTimeStr + `,
  9742  			"run_started_at": ` + referenceTimeStr + `,
  9743  			"jobs_url": "j",
  9744  			"logs_url": "l",
  9745  			"check_suite_url": "c",
  9746  			"artifacts_url": "a",
  9747  			"cancel_url": "c",
  9748  			"rerun_url": "r",
  9749  			"previous_attempt_url": "p",
  9750  			"head_commit": {
  9751  				"message": "m",
  9752  				"author": {
  9753  					"name": "n",
  9754  					"email": "e",
  9755  					"username": "l"
  9756  				},
  9757  				"url": "u",
  9758  				"distinct": false,
  9759  				"sha": "s",
  9760  				"id": "i",
  9761  				"tree_id": "tid",
  9762  				"timestamp": ` + referenceTimeStr + `,
  9763  				"committer": {
  9764  					"name": "n",
  9765  					"email": "e",
  9766  					"username": "l"
  9767  				}
  9768  			},
  9769  			"workflow_url": "w",
  9770  			"repository": {
  9771  				"id": 1,
  9772  				"name": "n",
  9773  				"url": "u"
  9774  			},
  9775  			"head_repository": {
  9776  				"id": 1,
  9777  				"name": "n",
  9778  				"url": "u"
  9779  			}
  9780  		},
  9781  		"organization": {
  9782  			"name": "n",
  9783  			"company": "c",
  9784  			"blog": "b",
  9785  			"location": "loc",
  9786  			"email": "e",
  9787  			"twitter_username": "tu",
  9788  			"description": "d",
  9789  			"billing_email": "be",
  9790  			"is_verified": true,
  9791  			"has_organization_projects": true,
  9792  			"has_repository_projects": true,
  9793  			"default_repository_permission": "drp",
  9794  			"members_can_create_repositories": true,
  9795  			"members_can_create_public_repositories": false,
  9796  			"members_can_create_private_repositories": true,
  9797  			"members_can_create_internal_repositories": true,
  9798  			"members_allowed_repository_creation_type": "marct",
  9799  			"members_can_create_pages": true,
  9800  			"members_can_create_public_pages": false,
  9801  			"members_can_create_private_pages": true
  9802  		},
  9803  		"repository": {
  9804  			"id": 1,
  9805  			"name": "n",
  9806  			"url": "s"
  9807  		},
  9808  		"sender": {
  9809  			"login": "l",
  9810  			"id": 1,
  9811  			"node_id": "n",
  9812  			"avatar_url": "a",
  9813  			"url": "u",
  9814  			"events_url": "e",
  9815  			"repos_url": "r"
  9816  		}
  9817  	}`
  9818  
  9819  	testJSONMarshal(t, u, want)
  9820  }
  9821  
  9822  func TestWorkflowDispatchEvent_Marshal(t *testing.T) {
  9823  	testJSONMarshal(t, &WorkflowDispatchEvent{}, "{}")
  9824  
  9825  	i := make(map[string]interface{})
  9826  	i["key"] = "value"
  9827  
  9828  	jsonMsg, _ := json.Marshal(i)
  9829  	u := &WorkflowDispatchEvent{
  9830  		Inputs:   jsonMsg,
  9831  		Ref:      String("r"),
  9832  		Workflow: String("w"),
  9833  		Repo: &Repository{
  9834  			ID:   Int64(1),
  9835  			URL:  String("s"),
  9836  			Name: String("n"),
  9837  		},
  9838  		Org: &Organization{
  9839  			BillingEmail:                         String("be"),
  9840  			Blog:                                 String("b"),
  9841  			Company:                              String("c"),
  9842  			Email:                                String("e"),
  9843  			TwitterUsername:                      String("tu"),
  9844  			Location:                             String("loc"),
  9845  			Name:                                 String("n"),
  9846  			Description:                          String("d"),
  9847  			IsVerified:                           Bool(true),
  9848  			HasOrganizationProjects:              Bool(true),
  9849  			HasRepositoryProjects:                Bool(true),
  9850  			DefaultRepoPermission:                String("drp"),
  9851  			MembersCanCreateRepos:                Bool(true),
  9852  			MembersCanCreateInternalRepos:        Bool(true),
  9853  			MembersCanCreatePrivateRepos:         Bool(true),
  9854  			MembersCanCreatePublicRepos:          Bool(false),
  9855  			MembersAllowedRepositoryCreationType: String("marct"),
  9856  			MembersCanCreatePages:                Bool(true),
  9857  			MembersCanCreatePublicPages:          Bool(false),
  9858  			MembersCanCreatePrivatePages:         Bool(true),
  9859  		},
  9860  		Sender: &User{
  9861  			Login:     String("l"),
  9862  			ID:        Int64(1),
  9863  			NodeID:    String("n"),
  9864  			URL:       String("u"),
  9865  			ReposURL:  String("r"),
  9866  			EventsURL: String("e"),
  9867  			AvatarURL: String("a"),
  9868  		},
  9869  	}
  9870  
  9871  	want := `{
  9872  		"inputs": {
  9873  			"key": "value"
  9874  		},
  9875  		"ref": "r",
  9876  		"workflow": "w",
  9877  		"repository": {
  9878  			"id": 1,
  9879  			"name": "n",
  9880  			"url": "s"
  9881  		},
  9882  		"organization": {
  9883  			"name": "n",
  9884  			"company": "c",
  9885  			"blog": "b",
  9886  			"location": "loc",
  9887  			"email": "e",
  9888  			"twitter_username": "tu",
  9889  			"description": "d",
  9890  			"billing_email": "be",
  9891  			"is_verified": true,
  9892  			"has_organization_projects": true,
  9893  			"has_repository_projects": true,
  9894  			"default_repository_permission": "drp",
  9895  			"members_can_create_repositories": true,
  9896  			"members_can_create_public_repositories": false,
  9897  			"members_can_create_private_repositories": true,
  9898  			"members_can_create_internal_repositories": true,
  9899  			"members_allowed_repository_creation_type": "marct",
  9900  			"members_can_create_pages": true,
  9901  			"members_can_create_public_pages": false,
  9902  			"members_can_create_private_pages": true
  9903  		},
  9904  		"sender": {
  9905  			"login": "l",
  9906  			"id": 1,
  9907  			"node_id": "n",
  9908  			"avatar_url": "a",
  9909  			"url": "u",
  9910  			"events_url": "e",
  9911  			"repos_url": "r"
  9912  		}
  9913  	}`
  9914  
  9915  	testJSONMarshal(t, u, want)
  9916  }
  9917  
  9918  func TestWatchEvent_Marshal(t *testing.T) {
  9919  	testJSONMarshal(t, &WatchEvent{}, "{}")
  9920  
  9921  	u := &WatchEvent{
  9922  		Action: String("a"),
  9923  		Repo: &Repository{
  9924  			ID:   Int64(1),
  9925  			URL:  String("s"),
  9926  			Name: String("n"),
  9927  		},
  9928  		Sender: &User{
  9929  			Login:     String("l"),
  9930  			ID:        Int64(1),
  9931  			NodeID:    String("n"),
  9932  			URL:       String("u"),
  9933  			ReposURL:  String("r"),
  9934  			EventsURL: String("e"),
  9935  			AvatarURL: String("a"),
  9936  		},
  9937  		Installation: &Installation{
  9938  			ID:       Int64(1),
  9939  			NodeID:   String("nid"),
  9940  			AppID:    Int64(1),
  9941  			AppSlug:  String("as"),
  9942  			TargetID: Int64(1),
  9943  			Account: &User{
  9944  				Login:           String("l"),
  9945  				ID:              Int64(1),
  9946  				URL:             String("u"),
  9947  				AvatarURL:       String("a"),
  9948  				GravatarID:      String("g"),
  9949  				Name:            String("n"),
  9950  				Company:         String("c"),
  9951  				Blog:            String("b"),
  9952  				Location:        String("l"),
  9953  				Email:           String("e"),
  9954  				Hireable:        Bool(true),
  9955  				Bio:             String("b"),
  9956  				TwitterUsername: String("t"),
  9957  				PublicRepos:     Int(1),
  9958  				Followers:       Int(1),
  9959  				Following:       Int(1),
  9960  				CreatedAt:       &Timestamp{referenceTime},
  9961  				SuspendedAt:     &Timestamp{referenceTime},
  9962  			},
  9963  			AccessTokensURL:     String("atu"),
  9964  			RepositoriesURL:     String("ru"),
  9965  			HTMLURL:             String("hu"),
  9966  			TargetType:          String("tt"),
  9967  			SingleFileName:      String("sfn"),
  9968  			RepositorySelection: String("rs"),
  9969  			Events:              []string{"e"},
  9970  			SingleFilePaths:     []string{"s"},
  9971  			Permissions: &InstallationPermissions{
  9972  				Actions:                       String("a"),
  9973  				Administration:                String("ad"),
  9974  				Checks:                        String("c"),
  9975  				Contents:                      String("co"),
  9976  				ContentReferences:             String("cr"),
  9977  				Deployments:                   String("d"),
  9978  				Environments:                  String("e"),
  9979  				Issues:                        String("i"),
  9980  				Metadata:                      String("md"),
  9981  				Members:                       String("m"),
  9982  				OrganizationAdministration:    String("oa"),
  9983  				OrganizationHooks:             String("oh"),
  9984  				OrganizationPlan:              String("op"),
  9985  				OrganizationPreReceiveHooks:   String("opr"),
  9986  				OrganizationProjects:          String("op"),
  9987  				OrganizationSecrets:           String("os"),
  9988  				OrganizationSelfHostedRunners: String("osh"),
  9989  				OrganizationUserBlocking:      String("oub"),
  9990  				Packages:                      String("pkg"),
  9991  				Pages:                         String("pg"),
  9992  				PullRequests:                  String("pr"),
  9993  				RepositoryHooks:               String("rh"),
  9994  				RepositoryProjects:            String("rp"),
  9995  				RepositoryPreReceiveHooks:     String("rprh"),
  9996  				Secrets:                       String("s"),
  9997  				SecretScanningAlerts:          String("ssa"),
  9998  				SecurityEvents:                String("se"),
  9999  				SingleFile:                    String("sf"),
 10000  				Statuses:                      String("s"),
 10001  				TeamDiscussions:               String("td"),
 10002  				VulnerabilityAlerts:           String("va"),
 10003  				Workflows:                     String("w"),
 10004  			},
 10005  			CreatedAt:              &Timestamp{referenceTime},
 10006  			UpdatedAt:              &Timestamp{referenceTime},
 10007  			HasMultipleSingleFiles: Bool(false),
 10008  			SuspendedBy: &User{
 10009  				Login:           String("l"),
 10010  				ID:              Int64(1),
 10011  				URL:             String("u"),
 10012  				AvatarURL:       String("a"),
 10013  				GravatarID:      String("g"),
 10014  				Name:            String("n"),
 10015  				Company:         String("c"),
 10016  				Blog:            String("b"),
 10017  				Location:        String("l"),
 10018  				Email:           String("e"),
 10019  				Hireable:        Bool(true),
 10020  				Bio:             String("b"),
 10021  				TwitterUsername: String("t"),
 10022  				PublicRepos:     Int(1),
 10023  				Followers:       Int(1),
 10024  				Following:       Int(1),
 10025  				CreatedAt:       &Timestamp{referenceTime},
 10026  				SuspendedAt:     &Timestamp{referenceTime},
 10027  			},
 10028  			SuspendedAt: &Timestamp{referenceTime},
 10029  		},
 10030  	}
 10031  
 10032  	want := `{
 10033  		"action": "a",
 10034  		"repository": {
 10035  			"id": 1,
 10036  			"name": "n",
 10037  			"url": "s"
 10038  		},
 10039  		"sender": {
 10040  			"login": "l",
 10041  			"id": 1,
 10042  			"node_id": "n",
 10043  			"avatar_url": "a",
 10044  			"url": "u",
 10045  			"events_url": "e",
 10046  			"repos_url": "r"
 10047  		},
 10048  		"installation": {
 10049  			"id": 1,
 10050  			"node_id": "nid",
 10051  			"app_id": 1,
 10052  			"app_slug": "as",
 10053  			"target_id": 1,
 10054  			"account": {
 10055  				"login": "l",
 10056  				"id": 1,
 10057  				"avatar_url": "a",
 10058  				"gravatar_id": "g",
 10059  				"name": "n",
 10060  				"company": "c",
 10061  				"blog": "b",
 10062  				"location": "l",
 10063  				"email": "e",
 10064  				"hireable": true,
 10065  				"bio": "b",
 10066  				"twitter_username": "t",
 10067  				"public_repos": 1,
 10068  				"followers": 1,
 10069  				"following": 1,
 10070  				"created_at": ` + referenceTimeStr + `,
 10071  				"suspended_at": ` + referenceTimeStr + `,
 10072  				"url": "u"
 10073  			},
 10074  			"access_tokens_url": "atu",
 10075  			"repositories_url": "ru",
 10076  			"html_url": "hu",
 10077  			"target_type": "tt",
 10078  			"single_file_name": "sfn",
 10079  			"repository_selection": "rs",
 10080  			"events": [
 10081  				"e"
 10082  			],
 10083  			"single_file_paths": [
 10084  				"s"
 10085  			],
 10086  			"permissions": {
 10087  				"actions": "a",
 10088  				"administration": "ad",
 10089  				"checks": "c",
 10090  				"contents": "co",
 10091  				"content_references": "cr",
 10092  				"deployments": "d",
 10093  				"environments": "e",
 10094  				"issues": "i",
 10095  				"metadata": "md",
 10096  				"members": "m",
 10097  				"organization_administration": "oa",
 10098  				"organization_hooks": "oh",
 10099  				"organization_plan": "op",
 10100  				"organization_pre_receive_hooks": "opr",
 10101  				"organization_projects": "op",
 10102  				"organization_secrets": "os",
 10103  				"organization_self_hosted_runners": "osh",
 10104  				"organization_user_blocking": "oub",
 10105  				"packages": "pkg",
 10106  				"pages": "pg",
 10107  				"pull_requests": "pr",
 10108  				"repository_hooks": "rh",
 10109  				"repository_projects": "rp",
 10110  				"repository_pre_receive_hooks": "rprh",
 10111  				"secrets": "s",
 10112  				"secret_scanning_alerts": "ssa",
 10113  				"security_events": "se",
 10114  				"single_file": "sf",
 10115  				"statuses": "s",
 10116  				"team_discussions": "td",
 10117  				"vulnerability_alerts": "va",
 10118  				"workflows": "w"
 10119  			},
 10120  			"created_at": ` + referenceTimeStr + `,
 10121  			"updated_at": ` + referenceTimeStr + `,
 10122  			"has_multiple_single_files": false,
 10123  			"suspended_by": {
 10124  				"login": "l",
 10125  				"id": 1,
 10126  				"avatar_url": "a",
 10127  				"gravatar_id": "g",
 10128  				"name": "n",
 10129  				"company": "c",
 10130  				"blog": "b",
 10131  				"location": "l",
 10132  				"email": "e",
 10133  				"hireable": true,
 10134  				"bio": "b",
 10135  				"twitter_username": "t",
 10136  				"public_repos": 1,
 10137  				"followers": 1,
 10138  				"following": 1,
 10139  				"created_at": ` + referenceTimeStr + `,
 10140  				"suspended_at": ` + referenceTimeStr + `,
 10141  				"url": "u"
 10142  			},
 10143  			"suspended_at": ` + referenceTimeStr + `
 10144  		}
 10145  	}`
 10146  
 10147  	testJSONMarshal(t, u, want)
 10148  }
 10149  
 10150  func TestUserEvent_Marshal(t *testing.T) {
 10151  	testJSONMarshal(t, &UserEvent{}, "{}")
 10152  
 10153  	u := &UserEvent{
 10154  		User: &User{
 10155  			Login:     String("l"),
 10156  			ID:        Int64(1),
 10157  			NodeID:    String("n"),
 10158  			URL:       String("u"),
 10159  			ReposURL:  String("r"),
 10160  			EventsURL: String("e"),
 10161  			AvatarURL: String("a"),
 10162  		},
 10163  		// The action performed. Possible values are: "created" or "deleted".
 10164  		Action: String("a"),
 10165  		Enterprise: &Enterprise{
 10166  			ID:          Int(1),
 10167  			Slug:        String("s"),
 10168  			Name:        String("n"),
 10169  			NodeID:      String("nid"),
 10170  			AvatarURL:   String("au"),
 10171  			Description: String("d"),
 10172  			WebsiteURL:  String("wu"),
 10173  			HTMLURL:     String("hu"),
 10174  			CreatedAt:   &Timestamp{referenceTime},
 10175  			UpdatedAt:   &Timestamp{referenceTime},
 10176  		},
 10177  		Sender: &User{
 10178  			Login:     String("l"),
 10179  			ID:        Int64(1),
 10180  			NodeID:    String("n"),
 10181  			URL:       String("u"),
 10182  			ReposURL:  String("r"),
 10183  			EventsURL: String("e"),
 10184  			AvatarURL: String("a"),
 10185  		},
 10186  	}
 10187  
 10188  	want := `{
 10189  		"user": {
 10190  			"login": "l",
 10191  			"id": 1,
 10192  			"node_id": "n",
 10193  			"avatar_url": "a",
 10194  			"url": "u",
 10195  			"events_url": "e",
 10196  			"repos_url": "r"
 10197  		},
 10198  		"action": "a",
 10199  		"enterprise": {
 10200  			"id": 1,
 10201  			"slug": "s",
 10202  			"name": "n",
 10203  			"node_id": "nid",
 10204  			"avatar_url": "au",
 10205  			"description": "d",
 10206  			"website_url": "wu",
 10207  			"html_url": "hu",
 10208  			"created_at": ` + referenceTimeStr + `,
 10209  			"updated_at": ` + referenceTimeStr + `
 10210  		},
 10211  		"sender": {
 10212  			"login": "l",
 10213  			"id": 1,
 10214  			"node_id": "n",
 10215  			"avatar_url": "a",
 10216  			"url": "u",
 10217  			"events_url": "e",
 10218  			"repos_url": "r"
 10219  		}
 10220  	}`
 10221  
 10222  	testJSONMarshal(t, u, want)
 10223  }
 10224  
 10225  func TestCheckRunEvent_Marshal(t *testing.T) {
 10226  	testJSONMarshal(t, &CheckRunEvent{}, "{}")
 10227  
 10228  	r := &CheckRunEvent{
 10229  		CheckRun: &CheckRun{
 10230  			ID:          Int64(1),
 10231  			NodeID:      String("n"),
 10232  			HeadSHA:     String("h"),
 10233  			ExternalID:  String("1"),
 10234  			URL:         String("u"),
 10235  			HTMLURL:     String("u"),
 10236  			DetailsURL:  String("u"),
 10237  			Status:      String("s"),
 10238  			Conclusion:  String("c"),
 10239  			StartedAt:   &Timestamp{referenceTime},
 10240  			CompletedAt: &Timestamp{referenceTime},
 10241  			Output: &CheckRunOutput{
 10242  				Annotations: []*CheckRunAnnotation{
 10243  					{
 10244  						AnnotationLevel: String("a"),
 10245  						EndLine:         Int(1),
 10246  						Message:         String("m"),
 10247  						Path:            String("p"),
 10248  						RawDetails:      String("r"),
 10249  						StartLine:       Int(1),
 10250  						Title:           String("t"),
 10251  					},
 10252  				},
 10253  				AnnotationsCount: Int(1),
 10254  				AnnotationsURL:   String("a"),
 10255  				Images: []*CheckRunImage{
 10256  					{
 10257  						Alt:      String("a"),
 10258  						ImageURL: String("i"),
 10259  						Caption:  String("c"),
 10260  					},
 10261  				},
 10262  				Title:   String("t"),
 10263  				Summary: String("s"),
 10264  				Text:    String("t"),
 10265  			},
 10266  			Name: String("n"),
 10267  			CheckSuite: &CheckSuite{
 10268  				ID: Int64(1),
 10269  			},
 10270  			App: &App{
 10271  				ID:     Int64(1),
 10272  				NodeID: String("n"),
 10273  				Owner: &User{
 10274  					Login:     String("l"),
 10275  					ID:        Int64(1),
 10276  					NodeID:    String("n"),
 10277  					URL:       String("u"),
 10278  					ReposURL:  String("r"),
 10279  					EventsURL: String("e"),
 10280  					AvatarURL: String("a"),
 10281  				},
 10282  				Name:        String("n"),
 10283  				Description: String("d"),
 10284  				HTMLURL:     String("h"),
 10285  				ExternalURL: String("u"),
 10286  				CreatedAt:   &Timestamp{referenceTime},
 10287  				UpdatedAt:   &Timestamp{referenceTime},
 10288  			},
 10289  			PullRequests: []*PullRequest{
 10290  				{
 10291  					URL:    String("u"),
 10292  					ID:     Int64(1),
 10293  					Number: Int(1),
 10294  					Head: &PullRequestBranch{
 10295  						Ref: String("r"),
 10296  						SHA: String("s"),
 10297  						Repo: &Repository{
 10298  							ID:   Int64(1),
 10299  							URL:  String("s"),
 10300  							Name: String("n"),
 10301  						},
 10302  					},
 10303  					Base: &PullRequestBranch{
 10304  						Ref: String("r"),
 10305  						SHA: String("s"),
 10306  						Repo: &Repository{
 10307  							ID:   Int64(1),
 10308  							URL:  String("u"),
 10309  							Name: String("n"),
 10310  						},
 10311  					},
 10312  				},
 10313  			},
 10314  		},
 10315  		Action: String("a"),
 10316  		Repo: &Repository{
 10317  			ID:   Int64(1),
 10318  			URL:  String("s"),
 10319  			Name: String("n"),
 10320  		},
 10321  		Org: &Organization{
 10322  			BillingEmail:                         String("be"),
 10323  			Blog:                                 String("b"),
 10324  			Company:                              String("c"),
 10325  			Email:                                String("e"),
 10326  			TwitterUsername:                      String("tu"),
 10327  			Location:                             String("loc"),
 10328  			Name:                                 String("n"),
 10329  			Description:                          String("d"),
 10330  			IsVerified:                           Bool(true),
 10331  			HasOrganizationProjects:              Bool(true),
 10332  			HasRepositoryProjects:                Bool(true),
 10333  			DefaultRepoPermission:                String("drp"),
 10334  			MembersCanCreateRepos:                Bool(true),
 10335  			MembersCanCreateInternalRepos:        Bool(true),
 10336  			MembersCanCreatePrivateRepos:         Bool(true),
 10337  			MembersCanCreatePublicRepos:          Bool(false),
 10338  			MembersAllowedRepositoryCreationType: String("marct"),
 10339  			MembersCanCreatePages:                Bool(true),
 10340  			MembersCanCreatePublicPages:          Bool(false),
 10341  			MembersCanCreatePrivatePages:         Bool(true),
 10342  		},
 10343  		Sender: &User{
 10344  			Login:     String("l"),
 10345  			ID:        Int64(1),
 10346  			NodeID:    String("n"),
 10347  			URL:       String("u"),
 10348  			ReposURL:  String("r"),
 10349  			EventsURL: String("e"),
 10350  			AvatarURL: String("a"),
 10351  		},
 10352  		Installation: &Installation{
 10353  			ID:       Int64(1),
 10354  			NodeID:   String("nid"),
 10355  			AppID:    Int64(1),
 10356  			AppSlug:  String("as"),
 10357  			TargetID: Int64(1),
 10358  			Account: &User{
 10359  				Login:           String("l"),
 10360  				ID:              Int64(1),
 10361  				URL:             String("u"),
 10362  				AvatarURL:       String("a"),
 10363  				GravatarID:      String("g"),
 10364  				Name:            String("n"),
 10365  				Company:         String("c"),
 10366  				Blog:            String("b"),
 10367  				Location:        String("l"),
 10368  				Email:           String("e"),
 10369  				Hireable:        Bool(true),
 10370  				Bio:             String("b"),
 10371  				TwitterUsername: String("t"),
 10372  				PublicRepos:     Int(1),
 10373  				Followers:       Int(1),
 10374  				Following:       Int(1),
 10375  				CreatedAt:       &Timestamp{referenceTime},
 10376  				SuspendedAt:     &Timestamp{referenceTime},
 10377  			},
 10378  			AccessTokensURL:     String("atu"),
 10379  			RepositoriesURL:     String("ru"),
 10380  			HTMLURL:             String("hu"),
 10381  			TargetType:          String("tt"),
 10382  			SingleFileName:      String("sfn"),
 10383  			RepositorySelection: String("rs"),
 10384  			Events:              []string{"e"},
 10385  			SingleFilePaths:     []string{"s"},
 10386  			Permissions: &InstallationPermissions{
 10387  				Actions:                       String("a"),
 10388  				Administration:                String("ad"),
 10389  				Checks:                        String("c"),
 10390  				Contents:                      String("co"),
 10391  				ContentReferences:             String("cr"),
 10392  				Deployments:                   String("d"),
 10393  				Environments:                  String("e"),
 10394  				Issues:                        String("i"),
 10395  				Metadata:                      String("md"),
 10396  				Members:                       String("m"),
 10397  				OrganizationAdministration:    String("oa"),
 10398  				OrganizationHooks:             String("oh"),
 10399  				OrganizationPlan:              String("op"),
 10400  				OrganizationPreReceiveHooks:   String("opr"),
 10401  				OrganizationProjects:          String("op"),
 10402  				OrganizationSecrets:           String("os"),
 10403  				OrganizationSelfHostedRunners: String("osh"),
 10404  				OrganizationUserBlocking:      String("oub"),
 10405  				Packages:                      String("pkg"),
 10406  				Pages:                         String("pg"),
 10407  				PullRequests:                  String("pr"),
 10408  				RepositoryHooks:               String("rh"),
 10409  				RepositoryProjects:            String("rp"),
 10410  				RepositoryPreReceiveHooks:     String("rprh"),
 10411  				Secrets:                       String("s"),
 10412  				SecretScanningAlerts:          String("ssa"),
 10413  				SecurityEvents:                String("se"),
 10414  				SingleFile:                    String("sf"),
 10415  				Statuses:                      String("s"),
 10416  				TeamDiscussions:               String("td"),
 10417  				VulnerabilityAlerts:           String("va"),
 10418  				Workflows:                     String("w"),
 10419  			},
 10420  			CreatedAt:              &Timestamp{referenceTime},
 10421  			UpdatedAt:              &Timestamp{referenceTime},
 10422  			HasMultipleSingleFiles: Bool(false),
 10423  			SuspendedBy: &User{
 10424  				Login:           String("l"),
 10425  				ID:              Int64(1),
 10426  				URL:             String("u"),
 10427  				AvatarURL:       String("a"),
 10428  				GravatarID:      String("g"),
 10429  				Name:            String("n"),
 10430  				Company:         String("c"),
 10431  				Blog:            String("b"),
 10432  				Location:        String("l"),
 10433  				Email:           String("e"),
 10434  				Hireable:        Bool(true),
 10435  				Bio:             String("b"),
 10436  				TwitterUsername: String("t"),
 10437  				PublicRepos:     Int(1),
 10438  				Followers:       Int(1),
 10439  				Following:       Int(1),
 10440  				CreatedAt:       &Timestamp{referenceTime},
 10441  				SuspendedAt:     &Timestamp{referenceTime},
 10442  			},
 10443  			SuspendedAt: &Timestamp{referenceTime},
 10444  		},
 10445  		RequestedAction: &RequestedAction{
 10446  			Identifier: "i",
 10447  		},
 10448  	}
 10449  
 10450  	want := `{
 10451  		"check_run": {
 10452  			"id": 1,
 10453  			"node_id": "n",
 10454  			"head_sha": "h",
 10455  			"external_id": "1",
 10456  			"url": "u",
 10457  			"html_url": "u",
 10458  			"details_url": "u",
 10459  			"status": "s",
 10460  			"conclusion": "c",
 10461  			"started_at": ` + referenceTimeStr + `,
 10462  			"completed_at": ` + referenceTimeStr + `,
 10463  			"output": {
 10464  				"title": "t",
 10465  				"summary": "s",
 10466  				"text": "t",
 10467  				"annotations_count": 1,
 10468  				"annotations_url": "a",
 10469  				"annotations": [
 10470  					{
 10471  						"path": "p",
 10472  						"start_line": 1,
 10473  						"end_line": 1,
 10474  						"annotation_level": "a",
 10475  						"message": "m",
 10476  						"title": "t",
 10477  						"raw_details": "r"
 10478  					}
 10479  				],
 10480  				"images": [
 10481  					{
 10482  						"alt": "a",
 10483  						"image_url": "i",
 10484  						"caption": "c"
 10485  					}
 10486  				]
 10487  			},
 10488  			"name": "n",
 10489  			"check_suite": {
 10490  				"id": 1
 10491  			},
 10492  			"app": {
 10493  				"id": 1,
 10494  				"node_id": "n",
 10495  				"owner": {
 10496  					"login": "l",
 10497  					"id": 1,
 10498  					"node_id": "n",
 10499  					"avatar_url": "a",
 10500  					"url": "u",
 10501  					"events_url": "e",
 10502  					"repos_url": "r"
 10503  				},
 10504  				"name": "n",
 10505  				"description": "d",
 10506  				"external_url": "u",
 10507  				"html_url": "h",
 10508  				"created_at": ` + referenceTimeStr + `,
 10509  				"updated_at": ` + referenceTimeStr + `
 10510  			},
 10511  			"pull_requests": [
 10512  				{
 10513  					"id": 1,
 10514  					"number": 1,
 10515  					"url": "u",
 10516  					"head": {
 10517  						"ref": "r",
 10518  						"sha": "s",
 10519  						"repo": {
 10520  							"id": 1,
 10521  							"name": "n",
 10522  							"url": "s"
 10523  						}
 10524  					},
 10525  					"base": {
 10526  						"ref": "r",
 10527  						"sha": "s",
 10528  						"repo": {
 10529  							"id": 1,
 10530  							"name": "n",
 10531  							"url": "u"
 10532  						}
 10533  					}
 10534  				}
 10535  			]
 10536  		},
 10537  		"action": "a",
 10538  		"repository": {
 10539  			"id": 1,
 10540  			"name": "n",
 10541  			"url": "s"
 10542  		},
 10543  		"organization": {
 10544  			"name": "n",
 10545  			"company": "c",
 10546  			"blog": "b",
 10547  			"location": "loc",
 10548  			"email": "e",
 10549  			"twitter_username": "tu",
 10550  			"description": "d",
 10551  			"billing_email": "be",
 10552  			"is_verified": true,
 10553  			"has_organization_projects": true,
 10554  			"has_repository_projects": true,
 10555  			"default_repository_permission": "drp",
 10556  			"members_can_create_repositories": true,
 10557  			"members_can_create_public_repositories": false,
 10558  			"members_can_create_private_repositories": true,
 10559  			"members_can_create_internal_repositories": true,
 10560  			"members_allowed_repository_creation_type": "marct",
 10561  			"members_can_create_pages": true,
 10562  			"members_can_create_public_pages": false,
 10563  			"members_can_create_private_pages": true
 10564  		},
 10565  		"sender": {
 10566  			"login": "l",
 10567  			"id": 1,
 10568  			"node_id": "n",
 10569  			"avatar_url": "a",
 10570  			"url": "u",
 10571  			"events_url": "e",
 10572  			"repos_url": "r"
 10573  		},
 10574  		"installation": {
 10575  			"id": 1,
 10576  			"node_id": "nid",
 10577  			"app_id": 1,
 10578  			"app_slug": "as",
 10579  			"target_id": 1,
 10580  			"account": {
 10581  				"login": "l",
 10582  				"id": 1,
 10583  				"avatar_url": "a",
 10584  				"gravatar_id": "g",
 10585  				"name": "n",
 10586  				"company": "c",
 10587  				"blog": "b",
 10588  				"location": "l",
 10589  				"email": "e",
 10590  				"hireable": true,
 10591  				"bio": "b",
 10592  				"twitter_username": "t",
 10593  				"public_repos": 1,
 10594  				"followers": 1,
 10595  				"following": 1,
 10596  				"created_at": ` + referenceTimeStr + `,
 10597  				"suspended_at": ` + referenceTimeStr + `,
 10598  				"url": "u"
 10599  			},
 10600  			"access_tokens_url": "atu",
 10601  			"repositories_url": "ru",
 10602  			"html_url": "hu",
 10603  			"target_type": "tt",
 10604  			"single_file_name": "sfn",
 10605  			"repository_selection": "rs",
 10606  			"events": [
 10607  				"e"
 10608  			],
 10609  			"single_file_paths": [
 10610  				"s"
 10611  			],
 10612  			"permissions": {
 10613  				"actions": "a",
 10614  				"administration": "ad",
 10615  				"checks": "c",
 10616  				"contents": "co",
 10617  				"content_references": "cr",
 10618  				"deployments": "d",
 10619  				"environments": "e",
 10620  				"issues": "i",
 10621  				"metadata": "md",
 10622  				"members": "m",
 10623  				"organization_administration": "oa",
 10624  				"organization_hooks": "oh",
 10625  				"organization_plan": "op",
 10626  				"organization_pre_receive_hooks": "opr",
 10627  				"organization_projects": "op",
 10628  				"organization_secrets": "os",
 10629  				"organization_self_hosted_runners": "osh",
 10630  				"organization_user_blocking": "oub",
 10631  				"packages": "pkg",
 10632  				"pages": "pg",
 10633  				"pull_requests": "pr",
 10634  				"repository_hooks": "rh",
 10635  				"repository_projects": "rp",
 10636  				"repository_pre_receive_hooks": "rprh",
 10637  				"secrets": "s",
 10638  				"secret_scanning_alerts": "ssa",
 10639  				"security_events": "se",
 10640  				"single_file": "sf",
 10641  				"statuses": "s",
 10642  				"team_discussions": "td",
 10643  				"vulnerability_alerts": "va",
 10644  				"workflows": "w"
 10645  			},
 10646  			"created_at": ` + referenceTimeStr + `,
 10647  			"updated_at": ` + referenceTimeStr + `,
 10648  			"has_multiple_single_files": false,
 10649  			"suspended_by": {
 10650  				"login": "l",
 10651  				"id": 1,
 10652  				"avatar_url": "a",
 10653  				"gravatar_id": "g",
 10654  				"name": "n",
 10655  				"company": "c",
 10656  				"blog": "b",
 10657  				"location": "l",
 10658  				"email": "e",
 10659  				"hireable": true,
 10660  				"bio": "b",
 10661  				"twitter_username": "t",
 10662  				"public_repos": 1,
 10663  				"followers": 1,
 10664  				"following": 1,
 10665  				"created_at": ` + referenceTimeStr + `,
 10666  				"suspended_at": ` + referenceTimeStr + `,
 10667  				"url": "u"
 10668  			},
 10669  			"suspended_at": ` + referenceTimeStr + `
 10670  		},
 10671  		"requested_action": {
 10672  			"identifier": "i"
 10673  		}
 10674  	}`
 10675  
 10676  	testJSONMarshal(t, r, want)
 10677  }
 10678  
 10679  func TestCheckSuiteEvent_Marshal(t *testing.T) {
 10680  	testJSONMarshal(t, &CheckSuiteEvent{}, "{}")
 10681  
 10682  	r := &CheckSuiteEvent{
 10683  		CheckSuite: &CheckSuite{
 10684  			ID:         Int64(1),
 10685  			NodeID:     String("n"),
 10686  			HeadBranch: String("h"),
 10687  			HeadSHA:    String("h"),
 10688  			URL:        String("u"),
 10689  			BeforeSHA:  String("b"),
 10690  			AfterSHA:   String("a"),
 10691  			Status:     String("s"),
 10692  			Conclusion: String("c"),
 10693  			App: &App{
 10694  				ID:     Int64(1),
 10695  				NodeID: String("n"),
 10696  				Owner: &User{
 10697  					Login:     String("l"),
 10698  					ID:        Int64(1),
 10699  					NodeID:    String("n"),
 10700  					URL:       String("u"),
 10701  					ReposURL:  String("r"),
 10702  					EventsURL: String("e"),
 10703  					AvatarURL: String("a"),
 10704  				},
 10705  				Name:        String("n"),
 10706  				Description: String("d"),
 10707  				HTMLURL:     String("h"),
 10708  				ExternalURL: String("u"),
 10709  				CreatedAt:   &Timestamp{referenceTime},
 10710  				UpdatedAt:   &Timestamp{referenceTime},
 10711  			},
 10712  			Repository: &Repository{
 10713  				ID: Int64(1),
 10714  			},
 10715  			PullRequests: []*PullRequest{
 10716  				{
 10717  					URL:    String("u"),
 10718  					ID:     Int64(1),
 10719  					Number: Int(1),
 10720  					Head: &PullRequestBranch{
 10721  						Ref: String("r"),
 10722  						SHA: String("s"),
 10723  						Repo: &Repository{
 10724  							ID:   Int64(1),
 10725  							URL:  String("s"),
 10726  							Name: String("n"),
 10727  						},
 10728  					},
 10729  					Base: &PullRequestBranch{
 10730  						Ref: String("r"),
 10731  						SHA: String("s"),
 10732  						Repo: &Repository{
 10733  							ID:   Int64(1),
 10734  							URL:  String("u"),
 10735  							Name: String("n"),
 10736  						},
 10737  					},
 10738  				},
 10739  			},
 10740  			HeadCommit: &Commit{
 10741  				SHA: String("s"),
 10742  			},
 10743  		},
 10744  		Action: String("a"),
 10745  		Repo: &Repository{
 10746  			ID:   Int64(1),
 10747  			URL:  String("s"),
 10748  			Name: String("n"),
 10749  		},
 10750  		Org: &Organization{
 10751  			BillingEmail:                         String("be"),
 10752  			Blog:                                 String("b"),
 10753  			Company:                              String("c"),
 10754  			Email:                                String("e"),
 10755  			TwitterUsername:                      String("tu"),
 10756  			Location:                             String("loc"),
 10757  			Name:                                 String("n"),
 10758  			Description:                          String("d"),
 10759  			IsVerified:                           Bool(true),
 10760  			HasOrganizationProjects:              Bool(true),
 10761  			HasRepositoryProjects:                Bool(true),
 10762  			DefaultRepoPermission:                String("drp"),
 10763  			MembersCanCreateRepos:                Bool(true),
 10764  			MembersCanCreateInternalRepos:        Bool(true),
 10765  			MembersCanCreatePrivateRepos:         Bool(true),
 10766  			MembersCanCreatePublicRepos:          Bool(false),
 10767  			MembersAllowedRepositoryCreationType: String("marct"),
 10768  			MembersCanCreatePages:                Bool(true),
 10769  			MembersCanCreatePublicPages:          Bool(false),
 10770  			MembersCanCreatePrivatePages:         Bool(true),
 10771  		},
 10772  		Sender: &User{
 10773  			Login:     String("l"),
 10774  			ID:        Int64(1),
 10775  			NodeID:    String("n"),
 10776  			URL:       String("u"),
 10777  			ReposURL:  String("r"),
 10778  			EventsURL: String("e"),
 10779  			AvatarURL: String("a"),
 10780  		},
 10781  		Installation: &Installation{
 10782  			ID:       Int64(1),
 10783  			NodeID:   String("nid"),
 10784  			AppID:    Int64(1),
 10785  			AppSlug:  String("as"),
 10786  			TargetID: Int64(1),
 10787  			Account: &User{
 10788  				Login:           String("l"),
 10789  				ID:              Int64(1),
 10790  				URL:             String("u"),
 10791  				AvatarURL:       String("a"),
 10792  				GravatarID:      String("g"),
 10793  				Name:            String("n"),
 10794  				Company:         String("c"),
 10795  				Blog:            String("b"),
 10796  				Location:        String("l"),
 10797  				Email:           String("e"),
 10798  				Hireable:        Bool(true),
 10799  				Bio:             String("b"),
 10800  				TwitterUsername: String("t"),
 10801  				PublicRepos:     Int(1),
 10802  				Followers:       Int(1),
 10803  				Following:       Int(1),
 10804  				CreatedAt:       &Timestamp{referenceTime},
 10805  				SuspendedAt:     &Timestamp{referenceTime},
 10806  			},
 10807  			AccessTokensURL:     String("atu"),
 10808  			RepositoriesURL:     String("ru"),
 10809  			HTMLURL:             String("hu"),
 10810  			TargetType:          String("tt"),
 10811  			SingleFileName:      String("sfn"),
 10812  			RepositorySelection: String("rs"),
 10813  			Events:              []string{"e"},
 10814  			SingleFilePaths:     []string{"s"},
 10815  			Permissions: &InstallationPermissions{
 10816  				Actions:                       String("a"),
 10817  				Administration:                String("ad"),
 10818  				Checks:                        String("c"),
 10819  				Contents:                      String("co"),
 10820  				ContentReferences:             String("cr"),
 10821  				Deployments:                   String("d"),
 10822  				Environments:                  String("e"),
 10823  				Issues:                        String("i"),
 10824  				Metadata:                      String("md"),
 10825  				Members:                       String("m"),
 10826  				OrganizationAdministration:    String("oa"),
 10827  				OrganizationHooks:             String("oh"),
 10828  				OrganizationPlan:              String("op"),
 10829  				OrganizationPreReceiveHooks:   String("opr"),
 10830  				OrganizationProjects:          String("op"),
 10831  				OrganizationSecrets:           String("os"),
 10832  				OrganizationSelfHostedRunners: String("osh"),
 10833  				OrganizationUserBlocking:      String("oub"),
 10834  				Packages:                      String("pkg"),
 10835  				Pages:                         String("pg"),
 10836  				PullRequests:                  String("pr"),
 10837  				RepositoryHooks:               String("rh"),
 10838  				RepositoryProjects:            String("rp"),
 10839  				RepositoryPreReceiveHooks:     String("rprh"),
 10840  				Secrets:                       String("s"),
 10841  				SecretScanningAlerts:          String("ssa"),
 10842  				SecurityEvents:                String("se"),
 10843  				SingleFile:                    String("sf"),
 10844  				Statuses:                      String("s"),
 10845  				TeamDiscussions:               String("td"),
 10846  				VulnerabilityAlerts:           String("va"),
 10847  				Workflows:                     String("w"),
 10848  			},
 10849  			CreatedAt:              &Timestamp{referenceTime},
 10850  			UpdatedAt:              &Timestamp{referenceTime},
 10851  			HasMultipleSingleFiles: Bool(false),
 10852  			SuspendedBy: &User{
 10853  				Login:           String("l"),
 10854  				ID:              Int64(1),
 10855  				URL:             String("u"),
 10856  				AvatarURL:       String("a"),
 10857  				GravatarID:      String("g"),
 10858  				Name:            String("n"),
 10859  				Company:         String("c"),
 10860  				Blog:            String("b"),
 10861  				Location:        String("l"),
 10862  				Email:           String("e"),
 10863  				Hireable:        Bool(true),
 10864  				Bio:             String("b"),
 10865  				TwitterUsername: String("t"),
 10866  				PublicRepos:     Int(1),
 10867  				Followers:       Int(1),
 10868  				Following:       Int(1),
 10869  				CreatedAt:       &Timestamp{referenceTime},
 10870  				SuspendedAt:     &Timestamp{referenceTime},
 10871  			},
 10872  			SuspendedAt: &Timestamp{referenceTime},
 10873  		},
 10874  	}
 10875  
 10876  	want := `{
 10877  		"check_suite": {
 10878  			"id": 1,
 10879  			"node_id": "n",
 10880  			"head_branch": "h",
 10881  			"head_sha": "h",
 10882  			"url": "u",
 10883  			"before": "b",
 10884  			"after": "a",
 10885  			"status": "s",
 10886  			"conclusion": "c",
 10887  			"app": {
 10888  				"id": 1,
 10889  				"node_id": "n",
 10890  				"owner": {
 10891  					"login": "l",
 10892  					"id": 1,
 10893  					"node_id": "n",
 10894  					"avatar_url": "a",
 10895  					"url": "u",
 10896  					"events_url": "e",
 10897  					"repos_url": "r"
 10898  				},
 10899  				"name": "n",
 10900  				"description": "d",
 10901  				"external_url": "u",
 10902  				"html_url": "h",
 10903  				"created_at": ` + referenceTimeStr + `,
 10904  				"updated_at": ` + referenceTimeStr + `
 10905  			},
 10906  			"repository": {
 10907  				"id": 1
 10908  			},
 10909  			"pull_requests": [
 10910  			{
 10911  				"id": 1,
 10912  				"number": 1,
 10913  				"url": "u",
 10914  				"head": {
 10915  					"ref": "r",
 10916  					"sha": "s",
 10917  					"repo": {
 10918  						"id": 1,
 10919  						"name": "n",
 10920  						"url": "s"
 10921  					}
 10922  				},
 10923  				"base": {
 10924  					"ref": "r",
 10925  					"sha": "s",
 10926  					"repo": {
 10927  						"id": 1,
 10928  						"name": "n",
 10929  						"url": "u"
 10930  					}
 10931  				}
 10932  			}
 10933  		],
 10934  		"head_commit": {
 10935  			"sha": "s"
 10936  		}
 10937  		},
 10938  		"action": "a",
 10939  		"repository": {
 10940  			"id": 1,
 10941  			"name": "n",
 10942  			"url": "s"
 10943  		},
 10944  		"organization": {
 10945  			"name": "n",
 10946  			"company": "c",
 10947  			"blog": "b",
 10948  			"location": "loc",
 10949  			"email": "e",
 10950  			"twitter_username": "tu",
 10951  			"description": "d",
 10952  			"billing_email": "be",
 10953  			"is_verified": true,
 10954  			"has_organization_projects": true,
 10955  			"has_repository_projects": true,
 10956  			"default_repository_permission": "drp",
 10957  			"members_can_create_repositories": true,
 10958  			"members_can_create_public_repositories": false,
 10959  			"members_can_create_private_repositories": true,
 10960  			"members_can_create_internal_repositories": true,
 10961  			"members_allowed_repository_creation_type": "marct",
 10962  			"members_can_create_pages": true,
 10963  			"members_can_create_public_pages": false,
 10964  			"members_can_create_private_pages": true
 10965  		},
 10966  		"sender": {
 10967  			"login": "l",
 10968  			"id": 1,
 10969  			"node_id": "n",
 10970  			"avatar_url": "a",
 10971  			"url": "u",
 10972  			"events_url": "e",
 10973  			"repos_url": "r"
 10974  		},
 10975  		"installation": {
 10976  			"id": 1,
 10977  			"node_id": "nid",
 10978  			"app_id": 1,
 10979  			"app_slug": "as",
 10980  			"target_id": 1,
 10981  			"account": {
 10982  				"login": "l",
 10983  				"id": 1,
 10984  				"avatar_url": "a",
 10985  				"gravatar_id": "g",
 10986  				"name": "n",
 10987  				"company": "c",
 10988  				"blog": "b",
 10989  				"location": "l",
 10990  				"email": "e",
 10991  				"hireable": true,
 10992  				"bio": "b",
 10993  				"twitter_username": "t",
 10994  				"public_repos": 1,
 10995  				"followers": 1,
 10996  				"following": 1,
 10997  				"created_at": ` + referenceTimeStr + `,
 10998  				"suspended_at": ` + referenceTimeStr + `,
 10999  				"url": "u"
 11000  			},
 11001  			"access_tokens_url": "atu",
 11002  			"repositories_url": "ru",
 11003  			"html_url": "hu",
 11004  			"target_type": "tt",
 11005  			"single_file_name": "sfn",
 11006  			"repository_selection": "rs",
 11007  			"events": [
 11008  				"e"
 11009  			],
 11010  			"single_file_paths": [
 11011  				"s"
 11012  			],
 11013  			"permissions": {
 11014  				"actions": "a",
 11015  				"administration": "ad",
 11016  				"checks": "c",
 11017  				"contents": "co",
 11018  				"content_references": "cr",
 11019  				"deployments": "d",
 11020  				"environments": "e",
 11021  				"issues": "i",
 11022  				"metadata": "md",
 11023  				"members": "m",
 11024  				"organization_administration": "oa",
 11025  				"organization_hooks": "oh",
 11026  				"organization_plan": "op",
 11027  				"organization_pre_receive_hooks": "opr",
 11028  				"organization_projects": "op",
 11029  				"organization_secrets": "os",
 11030  				"organization_self_hosted_runners": "osh",
 11031  				"organization_user_blocking": "oub",
 11032  				"packages": "pkg",
 11033  				"pages": "pg",
 11034  				"pull_requests": "pr",
 11035  				"repository_hooks": "rh",
 11036  				"repository_projects": "rp",
 11037  				"repository_pre_receive_hooks": "rprh",
 11038  				"secrets": "s",
 11039  				"secret_scanning_alerts": "ssa",
 11040  				"security_events": "se",
 11041  				"single_file": "sf",
 11042  				"statuses": "s",
 11043  				"team_discussions": "td",
 11044  				"vulnerability_alerts": "va",
 11045  				"workflows": "w"
 11046  			},
 11047  			"created_at": ` + referenceTimeStr + `,
 11048  			"updated_at": ` + referenceTimeStr + `,
 11049  			"has_multiple_single_files": false,
 11050  			"suspended_by": {
 11051  				"login": "l",
 11052  				"id": 1,
 11053  				"avatar_url": "a",
 11054  				"gravatar_id": "g",
 11055  				"name": "n",
 11056  				"company": "c",
 11057  				"blog": "b",
 11058  				"location": "l",
 11059  				"email": "e",
 11060  				"hireable": true,
 11061  				"bio": "b",
 11062  				"twitter_username": "t",
 11063  				"public_repos": 1,
 11064  				"followers": 1,
 11065  				"following": 1,
 11066  				"created_at": ` + referenceTimeStr + `,
 11067  				"suspended_at": ` + referenceTimeStr + `,
 11068  				"url": "u"
 11069  			},
 11070  			"suspended_at": ` + referenceTimeStr + `
 11071  		}
 11072  	}`
 11073  
 11074  	testJSONMarshal(t, r, want)
 11075  }
 11076  
 11077  func TestDeployKeyEvent_Marshal(t *testing.T) {
 11078  	testJSONMarshal(t, &DeployKeyEvent{}, "{}")
 11079  
 11080  	u := &DeployKeyEvent{
 11081  		Action: String("a"),
 11082  		Key: &Key{
 11083  			ID:        Int64(1),
 11084  			Key:       String("k"),
 11085  			URL:       String("k"),
 11086  			Title:     String("k"),
 11087  			ReadOnly:  Bool(false),
 11088  			Verified:  Bool(false),
 11089  			CreatedAt: &Timestamp{referenceTime},
 11090  		},
 11091  		Repo: &Repository{
 11092  			ID:   Int64(1),
 11093  			URL:  String("s"),
 11094  			Name: String("n"),
 11095  		},
 11096  		Organization: &Organization{
 11097  			BillingEmail:                         String("be"),
 11098  			Blog:                                 String("b"),
 11099  			Company:                              String("c"),
 11100  			Email:                                String("e"),
 11101  			TwitterUsername:                      String("tu"),
 11102  			Location:                             String("loc"),
 11103  			Name:                                 String("n"),
 11104  			Description:                          String("d"),
 11105  			IsVerified:                           Bool(true),
 11106  			HasOrganizationProjects:              Bool(true),
 11107  			HasRepositoryProjects:                Bool(true),
 11108  			DefaultRepoPermission:                String("drp"),
 11109  			MembersCanCreateRepos:                Bool(true),
 11110  			MembersCanCreateInternalRepos:        Bool(true),
 11111  			MembersCanCreatePrivateRepos:         Bool(true),
 11112  			MembersCanCreatePublicRepos:          Bool(false),
 11113  			MembersAllowedRepositoryCreationType: String("marct"),
 11114  			MembersCanCreatePages:                Bool(true),
 11115  			MembersCanCreatePublicPages:          Bool(false),
 11116  			MembersCanCreatePrivatePages:         Bool(true),
 11117  		},
 11118  		Sender: &User{
 11119  			Login:     String("l"),
 11120  			ID:        Int64(1),
 11121  			NodeID:    String("n"),
 11122  			AvatarURL: String("a"),
 11123  			URL:       String("u"),
 11124  			EventsURL: String("e"),
 11125  			ReposURL:  String("r"),
 11126  		},
 11127  	}
 11128  
 11129  	want := `{
 11130  		"action": "a",
 11131  		"key": {
 11132  			"id": 1,
 11133  			"key": "k",
 11134  			"url": "k",
 11135  			"title": "k",
 11136  			"read_only": false,
 11137  			"verified": false,
 11138  			"created_at": ` + referenceTimeStr + `
 11139  		},
 11140  		"repository": {
 11141  			"id": 1,
 11142  			"name": "n",
 11143  			"url": "s"
 11144  		},
 11145  		"organization": {
 11146  			"name": "n",
 11147  			"company": "c",
 11148  			"blog": "b",
 11149  			"location": "loc",
 11150  			"email": "e",
 11151  			"twitter_username": "tu",
 11152  			"description": "d",
 11153  			"billing_email": "be",
 11154  			"is_verified": true,
 11155  			"has_organization_projects": true,
 11156  			"has_repository_projects": true,
 11157  			"default_repository_permission": "drp",
 11158  			"members_can_create_repositories": true,
 11159  			"members_can_create_public_repositories": false,
 11160  			"members_can_create_private_repositories": true,
 11161  			"members_can_create_internal_repositories": true,
 11162  			"members_allowed_repository_creation_type": "marct",
 11163  			"members_can_create_pages": true,
 11164  			"members_can_create_public_pages": false,
 11165  			"members_can_create_private_pages": true
 11166  		},
 11167  		"sender": {
 11168  			"login": "l",
 11169  			"id": 1,
 11170  			"node_id": "n",
 11171  			"avatar_url": "a",
 11172  			"url": "u",
 11173  			"events_url": "e",
 11174  			"repos_url": "r"
 11175  		}
 11176  	}`
 11177  
 11178  	testJSONMarshal(t, u, want)
 11179  }
 11180  
 11181  func TestMetaEvent_Marshal(t *testing.T) {
 11182  	testJSONMarshal(t, &MetaEvent{}, "{}")
 11183  
 11184  	v := make(map[string]interface{})
 11185  	v["a"] = "b"
 11186  
 11187  	u := &MetaEvent{
 11188  		Action: String("a"),
 11189  		HookID: Int64(1),
 11190  		Hook: &Hook{
 11191  			CreatedAt:    &Timestamp{referenceTime},
 11192  			UpdatedAt:    &Timestamp{referenceTime},
 11193  			URL:          String("u"),
 11194  			ID:           Int64(1),
 11195  			Type:         String("t"),
 11196  			Name:         String("n"),
 11197  			TestURL:      String("tu"),
 11198  			PingURL:      String("pu"),
 11199  			LastResponse: v,
 11200  			Config:       v,
 11201  			Events:       []string{"a"},
 11202  			Active:       Bool(true),
 11203  		},
 11204  	}
 11205  
 11206  	want := `{
 11207  		"action": "a",
 11208  		"hook_id": 1,
 11209  		"hook": {
 11210  			"created_at": ` + referenceTimeStr + `,
 11211  			"updated_at": ` + referenceTimeStr + `,
 11212  			"url": "u",
 11213  			"id": 1,
 11214  			"type": "t",
 11215  			"name": "n",
 11216  			"test_url": "tu",
 11217  			"ping_url": "pu",
 11218  			"last_response": {
 11219  				"a": "b"
 11220  			},
 11221  			"config": {
 11222  				"a": "b"
 11223  			},
 11224  			"events": [
 11225  				"a"
 11226  			],
 11227  			"active": true
 11228  		}
 11229  	}`
 11230  
 11231  	testJSONMarshal(t, u, want)
 11232  }
 11233  
 11234  func TestRequestedAction_Marshal(t *testing.T) {
 11235  	testJSONMarshal(t, &RequestedAction{}, "{}")
 11236  
 11237  	r := &RequestedAction{
 11238  		Identifier: "i",
 11239  	}
 11240  
 11241  	want := `{
 11242  		"identifier": "i"
 11243  	}`
 11244  
 11245  	testJSONMarshal(t, r, want)
 11246  }
 11247  
 11248  func TestCreateEvent_Marshal(t *testing.T) {
 11249  	testJSONMarshal(t, &CreateEvent{}, "{}")
 11250  
 11251  	r := &CreateEvent{
 11252  		Ref:          String("r"),
 11253  		RefType:      String("rt"),
 11254  		MasterBranch: String("mb"),
 11255  		Description:  String("d"),
 11256  		PusherType:   String("pt"),
 11257  		Repo: &Repository{
 11258  			ID:   Int64(1),
 11259  			URL:  String("s"),
 11260  			Name: String("n"),
 11261  		},
 11262  		Sender: &User{
 11263  			Login:     String("l"),
 11264  			ID:        Int64(1),
 11265  			NodeID:    String("n"),
 11266  			URL:       String("u"),
 11267  			ReposURL:  String("r"),
 11268  			EventsURL: String("e"),
 11269  			AvatarURL: String("a"),
 11270  		},
 11271  		Installation: &Installation{
 11272  			ID:       Int64(1),
 11273  			NodeID:   String("nid"),
 11274  			AppID:    Int64(1),
 11275  			AppSlug:  String("as"),
 11276  			TargetID: Int64(1),
 11277  			Account: &User{
 11278  				Login:           String("l"),
 11279  				ID:              Int64(1),
 11280  				URL:             String("u"),
 11281  				AvatarURL:       String("a"),
 11282  				GravatarID:      String("g"),
 11283  				Name:            String("n"),
 11284  				Company:         String("c"),
 11285  				Blog:            String("b"),
 11286  				Location:        String("l"),
 11287  				Email:           String("e"),
 11288  				Hireable:        Bool(true),
 11289  				Bio:             String("b"),
 11290  				TwitterUsername: String("t"),
 11291  				PublicRepos:     Int(1),
 11292  				Followers:       Int(1),
 11293  				Following:       Int(1),
 11294  				CreatedAt:       &Timestamp{referenceTime},
 11295  				SuspendedAt:     &Timestamp{referenceTime},
 11296  			},
 11297  			AccessTokensURL:     String("atu"),
 11298  			RepositoriesURL:     String("ru"),
 11299  			HTMLURL:             String("hu"),
 11300  			TargetType:          String("tt"),
 11301  			SingleFileName:      String("sfn"),
 11302  			RepositorySelection: String("rs"),
 11303  			Events:              []string{"e"},
 11304  			SingleFilePaths:     []string{"s"},
 11305  			Permissions: &InstallationPermissions{
 11306  				Actions:                       String("a"),
 11307  				Administration:                String("ad"),
 11308  				Checks:                        String("c"),
 11309  				Contents:                      String("co"),
 11310  				ContentReferences:             String("cr"),
 11311  				Deployments:                   String("d"),
 11312  				Environments:                  String("e"),
 11313  				Issues:                        String("i"),
 11314  				Metadata:                      String("md"),
 11315  				Members:                       String("m"),
 11316  				OrganizationAdministration:    String("oa"),
 11317  				OrganizationHooks:             String("oh"),
 11318  				OrganizationPlan:              String("op"),
 11319  				OrganizationPreReceiveHooks:   String("opr"),
 11320  				OrganizationProjects:          String("op"),
 11321  				OrganizationSecrets:           String("os"),
 11322  				OrganizationSelfHostedRunners: String("osh"),
 11323  				OrganizationUserBlocking:      String("oub"),
 11324  				Packages:                      String("pkg"),
 11325  				Pages:                         String("pg"),
 11326  				PullRequests:                  String("pr"),
 11327  				RepositoryHooks:               String("rh"),
 11328  				RepositoryProjects:            String("rp"),
 11329  				RepositoryPreReceiveHooks:     String("rprh"),
 11330  				Secrets:                       String("s"),
 11331  				SecretScanningAlerts:          String("ssa"),
 11332  				SecurityEvents:                String("se"),
 11333  				SingleFile:                    String("sf"),
 11334  				Statuses:                      String("s"),
 11335  				TeamDiscussions:               String("td"),
 11336  				VulnerabilityAlerts:           String("va"),
 11337  				Workflows:                     String("w"),
 11338  			},
 11339  			CreatedAt:              &Timestamp{referenceTime},
 11340  			UpdatedAt:              &Timestamp{referenceTime},
 11341  			HasMultipleSingleFiles: Bool(false),
 11342  			SuspendedBy: &User{
 11343  				Login:           String("l"),
 11344  				ID:              Int64(1),
 11345  				URL:             String("u"),
 11346  				AvatarURL:       String("a"),
 11347  				GravatarID:      String("g"),
 11348  				Name:            String("n"),
 11349  				Company:         String("c"),
 11350  				Blog:            String("b"),
 11351  				Location:        String("l"),
 11352  				Email:           String("e"),
 11353  				Hireable:        Bool(true),
 11354  				Bio:             String("b"),
 11355  				TwitterUsername: String("t"),
 11356  				PublicRepos:     Int(1),
 11357  				Followers:       Int(1),
 11358  				Following:       Int(1),
 11359  				CreatedAt:       &Timestamp{referenceTime},
 11360  				SuspendedAt:     &Timestamp{referenceTime},
 11361  			},
 11362  			SuspendedAt: &Timestamp{referenceTime},
 11363  		},
 11364  	}
 11365  
 11366  	want := `{
 11367  		"ref": "r",
 11368  		"ref_type": "rt",
 11369  		"master_branch": "mb",
 11370  		"description": "d",
 11371  		"pusher_type": "pt",
 11372  		"repository": {
 11373  			"id": 1,
 11374  			"name": "n",
 11375  			"url": "s"
 11376  		},
 11377  		"sender": {
 11378  			"login": "l",
 11379  			"id": 1,
 11380  			"node_id": "n",
 11381  			"avatar_url": "a",
 11382  			"url": "u",
 11383  			"events_url": "e",
 11384  			"repos_url": "r"
 11385  		},
 11386  		"installation": {
 11387  			"id": 1,
 11388  			"node_id": "nid",
 11389  			"app_id": 1,
 11390  			"app_slug": "as",
 11391  			"target_id": 1,
 11392  			"account": {
 11393  				"login": "l",
 11394  				"id": 1,
 11395  				"avatar_url": "a",
 11396  				"gravatar_id": "g",
 11397  				"name": "n",
 11398  				"company": "c",
 11399  				"blog": "b",
 11400  				"location": "l",
 11401  				"email": "e",
 11402  				"hireable": true,
 11403  				"bio": "b",
 11404  				"twitter_username": "t",
 11405  				"public_repos": 1,
 11406  				"followers": 1,
 11407  				"following": 1,
 11408  				"created_at": ` + referenceTimeStr + `,
 11409  				"suspended_at": ` + referenceTimeStr + `,
 11410  				"url": "u"
 11411  			},
 11412  			"access_tokens_url": "atu",
 11413  			"repositories_url": "ru",
 11414  			"html_url": "hu",
 11415  			"target_type": "tt",
 11416  			"single_file_name": "sfn",
 11417  			"repository_selection": "rs",
 11418  			"events": [
 11419  				"e"
 11420  			],
 11421  			"single_file_paths": [
 11422  				"s"
 11423  			],
 11424  			"permissions": {
 11425  				"actions": "a",
 11426  				"administration": "ad",
 11427  				"checks": "c",
 11428  				"contents": "co",
 11429  				"content_references": "cr",
 11430  				"deployments": "d",
 11431  				"environments": "e",
 11432  				"issues": "i",
 11433  				"metadata": "md",
 11434  				"members": "m",
 11435  				"organization_administration": "oa",
 11436  				"organization_hooks": "oh",
 11437  				"organization_plan": "op",
 11438  				"organization_pre_receive_hooks": "opr",
 11439  				"organization_projects": "op",
 11440  				"organization_secrets": "os",
 11441  				"organization_self_hosted_runners": "osh",
 11442  				"organization_user_blocking": "oub",
 11443  				"packages": "pkg",
 11444  				"pages": "pg",
 11445  				"pull_requests": "pr",
 11446  				"repository_hooks": "rh",
 11447  				"repository_projects": "rp",
 11448  				"repository_pre_receive_hooks": "rprh",
 11449  				"secrets": "s",
 11450  				"secret_scanning_alerts": "ssa",
 11451  				"security_events": "se",
 11452  				"single_file": "sf",
 11453  				"statuses": "s",
 11454  				"team_discussions": "td",
 11455  				"vulnerability_alerts": "va",
 11456  				"workflows": "w"
 11457  			},
 11458  			"created_at": ` + referenceTimeStr + `,
 11459  			"updated_at": ` + referenceTimeStr + `,
 11460  			"has_multiple_single_files": false,
 11461  			"suspended_by": {
 11462  				"login": "l",
 11463  				"id": 1,
 11464  				"avatar_url": "a",
 11465  				"gravatar_id": "g",
 11466  				"name": "n",
 11467  				"company": "c",
 11468  				"blog": "b",
 11469  				"location": "l",
 11470  				"email": "e",
 11471  				"hireable": true,
 11472  				"bio": "b",
 11473  				"twitter_username": "t",
 11474  				"public_repos": 1,
 11475  				"followers": 1,
 11476  				"following": 1,
 11477  				"created_at": ` + referenceTimeStr + `,
 11478  				"suspended_at": ` + referenceTimeStr + `,
 11479  				"url": "u"
 11480  			},
 11481  			"suspended_at": ` + referenceTimeStr + `
 11482  		}
 11483  	}`
 11484  
 11485  	testJSONMarshal(t, r, want)
 11486  }
 11487  
 11488  func TestDeleteEvent_Marshal(t *testing.T) {
 11489  	testJSONMarshal(t, &DeleteEvent{}, "{}")
 11490  
 11491  	r := &DeleteEvent{
 11492  		Ref:        String("r"),
 11493  		RefType:    String("rt"),
 11494  		PusherType: String("pt"),
 11495  		Repo: &Repository{
 11496  			ID:   Int64(1),
 11497  			URL:  String("s"),
 11498  			Name: String("n"),
 11499  		},
 11500  		Sender: &User{
 11501  			Login:     String("l"),
 11502  			ID:        Int64(1),
 11503  			NodeID:    String("n"),
 11504  			URL:       String("u"),
 11505  			ReposURL:  String("r"),
 11506  			EventsURL: String("e"),
 11507  			AvatarURL: String("a"),
 11508  		},
 11509  		Installation: &Installation{
 11510  			ID:       Int64(1),
 11511  			NodeID:   String("nid"),
 11512  			AppID:    Int64(1),
 11513  			AppSlug:  String("as"),
 11514  			TargetID: Int64(1),
 11515  			Account: &User{
 11516  				Login:           String("l"),
 11517  				ID:              Int64(1),
 11518  				URL:             String("u"),
 11519  				AvatarURL:       String("a"),
 11520  				GravatarID:      String("g"),
 11521  				Name:            String("n"),
 11522  				Company:         String("c"),
 11523  				Blog:            String("b"),
 11524  				Location:        String("l"),
 11525  				Email:           String("e"),
 11526  				Hireable:        Bool(true),
 11527  				Bio:             String("b"),
 11528  				TwitterUsername: String("t"),
 11529  				PublicRepos:     Int(1),
 11530  				Followers:       Int(1),
 11531  				Following:       Int(1),
 11532  				CreatedAt:       &Timestamp{referenceTime},
 11533  				SuspendedAt:     &Timestamp{referenceTime},
 11534  			},
 11535  			AccessTokensURL:     String("atu"),
 11536  			RepositoriesURL:     String("ru"),
 11537  			HTMLURL:             String("hu"),
 11538  			TargetType:          String("tt"),
 11539  			SingleFileName:      String("sfn"),
 11540  			RepositorySelection: String("rs"),
 11541  			Events:              []string{"e"},
 11542  			SingleFilePaths:     []string{"s"},
 11543  			Permissions: &InstallationPermissions{
 11544  				Actions:                       String("a"),
 11545  				Administration:                String("ad"),
 11546  				Checks:                        String("c"),
 11547  				Contents:                      String("co"),
 11548  				ContentReferences:             String("cr"),
 11549  				Deployments:                   String("d"),
 11550  				Environments:                  String("e"),
 11551  				Issues:                        String("i"),
 11552  				Metadata:                      String("md"),
 11553  				Members:                       String("m"),
 11554  				OrganizationAdministration:    String("oa"),
 11555  				OrganizationHooks:             String("oh"),
 11556  				OrganizationPlan:              String("op"),
 11557  				OrganizationPreReceiveHooks:   String("opr"),
 11558  				OrganizationProjects:          String("op"),
 11559  				OrganizationSecrets:           String("os"),
 11560  				OrganizationSelfHostedRunners: String("osh"),
 11561  				OrganizationUserBlocking:      String("oub"),
 11562  				Packages:                      String("pkg"),
 11563  				Pages:                         String("pg"),
 11564  				PullRequests:                  String("pr"),
 11565  				RepositoryHooks:               String("rh"),
 11566  				RepositoryProjects:            String("rp"),
 11567  				RepositoryPreReceiveHooks:     String("rprh"),
 11568  				Secrets:                       String("s"),
 11569  				SecretScanningAlerts:          String("ssa"),
 11570  				SecurityEvents:                String("se"),
 11571  				SingleFile:                    String("sf"),
 11572  				Statuses:                      String("s"),
 11573  				TeamDiscussions:               String("td"),
 11574  				VulnerabilityAlerts:           String("va"),
 11575  				Workflows:                     String("w"),
 11576  			},
 11577  			CreatedAt:              &Timestamp{referenceTime},
 11578  			UpdatedAt:              &Timestamp{referenceTime},
 11579  			HasMultipleSingleFiles: Bool(false),
 11580  			SuspendedBy: &User{
 11581  				Login:           String("l"),
 11582  				ID:              Int64(1),
 11583  				URL:             String("u"),
 11584  				AvatarURL:       String("a"),
 11585  				GravatarID:      String("g"),
 11586  				Name:            String("n"),
 11587  				Company:         String("c"),
 11588  				Blog:            String("b"),
 11589  				Location:        String("l"),
 11590  				Email:           String("e"),
 11591  				Hireable:        Bool(true),
 11592  				Bio:             String("b"),
 11593  				TwitterUsername: String("t"),
 11594  				PublicRepos:     Int(1),
 11595  				Followers:       Int(1),
 11596  				Following:       Int(1),
 11597  				CreatedAt:       &Timestamp{referenceTime},
 11598  				SuspendedAt:     &Timestamp{referenceTime},
 11599  			},
 11600  			SuspendedAt: &Timestamp{referenceTime},
 11601  		},
 11602  	}
 11603  
 11604  	want := `{
 11605  		"ref": "r",
 11606  		"ref_type": "rt",
 11607  		"pusher_type": "pt",
 11608  		"repository": {
 11609  			"id": 1,
 11610  			"name": "n",
 11611  			"url": "s"
 11612  		},
 11613  		"sender": {
 11614  			"login": "l",
 11615  			"id": 1,
 11616  			"node_id": "n",
 11617  			"avatar_url": "a",
 11618  			"url": "u",
 11619  			"events_url": "e",
 11620  			"repos_url": "r"
 11621  		},
 11622  		"installation": {
 11623  			"id": 1,
 11624  			"node_id": "nid",
 11625  			"app_id": 1,
 11626  			"app_slug": "as",
 11627  			"target_id": 1,
 11628  			"account": {
 11629  				"login": "l",
 11630  				"id": 1,
 11631  				"avatar_url": "a",
 11632  				"gravatar_id": "g",
 11633  				"name": "n",
 11634  				"company": "c",
 11635  				"blog": "b",
 11636  				"location": "l",
 11637  				"email": "e",
 11638  				"hireable": true,
 11639  				"bio": "b",
 11640  				"twitter_username": "t",
 11641  				"public_repos": 1,
 11642  				"followers": 1,
 11643  				"following": 1,
 11644  				"created_at": ` + referenceTimeStr + `,
 11645  				"suspended_at": ` + referenceTimeStr + `,
 11646  				"url": "u"
 11647  			},
 11648  			"access_tokens_url": "atu",
 11649  			"repositories_url": "ru",
 11650  			"html_url": "hu",
 11651  			"target_type": "tt",
 11652  			"single_file_name": "sfn",
 11653  			"repository_selection": "rs",
 11654  			"events": [
 11655  				"e"
 11656  			],
 11657  			"single_file_paths": [
 11658  				"s"
 11659  			],
 11660  			"permissions": {
 11661  				"actions": "a",
 11662  				"administration": "ad",
 11663  				"checks": "c",
 11664  				"contents": "co",
 11665  				"content_references": "cr",
 11666  				"deployments": "d",
 11667  				"environments": "e",
 11668  				"issues": "i",
 11669  				"metadata": "md",
 11670  				"members": "m",
 11671  				"organization_administration": "oa",
 11672  				"organization_hooks": "oh",
 11673  				"organization_plan": "op",
 11674  				"organization_pre_receive_hooks": "opr",
 11675  				"organization_projects": "op",
 11676  				"organization_secrets": "os",
 11677  				"organization_self_hosted_runners": "osh",
 11678  				"organization_user_blocking": "oub",
 11679  				"packages": "pkg",
 11680  				"pages": "pg",
 11681  				"pull_requests": "pr",
 11682  				"repository_hooks": "rh",
 11683  				"repository_projects": "rp",
 11684  				"repository_pre_receive_hooks": "rprh",
 11685  				"secrets": "s",
 11686  				"secret_scanning_alerts": "ssa",
 11687  				"security_events": "se",
 11688  				"single_file": "sf",
 11689  				"statuses": "s",
 11690  				"team_discussions": "td",
 11691  				"vulnerability_alerts": "va",
 11692  				"workflows": "w"
 11693  			},
 11694  			"created_at": ` + referenceTimeStr + `,
 11695  			"updated_at": ` + referenceTimeStr + `,
 11696  			"has_multiple_single_files": false,
 11697  			"suspended_by": {
 11698  				"login": "l",
 11699  				"id": 1,
 11700  				"avatar_url": "a",
 11701  				"gravatar_id": "g",
 11702  				"name": "n",
 11703  				"company": "c",
 11704  				"blog": "b",
 11705  				"location": "l",
 11706  				"email": "e",
 11707  				"hireable": true,
 11708  				"bio": "b",
 11709  				"twitter_username": "t",
 11710  				"public_repos": 1,
 11711  				"followers": 1,
 11712  				"following": 1,
 11713  				"created_at": ` + referenceTimeStr + `,
 11714  				"suspended_at": ` + referenceTimeStr + `,
 11715  				"url": "u"
 11716  			},
 11717  			"suspended_at": ` + referenceTimeStr + `
 11718  		}
 11719  	}`
 11720  
 11721  	testJSONMarshal(t, r, want)
 11722  }
 11723  
 11724  func TestForkEvent_Marshal(t *testing.T) {
 11725  	testJSONMarshal(t, &ForkEvent{}, "{}")
 11726  
 11727  	u := &ForkEvent{
 11728  		Forkee: &Repository{
 11729  			ID:   Int64(1),
 11730  			URL:  String("s"),
 11731  			Name: String("n"),
 11732  		},
 11733  		Repo: &Repository{
 11734  			ID:   Int64(1),
 11735  			URL:  String("s"),
 11736  			Name: String("n"),
 11737  		},
 11738  		Sender: &User{
 11739  			Login:     String("l"),
 11740  			ID:        Int64(1),
 11741  			NodeID:    String("n"),
 11742  			URL:       String("u"),
 11743  			ReposURL:  String("r"),
 11744  			EventsURL: String("e"),
 11745  			AvatarURL: String("a"),
 11746  		},
 11747  		Installation: &Installation{
 11748  			ID:       Int64(1),
 11749  			NodeID:   String("nid"),
 11750  			AppID:    Int64(1),
 11751  			AppSlug:  String("as"),
 11752  			TargetID: Int64(1),
 11753  			Account: &User{
 11754  				Login:           String("l"),
 11755  				ID:              Int64(1),
 11756  				URL:             String("u"),
 11757  				AvatarURL:       String("a"),
 11758  				GravatarID:      String("g"),
 11759  				Name:            String("n"),
 11760  				Company:         String("c"),
 11761  				Blog:            String("b"),
 11762  				Location:        String("l"),
 11763  				Email:           String("e"),
 11764  				Hireable:        Bool(true),
 11765  				Bio:             String("b"),
 11766  				TwitterUsername: String("t"),
 11767  				PublicRepos:     Int(1),
 11768  				Followers:       Int(1),
 11769  				Following:       Int(1),
 11770  				CreatedAt:       &Timestamp{referenceTime},
 11771  				SuspendedAt:     &Timestamp{referenceTime},
 11772  			},
 11773  			AccessTokensURL:     String("atu"),
 11774  			RepositoriesURL:     String("ru"),
 11775  			HTMLURL:             String("hu"),
 11776  			TargetType:          String("tt"),
 11777  			SingleFileName:      String("sfn"),
 11778  			RepositorySelection: String("rs"),
 11779  			Events:              []string{"e"},
 11780  			SingleFilePaths:     []string{"s"},
 11781  			Permissions: &InstallationPermissions{
 11782  				Actions:                       String("a"),
 11783  				Administration:                String("ad"),
 11784  				Checks:                        String("c"),
 11785  				Contents:                      String("co"),
 11786  				ContentReferences:             String("cr"),
 11787  				Deployments:                   String("d"),
 11788  				Environments:                  String("e"),
 11789  				Issues:                        String("i"),
 11790  				Metadata:                      String("md"),
 11791  				Members:                       String("m"),
 11792  				OrganizationAdministration:    String("oa"),
 11793  				OrganizationHooks:             String("oh"),
 11794  				OrganizationPlan:              String("op"),
 11795  				OrganizationPreReceiveHooks:   String("opr"),
 11796  				OrganizationProjects:          String("op"),
 11797  				OrganizationSecrets:           String("os"),
 11798  				OrganizationSelfHostedRunners: String("osh"),
 11799  				OrganizationUserBlocking:      String("oub"),
 11800  				Packages:                      String("pkg"),
 11801  				Pages:                         String("pg"),
 11802  				PullRequests:                  String("pr"),
 11803  				RepositoryHooks:               String("rh"),
 11804  				RepositoryProjects:            String("rp"),
 11805  				RepositoryPreReceiveHooks:     String("rprh"),
 11806  				Secrets:                       String("s"),
 11807  				SecretScanningAlerts:          String("ssa"),
 11808  				SecurityEvents:                String("se"),
 11809  				SingleFile:                    String("sf"),
 11810  				Statuses:                      String("s"),
 11811  				TeamDiscussions:               String("td"),
 11812  				VulnerabilityAlerts:           String("va"),
 11813  				Workflows:                     String("w"),
 11814  			},
 11815  			CreatedAt:              &Timestamp{referenceTime},
 11816  			UpdatedAt:              &Timestamp{referenceTime},
 11817  			HasMultipleSingleFiles: Bool(false),
 11818  			SuspendedBy: &User{
 11819  				Login:           String("l"),
 11820  				ID:              Int64(1),
 11821  				URL:             String("u"),
 11822  				AvatarURL:       String("a"),
 11823  				GravatarID:      String("g"),
 11824  				Name:            String("n"),
 11825  				Company:         String("c"),
 11826  				Blog:            String("b"),
 11827  				Location:        String("l"),
 11828  				Email:           String("e"),
 11829  				Hireable:        Bool(true),
 11830  				Bio:             String("b"),
 11831  				TwitterUsername: String("t"),
 11832  				PublicRepos:     Int(1),
 11833  				Followers:       Int(1),
 11834  				Following:       Int(1),
 11835  				CreatedAt:       &Timestamp{referenceTime},
 11836  				SuspendedAt:     &Timestamp{referenceTime},
 11837  			},
 11838  			SuspendedAt: &Timestamp{referenceTime},
 11839  		},
 11840  	}
 11841  
 11842  	want := `{
 11843  		"forkee": {
 11844  			"id": 1,
 11845  			"name": "n",
 11846  			"url": "s"
 11847  		},
 11848  		"repository": {
 11849  			"id": 1,
 11850  			"name": "n",
 11851  			"url": "s"
 11852  		},
 11853  		"sender": {
 11854  			"login": "l",
 11855  			"id": 1,
 11856  			"node_id": "n",
 11857  			"avatar_url": "a",
 11858  			"url": "u",
 11859  			"events_url": "e",
 11860  			"repos_url": "r"
 11861  		},
 11862  		"installation": {
 11863  			"id": 1,
 11864  			"node_id": "nid",
 11865  			"app_id": 1,
 11866  			"app_slug": "as",
 11867  			"target_id": 1,
 11868  			"account": {
 11869  				"login": "l",
 11870  				"id": 1,
 11871  				"avatar_url": "a",
 11872  				"gravatar_id": "g",
 11873  				"name": "n",
 11874  				"company": "c",
 11875  				"blog": "b",
 11876  				"location": "l",
 11877  				"email": "e",
 11878  				"hireable": true,
 11879  				"bio": "b",
 11880  				"twitter_username": "t",
 11881  				"public_repos": 1,
 11882  				"followers": 1,
 11883  				"following": 1,
 11884  				"created_at": ` + referenceTimeStr + `,
 11885  				"suspended_at": ` + referenceTimeStr + `,
 11886  				"url": "u"
 11887  			},
 11888  			"access_tokens_url": "atu",
 11889  			"repositories_url": "ru",
 11890  			"html_url": "hu",
 11891  			"target_type": "tt",
 11892  			"single_file_name": "sfn",
 11893  			"repository_selection": "rs",
 11894  			"events": [
 11895  				"e"
 11896  			],
 11897  			"single_file_paths": [
 11898  				"s"
 11899  			],
 11900  			"permissions": {
 11901  				"actions": "a",
 11902  				"administration": "ad",
 11903  				"checks": "c",
 11904  				"contents": "co",
 11905  				"content_references": "cr",
 11906  				"deployments": "d",
 11907  				"environments": "e",
 11908  				"issues": "i",
 11909  				"metadata": "md",
 11910  				"members": "m",
 11911  				"organization_administration": "oa",
 11912  				"organization_hooks": "oh",
 11913  				"organization_plan": "op",
 11914  				"organization_pre_receive_hooks": "opr",
 11915  				"organization_projects": "op",
 11916  				"organization_secrets": "os",
 11917  				"organization_self_hosted_runners": "osh",
 11918  				"organization_user_blocking": "oub",
 11919  				"packages": "pkg",
 11920  				"pages": "pg",
 11921  				"pull_requests": "pr",
 11922  				"repository_hooks": "rh",
 11923  				"repository_projects": "rp",
 11924  				"repository_pre_receive_hooks": "rprh",
 11925  				"secrets": "s",
 11926  				"secret_scanning_alerts": "ssa",
 11927  				"security_events": "se",
 11928  				"single_file": "sf",
 11929  				"statuses": "s",
 11930  				"team_discussions": "td",
 11931  				"vulnerability_alerts": "va",
 11932  				"workflows": "w"
 11933  			},
 11934  			"created_at": ` + referenceTimeStr + `,
 11935  			"updated_at": ` + referenceTimeStr + `,
 11936  			"has_multiple_single_files": false,
 11937  			"suspended_by": {
 11938  				"login": "l",
 11939  				"id": 1,
 11940  				"avatar_url": "a",
 11941  				"gravatar_id": "g",
 11942  				"name": "n",
 11943  				"company": "c",
 11944  				"blog": "b",
 11945  				"location": "l",
 11946  				"email": "e",
 11947  				"hireable": true,
 11948  				"bio": "b",
 11949  				"twitter_username": "t",
 11950  				"public_repos": 1,
 11951  				"followers": 1,
 11952  				"following": 1,
 11953  				"created_at": ` + referenceTimeStr + `,
 11954  				"suspended_at": ` + referenceTimeStr + `,
 11955  				"url": "u"
 11956  			},
 11957  			"suspended_at": ` + referenceTimeStr + `
 11958  		}
 11959  	}`
 11960  
 11961  	testJSONMarshal(t, u, want)
 11962  }
 11963  
 11964  func TestGitHubAppAuthorizationEvent_Marshal(t *testing.T) {
 11965  	testJSONMarshal(t, &GitHubAppAuthorizationEvent{}, "{}")
 11966  
 11967  	u := &GitHubAppAuthorizationEvent{
 11968  		Action: String("a"),
 11969  		Sender: &User{
 11970  			Login:     String("l"),
 11971  			ID:        Int64(1),
 11972  			NodeID:    String("n"),
 11973  			URL:       String("u"),
 11974  			ReposURL:  String("r"),
 11975  			EventsURL: String("e"),
 11976  			AvatarURL: String("a"),
 11977  		},
 11978  	}
 11979  
 11980  	want := `{
 11981  		"action": "a",
 11982  		"sender": {
 11983  			"login": "l",
 11984  			"id": 1,
 11985  			"node_id": "n",
 11986  			"avatar_url": "a",
 11987  			"url": "u",
 11988  			"events_url": "e",
 11989  			"repos_url": "r"
 11990  		}
 11991  	}`
 11992  
 11993  	testJSONMarshal(t, u, want)
 11994  }
 11995  
 11996  func TestInstallationEvent_Marshal(t *testing.T) {
 11997  	testJSONMarshal(t, &InstallationEvent{}, "{}")
 11998  
 11999  	u := &InstallationEvent{
 12000  		Action: String("a"),
 12001  		Repositories: []*Repository{
 12002  			{
 12003  				ID:   Int64(1),
 12004  				URL:  String("u"),
 12005  				Name: String("n"),
 12006  			},
 12007  		},
 12008  		Sender: &User{
 12009  			Login:     String("l"),
 12010  			ID:        Int64(1),
 12011  			NodeID:    String("n"),
 12012  			URL:       String("u"),
 12013  			ReposURL:  String("r"),
 12014  			EventsURL: String("e"),
 12015  			AvatarURL: String("a"),
 12016  		},
 12017  		Installation: &Installation{
 12018  			ID:       Int64(1),
 12019  			NodeID:   String("nid"),
 12020  			AppID:    Int64(1),
 12021  			AppSlug:  String("as"),
 12022  			TargetID: Int64(1),
 12023  			Account: &User{
 12024  				Login:           String("l"),
 12025  				ID:              Int64(1),
 12026  				URL:             String("u"),
 12027  				AvatarURL:       String("a"),
 12028  				GravatarID:      String("g"),
 12029  				Name:            String("n"),
 12030  				Company:         String("c"),
 12031  				Blog:            String("b"),
 12032  				Location:        String("l"),
 12033  				Email:           String("e"),
 12034  				Hireable:        Bool(true),
 12035  				Bio:             String("b"),
 12036  				TwitterUsername: String("t"),
 12037  				PublicRepos:     Int(1),
 12038  				Followers:       Int(1),
 12039  				Following:       Int(1),
 12040  				CreatedAt:       &Timestamp{referenceTime},
 12041  				SuspendedAt:     &Timestamp{referenceTime},
 12042  			},
 12043  			AccessTokensURL:     String("atu"),
 12044  			RepositoriesURL:     String("ru"),
 12045  			HTMLURL:             String("hu"),
 12046  			TargetType:          String("tt"),
 12047  			SingleFileName:      String("sfn"),
 12048  			RepositorySelection: String("rs"),
 12049  			Events:              []string{"e"},
 12050  			SingleFilePaths:     []string{"s"},
 12051  			Permissions: &InstallationPermissions{
 12052  				Actions:                       String("a"),
 12053  				Administration:                String("ad"),
 12054  				Checks:                        String("c"),
 12055  				Contents:                      String("co"),
 12056  				ContentReferences:             String("cr"),
 12057  				Deployments:                   String("d"),
 12058  				Environments:                  String("e"),
 12059  				Issues:                        String("i"),
 12060  				Metadata:                      String("md"),
 12061  				Members:                       String("m"),
 12062  				OrganizationAdministration:    String("oa"),
 12063  				OrganizationHooks:             String("oh"),
 12064  				OrganizationPlan:              String("op"),
 12065  				OrganizationPreReceiveHooks:   String("opr"),
 12066  				OrganizationProjects:          String("op"),
 12067  				OrganizationSecrets:           String("os"),
 12068  				OrganizationSelfHostedRunners: String("osh"),
 12069  				OrganizationUserBlocking:      String("oub"),
 12070  				Packages:                      String("pkg"),
 12071  				Pages:                         String("pg"),
 12072  				PullRequests:                  String("pr"),
 12073  				RepositoryHooks:               String("rh"),
 12074  				RepositoryProjects:            String("rp"),
 12075  				RepositoryPreReceiveHooks:     String("rprh"),
 12076  				Secrets:                       String("s"),
 12077  				SecretScanningAlerts:          String("ssa"),
 12078  				SecurityEvents:                String("se"),
 12079  				SingleFile:                    String("sf"),
 12080  				Statuses:                      String("s"),
 12081  				TeamDiscussions:               String("td"),
 12082  				VulnerabilityAlerts:           String("va"),
 12083  				Workflows:                     String("w"),
 12084  			},
 12085  			CreatedAt:              &Timestamp{referenceTime},
 12086  			UpdatedAt:              &Timestamp{referenceTime},
 12087  			HasMultipleSingleFiles: Bool(false),
 12088  			SuspendedBy: &User{
 12089  				Login:           String("l"),
 12090  				ID:              Int64(1),
 12091  				URL:             String("u"),
 12092  				AvatarURL:       String("a"),
 12093  				GravatarID:      String("g"),
 12094  				Name:            String("n"),
 12095  				Company:         String("c"),
 12096  				Blog:            String("b"),
 12097  				Location:        String("l"),
 12098  				Email:           String("e"),
 12099  				Hireable:        Bool(true),
 12100  				Bio:             String("b"),
 12101  				TwitterUsername: String("t"),
 12102  				PublicRepos:     Int(1),
 12103  				Followers:       Int(1),
 12104  				Following:       Int(1),
 12105  				CreatedAt:       &Timestamp{referenceTime},
 12106  				SuspendedAt:     &Timestamp{referenceTime},
 12107  			},
 12108  			SuspendedAt: &Timestamp{referenceTime},
 12109  		},
 12110  	}
 12111  
 12112  	want := `{
 12113  		"action": "a",
 12114  		"repositories": [
 12115  			{
 12116  				"id":1,
 12117  				"name":"n",
 12118  				"url":"u"
 12119  			}
 12120  		],
 12121  		"sender": {
 12122  			"login": "l",
 12123  			"id": 1,
 12124  			"node_id": "n",
 12125  			"avatar_url": "a",
 12126  			"url": "u",
 12127  			"events_url": "e",
 12128  			"repos_url": "r"
 12129  		},
 12130  		"installation": {
 12131  			"id": 1,
 12132  			"node_id": "nid",
 12133  			"app_id": 1,
 12134  			"app_slug": "as",
 12135  			"target_id": 1,
 12136  			"account": {
 12137  				"login": "l",
 12138  				"id": 1,
 12139  				"avatar_url": "a",
 12140  				"gravatar_id": "g",
 12141  				"name": "n",
 12142  				"company": "c",
 12143  				"blog": "b",
 12144  				"location": "l",
 12145  				"email": "e",
 12146  				"hireable": true,
 12147  				"bio": "b",
 12148  				"twitter_username": "t",
 12149  				"public_repos": 1,
 12150  				"followers": 1,
 12151  				"following": 1,
 12152  				"created_at": ` + referenceTimeStr + `,
 12153  				"suspended_at": ` + referenceTimeStr + `,
 12154  				"url": "u"
 12155  			},
 12156  			"access_tokens_url": "atu",
 12157  			"repositories_url": "ru",
 12158  			"html_url": "hu",
 12159  			"target_type": "tt",
 12160  			"single_file_name": "sfn",
 12161  			"repository_selection": "rs",
 12162  			"events": [
 12163  				"e"
 12164  			],
 12165  			"single_file_paths": [
 12166  				"s"
 12167  			],
 12168  			"permissions": {
 12169  				"actions": "a",
 12170  				"administration": "ad",
 12171  				"checks": "c",
 12172  				"contents": "co",
 12173  				"content_references": "cr",
 12174  				"deployments": "d",
 12175  				"environments": "e",
 12176  				"issues": "i",
 12177  				"metadata": "md",
 12178  				"members": "m",
 12179  				"organization_administration": "oa",
 12180  				"organization_hooks": "oh",
 12181  				"organization_plan": "op",
 12182  				"organization_pre_receive_hooks": "opr",
 12183  				"organization_projects": "op",
 12184  				"organization_secrets": "os",
 12185  				"organization_self_hosted_runners": "osh",
 12186  				"organization_user_blocking": "oub",
 12187  				"packages": "pkg",
 12188  				"pages": "pg",
 12189  				"pull_requests": "pr",
 12190  				"repository_hooks": "rh",
 12191  				"repository_projects": "rp",
 12192  				"repository_pre_receive_hooks": "rprh",
 12193  				"secrets": "s",
 12194  				"secret_scanning_alerts": "ssa",
 12195  				"security_events": "se",
 12196  				"single_file": "sf",
 12197  				"statuses": "s",
 12198  				"team_discussions": "td",
 12199  				"vulnerability_alerts": "va",
 12200  				"workflows": "w"
 12201  			},
 12202  			"created_at": ` + referenceTimeStr + `,
 12203  			"updated_at": ` + referenceTimeStr + `,
 12204  			"has_multiple_single_files": false,
 12205  			"suspended_by": {
 12206  				"login": "l",
 12207  				"id": 1,
 12208  				"avatar_url": "a",
 12209  				"gravatar_id": "g",
 12210  				"name": "n",
 12211  				"company": "c",
 12212  				"blog": "b",
 12213  				"location": "l",
 12214  				"email": "e",
 12215  				"hireable": true,
 12216  				"bio": "b",
 12217  				"twitter_username": "t",
 12218  				"public_repos": 1,
 12219  				"followers": 1,
 12220  				"following": 1,
 12221  				"created_at": ` + referenceTimeStr + `,
 12222  				"suspended_at": ` + referenceTimeStr + `,
 12223  				"url": "u"
 12224  			},
 12225  			"suspended_at": ` + referenceTimeStr + `
 12226  		}
 12227  	}`
 12228  
 12229  	testJSONMarshal(t, u, want)
 12230  }
 12231  
 12232  func TestHeadCommit_Marshal(t *testing.T) {
 12233  	testJSONMarshal(t, &HeadCommit{}, "{}")
 12234  
 12235  	u := &HeadCommit{
 12236  		Message: String("m"),
 12237  		Author: &CommitAuthor{
 12238  			Date:  &Timestamp{referenceTime},
 12239  			Name:  String("n"),
 12240  			Email: String("e"),
 12241  			Login: String("u"),
 12242  		},
 12243  		URL:       String("u"),
 12244  		Distinct:  Bool(true),
 12245  		SHA:       String("s"),
 12246  		ID:        String("id"),
 12247  		TreeID:    String("tid"),
 12248  		Timestamp: &Timestamp{referenceTime},
 12249  		Committer: &CommitAuthor{
 12250  			Date:  &Timestamp{referenceTime},
 12251  			Name:  String("n"),
 12252  			Email: String("e"),
 12253  			Login: String("u"),
 12254  		},
 12255  		Added:    []string{"a"},
 12256  		Removed:  []string{"r"},
 12257  		Modified: []string{"m"},
 12258  	}
 12259  
 12260  	want := `{
 12261  		"message": "m",
 12262  		"author": {
 12263  			"date": ` + referenceTimeStr + `,
 12264  			"name": "n",
 12265  			"email": "e",
 12266  			"username": "u"
 12267  		},
 12268  		"url": "u",
 12269  		"distinct": true,
 12270  		"sha": "s",
 12271  		"id": "id",
 12272  		"tree_id": "tid",
 12273  		"timestamp": ` + referenceTimeStr + `,
 12274  		"committer": {
 12275  			"date": ` + referenceTimeStr + `,
 12276  			"name": "n",
 12277  			"email": "e",
 12278  			"username": "u"
 12279  		},
 12280  		"added": [
 12281  			"a"
 12282  		],
 12283  		"removed":  [
 12284  			"r"
 12285  		],
 12286  		"modified":  [
 12287  			"m"
 12288  		]
 12289  	}`
 12290  
 12291  	testJSONMarshal(t, u, want)
 12292  }
 12293  
 12294  func TestPushEventRepository_Marshal(t *testing.T) {
 12295  	testJSONMarshal(t, &PushEventRepository{}, "{}")
 12296  
 12297  	u := &PushEventRepository{
 12298  		ID:       Int64(1),
 12299  		NodeID:   String("nid"),
 12300  		Name:     String("n"),
 12301  		FullName: String("fn"),
 12302  		Owner: &User{
 12303  			Login:       String("l"),
 12304  			ID:          Int64(1),
 12305  			AvatarURL:   String("a"),
 12306  			GravatarID:  String("g"),
 12307  			Name:        String("n"),
 12308  			Company:     String("c"),
 12309  			Blog:        String("b"),
 12310  			Location:    String("l"),
 12311  			Email:       String("e"),
 12312  			Hireable:    Bool(true),
 12313  			PublicRepos: Int(1),
 12314  			Followers:   Int(1),
 12315  			Following:   Int(1),
 12316  			CreatedAt:   &Timestamp{referenceTime},
 12317  			URL:         String("u"),
 12318  		},
 12319  		Private:         Bool(true),
 12320  		Description:     String("d"),
 12321  		Fork:            Bool(true),
 12322  		CreatedAt:       &Timestamp{referenceTime},
 12323  		PushedAt:        &Timestamp{referenceTime},
 12324  		UpdatedAt:       &Timestamp{referenceTime},
 12325  		Homepage:        String("h"),
 12326  		PullsURL:        String("p"),
 12327  		Size:            Int(1),
 12328  		StargazersCount: Int(1),
 12329  		WatchersCount:   Int(1),
 12330  		Language:        String("l"),
 12331  		HasIssues:       Bool(true),
 12332  		HasDownloads:    Bool(true),
 12333  		HasWiki:         Bool(true),
 12334  		HasPages:        Bool(true),
 12335  		ForksCount:      Int(1),
 12336  		Archived:        Bool(true),
 12337  		Disabled:        Bool(true),
 12338  		OpenIssuesCount: Int(1),
 12339  		DefaultBranch:   String("d"),
 12340  		MasterBranch:    String("m"),
 12341  		Organization:    String("o"),
 12342  		URL:             String("u"),
 12343  		ArchiveURL:      String("a"),
 12344  		HTMLURL:         String("h"),
 12345  		StatusesURL:     String("s"),
 12346  		GitURL:          String("g"),
 12347  		SSHURL:          String("s"),
 12348  		CloneURL:        String("c"),
 12349  		SVNURL:          String("s"),
 12350  		Topics:          []string{"octocat", "api"},
 12351  	}
 12352  
 12353  	want := `{
 12354  		"id": 1,
 12355  		"node_id": "nid",
 12356  		"name": "n",
 12357  		"full_name": "fn",
 12358  		"owner": {
 12359  			"login": "l",
 12360  			"id": 1,
 12361  			"avatar_url": "a",
 12362  			"gravatar_id": "g",
 12363  			"name": "n",
 12364  			"company": "c",
 12365  			"blog": "b",
 12366  			"location": "l",
 12367  			"email": "e",
 12368  			"hireable": true,
 12369  			"public_repos": 1,
 12370  			"followers": 1,
 12371  			"following": 1,
 12372  			"created_at": ` + referenceTimeStr + `,
 12373  			"url": "u"
 12374  		},
 12375  		"private": true,
 12376  		"description": "d",
 12377  		"fork": true,
 12378  		"created_at": ` + referenceTimeStr + `,
 12379  		"pushed_at": ` + referenceTimeStr + `,
 12380  		"updated_at": ` + referenceTimeStr + `,
 12381  		"homepage": "h",
 12382  		"pulls_url": "p",
 12383  		"size": 1,
 12384  		"stargazers_count": 1,
 12385  		"watchers_count": 1,
 12386  		"language": "l",
 12387  		"has_issues": true,
 12388  		"has_downloads": true,
 12389  		"has_wiki": true,
 12390  		"has_pages": true,
 12391  		"forks_count": 1,
 12392  		"archived": true,
 12393  		"disabled": true,
 12394  		"open_issues_count": 1,
 12395  		"default_branch": "d",
 12396  		"master_branch": "m",
 12397  		"organization": "o",
 12398  		"url": "u",
 12399  		"archive_url": "a",
 12400  		"html_url": "h",
 12401  		"statuses_url": "s",
 12402  		"git_url": "g",
 12403  		"ssh_url": "s",
 12404  		"clone_url": "c",
 12405  		"svn_url": "s",
 12406  		"topics": ["octocat","api"]
 12407      }`
 12408  
 12409  	testJSONMarshal(t, u, want)
 12410  }
 12411  
 12412  func TestPushEventRepoOwner_Marshal(t *testing.T) {
 12413  	testJSONMarshal(t, &PushEventRepoOwner{}, "{}")
 12414  
 12415  	u := &PushEventRepoOwner{
 12416  		Name:  String("n"),
 12417  		Email: String("e"),
 12418  	}
 12419  
 12420  	want := `{
 12421  		"name": "n",
 12422  		"email": "e"
 12423  	}`
 12424  
 12425  	testJSONMarshal(t, u, want)
 12426  }
 12427  
 12428  func TestProjectEvent_Marshal(t *testing.T) {
 12429  	testJSONMarshal(t, &ProjectEvent{}, "{}")
 12430  
 12431  	u := &ProjectEvent{
 12432  		Project: &Project{ID: Int64(1)},
 12433  		Action:  String("a"),
 12434  		Changes: &ProjectChange{
 12435  			Name: &ProjectName{From: String("NameFrom")},
 12436  			Body: &ProjectBody{From: String("BodyFrom")},
 12437  		},
 12438  		Repo: &Repository{
 12439  			ID:   Int64(1),
 12440  			URL:  String("s"),
 12441  			Name: String("n"),
 12442  		},
 12443  		Org: &Organization{
 12444  			BillingEmail:                         String("be"),
 12445  			Blog:                                 String("b"),
 12446  			Company:                              String("c"),
 12447  			Email:                                String("e"),
 12448  			TwitterUsername:                      String("tu"),
 12449  			Location:                             String("loc"),
 12450  			Name:                                 String("n"),
 12451  			Description:                          String("d"),
 12452  			IsVerified:                           Bool(true),
 12453  			HasOrganizationProjects:              Bool(true),
 12454  			HasRepositoryProjects:                Bool(true),
 12455  			DefaultRepoPermission:                String("drp"),
 12456  			MembersCanCreateRepos:                Bool(true),
 12457  			MembersCanCreateInternalRepos:        Bool(true),
 12458  			MembersCanCreatePrivateRepos:         Bool(true),
 12459  			MembersCanCreatePublicRepos:          Bool(false),
 12460  			MembersAllowedRepositoryCreationType: String("marct"),
 12461  			MembersCanCreatePages:                Bool(true),
 12462  			MembersCanCreatePublicPages:          Bool(false),
 12463  			MembersCanCreatePrivatePages:         Bool(true),
 12464  		},
 12465  		Sender: &User{
 12466  			Login:     String("l"),
 12467  			ID:        Int64(1),
 12468  			NodeID:    String("n"),
 12469  			URL:       String("u"),
 12470  			ReposURL:  String("r"),
 12471  			EventsURL: String("e"),
 12472  			AvatarURL: String("a"),
 12473  		},
 12474  		Installation: &Installation{
 12475  			ID:       Int64(1),
 12476  			NodeID:   String("nid"),
 12477  			AppID:    Int64(1),
 12478  			AppSlug:  String("as"),
 12479  			TargetID: Int64(1),
 12480  			Account: &User{
 12481  				Login:           String("l"),
 12482  				ID:              Int64(1),
 12483  				URL:             String("u"),
 12484  				AvatarURL:       String("a"),
 12485  				GravatarID:      String("g"),
 12486  				Name:            String("n"),
 12487  				Company:         String("c"),
 12488  				Blog:            String("b"),
 12489  				Location:        String("l"),
 12490  				Email:           String("e"),
 12491  				Hireable:        Bool(true),
 12492  				Bio:             String("b"),
 12493  				TwitterUsername: String("t"),
 12494  				PublicRepos:     Int(1),
 12495  				Followers:       Int(1),
 12496  				Following:       Int(1),
 12497  				CreatedAt:       &Timestamp{referenceTime},
 12498  				SuspendedAt:     &Timestamp{referenceTime},
 12499  			},
 12500  			AccessTokensURL:     String("atu"),
 12501  			RepositoriesURL:     String("ru"),
 12502  			HTMLURL:             String("hu"),
 12503  			TargetType:          String("tt"),
 12504  			SingleFileName:      String("sfn"),
 12505  			RepositorySelection: String("rs"),
 12506  			Events:              []string{"e"},
 12507  			SingleFilePaths:     []string{"s"},
 12508  			Permissions: &InstallationPermissions{
 12509  				Actions:                       String("a"),
 12510  				Administration:                String("ad"),
 12511  				Checks:                        String("c"),
 12512  				Contents:                      String("co"),
 12513  				ContentReferences:             String("cr"),
 12514  				Deployments:                   String("d"),
 12515  				Environments:                  String("e"),
 12516  				Issues:                        String("i"),
 12517  				Metadata:                      String("md"),
 12518  				Members:                       String("m"),
 12519  				OrganizationAdministration:    String("oa"),
 12520  				OrganizationHooks:             String("oh"),
 12521  				OrganizationPlan:              String("op"),
 12522  				OrganizationPreReceiveHooks:   String("opr"),
 12523  				OrganizationProjects:          String("op"),
 12524  				OrganizationSecrets:           String("os"),
 12525  				OrganizationSelfHostedRunners: String("osh"),
 12526  				OrganizationUserBlocking:      String("oub"),
 12527  				Packages:                      String("pkg"),
 12528  				Pages:                         String("pg"),
 12529  				PullRequests:                  String("pr"),
 12530  				RepositoryHooks:               String("rh"),
 12531  				RepositoryProjects:            String("rp"),
 12532  				RepositoryPreReceiveHooks:     String("rprh"),
 12533  				Secrets:                       String("s"),
 12534  				SecretScanningAlerts:          String("ssa"),
 12535  				SecurityEvents:                String("se"),
 12536  				SingleFile:                    String("sf"),
 12537  				Statuses:                      String("s"),
 12538  				TeamDiscussions:               String("td"),
 12539  				VulnerabilityAlerts:           String("va"),
 12540  				Workflows:                     String("w"),
 12541  			},
 12542  			CreatedAt:              &Timestamp{referenceTime},
 12543  			UpdatedAt:              &Timestamp{referenceTime},
 12544  			HasMultipleSingleFiles: Bool(false),
 12545  			SuspendedBy: &User{
 12546  				Login:           String("l"),
 12547  				ID:              Int64(1),
 12548  				URL:             String("u"),
 12549  				AvatarURL:       String("a"),
 12550  				GravatarID:      String("g"),
 12551  				Name:            String("n"),
 12552  				Company:         String("c"),
 12553  				Blog:            String("b"),
 12554  				Location:        String("l"),
 12555  				Email:           String("e"),
 12556  				Hireable:        Bool(true),
 12557  				Bio:             String("b"),
 12558  				TwitterUsername: String("t"),
 12559  				PublicRepos:     Int(1),
 12560  				Followers:       Int(1),
 12561  				Following:       Int(1),
 12562  				CreatedAt:       &Timestamp{referenceTime},
 12563  				SuspendedAt:     &Timestamp{referenceTime},
 12564  			},
 12565  			SuspendedAt: &Timestamp{referenceTime},
 12566  		},
 12567  	}
 12568  
 12569  	want := `{
 12570  		"action": "a",
 12571  		"changes": {
 12572  			"name": {
 12573  				"from": "NameFrom"
 12574  			},
 12575  			"body": {
 12576  				"from": "BodyFrom"
 12577  			}
 12578  		},
 12579  		"project": {
 12580  			"id": 1
 12581  		},
 12582  		"repository": {
 12583  			"id": 1,
 12584  			"name": "n",
 12585  			"url": "s"
 12586  		},
 12587  		"organization": {
 12588  			"name": "n",
 12589  			"company": "c",
 12590  			"blog": "b",
 12591  			"location": "loc",
 12592  			"email": "e",
 12593  			"twitter_username": "tu",
 12594  			"description": "d",
 12595  			"billing_email": "be",
 12596  			"is_verified": true,
 12597  			"has_organization_projects": true,
 12598  			"has_repository_projects": true,
 12599  			"default_repository_permission": "drp",
 12600  			"members_can_create_repositories": true,
 12601  			"members_can_create_public_repositories": false,
 12602  			"members_can_create_private_repositories": true,
 12603  			"members_can_create_internal_repositories": true,
 12604  			"members_allowed_repository_creation_type": "marct",
 12605  			"members_can_create_pages": true,
 12606  			"members_can_create_public_pages": false,
 12607  			"members_can_create_private_pages": true
 12608  		},
 12609  		"sender": {
 12610  			"login": "l",
 12611  			"id": 1,
 12612  			"node_id": "n",
 12613  			"avatar_url": "a",
 12614  			"url": "u",
 12615  			"events_url": "e",
 12616  			"repos_url": "r"
 12617  		},
 12618  		"installation": {
 12619  			"id": 1,
 12620  			"node_id": "nid",
 12621  			"app_id": 1,
 12622  			"app_slug": "as",
 12623  			"target_id": 1,
 12624  			"account": {
 12625  				"login": "l",
 12626  				"id": 1,
 12627  				"avatar_url": "a",
 12628  				"gravatar_id": "g",
 12629  				"name": "n",
 12630  				"company": "c",
 12631  				"blog": "b",
 12632  				"location": "l",
 12633  				"email": "e",
 12634  				"hireable": true,
 12635  				"bio": "b",
 12636  				"twitter_username": "t",
 12637  				"public_repos": 1,
 12638  				"followers": 1,
 12639  				"following": 1,
 12640  				"created_at": ` + referenceTimeStr + `,
 12641  				"suspended_at": ` + referenceTimeStr + `,
 12642  				"url": "u"
 12643  			},
 12644  			"access_tokens_url": "atu",
 12645  			"repositories_url": "ru",
 12646  			"html_url": "hu",
 12647  			"target_type": "tt",
 12648  			"single_file_name": "sfn",
 12649  			"repository_selection": "rs",
 12650  			"events": [
 12651  				"e"
 12652  			],
 12653  			"single_file_paths": [
 12654  				"s"
 12655  			],
 12656  			"permissions": {
 12657  				"actions": "a",
 12658  				"administration": "ad",
 12659  				"checks": "c",
 12660  				"contents": "co",
 12661  				"content_references": "cr",
 12662  				"deployments": "d",
 12663  				"environments": "e",
 12664  				"issues": "i",
 12665  				"metadata": "md",
 12666  				"members": "m",
 12667  				"organization_administration": "oa",
 12668  				"organization_hooks": "oh",
 12669  				"organization_plan": "op",
 12670  				"organization_pre_receive_hooks": "opr",
 12671  				"organization_projects": "op",
 12672  				"organization_secrets": "os",
 12673  				"organization_self_hosted_runners": "osh",
 12674  				"organization_user_blocking": "oub",
 12675  				"packages": "pkg",
 12676  				"pages": "pg",
 12677  				"pull_requests": "pr",
 12678  				"repository_hooks": "rh",
 12679  				"repository_projects": "rp",
 12680  				"repository_pre_receive_hooks": "rprh",
 12681  				"secrets": "s",
 12682  				"secret_scanning_alerts": "ssa",
 12683  				"security_events": "se",
 12684  				"single_file": "sf",
 12685  				"statuses": "s",
 12686  				"team_discussions": "td",
 12687  				"vulnerability_alerts": "va",
 12688  				"workflows": "w"
 12689  			},
 12690  			"created_at": ` + referenceTimeStr + `,
 12691  			"updated_at": ` + referenceTimeStr + `,
 12692  			"has_multiple_single_files": false,
 12693  			"suspended_by": {
 12694  				"login": "l",
 12695  				"id": 1,
 12696  				"avatar_url": "a",
 12697  				"gravatar_id": "g",
 12698  				"name": "n",
 12699  				"company": "c",
 12700  				"blog": "b",
 12701  				"location": "l",
 12702  				"email": "e",
 12703  				"hireable": true,
 12704  				"bio": "b",
 12705  				"twitter_username": "t",
 12706  				"public_repos": 1,
 12707  				"followers": 1,
 12708  				"following": 1,
 12709  				"created_at": ` + referenceTimeStr + `,
 12710  				"suspended_at": ` + referenceTimeStr + `,
 12711  				"url": "u"
 12712  			},
 12713  			"suspended_at": ` + referenceTimeStr + `
 12714  		}
 12715  	}`
 12716  
 12717  	testJSONMarshal(t, u, want)
 12718  }
 12719  
 12720  func TestProjectCardEvent_Marshal(t *testing.T) {
 12721  	testJSONMarshal(t, &ProjectCardEvent{}, "{}")
 12722  
 12723  	u := &ProjectCardEvent{
 12724  		Action: String("a"),
 12725  		Changes: &ProjectCardChange{
 12726  			Note: &ProjectCardNote{From: String("NoteFrom")},
 12727  		},
 12728  		AfterID:     Int64(1),
 12729  		ProjectCard: &ProjectCard{ID: Int64(1)},
 12730  		Repo: &Repository{
 12731  			ID:   Int64(1),
 12732  			URL:  String("s"),
 12733  			Name: String("n"),
 12734  		},
 12735  		Org: &Organization{
 12736  			BillingEmail:                         String("be"),
 12737  			Blog:                                 String("b"),
 12738  			Company:                              String("c"),
 12739  			Email:                                String("e"),
 12740  			TwitterUsername:                      String("tu"),
 12741  			Location:                             String("loc"),
 12742  			Name:                                 String("n"),
 12743  			Description:                          String("d"),
 12744  			IsVerified:                           Bool(true),
 12745  			HasOrganizationProjects:              Bool(true),
 12746  			HasRepositoryProjects:                Bool(true),
 12747  			DefaultRepoPermission:                String("drp"),
 12748  			MembersCanCreateRepos:                Bool(true),
 12749  			MembersCanCreateInternalRepos:        Bool(true),
 12750  			MembersCanCreatePrivateRepos:         Bool(true),
 12751  			MembersCanCreatePublicRepos:          Bool(false),
 12752  			MembersAllowedRepositoryCreationType: String("marct"),
 12753  			MembersCanCreatePages:                Bool(true),
 12754  			MembersCanCreatePublicPages:          Bool(false),
 12755  			MembersCanCreatePrivatePages:         Bool(true),
 12756  		},
 12757  		Sender: &User{
 12758  			Login:     String("l"),
 12759  			ID:        Int64(1),
 12760  			NodeID:    String("n"),
 12761  			URL:       String("u"),
 12762  			ReposURL:  String("r"),
 12763  			EventsURL: String("e"),
 12764  			AvatarURL: String("a"),
 12765  		},
 12766  		Installation: &Installation{
 12767  			ID:       Int64(1),
 12768  			NodeID:   String("nid"),
 12769  			AppID:    Int64(1),
 12770  			AppSlug:  String("as"),
 12771  			TargetID: Int64(1),
 12772  			Account: &User{
 12773  				Login:           String("l"),
 12774  				ID:              Int64(1),
 12775  				URL:             String("u"),
 12776  				AvatarURL:       String("a"),
 12777  				GravatarID:      String("g"),
 12778  				Name:            String("n"),
 12779  				Company:         String("c"),
 12780  				Blog:            String("b"),
 12781  				Location:        String("l"),
 12782  				Email:           String("e"),
 12783  				Hireable:        Bool(true),
 12784  				Bio:             String("b"),
 12785  				TwitterUsername: String("t"),
 12786  				PublicRepos:     Int(1),
 12787  				Followers:       Int(1),
 12788  				Following:       Int(1),
 12789  				CreatedAt:       &Timestamp{referenceTime},
 12790  				SuspendedAt:     &Timestamp{referenceTime},
 12791  			},
 12792  			AccessTokensURL:     String("atu"),
 12793  			RepositoriesURL:     String("ru"),
 12794  			HTMLURL:             String("hu"),
 12795  			TargetType:          String("tt"),
 12796  			SingleFileName:      String("sfn"),
 12797  			RepositorySelection: String("rs"),
 12798  			Events:              []string{"e"},
 12799  			SingleFilePaths:     []string{"s"},
 12800  			Permissions: &InstallationPermissions{
 12801  				Actions:                       String("a"),
 12802  				Administration:                String("ad"),
 12803  				Checks:                        String("c"),
 12804  				Contents:                      String("co"),
 12805  				ContentReferences:             String("cr"),
 12806  				Deployments:                   String("d"),
 12807  				Environments:                  String("e"),
 12808  				Issues:                        String("i"),
 12809  				Metadata:                      String("md"),
 12810  				Members:                       String("m"),
 12811  				OrganizationAdministration:    String("oa"),
 12812  				OrganizationHooks:             String("oh"),
 12813  				OrganizationPlan:              String("op"),
 12814  				OrganizationPreReceiveHooks:   String("opr"),
 12815  				OrganizationProjects:          String("op"),
 12816  				OrganizationSecrets:           String("os"),
 12817  				OrganizationSelfHostedRunners: String("osh"),
 12818  				OrganizationUserBlocking:      String("oub"),
 12819  				Packages:                      String("pkg"),
 12820  				Pages:                         String("pg"),
 12821  				PullRequests:                  String("pr"),
 12822  				RepositoryHooks:               String("rh"),
 12823  				RepositoryProjects:            String("rp"),
 12824  				RepositoryPreReceiveHooks:     String("rprh"),
 12825  				Secrets:                       String("s"),
 12826  				SecretScanningAlerts:          String("ssa"),
 12827  				SecurityEvents:                String("se"),
 12828  				SingleFile:                    String("sf"),
 12829  				Statuses:                      String("s"),
 12830  				TeamDiscussions:               String("td"),
 12831  				VulnerabilityAlerts:           String("va"),
 12832  				Workflows:                     String("w"),
 12833  			},
 12834  			CreatedAt:              &Timestamp{referenceTime},
 12835  			UpdatedAt:              &Timestamp{referenceTime},
 12836  			HasMultipleSingleFiles: Bool(false),
 12837  			SuspendedBy: &User{
 12838  				Login:           String("l"),
 12839  				ID:              Int64(1),
 12840  				URL:             String("u"),
 12841  				AvatarURL:       String("a"),
 12842  				GravatarID:      String("g"),
 12843  				Name:            String("n"),
 12844  				Company:         String("c"),
 12845  				Blog:            String("b"),
 12846  				Location:        String("l"),
 12847  				Email:           String("e"),
 12848  				Hireable:        Bool(true),
 12849  				Bio:             String("b"),
 12850  				TwitterUsername: String("t"),
 12851  				PublicRepos:     Int(1),
 12852  				Followers:       Int(1),
 12853  				Following:       Int(1),
 12854  				CreatedAt:       &Timestamp{referenceTime},
 12855  				SuspendedAt:     &Timestamp{referenceTime},
 12856  			},
 12857  			SuspendedAt: &Timestamp{referenceTime},
 12858  		},
 12859  	}
 12860  
 12861  	want := `{
 12862  		"action": "a",
 12863  		"changes": {
 12864  			"note": {
 12865  				"from": "NoteFrom"
 12866  			}
 12867  		},
 12868  		"after_id": 1,
 12869  		"project_card": {
 12870  			"id": 1
 12871  		},
 12872  		"repository": {
 12873  			"id": 1,
 12874  			"name": "n",
 12875  			"url": "s"
 12876  		},
 12877  		"organization": {
 12878  			"name": "n",
 12879  			"company": "c",
 12880  			"blog": "b",
 12881  			"location": "loc",
 12882  			"email": "e",
 12883  			"twitter_username": "tu",
 12884  			"description": "d",
 12885  			"billing_email": "be",
 12886  			"is_verified": true,
 12887  			"has_organization_projects": true,
 12888  			"has_repository_projects": true,
 12889  			"default_repository_permission": "drp",
 12890  			"members_can_create_repositories": true,
 12891  			"members_can_create_public_repositories": false,
 12892  			"members_can_create_private_repositories": true,
 12893  			"members_can_create_internal_repositories": true,
 12894  			"members_allowed_repository_creation_type": "marct",
 12895  			"members_can_create_pages": true,
 12896  			"members_can_create_public_pages": false,
 12897  			"members_can_create_private_pages": true
 12898  		},
 12899  		"sender": {
 12900  			"login": "l",
 12901  			"id": 1,
 12902  			"node_id": "n",
 12903  			"avatar_url": "a",
 12904  			"url": "u",
 12905  			"events_url": "e",
 12906  			"repos_url": "r"
 12907  		},
 12908  		"installation": {
 12909  			"id": 1,
 12910  			"node_id": "nid",
 12911  			"app_id": 1,
 12912  			"app_slug": "as",
 12913  			"target_id": 1,
 12914  			"account": {
 12915  				"login": "l",
 12916  				"id": 1,
 12917  				"avatar_url": "a",
 12918  				"gravatar_id": "g",
 12919  				"name": "n",
 12920  				"company": "c",
 12921  				"blog": "b",
 12922  				"location": "l",
 12923  				"email": "e",
 12924  				"hireable": true,
 12925  				"bio": "b",
 12926  				"twitter_username": "t",
 12927  				"public_repos": 1,
 12928  				"followers": 1,
 12929  				"following": 1,
 12930  				"created_at": ` + referenceTimeStr + `,
 12931  				"suspended_at": ` + referenceTimeStr + `,
 12932  				"url": "u"
 12933  			},
 12934  			"access_tokens_url": "atu",
 12935  			"repositories_url": "ru",
 12936  			"html_url": "hu",
 12937  			"target_type": "tt",
 12938  			"single_file_name": "sfn",
 12939  			"repository_selection": "rs",
 12940  			"events": [
 12941  				"e"
 12942  			],
 12943  			"single_file_paths": [
 12944  				"s"
 12945  			],
 12946  			"permissions": {
 12947  				"actions": "a",
 12948  				"administration": "ad",
 12949  				"checks": "c",
 12950  				"contents": "co",
 12951  				"content_references": "cr",
 12952  				"deployments": "d",
 12953  				"environments": "e",
 12954  				"issues": "i",
 12955  				"metadata": "md",
 12956  				"members": "m",
 12957  				"organization_administration": "oa",
 12958  				"organization_hooks": "oh",
 12959  				"organization_plan": "op",
 12960  				"organization_pre_receive_hooks": "opr",
 12961  				"organization_projects": "op",
 12962  				"organization_secrets": "os",
 12963  				"organization_self_hosted_runners": "osh",
 12964  				"organization_user_blocking": "oub",
 12965  				"packages": "pkg",
 12966  				"pages": "pg",
 12967  				"pull_requests": "pr",
 12968  				"repository_hooks": "rh",
 12969  				"repository_projects": "rp",
 12970  				"repository_pre_receive_hooks": "rprh",
 12971  				"secrets": "s",
 12972  				"secret_scanning_alerts": "ssa",
 12973  				"security_events": "se",
 12974  				"single_file": "sf",
 12975  				"statuses": "s",
 12976  				"team_discussions": "td",
 12977  				"vulnerability_alerts": "va",
 12978  				"workflows": "w"
 12979  			},
 12980  			"created_at": ` + referenceTimeStr + `,
 12981  			"updated_at": ` + referenceTimeStr + `,
 12982  			"has_multiple_single_files": false,
 12983  			"suspended_by": {
 12984  				"login": "l",
 12985  				"id": 1,
 12986  				"avatar_url": "a",
 12987  				"gravatar_id": "g",
 12988  				"name": "n",
 12989  				"company": "c",
 12990  				"blog": "b",
 12991  				"location": "l",
 12992  				"email": "e",
 12993  				"hireable": true,
 12994  				"bio": "b",
 12995  				"twitter_username": "t",
 12996  				"public_repos": 1,
 12997  				"followers": 1,
 12998  				"following": 1,
 12999  				"created_at": ` + referenceTimeStr + `,
 13000  				"suspended_at": ` + referenceTimeStr + `,
 13001  				"url": "u"
 13002  			},
 13003  			"suspended_at": ` + referenceTimeStr + `
 13004  		}
 13005  	}`
 13006  
 13007  	testJSONMarshal(t, u, want)
 13008  }
 13009  
 13010  func TestProjectColumnEvent_Marshal(t *testing.T) {
 13011  	testJSONMarshal(t, &ProjectColumnEvent{}, "{}")
 13012  
 13013  	u := &ProjectColumnEvent{
 13014  		Action: String("a"),
 13015  		Changes: &ProjectColumnChange{
 13016  			Name: &ProjectColumnName{From: String("NameFrom")},
 13017  		},
 13018  		AfterID:       Int64(1),
 13019  		ProjectColumn: &ProjectColumn{ID: Int64(1)},
 13020  		Repo: &Repository{
 13021  			ID:   Int64(1),
 13022  			URL:  String("s"),
 13023  			Name: String("n"),
 13024  		},
 13025  		Org: &Organization{
 13026  			BillingEmail:                         String("be"),
 13027  			Blog:                                 String("b"),
 13028  			Company:                              String("c"),
 13029  			Email:                                String("e"),
 13030  			TwitterUsername:                      String("tu"),
 13031  			Location:                             String("loc"),
 13032  			Name:                                 String("n"),
 13033  			Description:                          String("d"),
 13034  			IsVerified:                           Bool(true),
 13035  			HasOrganizationProjects:              Bool(true),
 13036  			HasRepositoryProjects:                Bool(true),
 13037  			DefaultRepoPermission:                String("drp"),
 13038  			MembersCanCreateRepos:                Bool(true),
 13039  			MembersCanCreateInternalRepos:        Bool(true),
 13040  			MembersCanCreatePrivateRepos:         Bool(true),
 13041  			MembersCanCreatePublicRepos:          Bool(false),
 13042  			MembersAllowedRepositoryCreationType: String("marct"),
 13043  			MembersCanCreatePages:                Bool(true),
 13044  			MembersCanCreatePublicPages:          Bool(false),
 13045  			MembersCanCreatePrivatePages:         Bool(true),
 13046  		},
 13047  		Sender: &User{
 13048  			Login:     String("l"),
 13049  			ID:        Int64(1),
 13050  			NodeID:    String("n"),
 13051  			URL:       String("u"),
 13052  			ReposURL:  String("r"),
 13053  			EventsURL: String("e"),
 13054  			AvatarURL: String("a"),
 13055  		},
 13056  		Installation: &Installation{
 13057  			ID:       Int64(1),
 13058  			NodeID:   String("nid"),
 13059  			AppID:    Int64(1),
 13060  			AppSlug:  String("as"),
 13061  			TargetID: Int64(1),
 13062  			Account: &User{
 13063  				Login:           String("l"),
 13064  				ID:              Int64(1),
 13065  				URL:             String("u"),
 13066  				AvatarURL:       String("a"),
 13067  				GravatarID:      String("g"),
 13068  				Name:            String("n"),
 13069  				Company:         String("c"),
 13070  				Blog:            String("b"),
 13071  				Location:        String("l"),
 13072  				Email:           String("e"),
 13073  				Hireable:        Bool(true),
 13074  				Bio:             String("b"),
 13075  				TwitterUsername: String("t"),
 13076  				PublicRepos:     Int(1),
 13077  				Followers:       Int(1),
 13078  				Following:       Int(1),
 13079  				CreatedAt:       &Timestamp{referenceTime},
 13080  				SuspendedAt:     &Timestamp{referenceTime},
 13081  			},
 13082  			AccessTokensURL:     String("atu"),
 13083  			RepositoriesURL:     String("ru"),
 13084  			HTMLURL:             String("hu"),
 13085  			TargetType:          String("tt"),
 13086  			SingleFileName:      String("sfn"),
 13087  			RepositorySelection: String("rs"),
 13088  			Events:              []string{"e"},
 13089  			SingleFilePaths:     []string{"s"},
 13090  			Permissions: &InstallationPermissions{
 13091  				Actions:                       String("a"),
 13092  				Administration:                String("ad"),
 13093  				Checks:                        String("c"),
 13094  				Contents:                      String("co"),
 13095  				ContentReferences:             String("cr"),
 13096  				Deployments:                   String("d"),
 13097  				Environments:                  String("e"),
 13098  				Issues:                        String("i"),
 13099  				Metadata:                      String("md"),
 13100  				Members:                       String("m"),
 13101  				OrganizationAdministration:    String("oa"),
 13102  				OrganizationHooks:             String("oh"),
 13103  				OrganizationPlan:              String("op"),
 13104  				OrganizationPreReceiveHooks:   String("opr"),
 13105  				OrganizationProjects:          String("op"),
 13106  				OrganizationSecrets:           String("os"),
 13107  				OrganizationSelfHostedRunners: String("osh"),
 13108  				OrganizationUserBlocking:      String("oub"),
 13109  				Packages:                      String("pkg"),
 13110  				Pages:                         String("pg"),
 13111  				PullRequests:                  String("pr"),
 13112  				RepositoryHooks:               String("rh"),
 13113  				RepositoryProjects:            String("rp"),
 13114  				RepositoryPreReceiveHooks:     String("rprh"),
 13115  				Secrets:                       String("s"),
 13116  				SecretScanningAlerts:          String("ssa"),
 13117  				SecurityEvents:                String("se"),
 13118  				SingleFile:                    String("sf"),
 13119  				Statuses:                      String("s"),
 13120  				TeamDiscussions:               String("td"),
 13121  				VulnerabilityAlerts:           String("va"),
 13122  				Workflows:                     String("w"),
 13123  			},
 13124  			CreatedAt:              &Timestamp{referenceTime},
 13125  			UpdatedAt:              &Timestamp{referenceTime},
 13126  			HasMultipleSingleFiles: Bool(false),
 13127  			SuspendedBy: &User{
 13128  				Login:           String("l"),
 13129  				ID:              Int64(1),
 13130  				URL:             String("u"),
 13131  				AvatarURL:       String("a"),
 13132  				GravatarID:      String("g"),
 13133  				Name:            String("n"),
 13134  				Company:         String("c"),
 13135  				Blog:            String("b"),
 13136  				Location:        String("l"),
 13137  				Email:           String("e"),
 13138  				Hireable:        Bool(true),
 13139  				Bio:             String("b"),
 13140  				TwitterUsername: String("t"),
 13141  				PublicRepos:     Int(1),
 13142  				Followers:       Int(1),
 13143  				Following:       Int(1),
 13144  				CreatedAt:       &Timestamp{referenceTime},
 13145  				SuspendedAt:     &Timestamp{referenceTime},
 13146  			},
 13147  			SuspendedAt: &Timestamp{referenceTime},
 13148  		},
 13149  	}
 13150  
 13151  	want := `{
 13152  		"action": "a",
 13153  		"changes": {
 13154  			"name": {
 13155  				"from": "NameFrom"
 13156  			}
 13157  		},
 13158  		"after_id": 1,
 13159  		"project_column": {
 13160  			"id": 1
 13161  		},
 13162  		"repository": {
 13163  			"id": 1,
 13164  			"name": "n",
 13165  			"url": "s"
 13166  		},
 13167  		"organization": {
 13168  			"name": "n",
 13169  			"company": "c",
 13170  			"blog": "b",
 13171  			"location": "loc",
 13172  			"email": "e",
 13173  			"twitter_username": "tu",
 13174  			"description": "d",
 13175  			"billing_email": "be",
 13176  			"is_verified": true,
 13177  			"has_organization_projects": true,
 13178  			"has_repository_projects": true,
 13179  			"default_repository_permission": "drp",
 13180  			"members_can_create_repositories": true,
 13181  			"members_can_create_public_repositories": false,
 13182  			"members_can_create_private_repositories": true,
 13183  			"members_can_create_internal_repositories": true,
 13184  			"members_allowed_repository_creation_type": "marct",
 13185  			"members_can_create_pages": true,
 13186  			"members_can_create_public_pages": false,
 13187  			"members_can_create_private_pages": true
 13188  		},
 13189  		"sender": {
 13190  			"login": "l",
 13191  			"id": 1,
 13192  			"node_id": "n",
 13193  			"avatar_url": "a",
 13194  			"url": "u",
 13195  			"events_url": "e",
 13196  			"repos_url": "r"
 13197  		},
 13198  		"installation": {
 13199  			"id": 1,
 13200  			"node_id": "nid",
 13201  			"app_id": 1,
 13202  			"app_slug": "as",
 13203  			"target_id": 1,
 13204  			"account": {
 13205  				"login": "l",
 13206  				"id": 1,
 13207  				"avatar_url": "a",
 13208  				"gravatar_id": "g",
 13209  				"name": "n",
 13210  				"company": "c",
 13211  				"blog": "b",
 13212  				"location": "l",
 13213  				"email": "e",
 13214  				"hireable": true,
 13215  				"bio": "b",
 13216  				"twitter_username": "t",
 13217  				"public_repos": 1,
 13218  				"followers": 1,
 13219  				"following": 1,
 13220  				"created_at": ` + referenceTimeStr + `,
 13221  				"suspended_at": ` + referenceTimeStr + `,
 13222  				"url": "u"
 13223  			},
 13224  			"access_tokens_url": "atu",
 13225  			"repositories_url": "ru",
 13226  			"html_url": "hu",
 13227  			"target_type": "tt",
 13228  			"single_file_name": "sfn",
 13229  			"repository_selection": "rs",
 13230  			"events": [
 13231  				"e"
 13232  			],
 13233  			"single_file_paths": [
 13234  				"s"
 13235  			],
 13236  			"permissions": {
 13237  				"actions": "a",
 13238  				"administration": "ad",
 13239  				"checks": "c",
 13240  				"contents": "co",
 13241  				"content_references": "cr",
 13242  				"deployments": "d",
 13243  				"environments": "e",
 13244  				"issues": "i",
 13245  				"metadata": "md",
 13246  				"members": "m",
 13247  				"organization_administration": "oa",
 13248  				"organization_hooks": "oh",
 13249  				"organization_plan": "op",
 13250  				"organization_pre_receive_hooks": "opr",
 13251  				"organization_projects": "op",
 13252  				"organization_secrets": "os",
 13253  				"organization_self_hosted_runners": "osh",
 13254  				"organization_user_blocking": "oub",
 13255  				"packages": "pkg",
 13256  				"pages": "pg",
 13257  				"pull_requests": "pr",
 13258  				"repository_hooks": "rh",
 13259  				"repository_projects": "rp",
 13260  				"repository_pre_receive_hooks": "rprh",
 13261  				"secrets": "s",
 13262  				"secret_scanning_alerts": "ssa",
 13263  				"security_events": "se",
 13264  				"single_file": "sf",
 13265  				"statuses": "s",
 13266  				"team_discussions": "td",
 13267  				"vulnerability_alerts": "va",
 13268  				"workflows": "w"
 13269  			},
 13270  			"created_at": ` + referenceTimeStr + `,
 13271  			"updated_at": ` + referenceTimeStr + `,
 13272  			"has_multiple_single_files": false,
 13273  			"suspended_by": {
 13274  				"login": "l",
 13275  				"id": 1,
 13276  				"avatar_url": "a",
 13277  				"gravatar_id": "g",
 13278  				"name": "n",
 13279  				"company": "c",
 13280  				"blog": "b",
 13281  				"location": "l",
 13282  				"email": "e",
 13283  				"hireable": true,
 13284  				"bio": "b",
 13285  				"twitter_username": "t",
 13286  				"public_repos": 1,
 13287  				"followers": 1,
 13288  				"following": 1,
 13289  				"created_at": ` + referenceTimeStr + `,
 13290  				"suspended_at": ` + referenceTimeStr + `,
 13291  				"url": "u"
 13292  			},
 13293  			"suspended_at": ` + referenceTimeStr + `
 13294  		}
 13295  	}`
 13296  
 13297  	testJSONMarshal(t, u, want)
 13298  }
 13299  
 13300  func TestPullRequestEvent_Marshal(t *testing.T) {
 13301  	testJSONMarshal(t, &PullRequestEvent{}, "{}")
 13302  
 13303  	u := &PullRequestEvent{
 13304  		Action: String("a"),
 13305  		Assignee: &User{
 13306  			Login:     String("l"),
 13307  			ID:        Int64(1),
 13308  			NodeID:    String("n"),
 13309  			URL:       String("u"),
 13310  			ReposURL:  String("r"),
 13311  			EventsURL: String("e"),
 13312  			AvatarURL: String("a"),
 13313  		},
 13314  		Number:      Int(1),
 13315  		PullRequest: &PullRequest{ID: Int64(1)},
 13316  		Changes: &EditChange{
 13317  			Title: &EditTitle{
 13318  				From: String("TitleFrom"),
 13319  			},
 13320  			Body: &EditBody{
 13321  				From: String("BodyFrom"),
 13322  			},
 13323  			Base: &EditBase{
 13324  				Ref: &EditRef{
 13325  					From: String("BaseRefFrom"),
 13326  				},
 13327  				SHA: &EditSHA{
 13328  					From: String("BaseSHAFrom"),
 13329  				},
 13330  			},
 13331  		},
 13332  		RequestedReviewer: &User{
 13333  			Login:     String("l"),
 13334  			ID:        Int64(1),
 13335  			NodeID:    String("n"),
 13336  			URL:       String("u"),
 13337  			ReposURL:  String("r"),
 13338  			EventsURL: String("e"),
 13339  			AvatarURL: String("a"),
 13340  		},
 13341  		RequestedTeam: &Team{ID: Int64(1)},
 13342  		Label:         &Label{ID: Int64(1)},
 13343  		Before:        String("before"),
 13344  		After:         String("after"),
 13345  		Repo: &Repository{
 13346  			ID:   Int64(1),
 13347  			URL:  String("s"),
 13348  			Name: String("n"),
 13349  		},
 13350  		Organization: &Organization{
 13351  			BillingEmail:                         String("be"),
 13352  			Blog:                                 String("b"),
 13353  			Company:                              String("c"),
 13354  			Email:                                String("e"),
 13355  			TwitterUsername:                      String("tu"),
 13356  			Location:                             String("loc"),
 13357  			Name:                                 String("n"),
 13358  			Description:                          String("d"),
 13359  			IsVerified:                           Bool(true),
 13360  			HasOrganizationProjects:              Bool(true),
 13361  			HasRepositoryProjects:                Bool(true),
 13362  			DefaultRepoPermission:                String("drp"),
 13363  			MembersCanCreateRepos:                Bool(true),
 13364  			MembersCanCreateInternalRepos:        Bool(true),
 13365  			MembersCanCreatePrivateRepos:         Bool(true),
 13366  			MembersCanCreatePublicRepos:          Bool(false),
 13367  			MembersAllowedRepositoryCreationType: String("marct"),
 13368  			MembersCanCreatePages:                Bool(true),
 13369  			MembersCanCreatePublicPages:          Bool(false),
 13370  			MembersCanCreatePrivatePages:         Bool(true),
 13371  		},
 13372  		Sender: &User{
 13373  			Login:     String("l"),
 13374  			ID:        Int64(1),
 13375  			NodeID:    String("n"),
 13376  			URL:       String("u"),
 13377  			ReposURL:  String("r"),
 13378  			EventsURL: String("e"),
 13379  			AvatarURL: String("a"),
 13380  		},
 13381  		Installation: &Installation{
 13382  			ID:       Int64(1),
 13383  			NodeID:   String("nid"),
 13384  			AppID:    Int64(1),
 13385  			AppSlug:  String("as"),
 13386  			TargetID: Int64(1),
 13387  			Account: &User{
 13388  				Login:           String("l"),
 13389  				ID:              Int64(1),
 13390  				URL:             String("u"),
 13391  				AvatarURL:       String("a"),
 13392  				GravatarID:      String("g"),
 13393  				Name:            String("n"),
 13394  				Company:         String("c"),
 13395  				Blog:            String("b"),
 13396  				Location:        String("l"),
 13397  				Email:           String("e"),
 13398  				Hireable:        Bool(true),
 13399  				Bio:             String("b"),
 13400  				TwitterUsername: String("t"),
 13401  				PublicRepos:     Int(1),
 13402  				Followers:       Int(1),
 13403  				Following:       Int(1),
 13404  				CreatedAt:       &Timestamp{referenceTime},
 13405  				SuspendedAt:     &Timestamp{referenceTime},
 13406  			},
 13407  			AccessTokensURL:     String("atu"),
 13408  			RepositoriesURL:     String("ru"),
 13409  			HTMLURL:             String("hu"),
 13410  			TargetType:          String("tt"),
 13411  			SingleFileName:      String("sfn"),
 13412  			RepositorySelection: String("rs"),
 13413  			Events:              []string{"e"},
 13414  			SingleFilePaths:     []string{"s"},
 13415  			Permissions: &InstallationPermissions{
 13416  				Actions:                       String("a"),
 13417  				Administration:                String("ad"),
 13418  				Checks:                        String("c"),
 13419  				Contents:                      String("co"),
 13420  				ContentReferences:             String("cr"),
 13421  				Deployments:                   String("d"),
 13422  				Environments:                  String("e"),
 13423  				Issues:                        String("i"),
 13424  				Metadata:                      String("md"),
 13425  				Members:                       String("m"),
 13426  				OrganizationAdministration:    String("oa"),
 13427  				OrganizationHooks:             String("oh"),
 13428  				OrganizationPlan:              String("op"),
 13429  				OrganizationPreReceiveHooks:   String("opr"),
 13430  				OrganizationProjects:          String("op"),
 13431  				OrganizationSecrets:           String("os"),
 13432  				OrganizationSelfHostedRunners: String("osh"),
 13433  				OrganizationUserBlocking:      String("oub"),
 13434  				Packages:                      String("pkg"),
 13435  				Pages:                         String("pg"),
 13436  				PullRequests:                  String("pr"),
 13437  				RepositoryHooks:               String("rh"),
 13438  				RepositoryProjects:            String("rp"),
 13439  				RepositoryPreReceiveHooks:     String("rprh"),
 13440  				Secrets:                       String("s"),
 13441  				SecretScanningAlerts:          String("ssa"),
 13442  				SecurityEvents:                String("se"),
 13443  				SingleFile:                    String("sf"),
 13444  				Statuses:                      String("s"),
 13445  				TeamDiscussions:               String("td"),
 13446  				VulnerabilityAlerts:           String("va"),
 13447  				Workflows:                     String("w"),
 13448  			},
 13449  			CreatedAt:              &Timestamp{referenceTime},
 13450  			UpdatedAt:              &Timestamp{referenceTime},
 13451  			HasMultipleSingleFiles: Bool(false),
 13452  			SuspendedBy: &User{
 13453  				Login:           String("l"),
 13454  				ID:              Int64(1),
 13455  				URL:             String("u"),
 13456  				AvatarURL:       String("a"),
 13457  				GravatarID:      String("g"),
 13458  				Name:            String("n"),
 13459  				Company:         String("c"),
 13460  				Blog:            String("b"),
 13461  				Location:        String("l"),
 13462  				Email:           String("e"),
 13463  				Hireable:        Bool(true),
 13464  				Bio:             String("b"),
 13465  				TwitterUsername: String("t"),
 13466  				PublicRepos:     Int(1),
 13467  				Followers:       Int(1),
 13468  				Following:       Int(1),
 13469  				CreatedAt:       &Timestamp{referenceTime},
 13470  				SuspendedAt:     &Timestamp{referenceTime},
 13471  			},
 13472  			SuspendedAt: &Timestamp{referenceTime},
 13473  		},
 13474  	}
 13475  
 13476  	want := `{
 13477  		"action": "a",
 13478  		"assignee": {
 13479  			"login": "l",
 13480  			"id": 1,
 13481  			"node_id": "n",
 13482  			"avatar_url": "a",
 13483  			"url": "u",
 13484  			"events_url": "e",
 13485  			"repos_url": "r"
 13486  		},
 13487  		"number": 1,
 13488  		"pull_request": {
 13489  			"id": 1
 13490  		},
 13491  		"changes": {
 13492  			"title": {
 13493  				"from": "TitleFrom"
 13494  			},
 13495  			"body": {
 13496  				"from": "BodyFrom"
 13497  			},
 13498  			"base": {
 13499  				"ref": {
 13500  					"from": "BaseRefFrom"
 13501  				},
 13502  				"sha": {
 13503  					"from": "BaseSHAFrom"
 13504  				}
 13505  			}
 13506  		},
 13507  		"requested_reviewer": {
 13508  			"login": "l",
 13509  			"id": 1,
 13510  			"node_id": "n",
 13511  			"avatar_url": "a",
 13512  			"url": "u",
 13513  			"events_url": "e",
 13514  			"repos_url": "r"
 13515  		},
 13516  		"requested_team": {
 13517  			"id": 1
 13518  		},
 13519  		"repository": {
 13520  			"id": 1,
 13521  			"name": "n",
 13522  			"url": "s"
 13523  		},
 13524  		"sender": {
 13525  			"login": "l",
 13526  			"id": 1,
 13527  			"node_id": "n",
 13528  			"avatar_url": "a",
 13529  			"url": "u",
 13530  			"events_url": "e",
 13531  			"repos_url": "r"
 13532  		},
 13533  		"installation": {
 13534  			"id": 1,
 13535  			"node_id": "nid",
 13536  			"app_id": 1,
 13537  			"app_slug": "as",
 13538  			"target_id": 1,
 13539  			"account": {
 13540  				"login": "l",
 13541  				"id": 1,
 13542  				"avatar_url": "a",
 13543  				"gravatar_id": "g",
 13544  				"name": "n",
 13545  				"company": "c",
 13546  				"blog": "b",
 13547  				"location": "l",
 13548  				"email": "e",
 13549  				"hireable": true,
 13550  				"bio": "b",
 13551  				"twitter_username": "t",
 13552  				"public_repos": 1,
 13553  				"followers": 1,
 13554  				"following": 1,
 13555  				"created_at": ` + referenceTimeStr + `,
 13556  				"suspended_at": ` + referenceTimeStr + `,
 13557  				"url": "u"
 13558  			},
 13559  			"access_tokens_url": "atu",
 13560  			"repositories_url": "ru",
 13561  			"html_url": "hu",
 13562  			"target_type": "tt",
 13563  			"single_file_name": "sfn",
 13564  			"repository_selection": "rs",
 13565  			"events": [
 13566  				"e"
 13567  			],
 13568  			"single_file_paths": [
 13569  				"s"
 13570  			],
 13571  			"permissions": {
 13572  				"actions": "a",
 13573  				"administration": "ad",
 13574  				"checks": "c",
 13575  				"contents": "co",
 13576  				"content_references": "cr",
 13577  				"deployments": "d",
 13578  				"environments": "e",
 13579  				"issues": "i",
 13580  				"metadata": "md",
 13581  				"members": "m",
 13582  				"organization_administration": "oa",
 13583  				"organization_hooks": "oh",
 13584  				"organization_plan": "op",
 13585  				"organization_pre_receive_hooks": "opr",
 13586  				"organization_projects": "op",
 13587  				"organization_secrets": "os",
 13588  				"organization_self_hosted_runners": "osh",
 13589  				"organization_user_blocking": "oub",
 13590  				"packages": "pkg",
 13591  				"pages": "pg",
 13592  				"pull_requests": "pr",
 13593  				"repository_hooks": "rh",
 13594  				"repository_projects": "rp",
 13595  				"repository_pre_receive_hooks": "rprh",
 13596  				"secrets": "s",
 13597  				"secret_scanning_alerts": "ssa",
 13598  				"security_events": "se",
 13599  				"single_file": "sf",
 13600  				"statuses": "s",
 13601  				"team_discussions": "td",
 13602  				"vulnerability_alerts": "va",
 13603  				"workflows": "w"
 13604  			},
 13605  			"created_at": ` + referenceTimeStr + `,
 13606  			"updated_at": ` + referenceTimeStr + `,
 13607  			"has_multiple_single_files": false,
 13608  			"suspended_by": {
 13609  				"login": "l",
 13610  				"id": 1,
 13611  				"avatar_url": "a",
 13612  				"gravatar_id": "g",
 13613  				"name": "n",
 13614  				"company": "c",
 13615  				"blog": "b",
 13616  				"location": "l",
 13617  				"email": "e",
 13618  				"hireable": true,
 13619  				"bio": "b",
 13620  				"twitter_username": "t",
 13621  				"public_repos": 1,
 13622  				"followers": 1,
 13623  				"following": 1,
 13624  				"created_at": ` + referenceTimeStr + `,
 13625  				"suspended_at": ` + referenceTimeStr + `,
 13626  				"url": "u"
 13627  			},
 13628  			"suspended_at": ` + referenceTimeStr + `
 13629  		},
 13630  		"label": {
 13631  			"id": 1
 13632  		},
 13633  		"organization": {
 13634  			"name": "n",
 13635  			"company": "c",
 13636  			"blog": "b",
 13637  			"location": "loc",
 13638  			"email": "e",
 13639  			"twitter_username": "tu",
 13640  			"description": "d",
 13641  			"billing_email": "be",
 13642  			"is_verified": true,
 13643  			"has_organization_projects": true,
 13644  			"has_repository_projects": true,
 13645  			"default_repository_permission": "drp",
 13646  			"members_can_create_repositories": true,
 13647  			"members_can_create_public_repositories": false,
 13648  			"members_can_create_private_repositories": true,
 13649  			"members_can_create_internal_repositories": true,
 13650  			"members_allowed_repository_creation_type": "marct",
 13651  			"members_can_create_pages": true,
 13652  			"members_can_create_public_pages": false,
 13653  			"members_can_create_private_pages": true
 13654  		},
 13655  		"before": "before",
 13656  		"after": "after"
 13657  	}`
 13658  
 13659  	testJSONMarshal(t, u, want)
 13660  }
 13661  
 13662  func TestPullRequestReviewCommentEvent_Marshal(t *testing.T) {
 13663  	testJSONMarshal(t, &PullRequestReviewCommentEvent{}, "{}")
 13664  
 13665  	u := &PullRequestReviewCommentEvent{
 13666  		Action:      String("a"),
 13667  		PullRequest: &PullRequest{ID: Int64(1)},
 13668  		Comment:     &PullRequestComment{ID: Int64(1)},
 13669  		Changes: &EditChange{
 13670  			Title: &EditTitle{
 13671  				From: String("TitleFrom"),
 13672  			},
 13673  			Body: &EditBody{
 13674  				From: String("BodyFrom"),
 13675  			},
 13676  			Base: &EditBase{
 13677  				Ref: &EditRef{
 13678  					From: String("BaseRefFrom"),
 13679  				},
 13680  				SHA: &EditSHA{
 13681  					From: String("BaseSHAFrom"),
 13682  				},
 13683  			},
 13684  		},
 13685  		Repo: &Repository{
 13686  			ID:   Int64(1),
 13687  			URL:  String("s"),
 13688  			Name: String("n"),
 13689  		},
 13690  		Sender: &User{
 13691  			Login:     String("l"),
 13692  			ID:        Int64(1),
 13693  			NodeID:    String("n"),
 13694  			URL:       String("u"),
 13695  			ReposURL:  String("r"),
 13696  			EventsURL: String("e"),
 13697  			AvatarURL: String("a"),
 13698  		},
 13699  		Installation: &Installation{
 13700  			ID:       Int64(1),
 13701  			NodeID:   String("nid"),
 13702  			AppID:    Int64(1),
 13703  			AppSlug:  String("as"),
 13704  			TargetID: Int64(1),
 13705  			Account: &User{
 13706  				Login:           String("l"),
 13707  				ID:              Int64(1),
 13708  				URL:             String("u"),
 13709  				AvatarURL:       String("a"),
 13710  				GravatarID:      String("g"),
 13711  				Name:            String("n"),
 13712  				Company:         String("c"),
 13713  				Blog:            String("b"),
 13714  				Location:        String("l"),
 13715  				Email:           String("e"),
 13716  				Hireable:        Bool(true),
 13717  				Bio:             String("b"),
 13718  				TwitterUsername: String("t"),
 13719  				PublicRepos:     Int(1),
 13720  				Followers:       Int(1),
 13721  				Following:       Int(1),
 13722  				CreatedAt:       &Timestamp{referenceTime},
 13723  				SuspendedAt:     &Timestamp{referenceTime},
 13724  			},
 13725  			AccessTokensURL:     String("atu"),
 13726  			RepositoriesURL:     String("ru"),
 13727  			HTMLURL:             String("hu"),
 13728  			TargetType:          String("tt"),
 13729  			SingleFileName:      String("sfn"),
 13730  			RepositorySelection: String("rs"),
 13731  			Events:              []string{"e"},
 13732  			SingleFilePaths:     []string{"s"},
 13733  			Permissions: &InstallationPermissions{
 13734  				Actions:                       String("a"),
 13735  				Administration:                String("ad"),
 13736  				Checks:                        String("c"),
 13737  				Contents:                      String("co"),
 13738  				ContentReferences:             String("cr"),
 13739  				Deployments:                   String("d"),
 13740  				Environments:                  String("e"),
 13741  				Issues:                        String("i"),
 13742  				Metadata:                      String("md"),
 13743  				Members:                       String("m"),
 13744  				OrganizationAdministration:    String("oa"),
 13745  				OrganizationHooks:             String("oh"),
 13746  				OrganizationPlan:              String("op"),
 13747  				OrganizationPreReceiveHooks:   String("opr"),
 13748  				OrganizationProjects:          String("op"),
 13749  				OrganizationSecrets:           String("os"),
 13750  				OrganizationSelfHostedRunners: String("osh"),
 13751  				OrganizationUserBlocking:      String("oub"),
 13752  				Packages:                      String("pkg"),
 13753  				Pages:                         String("pg"),
 13754  				PullRequests:                  String("pr"),
 13755  				RepositoryHooks:               String("rh"),
 13756  				RepositoryProjects:            String("rp"),
 13757  				RepositoryPreReceiveHooks:     String("rprh"),
 13758  				Secrets:                       String("s"),
 13759  				SecretScanningAlerts:          String("ssa"),
 13760  				SecurityEvents:                String("se"),
 13761  				SingleFile:                    String("sf"),
 13762  				Statuses:                      String("s"),
 13763  				TeamDiscussions:               String("td"),
 13764  				VulnerabilityAlerts:           String("va"),
 13765  				Workflows:                     String("w"),
 13766  			},
 13767  			CreatedAt:              &Timestamp{referenceTime},
 13768  			UpdatedAt:              &Timestamp{referenceTime},
 13769  			HasMultipleSingleFiles: Bool(false),
 13770  			SuspendedBy: &User{
 13771  				Login:           String("l"),
 13772  				ID:              Int64(1),
 13773  				URL:             String("u"),
 13774  				AvatarURL:       String("a"),
 13775  				GravatarID:      String("g"),
 13776  				Name:            String("n"),
 13777  				Company:         String("c"),
 13778  				Blog:            String("b"),
 13779  				Location:        String("l"),
 13780  				Email:           String("e"),
 13781  				Hireable:        Bool(true),
 13782  				Bio:             String("b"),
 13783  				TwitterUsername: String("t"),
 13784  				PublicRepos:     Int(1),
 13785  				Followers:       Int(1),
 13786  				Following:       Int(1),
 13787  				CreatedAt:       &Timestamp{referenceTime},
 13788  				SuspendedAt:     &Timestamp{referenceTime},
 13789  			},
 13790  			SuspendedAt: &Timestamp{referenceTime},
 13791  		},
 13792  	}
 13793  
 13794  	want := `{
 13795  		"action": "a",
 13796  		"pull_request": {
 13797  			"id": 1
 13798  		},
 13799  		"comment": {
 13800  			"id": 1
 13801  		},
 13802  		"changes": {
 13803  			"title": {
 13804  				"from": "TitleFrom"
 13805  			},
 13806  			"body": {
 13807  				"from": "BodyFrom"
 13808  			},
 13809  			"base": {
 13810  				"ref": {
 13811  					"from": "BaseRefFrom"
 13812  				},
 13813  				"sha": {
 13814  					"from": "BaseSHAFrom"
 13815  				}
 13816  			}
 13817  		},
 13818  		"repository": {
 13819  			"id": 1,
 13820  			"name": "n",
 13821  			"url": "s"
 13822  		},
 13823  		"sender": {
 13824  			"login": "l",
 13825  			"id": 1,
 13826  			"node_id": "n",
 13827  			"avatar_url": "a",
 13828  			"url": "u",
 13829  			"events_url": "e",
 13830  			"repos_url": "r"
 13831  		},
 13832  		"installation": {
 13833  			"id": 1,
 13834  			"node_id": "nid",
 13835  			"app_id": 1,
 13836  			"app_slug": "as",
 13837  			"target_id": 1,
 13838  			"account": {
 13839  				"login": "l",
 13840  				"id": 1,
 13841  				"avatar_url": "a",
 13842  				"gravatar_id": "g",
 13843  				"name": "n",
 13844  				"company": "c",
 13845  				"blog": "b",
 13846  				"location": "l",
 13847  				"email": "e",
 13848  				"hireable": true,
 13849  				"bio": "b",
 13850  				"twitter_username": "t",
 13851  				"public_repos": 1,
 13852  				"followers": 1,
 13853  				"following": 1,
 13854  				"created_at": ` + referenceTimeStr + `,
 13855  				"suspended_at": ` + referenceTimeStr + `,
 13856  				"url": "u"
 13857  			},
 13858  			"access_tokens_url": "atu",
 13859  			"repositories_url": "ru",
 13860  			"html_url": "hu",
 13861  			"target_type": "tt",
 13862  			"single_file_name": "sfn",
 13863  			"repository_selection": "rs",
 13864  			"events": [
 13865  				"e"
 13866  			],
 13867  			"single_file_paths": [
 13868  				"s"
 13869  			],
 13870  			"permissions": {
 13871  				"actions": "a",
 13872  				"administration": "ad",
 13873  				"checks": "c",
 13874  				"contents": "co",
 13875  				"content_references": "cr",
 13876  				"deployments": "d",
 13877  				"environments": "e",
 13878  				"issues": "i",
 13879  				"metadata": "md",
 13880  				"members": "m",
 13881  				"organization_administration": "oa",
 13882  				"organization_hooks": "oh",
 13883  				"organization_plan": "op",
 13884  				"organization_pre_receive_hooks": "opr",
 13885  				"organization_projects": "op",
 13886  				"organization_secrets": "os",
 13887  				"organization_self_hosted_runners": "osh",
 13888  				"organization_user_blocking": "oub",
 13889  				"packages": "pkg",
 13890  				"pages": "pg",
 13891  				"pull_requests": "pr",
 13892  				"repository_hooks": "rh",
 13893  				"repository_projects": "rp",
 13894  				"repository_pre_receive_hooks": "rprh",
 13895  				"secrets": "s",
 13896  				"secret_scanning_alerts": "ssa",
 13897  				"security_events": "se",
 13898  				"single_file": "sf",
 13899  				"statuses": "s",
 13900  				"team_discussions": "td",
 13901  				"vulnerability_alerts": "va",
 13902  				"workflows": "w"
 13903  			},
 13904  			"created_at": ` + referenceTimeStr + `,
 13905  			"updated_at": ` + referenceTimeStr + `,
 13906  			"has_multiple_single_files": false,
 13907  			"suspended_by": {
 13908  				"login": "l",
 13909  				"id": 1,
 13910  				"avatar_url": "a",
 13911  				"gravatar_id": "g",
 13912  				"name": "n",
 13913  				"company": "c",
 13914  				"blog": "b",
 13915  				"location": "l",
 13916  				"email": "e",
 13917  				"hireable": true,
 13918  				"bio": "b",
 13919  				"twitter_username": "t",
 13920  				"public_repos": 1,
 13921  				"followers": 1,
 13922  				"following": 1,
 13923  				"created_at": ` + referenceTimeStr + `,
 13924  				"suspended_at": ` + referenceTimeStr + `,
 13925  				"url": "u"
 13926  			},
 13927  			"suspended_at": ` + referenceTimeStr + `
 13928  		}
 13929  	}`
 13930  
 13931  	testJSONMarshal(t, u, want)
 13932  }
 13933  
 13934  func TestPullRequestReviewThreadEvent_Marshal(t *testing.T) {
 13935  	testJSONMarshal(t, &PullRequestReviewThreadEvent{}, "{}")
 13936  
 13937  	u := &PullRequestReviewThreadEvent{
 13938  		Action:      String("a"),
 13939  		PullRequest: &PullRequest{ID: Int64(1)},
 13940  		Thread: &PullRequestThread{
 13941  			Comments: []*PullRequestComment{{ID: Int64(1)}, {ID: Int64(2)}},
 13942  		},
 13943  		Repo: &Repository{
 13944  			ID:   Int64(1),
 13945  			URL:  String("s"),
 13946  			Name: String("n"),
 13947  		},
 13948  		Sender: &User{
 13949  			Login:     String("l"),
 13950  			ID:        Int64(1),
 13951  			NodeID:    String("n"),
 13952  			URL:       String("u"),
 13953  			ReposURL:  String("r"),
 13954  			EventsURL: String("e"),
 13955  			AvatarURL: String("a"),
 13956  		},
 13957  		Installation: &Installation{
 13958  			ID:       Int64(1),
 13959  			NodeID:   String("nid"),
 13960  			AppID:    Int64(1),
 13961  			AppSlug:  String("as"),
 13962  			TargetID: Int64(1),
 13963  			Account: &User{
 13964  				Login:           String("l"),
 13965  				ID:              Int64(1),
 13966  				URL:             String("u"),
 13967  				AvatarURL:       String("a"),
 13968  				GravatarID:      String("g"),
 13969  				Name:            String("n"),
 13970  				Company:         String("c"),
 13971  				Blog:            String("b"),
 13972  				Location:        String("l"),
 13973  				Email:           String("e"),
 13974  				Hireable:        Bool(true),
 13975  				Bio:             String("b"),
 13976  				TwitterUsername: String("t"),
 13977  				PublicRepos:     Int(1),
 13978  				Followers:       Int(1),
 13979  				Following:       Int(1),
 13980  				CreatedAt:       &Timestamp{referenceTime},
 13981  				SuspendedAt:     &Timestamp{referenceTime},
 13982  			},
 13983  			AccessTokensURL:     String("atu"),
 13984  			RepositoriesURL:     String("ru"),
 13985  			HTMLURL:             String("hu"),
 13986  			TargetType:          String("tt"),
 13987  			SingleFileName:      String("sfn"),
 13988  			RepositorySelection: String("rs"),
 13989  			Events:              []string{"e"},
 13990  			SingleFilePaths:     []string{"s"},
 13991  			Permissions: &InstallationPermissions{
 13992  				Actions:                       String("a"),
 13993  				Administration:                String("ad"),
 13994  				Checks:                        String("c"),
 13995  				Contents:                      String("co"),
 13996  				ContentReferences:             String("cr"),
 13997  				Deployments:                   String("d"),
 13998  				Environments:                  String("e"),
 13999  				Issues:                        String("i"),
 14000  				Metadata:                      String("md"),
 14001  				Members:                       String("m"),
 14002  				OrganizationAdministration:    String("oa"),
 14003  				OrganizationHooks:             String("oh"),
 14004  				OrganizationPlan:              String("op"),
 14005  				OrganizationPreReceiveHooks:   String("opr"),
 14006  				OrganizationProjects:          String("op"),
 14007  				OrganizationSecrets:           String("os"),
 14008  				OrganizationSelfHostedRunners: String("osh"),
 14009  				OrganizationUserBlocking:      String("oub"),
 14010  				Packages:                      String("pkg"),
 14011  				Pages:                         String("pg"),
 14012  				PullRequests:                  String("pr"),
 14013  				RepositoryHooks:               String("rh"),
 14014  				RepositoryProjects:            String("rp"),
 14015  				RepositoryPreReceiveHooks:     String("rprh"),
 14016  				Secrets:                       String("s"),
 14017  				SecretScanningAlerts:          String("ssa"),
 14018  				SecurityEvents:                String("se"),
 14019  				SingleFile:                    String("sf"),
 14020  				Statuses:                      String("s"),
 14021  				TeamDiscussions:               String("td"),
 14022  				VulnerabilityAlerts:           String("va"),
 14023  				Workflows:                     String("w"),
 14024  			},
 14025  			CreatedAt:              &Timestamp{referenceTime},
 14026  			UpdatedAt:              &Timestamp{referenceTime},
 14027  			HasMultipleSingleFiles: Bool(false),
 14028  			SuspendedBy: &User{
 14029  				Login:           String("l"),
 14030  				ID:              Int64(1),
 14031  				URL:             String("u"),
 14032  				AvatarURL:       String("a"),
 14033  				GravatarID:      String("g"),
 14034  				Name:            String("n"),
 14035  				Company:         String("c"),
 14036  				Blog:            String("b"),
 14037  				Location:        String("l"),
 14038  				Email:           String("e"),
 14039  				Hireable:        Bool(true),
 14040  				Bio:             String("b"),
 14041  				TwitterUsername: String("t"),
 14042  				PublicRepos:     Int(1),
 14043  				Followers:       Int(1),
 14044  				Following:       Int(1),
 14045  				CreatedAt:       &Timestamp{referenceTime},
 14046  				SuspendedAt:     &Timestamp{referenceTime},
 14047  			},
 14048  			SuspendedAt: &Timestamp{referenceTime},
 14049  		},
 14050  	}
 14051  
 14052  	want := `{
 14053  		"action": "a",
 14054  		"pull_request": {
 14055  			"id": 1
 14056  		},
 14057  		"thread": {
 14058  			"comments": [
 14059  				{
 14060  					"id": 1
 14061  				},
 14062  				{
 14063  					"id": 2
 14064  				}
 14065  			]
 14066  		},
 14067  		"repository": {
 14068  			"id": 1,
 14069  			"name": "n",
 14070  			"url": "s"
 14071  		},
 14072  		"sender": {
 14073  			"login": "l",
 14074  			"id": 1,
 14075  			"node_id": "n",
 14076  			"avatar_url": "a",
 14077  			"url": "u",
 14078  			"events_url": "e",
 14079  			"repos_url": "r"
 14080  		},
 14081  		"installation": {
 14082  			"id": 1,
 14083  			"node_id": "nid",
 14084  			"app_id": 1,
 14085  			"app_slug": "as",
 14086  			"target_id": 1,
 14087  			"account": {
 14088  				"login": "l",
 14089  				"id": 1,
 14090  				"avatar_url": "a",
 14091  				"gravatar_id": "g",
 14092  				"name": "n",
 14093  				"company": "c",
 14094  				"blog": "b",
 14095  				"location": "l",
 14096  				"email": "e",
 14097  				"hireable": true,
 14098  				"bio": "b",
 14099  				"twitter_username": "t",
 14100  				"public_repos": 1,
 14101  				"followers": 1,
 14102  				"following": 1,
 14103  				"created_at": ` + referenceTimeStr + `,
 14104  				"suspended_at": ` + referenceTimeStr + `,
 14105  				"url": "u"
 14106  			},
 14107  			"access_tokens_url": "atu",
 14108  			"repositories_url": "ru",
 14109  			"html_url": "hu",
 14110  			"target_type": "tt",
 14111  			"single_file_name": "sfn",
 14112  			"repository_selection": "rs",
 14113  			"events": [
 14114  				"e"
 14115  			],
 14116  			"single_file_paths": [
 14117  				"s"
 14118  			],
 14119  			"permissions": {
 14120  				"actions": "a",
 14121  				"administration": "ad",
 14122  				"checks": "c",
 14123  				"contents": "co",
 14124  				"content_references": "cr",
 14125  				"deployments": "d",
 14126  				"environments": "e",
 14127  				"issues": "i",
 14128  				"metadata": "md",
 14129  				"members": "m",
 14130  				"organization_administration": "oa",
 14131  				"organization_hooks": "oh",
 14132  				"organization_plan": "op",
 14133  				"organization_pre_receive_hooks": "opr",
 14134  				"organization_projects": "op",
 14135  				"organization_secrets": "os",
 14136  				"organization_self_hosted_runners": "osh",
 14137  				"organization_user_blocking": "oub",
 14138  				"packages": "pkg",
 14139  				"pages": "pg",
 14140  				"pull_requests": "pr",
 14141  				"repository_hooks": "rh",
 14142  				"repository_projects": "rp",
 14143  				"repository_pre_receive_hooks": "rprh",
 14144  				"secrets": "s",
 14145  				"secret_scanning_alerts": "ssa",
 14146  				"security_events": "se",
 14147  				"single_file": "sf",
 14148  				"statuses": "s",
 14149  				"team_discussions": "td",
 14150  				"vulnerability_alerts": "va",
 14151  				"workflows": "w"
 14152  			},
 14153  			"created_at": ` + referenceTimeStr + `,
 14154  			"updated_at": ` + referenceTimeStr + `,
 14155  			"has_multiple_single_files": false,
 14156  			"suspended_by": {
 14157  				"login": "l",
 14158  				"id": 1,
 14159  				"avatar_url": "a",
 14160  				"gravatar_id": "g",
 14161  				"name": "n",
 14162  				"company": "c",
 14163  				"blog": "b",
 14164  				"location": "l",
 14165  				"email": "e",
 14166  				"hireable": true,
 14167  				"bio": "b",
 14168  				"twitter_username": "t",
 14169  				"public_repos": 1,
 14170  				"followers": 1,
 14171  				"following": 1,
 14172  				"created_at": ` + referenceTimeStr + `,
 14173  				"suspended_at": ` + referenceTimeStr + `,
 14174  				"url": "u"
 14175  			},
 14176  			"suspended_at": ` + referenceTimeStr + `
 14177  		}
 14178  	}`
 14179  
 14180  	testJSONMarshal(t, u, want)
 14181  }
 14182  
 14183  func TestPullRequestTargetEvent_Marshal(t *testing.T) {
 14184  	testJSONMarshal(t, &PullRequestTargetEvent{}, "{}")
 14185  
 14186  	u := &PullRequestTargetEvent{
 14187  		Action: String("a"),
 14188  		Assignee: &User{
 14189  			Login:     String("l"),
 14190  			ID:        Int64(1),
 14191  			NodeID:    String("n"),
 14192  			URL:       String("u"),
 14193  			ReposURL:  String("r"),
 14194  			EventsURL: String("e"),
 14195  			AvatarURL: String("a"),
 14196  		},
 14197  		Number:      Int(1),
 14198  		PullRequest: &PullRequest{ID: Int64(1)},
 14199  		Changes: &EditChange{
 14200  			Title: &EditTitle{
 14201  				From: String("TitleFrom"),
 14202  			},
 14203  			Body: &EditBody{
 14204  				From: String("BodyFrom"),
 14205  			},
 14206  			Base: &EditBase{
 14207  				Ref: &EditRef{
 14208  					From: String("BaseRefFrom"),
 14209  				},
 14210  				SHA: &EditSHA{
 14211  					From: String("BaseSHAFrom"),
 14212  				},
 14213  			},
 14214  		},
 14215  		RequestedReviewer: &User{
 14216  			Login:     String("l"),
 14217  			ID:        Int64(1),
 14218  			NodeID:    String("n"),
 14219  			URL:       String("u"),
 14220  			ReposURL:  String("r"),
 14221  			EventsURL: String("e"),
 14222  			AvatarURL: String("a"),
 14223  		},
 14224  		RequestedTeam: &Team{ID: Int64(1)},
 14225  		Label:         &Label{ID: Int64(1)},
 14226  		Before:        String("before"),
 14227  		After:         String("after"),
 14228  		Repo: &Repository{
 14229  			ID:   Int64(1),
 14230  			URL:  String("s"),
 14231  			Name: String("n"),
 14232  		},
 14233  		Organization: &Organization{
 14234  			BillingEmail:                         String("be"),
 14235  			Blog:                                 String("b"),
 14236  			Company:                              String("c"),
 14237  			Email:                                String("e"),
 14238  			TwitterUsername:                      String("tu"),
 14239  			Location:                             String("loc"),
 14240  			Name:                                 String("n"),
 14241  			Description:                          String("d"),
 14242  			IsVerified:                           Bool(true),
 14243  			HasOrganizationProjects:              Bool(true),
 14244  			HasRepositoryProjects:                Bool(true),
 14245  			DefaultRepoPermission:                String("drp"),
 14246  			MembersCanCreateRepos:                Bool(true),
 14247  			MembersCanCreateInternalRepos:        Bool(true),
 14248  			MembersCanCreatePrivateRepos:         Bool(true),
 14249  			MembersCanCreatePublicRepos:          Bool(false),
 14250  			MembersAllowedRepositoryCreationType: String("marct"),
 14251  			MembersCanCreatePages:                Bool(true),
 14252  			MembersCanCreatePublicPages:          Bool(false),
 14253  			MembersCanCreatePrivatePages:         Bool(true),
 14254  		},
 14255  		Sender: &User{
 14256  			Login:     String("l"),
 14257  			ID:        Int64(1),
 14258  			NodeID:    String("n"),
 14259  			URL:       String("u"),
 14260  			ReposURL:  String("r"),
 14261  			EventsURL: String("e"),
 14262  			AvatarURL: String("a"),
 14263  		},
 14264  		Installation: &Installation{
 14265  			ID:       Int64(1),
 14266  			NodeID:   String("nid"),
 14267  			AppID:    Int64(1),
 14268  			AppSlug:  String("as"),
 14269  			TargetID: Int64(1),
 14270  			Account: &User{
 14271  				Login:           String("l"),
 14272  				ID:              Int64(1),
 14273  				URL:             String("u"),
 14274  				AvatarURL:       String("a"),
 14275  				GravatarID:      String("g"),
 14276  				Name:            String("n"),
 14277  				Company:         String("c"),
 14278  				Blog:            String("b"),
 14279  				Location:        String("l"),
 14280  				Email:           String("e"),
 14281  				Hireable:        Bool(true),
 14282  				Bio:             String("b"),
 14283  				TwitterUsername: String("t"),
 14284  				PublicRepos:     Int(1),
 14285  				Followers:       Int(1),
 14286  				Following:       Int(1),
 14287  				CreatedAt:       &Timestamp{referenceTime},
 14288  				SuspendedAt:     &Timestamp{referenceTime},
 14289  			},
 14290  			AccessTokensURL:     String("atu"),
 14291  			RepositoriesURL:     String("ru"),
 14292  			HTMLURL:             String("hu"),
 14293  			TargetType:          String("tt"),
 14294  			SingleFileName:      String("sfn"),
 14295  			RepositorySelection: String("rs"),
 14296  			Events:              []string{"e"},
 14297  			SingleFilePaths:     []string{"s"},
 14298  			Permissions: &InstallationPermissions{
 14299  				Actions:                       String("a"),
 14300  				Administration:                String("ad"),
 14301  				Checks:                        String("c"),
 14302  				Contents:                      String("co"),
 14303  				ContentReferences:             String("cr"),
 14304  				Deployments:                   String("d"),
 14305  				Environments:                  String("e"),
 14306  				Issues:                        String("i"),
 14307  				Metadata:                      String("md"),
 14308  				Members:                       String("m"),
 14309  				OrganizationAdministration:    String("oa"),
 14310  				OrganizationHooks:             String("oh"),
 14311  				OrganizationPlan:              String("op"),
 14312  				OrganizationPreReceiveHooks:   String("opr"),
 14313  				OrganizationProjects:          String("op"),
 14314  				OrganizationSecrets:           String("os"),
 14315  				OrganizationSelfHostedRunners: String("osh"),
 14316  				OrganizationUserBlocking:      String("oub"),
 14317  				Packages:                      String("pkg"),
 14318  				Pages:                         String("pg"),
 14319  				PullRequests:                  String("pr"),
 14320  				RepositoryHooks:               String("rh"),
 14321  				RepositoryProjects:            String("rp"),
 14322  				RepositoryPreReceiveHooks:     String("rprh"),
 14323  				Secrets:                       String("s"),
 14324  				SecretScanningAlerts:          String("ssa"),
 14325  				SecurityEvents:                String("se"),
 14326  				SingleFile:                    String("sf"),
 14327  				Statuses:                      String("s"),
 14328  				TeamDiscussions:               String("td"),
 14329  				VulnerabilityAlerts:           String("va"),
 14330  				Workflows:                     String("w"),
 14331  			},
 14332  			CreatedAt:              &Timestamp{referenceTime},
 14333  			UpdatedAt:              &Timestamp{referenceTime},
 14334  			HasMultipleSingleFiles: Bool(false),
 14335  			SuspendedBy: &User{
 14336  				Login:           String("l"),
 14337  				ID:              Int64(1),
 14338  				URL:             String("u"),
 14339  				AvatarURL:       String("a"),
 14340  				GravatarID:      String("g"),
 14341  				Name:            String("n"),
 14342  				Company:         String("c"),
 14343  				Blog:            String("b"),
 14344  				Location:        String("l"),
 14345  				Email:           String("e"),
 14346  				Hireable:        Bool(true),
 14347  				Bio:             String("b"),
 14348  				TwitterUsername: String("t"),
 14349  				PublicRepos:     Int(1),
 14350  				Followers:       Int(1),
 14351  				Following:       Int(1),
 14352  				CreatedAt:       &Timestamp{referenceTime},
 14353  				SuspendedAt:     &Timestamp{referenceTime},
 14354  			},
 14355  			SuspendedAt: &Timestamp{referenceTime},
 14356  		},
 14357  	}
 14358  
 14359  	want := `{
 14360  		"action": "a",
 14361  		"assignee": {
 14362  			"login": "l",
 14363  			"id": 1,
 14364  			"node_id": "n",
 14365  			"avatar_url": "a",
 14366  			"url": "u",
 14367  			"events_url": "e",
 14368  			"repos_url": "r"
 14369  		},
 14370  		"number": 1,
 14371  		"pull_request": {
 14372  			"id": 1
 14373  		},
 14374  		"changes": {
 14375  			"title": {
 14376  				"from": "TitleFrom"
 14377  			},
 14378  			"body": {
 14379  				"from": "BodyFrom"
 14380  			},
 14381  			"base": {
 14382  				"ref": {
 14383  					"from": "BaseRefFrom"
 14384  				},
 14385  				"sha": {
 14386  					"from": "BaseSHAFrom"
 14387  				}
 14388  			}
 14389  		},
 14390  		"requested_reviewer": {
 14391  			"login": "l",
 14392  			"id": 1,
 14393  			"node_id": "n",
 14394  			"avatar_url": "a",
 14395  			"url": "u",
 14396  			"events_url": "e",
 14397  			"repos_url": "r"
 14398  		},
 14399  		"requested_team": {
 14400  			"id": 1
 14401  		},
 14402  		"repository": {
 14403  			"id": 1,
 14404  			"name": "n",
 14405  			"url": "s"
 14406  		},
 14407  		"sender": {
 14408  			"login": "l",
 14409  			"id": 1,
 14410  			"node_id": "n",
 14411  			"avatar_url": "a",
 14412  			"url": "u",
 14413  			"events_url": "e",
 14414  			"repos_url": "r"
 14415  		},
 14416  		"installation": {
 14417  			"id": 1,
 14418  			"node_id": "nid",
 14419  			"app_id": 1,
 14420  			"app_slug": "as",
 14421  			"target_id": 1,
 14422  			"account": {
 14423  				"login": "l",
 14424  				"id": 1,
 14425  				"avatar_url": "a",
 14426  				"gravatar_id": "g",
 14427  				"name": "n",
 14428  				"company": "c",
 14429  				"blog": "b",
 14430  				"location": "l",
 14431  				"email": "e",
 14432  				"hireable": true,
 14433  				"bio": "b",
 14434  				"twitter_username": "t",
 14435  				"public_repos": 1,
 14436  				"followers": 1,
 14437  				"following": 1,
 14438  				"created_at": ` + referenceTimeStr + `,
 14439  				"suspended_at": ` + referenceTimeStr + `,
 14440  				"url": "u"
 14441  			},
 14442  			"access_tokens_url": "atu",
 14443  			"repositories_url": "ru",
 14444  			"html_url": "hu",
 14445  			"target_type": "tt",
 14446  			"single_file_name": "sfn",
 14447  			"repository_selection": "rs",
 14448  			"events": [
 14449  				"e"
 14450  			],
 14451  			"single_file_paths": [
 14452  				"s"
 14453  			],
 14454  			"permissions": {
 14455  				"actions": "a",
 14456  				"administration": "ad",
 14457  				"checks": "c",
 14458  				"contents": "co",
 14459  				"content_references": "cr",
 14460  				"deployments": "d",
 14461  				"environments": "e",
 14462  				"issues": "i",
 14463  				"metadata": "md",
 14464  				"members": "m",
 14465  				"organization_administration": "oa",
 14466  				"organization_hooks": "oh",
 14467  				"organization_plan": "op",
 14468  				"organization_pre_receive_hooks": "opr",
 14469  				"organization_projects": "op",
 14470  				"organization_secrets": "os",
 14471  				"organization_self_hosted_runners": "osh",
 14472  				"organization_user_blocking": "oub",
 14473  				"packages": "pkg",
 14474  				"pages": "pg",
 14475  				"pull_requests": "pr",
 14476  				"repository_hooks": "rh",
 14477  				"repository_projects": "rp",
 14478  				"repository_pre_receive_hooks": "rprh",
 14479  				"secrets": "s",
 14480  				"secret_scanning_alerts": "ssa",
 14481  				"security_events": "se",
 14482  				"single_file": "sf",
 14483  				"statuses": "s",
 14484  				"team_discussions": "td",
 14485  				"vulnerability_alerts": "va",
 14486  				"workflows": "w"
 14487  			},
 14488  			"created_at": ` + referenceTimeStr + `,
 14489  			"updated_at": ` + referenceTimeStr + `,
 14490  			"has_multiple_single_files": false,
 14491  			"suspended_by": {
 14492  				"login": "l",
 14493  				"id": 1,
 14494  				"avatar_url": "a",
 14495  				"gravatar_id": "g",
 14496  				"name": "n",
 14497  				"company": "c",
 14498  				"blog": "b",
 14499  				"location": "l",
 14500  				"email": "e",
 14501  				"hireable": true,
 14502  				"bio": "b",
 14503  				"twitter_username": "t",
 14504  				"public_repos": 1,
 14505  				"followers": 1,
 14506  				"following": 1,
 14507  				"created_at": ` + referenceTimeStr + `,
 14508  				"suspended_at": ` + referenceTimeStr + `,
 14509  				"url": "u"
 14510  			},
 14511  			"suspended_at": ` + referenceTimeStr + `
 14512  		},
 14513  		"label": {
 14514  			"id": 1
 14515  		},
 14516  		"organization": {
 14517  			"name": "n",
 14518  			"company": "c",
 14519  			"blog": "b",
 14520  			"location": "loc",
 14521  			"email": "e",
 14522  			"twitter_username": "tu",
 14523  			"description": "d",
 14524  			"billing_email": "be",
 14525  			"is_verified": true,
 14526  			"has_organization_projects": true,
 14527  			"has_repository_projects": true,
 14528  			"default_repository_permission": "drp",
 14529  			"members_can_create_repositories": true,
 14530  			"members_can_create_public_repositories": false,
 14531  			"members_can_create_private_repositories": true,
 14532  			"members_can_create_internal_repositories": true,
 14533  			"members_allowed_repository_creation_type": "marct",
 14534  			"members_can_create_pages": true,
 14535  			"members_can_create_public_pages": false,
 14536  			"members_can_create_private_pages": true
 14537  		},
 14538  		"before": "before",
 14539  		"after": "after"
 14540  	}`
 14541  
 14542  	testJSONMarshal(t, u, want)
 14543  }
 14544  
 14545  func TestRepositoryVulnerabilityAlertEvent_Marshal(t *testing.T) {
 14546  	testJSONMarshal(t, &RepositoryVulnerabilityAlertEvent{}, "{}")
 14547  
 14548  	u := &RepositoryVulnerabilityAlertEvent{
 14549  		Action: String("a"),
 14550  		Alert: &RepositoryVulnerabilityAlert{
 14551  			ID:                  Int64(1),
 14552  			AffectedRange:       String("ar"),
 14553  			AffectedPackageName: String("apn"),
 14554  			ExternalReference:   String("er"),
 14555  			ExternalIdentifier:  String("ei"),
 14556  			FixedIn:             String("fi"),
 14557  			Dismisser: &User{
 14558  				Login:     String("l"),
 14559  				ID:        Int64(1),
 14560  				NodeID:    String("n"),
 14561  				URL:       String("u"),
 14562  				ReposURL:  String("r"),
 14563  				EventsURL: String("e"),
 14564  				AvatarURL: String("a"),
 14565  			},
 14566  			DismissReason: String("dr"),
 14567  			DismissedAt:   &Timestamp{referenceTime},
 14568  		},
 14569  		Repository: &Repository{
 14570  			ID:   Int64(1),
 14571  			URL:  String("s"),
 14572  			Name: String("n"),
 14573  		},
 14574  	}
 14575  
 14576  	want := `{
 14577  		"action": "a",
 14578  		"alert": {
 14579  			"id": 1,
 14580  			"affected_range": "ar",
 14581  			"affected_package_name": "apn",
 14582  			"external_reference": "er",
 14583  			"external_identifier": "ei",
 14584  			"fixed_in": "fi",
 14585  			"dismisser": {
 14586  				"login": "l",
 14587  				"id": 1,
 14588  				"node_id": "n",
 14589  				"avatar_url": "a",
 14590  				"url": "u",
 14591  				"events_url": "e",
 14592  				"repos_url": "r"
 14593  			},
 14594  			"dismiss_reason": "dr",
 14595  			"dismissed_at": ` + referenceTimeStr + `
 14596  		},
 14597  		"repository": {
 14598  			"id": 1,
 14599  			"name": "n",
 14600  			"url": "s"
 14601  		}
 14602  	}`
 14603  
 14604  	testJSONMarshal(t, u, want)
 14605  }
 14606  
 14607  func TestSecretScanningAlertEvent_Marshal(t *testing.T) {
 14608  	testJSONMarshal(t, &SecretScanningAlertEvent{}, "{}")
 14609  
 14610  	u := &SecretScanningAlertEvent{
 14611  		Action: String("a"),
 14612  		Alert: &SecretScanningAlert{
 14613  			Number:     Int(1),
 14614  			SecretType: String("t"),
 14615  			Resolution: String("r"),
 14616  			ResolvedBy: &User{
 14617  				Login:     String("l"),
 14618  				ID:        Int64(1),
 14619  				NodeID:    String("n"),
 14620  				URL:       String("u"),
 14621  				ReposURL:  String("r"),
 14622  				EventsURL: String("e"),
 14623  				AvatarURL: String("a"),
 14624  			},
 14625  			ResolvedAt: &Timestamp{referenceTime},
 14626  		},
 14627  		Repo: &Repository{
 14628  			ID:   Int64(1),
 14629  			URL:  String("s"),
 14630  			Name: String("n"),
 14631  		},
 14632  		Organization: &Organization{
 14633  			BillingEmail:                         String("be"),
 14634  			Blog:                                 String("b"),
 14635  			Company:                              String("c"),
 14636  			Email:                                String("e"),
 14637  			TwitterUsername:                      String("tu"),
 14638  			Location:                             String("loc"),
 14639  			Name:                                 String("n"),
 14640  			Description:                          String("d"),
 14641  			IsVerified:                           Bool(true),
 14642  			HasOrganizationProjects:              Bool(true),
 14643  			HasRepositoryProjects:                Bool(true),
 14644  			DefaultRepoPermission:                String("drp"),
 14645  			MembersCanCreateRepos:                Bool(true),
 14646  			MembersCanCreateInternalRepos:        Bool(true),
 14647  			MembersCanCreatePrivateRepos:         Bool(true),
 14648  			MembersCanCreatePublicRepos:          Bool(false),
 14649  			MembersAllowedRepositoryCreationType: String("marct"),
 14650  			MembersCanCreatePages:                Bool(true),
 14651  			MembersCanCreatePublicPages:          Bool(false),
 14652  			MembersCanCreatePrivatePages:         Bool(true),
 14653  		},
 14654  		Enterprise: &Enterprise{
 14655  			ID:          Int(1),
 14656  			Slug:        String("s"),
 14657  			Name:        String("n"),
 14658  			NodeID:      String("nid"),
 14659  			AvatarURL:   String("au"),
 14660  			Description: String("d"),
 14661  			WebsiteURL:  String("wu"),
 14662  			HTMLURL:     String("hu"),
 14663  			CreatedAt:   &Timestamp{referenceTime},
 14664  			UpdatedAt:   &Timestamp{referenceTime},
 14665  		},
 14666  		Sender: &User{
 14667  			Login:     String("l"),
 14668  			ID:        Int64(1),
 14669  			NodeID:    String("n"),
 14670  			URL:       String("u"),
 14671  			ReposURL:  String("r"),
 14672  			EventsURL: String("e"),
 14673  			AvatarURL: String("a"),
 14674  		},
 14675  		Installation: &Installation{
 14676  			ID:       Int64(1),
 14677  			NodeID:   String("nid"),
 14678  			AppID:    Int64(1),
 14679  			AppSlug:  String("as"),
 14680  			TargetID: Int64(1),
 14681  			Account: &User{
 14682  				Login:           String("l"),
 14683  				ID:              Int64(1),
 14684  				URL:             String("u"),
 14685  				AvatarURL:       String("a"),
 14686  				GravatarID:      String("g"),
 14687  				Name:            String("n"),
 14688  				Company:         String("c"),
 14689  				Blog:            String("b"),
 14690  				Location:        String("l"),
 14691  				Email:           String("e"),
 14692  				Hireable:        Bool(true),
 14693  				Bio:             String("b"),
 14694  				TwitterUsername: String("t"),
 14695  				PublicRepos:     Int(1),
 14696  				Followers:       Int(1),
 14697  				Following:       Int(1),
 14698  				CreatedAt:       &Timestamp{referenceTime},
 14699  				SuspendedAt:     &Timestamp{referenceTime},
 14700  			},
 14701  			AccessTokensURL:     String("atu"),
 14702  			RepositoriesURL:     String("ru"),
 14703  			HTMLURL:             String("hu"),
 14704  			TargetType:          String("tt"),
 14705  			SingleFileName:      String("sfn"),
 14706  			RepositorySelection: String("rs"),
 14707  			Events:              []string{"e"},
 14708  			SingleFilePaths:     []string{"s"},
 14709  			Permissions: &InstallationPermissions{
 14710  				Actions:                       String("a"),
 14711  				Administration:                String("ad"),
 14712  				Checks:                        String("c"),
 14713  				Contents:                      String("co"),
 14714  				ContentReferences:             String("cr"),
 14715  				Deployments:                   String("d"),
 14716  				Environments:                  String("e"),
 14717  				Issues:                        String("i"),
 14718  				Metadata:                      String("md"),
 14719  				Members:                       String("m"),
 14720  				OrganizationAdministration:    String("oa"),
 14721  				OrganizationHooks:             String("oh"),
 14722  				OrganizationPlan:              String("op"),
 14723  				OrganizationPreReceiveHooks:   String("opr"),
 14724  				OrganizationProjects:          String("op"),
 14725  				OrganizationSecrets:           String("os"),
 14726  				OrganizationSelfHostedRunners: String("osh"),
 14727  				OrganizationUserBlocking:      String("oub"),
 14728  				Packages:                      String("pkg"),
 14729  				Pages:                         String("pg"),
 14730  				PullRequests:                  String("pr"),
 14731  				RepositoryHooks:               String("rh"),
 14732  				RepositoryProjects:            String("rp"),
 14733  				RepositoryPreReceiveHooks:     String("rprh"),
 14734  				Secrets:                       String("s"),
 14735  				SecretScanningAlerts:          String("ssa"),
 14736  				SecurityEvents:                String("se"),
 14737  				SingleFile:                    String("sf"),
 14738  				Statuses:                      String("s"),
 14739  				TeamDiscussions:               String("td"),
 14740  				VulnerabilityAlerts:           String("va"),
 14741  				Workflows:                     String("w"),
 14742  			},
 14743  			CreatedAt:              &Timestamp{referenceTime},
 14744  			UpdatedAt:              &Timestamp{referenceTime},
 14745  			HasMultipleSingleFiles: Bool(false),
 14746  			SuspendedBy: &User{
 14747  				Login:           String("l"),
 14748  				ID:              Int64(1),
 14749  				URL:             String("u"),
 14750  				AvatarURL:       String("a"),
 14751  				GravatarID:      String("g"),
 14752  				Name:            String("n"),
 14753  				Company:         String("c"),
 14754  				Blog:            String("b"),
 14755  				Location:        String("l"),
 14756  				Email:           String("e"),
 14757  				Hireable:        Bool(true),
 14758  				Bio:             String("b"),
 14759  				TwitterUsername: String("t"),
 14760  				PublicRepos:     Int(1),
 14761  				Followers:       Int(1),
 14762  				Following:       Int(1),
 14763  				CreatedAt:       &Timestamp{referenceTime},
 14764  				SuspendedAt:     &Timestamp{referenceTime},
 14765  			},
 14766  			SuspendedAt: &Timestamp{referenceTime},
 14767  		},
 14768  	}
 14769  
 14770  	want := `{
 14771  		"action": "a",
 14772  		"alert": {
 14773  			"number": 1,
 14774  			"secret_type": "t",
 14775  			"resolution": "r",
 14776  			"resolved_by": {
 14777  				"login": "l",
 14778  				"id": 1,
 14779  				"node_id": "n",
 14780  				"avatar_url": "a",
 14781  				"url": "u",
 14782  				"events_url": "e",
 14783  				"repos_url": "r"
 14784  			},
 14785  			"resolved_at": ` + referenceTimeStr + `
 14786  		},
 14787  		"repository": {
 14788  			"id": 1,
 14789  			"name": "n",
 14790  			"url": "s"
 14791  		},
 14792          "organization": {
 14793  			"name": "n",
 14794  			"company": "c",
 14795  			"blog": "b",
 14796  			"location": "loc",
 14797  			"email": "e",
 14798  			"twitter_username": "tu",
 14799  			"description": "d",
 14800  			"billing_email": "be",
 14801  			"is_verified": true,
 14802  			"has_organization_projects": true,
 14803  			"has_repository_projects": true,
 14804  			"default_repository_permission": "drp",
 14805  			"members_can_create_repositories": true,
 14806  			"members_can_create_public_repositories": false,
 14807  			"members_can_create_private_repositories": true,
 14808  			"members_can_create_internal_repositories": true,
 14809  			"members_allowed_repository_creation_type": "marct",
 14810  			"members_can_create_pages": true,
 14811  			"members_can_create_public_pages": false,
 14812  			"members_can_create_private_pages": true
 14813  		},
 14814          "enterprise": {
 14815  			"id": 1,
 14816  			"slug": "s",
 14817  			"name": "n",
 14818  			"node_id": "nid",
 14819  			"avatar_url": "au",
 14820  			"description": "d",
 14821  			"website_url": "wu",
 14822  			"html_url": "hu",
 14823  			"created_at": ` + referenceTimeStr + `,
 14824  			"updated_at": ` + referenceTimeStr + `
 14825  		},
 14826  		"sender": {
 14827  			"login": "l",
 14828  			"id": 1,
 14829  			"node_id": "n",
 14830  			"avatar_url": "a",
 14831  			"url": "u",
 14832  			"events_url": "e",
 14833  			"repos_url": "r"
 14834  		},
 14835          "installation": {
 14836  			"id": 1,
 14837  			"node_id": "nid",
 14838  			"app_id": 1,
 14839  			"app_slug": "as",
 14840  			"target_id": 1,
 14841  			"account": {
 14842  				"login": "l",
 14843  				"id": 1,
 14844  				"avatar_url": "a",
 14845  				"gravatar_id": "g",
 14846  				"name": "n",
 14847  				"company": "c",
 14848  				"blog": "b",
 14849  				"location": "l",
 14850  				"email": "e",
 14851  				"hireable": true,
 14852  				"bio": "b",
 14853  				"twitter_username": "t",
 14854  				"public_repos": 1,
 14855  				"followers": 1,
 14856  				"following": 1,
 14857  				"created_at": ` + referenceTimeStr + `,
 14858  				"suspended_at": ` + referenceTimeStr + `,
 14859  				"url": "u"
 14860  			},
 14861  			"access_tokens_url": "atu",
 14862  			"repositories_url": "ru",
 14863  			"html_url": "hu",
 14864  			"target_type": "tt",
 14865  			"single_file_name": "sfn",
 14866  			"repository_selection": "rs",
 14867  			"events": [
 14868  				"e"
 14869  			],
 14870  			"single_file_paths": [
 14871  				"s"
 14872  			],
 14873  			"permissions": {
 14874  				"actions": "a",
 14875  				"administration": "ad",
 14876  				"checks": "c",
 14877  				"contents": "co",
 14878  				"content_references": "cr",
 14879  				"deployments": "d",
 14880  				"environments": "e",
 14881  				"issues": "i",
 14882  				"metadata": "md",
 14883  				"members": "m",
 14884  				"organization_administration": "oa",
 14885  				"organization_hooks": "oh",
 14886  				"organization_plan": "op",
 14887  				"organization_pre_receive_hooks": "opr",
 14888  				"organization_projects": "op",
 14889  				"organization_secrets": "os",
 14890  				"organization_self_hosted_runners": "osh",
 14891  				"organization_user_blocking": "oub",
 14892  				"packages": "pkg",
 14893  				"pages": "pg",
 14894  				"pull_requests": "pr",
 14895  				"repository_hooks": "rh",
 14896  				"repository_projects": "rp",
 14897  				"repository_pre_receive_hooks": "rprh",
 14898  				"secrets": "s",
 14899  				"secret_scanning_alerts": "ssa",
 14900  				"security_events": "se",
 14901  				"single_file": "sf",
 14902  				"statuses": "s",
 14903  				"team_discussions": "td",
 14904  				"vulnerability_alerts": "va",
 14905  				"workflows": "w"
 14906  			},
 14907  			"created_at": ` + referenceTimeStr + `,
 14908  			"updated_at": ` + referenceTimeStr + `,
 14909  			"has_multiple_single_files": false,
 14910  			"suspended_by": {
 14911  				"login": "l",
 14912  				"id": 1,
 14913  				"avatar_url": "a",
 14914  				"gravatar_id": "g",
 14915  				"name": "n",
 14916  				"company": "c",
 14917  				"blog": "b",
 14918  				"location": "l",
 14919  				"email": "e",
 14920  				"hireable": true,
 14921  				"bio": "b",
 14922  				"twitter_username": "t",
 14923  				"public_repos": 1,
 14924  				"followers": 1,
 14925  				"following": 1,
 14926  				"created_at": ` + referenceTimeStr + `,
 14927  				"suspended_at": ` + referenceTimeStr + `,
 14928  				"url": "u"
 14929  			},
 14930  			"suspended_at": ` + referenceTimeStr + `
 14931  		}
 14932  	}`
 14933  
 14934  	testJSONMarshal(t, u, want)
 14935  }
 14936  
 14937  func TestSecurityAdvisoryEvent_Marshal(t *testing.T) {
 14938  	testJSONMarshal(t, &SecurityAdvisoryEvent{}, "{}")
 14939  	u := &SecurityAdvisoryEvent{
 14940  		Action: String("published"),
 14941  		SecurityAdvisory: &SecurityAdvisory{
 14942  			GHSAID:      String("GHSA-rf4j-j272-some"),
 14943  			Summary:     String("Siuuuuuuuuu"),
 14944  			Description: String("desc"),
 14945  			Severity:    String("moderate"),
 14946  			Identifiers: []*AdvisoryIdentifier{
 14947  				{
 14948  					Value: String("GHSA-rf4j-j272-some"),
 14949  					Type:  String("GHSA"),
 14950  				},
 14951  			},
 14952  			References: []*AdvisoryReference{
 14953  				{
 14954  					URL: String("https://some-url"),
 14955  				},
 14956  			},
 14957  			PublishedAt: &Timestamp{referenceTime},
 14958  			UpdatedAt:   &Timestamp{referenceTime},
 14959  			WithdrawnAt: nil,
 14960  			Vulnerabilities: []*AdvisoryVulnerability{
 14961  				{
 14962  					Package: &VulnerabilityPackage{
 14963  						Ecosystem: String("ucl"),
 14964  						Name:      String("penaldo"),
 14965  					},
 14966  					Severity:               String("moderate"),
 14967  					VulnerableVersionRange: String(">= 2.0.0, < 2.0.2"),
 14968  					FirstPatchedVersion: &FirstPatchedVersion{
 14969  						Identifier: String("2.0.2"),
 14970  					},
 14971  				},
 14972  			},
 14973  		},
 14974  	}
 14975  
 14976  	want := `{
 14977  		"action": "published",
 14978  		"security_advisory": {
 14979  		  "ghsa_id": "GHSA-rf4j-j272-some",
 14980  		  "summary": "Siuuuuuuuuu",
 14981  		  "description": "desc",
 14982  		  "severity": "moderate",
 14983  		  "identifiers": [
 14984  			{
 14985  			  "value": "GHSA-rf4j-j272-some",
 14986  			  "type": "GHSA"
 14987  			}
 14988  		  ],
 14989  		  "references": [
 14990  			{
 14991  			  "url": "https://some-url"
 14992  			}
 14993  		  ],
 14994  		  "published_at": ` + referenceTimeStr + `,
 14995  		  "updated_at": ` + referenceTimeStr + `,
 14996  		  "withdrawn_at": null,
 14997  		  "vulnerabilities": [
 14998  			{
 14999  			  "package": {
 15000  				"ecosystem": "ucl",
 15001  				"name": "penaldo"
 15002  			  },
 15003  			  "severity": "moderate",
 15004  			  "vulnerable_version_range": ">= 2.0.0, < 2.0.2",
 15005  			  "first_patched_version": {
 15006  				"identifier": "2.0.2"
 15007  			  }
 15008  			}
 15009  		  ]
 15010  		}
 15011  	  }`
 15012  
 15013  	testJSONMarshal(t, u, want)
 15014  }
 15015  
 15016  func TestCodeScanningAlertEvent_Marshal(t *testing.T) {
 15017  	testJSONMarshal(t, &CodeScanningAlertEvent{}, "{}")
 15018  
 15019  	u := &CodeScanningAlertEvent{
 15020  		Action: String("reopened"),
 15021  		Alert: &Alert{
 15022  			Number: Int(10),
 15023  			Rule: &Rule{
 15024  				ID:              String("Style/FrozenStringLiteralComment"),
 15025  				Severity:        String("note"),
 15026  				Description:     String("desc"),
 15027  				FullDescription: String("full desc"),
 15028  				Tags:            []string{"style"},
 15029  				Help:            String("help"),
 15030  			},
 15031  			Tool: &Tool{
 15032  				Name:    String("Rubocop"),
 15033  				Version: nil,
 15034  			},
 15035  			CreatedAt: &Timestamp{referenceTime},
 15036  			UpdatedAt: &Timestamp{referenceTime},
 15037  			FixedAt:   nil,
 15038  			State:     String("open"),
 15039  			URL:       String("a"),
 15040  			HTMLURL:   String("a"),
 15041  			Instances: []*MostRecentInstance{
 15042  				{
 15043  					Ref:         String("refs/heads/main"),
 15044  					AnalysisKey: String(".github/workflows/workflow.yml:upload"),
 15045  					Environment: String("{}"),
 15046  					State:       String("open"),
 15047  				},
 15048  			},
 15049  			DismissedBy:     nil,
 15050  			DismissedAt:     nil,
 15051  			DismissedReason: nil,
 15052  		},
 15053  		Ref:       String("refs/heads/main"),
 15054  		CommitOID: String("d6e4c75c141dbacecc279b721b8bsomeSHA"),
 15055  		Repo: &Repository{
 15056  			ID:     Int64(1234234535),
 15057  			NodeID: String("MDEwOlJlcG9zaXRvcnkxODY4NT=="),
 15058  			Owner: &User{
 15059  				Login:             String("Codertocat"),
 15060  				ID:                Int64(21031067),
 15061  				NodeID:            String("MDQ6VXNlcjIxMDMxMDY3"),
 15062  				AvatarURL:         String("a"),
 15063  				GravatarID:        String(""),
 15064  				URL:               String("a"),
 15065  				HTMLURL:           String("a"),
 15066  				Type:              String("User"),
 15067  				SiteAdmin:         Bool(false),
 15068  				FollowersURL:      String("a"),
 15069  				FollowingURL:      String("a"),
 15070  				EventsURL:         String("a"),
 15071  				GistsURL:          String("a"),
 15072  				OrganizationsURL:  String("a"),
 15073  				ReceivedEventsURL: String("a"),
 15074  				ReposURL:          String("a"),
 15075  				StarredURL:        String("a"),
 15076  				SubscriptionsURL:  String("a"),
 15077  			},
 15078  			HTMLURL:          String("a"),
 15079  			Name:             String("Hello-World"),
 15080  			FullName:         String("Codertocat/Hello-World"),
 15081  			Description:      nil,
 15082  			Fork:             Bool(false),
 15083  			Homepage:         nil,
 15084  			DefaultBranch:    String("main"),
 15085  			CreatedAt:        &Timestamp{referenceTime},
 15086  			PushedAt:         &Timestamp{referenceTime},
 15087  			UpdatedAt:        &Timestamp{referenceTime},
 15088  			CloneURL:         String("a"),
 15089  			GitURL:           String("a"),
 15090  			MirrorURL:        nil,
 15091  			SSHURL:           String("a"),
 15092  			SVNURL:           String("a"),
 15093  			Language:         nil,
 15094  			ForksCount:       Int(0),
 15095  			OpenIssuesCount:  Int(2),
 15096  			OpenIssues:       Int(2),
 15097  			StargazersCount:  Int(0),
 15098  			WatchersCount:    Int(0),
 15099  			Watchers:         Int(0),
 15100  			Size:             Int(0),
 15101  			Archived:         Bool(false),
 15102  			Disabled:         Bool(false),
 15103  			License:          nil,
 15104  			Private:          Bool(false),
 15105  			HasIssues:        Bool(true),
 15106  			HasWiki:          Bool(true),
 15107  			HasPages:         Bool(true),
 15108  			HasProjects:      Bool(true),
 15109  			HasDownloads:     Bool(true),
 15110  			URL:              String("a"),
 15111  			ArchiveURL:       String("a"),
 15112  			AssigneesURL:     String("a"),
 15113  			BlobsURL:         String("a"),
 15114  			BranchesURL:      String("a"),
 15115  			CollaboratorsURL: String("a"),
 15116  			CommentsURL:      String("a"),
 15117  			CommitsURL:       String("a"),
 15118  			CompareURL:       String("a"),
 15119  			ContentsURL:      String("a"),
 15120  			ContributorsURL:  String("a"),
 15121  			DeploymentsURL:   String("a"),
 15122  			DownloadsURL:     String("a"),
 15123  			EventsURL:        String("a"),
 15124  			ForksURL:         String("a"),
 15125  			GitCommitsURL:    String("a"),
 15126  			GitRefsURL:       String("a"),
 15127  			GitTagsURL:       String("a"),
 15128  			HooksURL:         String("a"),
 15129  			IssueCommentURL:  String("a"),
 15130  			IssueEventsURL:   String("a"),
 15131  			IssuesURL:        String("a"),
 15132  			KeysURL:          String("a"),
 15133  			LabelsURL:        String("a"),
 15134  			LanguagesURL:     String("a"),
 15135  			MergesURL:        String("a"),
 15136  			MilestonesURL:    String("a"),
 15137  			NotificationsURL: String("a"),
 15138  			PullsURL:         String("a"),
 15139  			ReleasesURL:      String("a"),
 15140  			StargazersURL:    String("a"),
 15141  			StatusesURL:      String("a"),
 15142  			SubscribersURL:   String("a"),
 15143  			SubscriptionURL:  String("a"),
 15144  			TagsURL:          String("a"),
 15145  			TreesURL:         String("a"),
 15146  			TeamsURL:         String("a"),
 15147  		},
 15148  		Org: &Organization{
 15149  			Login:            String("Octocoders"),
 15150  			ID:               Int64(6),
 15151  			NodeID:           String("MDEyOk9yZ2FuaXphdGlvbjY="),
 15152  			AvatarURL:        String("a"),
 15153  			Description:      String(""),
 15154  			URL:              String("a"),
 15155  			EventsURL:        String("a"),
 15156  			HooksURL:         String("a"),
 15157  			IssuesURL:        String("a"),
 15158  			MembersURL:       String("a"),
 15159  			PublicMembersURL: String("a"),
 15160  			ReposURL:         String("a"),
 15161  		},
 15162  		Sender: &User{
 15163  			Login:             String("github"),
 15164  			ID:                Int64(9919),
 15165  			NodeID:            String("MDEyOk9yZ2FuaXphdGlvbjk5MTk="),
 15166  			AvatarURL:         String("a"),
 15167  			HTMLURL:           String("a"),
 15168  			GravatarID:        String(""),
 15169  			Type:              String("Organization"),
 15170  			SiteAdmin:         Bool(false),
 15171  			URL:               String("a"),
 15172  			EventsURL:         String("a"),
 15173  			FollowingURL:      String("a"),
 15174  			FollowersURL:      String("a"),
 15175  			GistsURL:          String("a"),
 15176  			OrganizationsURL:  String("a"),
 15177  			ReceivedEventsURL: String("a"),
 15178  			ReposURL:          String("a"),
 15179  			StarredURL:        String("a"),
 15180  			SubscriptionsURL:  String("a"),
 15181  		},
 15182  	}
 15183  
 15184  	want := `{
 15185  		"action": "reopened",
 15186  		"alert": {
 15187  		  "number": 10,
 15188  		  "created_at": ` + referenceTimeStr + `,
 15189  		  "updated_at": ` + referenceTimeStr + `,
 15190  		  "url": "a",
 15191  		  "html_url": "a",
 15192  		  "instances": [
 15193  			{
 15194  			  "ref": "refs/heads/main",
 15195  			  "analysis_key": ".github/workflows/workflow.yml:upload",
 15196  			  "environment": "{}",
 15197  			  "state": "open"
 15198  			}
 15199  		  ],
 15200  		  "state": "open",
 15201  		  "fixed_at": null,
 15202  		  "dismissed_by": null,
 15203  		  "dismissed_at": null,
 15204  		  "dismissed_reason": null,
 15205  		  "rule": {
 15206  			"id": "Style/FrozenStringLiteralComment",
 15207  			"severity": "note",
 15208  			"description": "desc",
 15209  			"full_description": "full desc",
 15210  			"tags": [
 15211  			  "style"
 15212  			],
 15213  			"help": "help"
 15214  		  },
 15215  		  "tool": {
 15216  			"name": "Rubocop",
 15217  			"version": null
 15218  		  }
 15219  		},
 15220  		"ref": "refs/heads/main",
 15221  		"commit_oid": "d6e4c75c141dbacecc279b721b8bsomeSHA",
 15222  		"repository": {
 15223  		  "id": 1234234535,
 15224  		  "node_id": "MDEwOlJlcG9zaXRvcnkxODY4NT==",
 15225  		  "name": "Hello-World",
 15226  		  "full_name": "Codertocat/Hello-World",
 15227  		  "private": false,
 15228  		  "owner": {
 15229  			"login": "Codertocat",
 15230  			"id": 21031067,
 15231  			"node_id": "MDQ6VXNlcjIxMDMxMDY3",
 15232  			"avatar_url": "a",
 15233  			"gravatar_id": "",
 15234  			"url": "a",
 15235  			"html_url": "a",
 15236  			"followers_url": "a",
 15237  			"following_url": "a",
 15238  			"gists_url": "a",
 15239  			"starred_url": "a",
 15240  			"subscriptions_url": "a",
 15241  			"organizations_url": "a",
 15242  			"repos_url": "a",
 15243  			"events_url": "a",
 15244  			"received_events_url": "a",
 15245  			"type": "User",
 15246  			"site_admin": false
 15247  		  },
 15248  		  "html_url": "a",
 15249  		  "description": null,
 15250  		  "fork": false,
 15251  		  "url": "a",
 15252  		  "forks_url": "a",
 15253  		  "keys_url": "a",
 15254  		  "collaborators_url": "a",
 15255  		  "teams_url": "a",
 15256  		  "hooks_url": "a",
 15257  		  "issue_events_url": "a",
 15258  		  "events_url": "a",
 15259  		  "assignees_url": "a",
 15260  		  "branches_url": "a",
 15261  		  "tags_url": "a",
 15262  		  "blobs_url": "a",
 15263  		  "git_tags_url": "a",
 15264  		  "git_refs_url": "a",
 15265  		  "trees_url": "a",
 15266  		  "statuses_url": "a",
 15267  		  "languages_url": "a",
 15268  		  "stargazers_url": "a",
 15269  		  "contributors_url": "a",
 15270  		  "subscribers_url": "a",
 15271  		  "subscription_url": "a",
 15272  		  "commits_url": "a",
 15273  		  "git_commits_url": "a",
 15274  		  "comments_url": "a",
 15275  		  "issue_comment_url": "a",
 15276  		  "contents_url": "a",
 15277  		  "compare_url": "a",
 15278  		  "merges_url": "a",
 15279  		  "archive_url": "a",
 15280  		  "downloads_url": "a",
 15281  		  "issues_url": "a",
 15282  		  "pulls_url": "a",
 15283  		  "milestones_url": "a",
 15284  		  "notifications_url": "a",
 15285  		  "labels_url": "a",
 15286  		  "releases_url": "a",
 15287  		  "deployments_url": "a",
 15288  		  "created_at": ` + referenceTimeStr + `,
 15289  		  "updated_at": ` + referenceTimeStr + `,
 15290  		  "pushed_at": ` + referenceTimeStr + `,
 15291  		  "git_url": "a",
 15292  		  "ssh_url": "a",
 15293  		  "clone_url": "a",
 15294  		  "svn_url": "a",
 15295  		  "homepage": null,
 15296  		  "size": 0,
 15297  		  "stargazers_count": 0,
 15298  		  "watchers_count": 0,
 15299  		  "language": null,
 15300  		  "has_issues": true,
 15301  		  "has_projects": true,
 15302  		  "has_downloads": true,
 15303  		  "has_wiki": true,
 15304  		  "has_pages": true,
 15305  		  "forks_count": 0,
 15306  		  "mirror_url": null,
 15307  		  "archived": false,
 15308  		  "disabled": false,
 15309  		  "open_issues_count": 2,
 15310  		  "license": null,
 15311  		  "forks": 0,
 15312  		  "open_issues": 2,
 15313  		  "watchers": 0,
 15314  		  "default_branch": "main"
 15315  		},
 15316  		"organization": {
 15317  		  "login": "Octocoders",
 15318  		  "id": 6,
 15319  		  "node_id": "MDEyOk9yZ2FuaXphdGlvbjY=",
 15320  		  "url": "a",
 15321  		  "repos_url": "a",
 15322  		  "events_url": "a",
 15323  		  "hooks_url": "a",
 15324  		  "issues_url": "a",
 15325  		  "members_url": "a",
 15326  		  "public_members_url": "a",
 15327  		  "avatar_url": "a",
 15328  		  "description": ""
 15329  		},
 15330  		"sender": {
 15331  		  "login": "github",
 15332  		  "id": 9919,
 15333  		  "node_id": "MDEyOk9yZ2FuaXphdGlvbjk5MTk=",
 15334  		  "avatar_url": "a",
 15335  		  "gravatar_id": "",
 15336  		  "url": "a",
 15337  		  "html_url": "a",
 15338  		  "followers_url": "a",
 15339  		  "following_url": "a",
 15340  		  "gists_url": "a",
 15341  		  "starred_url": "a",
 15342  		  "subscriptions_url": "a",
 15343  		  "organizations_url": "a",
 15344  		  "repos_url": "a",
 15345  		  "events_url": "a",
 15346  		  "received_events_url": "a",
 15347  		  "type": "Organization",
 15348  		  "site_admin": false
 15349  		}
 15350  	  }`
 15351  
 15352  	testJSONMarshal(t, u, want)
 15353  }