github.com/google/go-github/v50@v50.2.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 TestProjectChange_Marshal_NameChange(t *testing.T) {
   108  	testJSONMarshal(t, &ProjectChange{}, "{}")
   109  
   110  	u := &ProjectChange{
   111  		Name: &ProjectName{From: String("NameFrom")},
   112  		Body: nil,
   113  	}
   114  
   115  	want := `{
   116  		"name": {
   117  			"from": "NameFrom"
   118  		  }
   119  	}`
   120  
   121  	testJSONMarshal(t, u, want)
   122  }
   123  
   124  func TestProjectChange_Marshal_BodyChange(t *testing.T) {
   125  	testJSONMarshal(t, &ProjectChange{}, "{}")
   126  
   127  	u := &ProjectChange{
   128  		Name: nil,
   129  		Body: &ProjectBody{From: String("BodyFrom")},
   130  	}
   131  
   132  	want := `{
   133  		"body": {
   134  			"from": "BodyFrom"
   135  		  }
   136  	}`
   137  
   138  	testJSONMarshal(t, u, want)
   139  }
   140  
   141  func TestProjectCardChange_Marshal_NoteChange(t *testing.T) {
   142  	testJSONMarshal(t, &ProjectCardChange{}, "{}")
   143  
   144  	u := &ProjectCardChange{
   145  		Note: &ProjectCardNote{From: String("NoteFrom")},
   146  	}
   147  
   148  	want := `{
   149  		"note": {
   150  			"from": "NoteFrom"
   151  		  }
   152  	}`
   153  
   154  	testJSONMarshal(t, u, want)
   155  }
   156  
   157  func TestProjectColumnChange_Marshal_NameChange(t *testing.T) {
   158  	testJSONMarshal(t, &ProjectColumnChange{}, "{}")
   159  
   160  	u := &ProjectColumnChange{
   161  		Name: &ProjectColumnName{From: String("NameFrom")},
   162  	}
   163  
   164  	want := `{
   165  		"name": {
   166  			"from": "NameFrom"
   167  		  }
   168  	}`
   169  
   170  	testJSONMarshal(t, u, want)
   171  }
   172  
   173  func TestTeamAddEvent_Marshal(t *testing.T) {
   174  	testJSONMarshal(t, &TeamAddEvent{}, "{}")
   175  
   176  	u := &TeamAddEvent{
   177  		Team: &Team{
   178  			ID:              Int64(1),
   179  			NodeID:          String("n"),
   180  			Name:            String("n"),
   181  			Description:     String("d"),
   182  			URL:             String("u"),
   183  			Slug:            String("s"),
   184  			Permission:      String("p"),
   185  			Privacy:         String("p"),
   186  			MembersCount:    Int(1),
   187  			ReposCount:      Int(1),
   188  			MembersURL:      String("m"),
   189  			RepositoriesURL: String("r"),
   190  			Organization: &Organization{
   191  				Login:     String("l"),
   192  				ID:        Int64(1),
   193  				NodeID:    String("n"),
   194  				AvatarURL: String("a"),
   195  				HTMLURL:   String("h"),
   196  				Name:      String("n"),
   197  				Company:   String("c"),
   198  				Blog:      String("b"),
   199  				Location:  String("l"),
   200  				Email:     String("e"),
   201  			},
   202  			Parent: &Team{
   203  				ID:           Int64(1),
   204  				NodeID:       String("n"),
   205  				Name:         String("n"),
   206  				Description:  String("d"),
   207  				URL:          String("u"),
   208  				Slug:         String("s"),
   209  				Permission:   String("p"),
   210  				Privacy:      String("p"),
   211  				MembersCount: Int(1),
   212  				ReposCount:   Int(1),
   213  			},
   214  			LDAPDN: String("l"),
   215  		},
   216  		Repo: &Repository{
   217  			ID:   Int64(1),
   218  			URL:  String("s"),
   219  			Name: String("n"),
   220  		},
   221  		Org: &Organization{
   222  			BillingEmail:                         String("be"),
   223  			Blog:                                 String("b"),
   224  			Company:                              String("c"),
   225  			Email:                                String("e"),
   226  			TwitterUsername:                      String("tu"),
   227  			Location:                             String("loc"),
   228  			Name:                                 String("n"),
   229  			Description:                          String("d"),
   230  			IsVerified:                           Bool(true),
   231  			HasOrganizationProjects:              Bool(true),
   232  			HasRepositoryProjects:                Bool(true),
   233  			DefaultRepoPermission:                String("drp"),
   234  			MembersCanCreateRepos:                Bool(true),
   235  			MembersCanCreateInternalRepos:        Bool(true),
   236  			MembersCanCreatePrivateRepos:         Bool(true),
   237  			MembersCanCreatePublicRepos:          Bool(false),
   238  			MembersAllowedRepositoryCreationType: String("marct"),
   239  			MembersCanCreatePages:                Bool(true),
   240  			MembersCanCreatePublicPages:          Bool(false),
   241  			MembersCanCreatePrivatePages:         Bool(true),
   242  		},
   243  		Sender: &User{
   244  			Login:     String("l"),
   245  			ID:        Int64(1),
   246  			NodeID:    String("n"),
   247  			URL:       String("u"),
   248  			ReposURL:  String("r"),
   249  			EventsURL: String("e"),
   250  			AvatarURL: String("a"),
   251  		},
   252  		Installation: &Installation{
   253  			ID:       Int64(1),
   254  			NodeID:   String("nid"),
   255  			AppID:    Int64(1),
   256  			AppSlug:  String("as"),
   257  			TargetID: Int64(1),
   258  			Account: &User{
   259  				Login:           String("l"),
   260  				ID:              Int64(1),
   261  				URL:             String("u"),
   262  				AvatarURL:       String("a"),
   263  				GravatarID:      String("g"),
   264  				Name:            String("n"),
   265  				Company:         String("c"),
   266  				Blog:            String("b"),
   267  				Location:        String("l"),
   268  				Email:           String("e"),
   269  				Hireable:        Bool(true),
   270  				Bio:             String("b"),
   271  				TwitterUsername: String("t"),
   272  				PublicRepos:     Int(1),
   273  				Followers:       Int(1),
   274  				Following:       Int(1),
   275  				CreatedAt:       &Timestamp{referenceTime},
   276  				SuspendedAt:     &Timestamp{referenceTime},
   277  			},
   278  			AccessTokensURL:     String("atu"),
   279  			RepositoriesURL:     String("ru"),
   280  			HTMLURL:             String("hu"),
   281  			TargetType:          String("tt"),
   282  			SingleFileName:      String("sfn"),
   283  			RepositorySelection: String("rs"),
   284  			Events:              []string{"e"},
   285  			SingleFilePaths:     []string{"s"},
   286  			Permissions: &InstallationPermissions{
   287  				Actions:                       String("a"),
   288  				Administration:                String("ad"),
   289  				Checks:                        String("c"),
   290  				Contents:                      String("co"),
   291  				ContentReferences:             String("cr"),
   292  				Deployments:                   String("d"),
   293  				Environments:                  String("e"),
   294  				Issues:                        String("i"),
   295  				Metadata:                      String("md"),
   296  				Members:                       String("m"),
   297  				OrganizationAdministration:    String("oa"),
   298  				OrganizationHooks:             String("oh"),
   299  				OrganizationPlan:              String("op"),
   300  				OrganizationPreReceiveHooks:   String("opr"),
   301  				OrganizationProjects:          String("op"),
   302  				OrganizationSecrets:           String("os"),
   303  				OrganizationSelfHostedRunners: String("osh"),
   304  				OrganizationUserBlocking:      String("oub"),
   305  				Packages:                      String("pkg"),
   306  				Pages:                         String("pg"),
   307  				PullRequests:                  String("pr"),
   308  				RepositoryHooks:               String("rh"),
   309  				RepositoryProjects:            String("rp"),
   310  				RepositoryPreReceiveHooks:     String("rprh"),
   311  				Secrets:                       String("s"),
   312  				SecretScanningAlerts:          String("ssa"),
   313  				SecurityEvents:                String("se"),
   314  				SingleFile:                    String("sf"),
   315  				Statuses:                      String("s"),
   316  				TeamDiscussions:               String("td"),
   317  				VulnerabilityAlerts:           String("va"),
   318  				Workflows:                     String("w"),
   319  			},
   320  			CreatedAt:              &Timestamp{referenceTime},
   321  			UpdatedAt:              &Timestamp{referenceTime},
   322  			HasMultipleSingleFiles: Bool(false),
   323  			SuspendedBy: &User{
   324  				Login:           String("l"),
   325  				ID:              Int64(1),
   326  				URL:             String("u"),
   327  				AvatarURL:       String("a"),
   328  				GravatarID:      String("g"),
   329  				Name:            String("n"),
   330  				Company:         String("c"),
   331  				Blog:            String("b"),
   332  				Location:        String("l"),
   333  				Email:           String("e"),
   334  				Hireable:        Bool(true),
   335  				Bio:             String("b"),
   336  				TwitterUsername: String("t"),
   337  				PublicRepos:     Int(1),
   338  				Followers:       Int(1),
   339  				Following:       Int(1),
   340  				CreatedAt:       &Timestamp{referenceTime},
   341  				SuspendedAt:     &Timestamp{referenceTime},
   342  			},
   343  			SuspendedAt: &Timestamp{referenceTime},
   344  		},
   345  	}
   346  
   347  	want := `{
   348  		"team": {
   349  			"id": 1,
   350  			"node_id": "n",
   351  			"name": "n",
   352  			"description": "d",
   353  			"url": "u",
   354  			"slug": "s",
   355  			"permission": "p",
   356  			"privacy": "p",
   357  			"members_count": 1,
   358  			"repos_count": 1,
   359  			"organization": {
   360  				"login": "l",
   361  				"id": 1,
   362  				"node_id": "n",
   363  				"avatar_url": "a",
   364  				"html_url": "h",
   365  				"name": "n",
   366  				"company": "c",
   367  				"blog": "b",
   368  				"location": "l",
   369  				"email": "e"
   370  			},
   371  			"members_url": "m",
   372  			"repositories_url": "r",
   373  			"parent": {
   374  				"id": 1,
   375  				"node_id": "n",
   376  				"name": "n",
   377  				"description": "d",
   378  				"url": "u",
   379  				"slug": "s",
   380  				"permission": "p",
   381  				"privacy": "p",
   382  				"members_count": 1,
   383  				"repos_count": 1
   384  			},
   385  			"ldap_dn": "l"
   386  		},
   387  		"repository": {
   388  			"id": 1,
   389  			"name": "n",
   390  			"url": "s"
   391  		},
   392  		"organization": {
   393  			"name": "n",
   394  			"company": "c",
   395  			"blog": "b",
   396  			"location": "loc",
   397  			"email": "e",
   398  			"twitter_username": "tu",
   399  			"description": "d",
   400  			"billing_email": "be",
   401  			"is_verified": true,
   402  			"has_organization_projects": true,
   403  			"has_repository_projects": true,
   404  			"default_repository_permission": "drp",
   405  			"members_can_create_repositories": true,
   406  			"members_can_create_public_repositories": false,
   407  			"members_can_create_private_repositories": true,
   408  			"members_can_create_internal_repositories": true,
   409  			"members_allowed_repository_creation_type": "marct",
   410  			"members_can_create_pages": true,
   411  			"members_can_create_public_pages": false,
   412  			"members_can_create_private_pages": true
   413  		},
   414  		"sender": {
   415  			"login": "l",
   416  			"id": 1,
   417  			"node_id": "n",
   418  			"avatar_url": "a",
   419  			"url": "u",
   420  			"events_url": "e",
   421  			"repos_url": "r"
   422  		},
   423  		"installation": {
   424  			"id": 1,
   425  			"node_id": "nid",
   426  			"app_id": 1,
   427  			"app_slug": "as",
   428  			"target_id": 1,
   429  			"account": {
   430  				"login": "l",
   431  				"id": 1,
   432  				"avatar_url": "a",
   433  				"gravatar_id": "g",
   434  				"name": "n",
   435  				"company": "c",
   436  				"blog": "b",
   437  				"location": "l",
   438  				"email": "e",
   439  				"hireable": true,
   440  				"bio": "b",
   441  				"twitter_username": "t",
   442  				"public_repos": 1,
   443  				"followers": 1,
   444  				"following": 1,
   445  				"created_at": ` + referenceTimeStr + `,
   446  				"suspended_at": ` + referenceTimeStr + `,
   447  				"url": "u"
   448  			},
   449  			"access_tokens_url": "atu",
   450  			"repositories_url": "ru",
   451  			"html_url": "hu",
   452  			"target_type": "tt",
   453  			"single_file_name": "sfn",
   454  			"repository_selection": "rs",
   455  			"events": [
   456  				"e"
   457  			],
   458  			"single_file_paths": [
   459  				"s"
   460  			],
   461  			"permissions": {
   462  				"actions": "a",
   463  				"administration": "ad",
   464  				"checks": "c",
   465  				"contents": "co",
   466  				"content_references": "cr",
   467  				"deployments": "d",
   468  				"environments": "e",
   469  				"issues": "i",
   470  				"metadata": "md",
   471  				"members": "m",
   472  				"organization_administration": "oa",
   473  				"organization_hooks": "oh",
   474  				"organization_plan": "op",
   475  				"organization_pre_receive_hooks": "opr",
   476  				"organization_projects": "op",
   477  				"organization_secrets": "os",
   478  				"organization_self_hosted_runners": "osh",
   479  				"organization_user_blocking": "oub",
   480  				"packages": "pkg",
   481  				"pages": "pg",
   482  				"pull_requests": "pr",
   483  				"repository_hooks": "rh",
   484  				"repository_projects": "rp",
   485  				"repository_pre_receive_hooks": "rprh",
   486  				"secrets": "s",
   487  				"secret_scanning_alerts": "ssa",
   488  				"security_events": "se",
   489  				"single_file": "sf",
   490  				"statuses": "s",
   491  				"team_discussions": "td",
   492  				"vulnerability_alerts": "va",
   493  				"workflows": "w"
   494  			},
   495  			"created_at": ` + referenceTimeStr + `,
   496  			"updated_at": ` + referenceTimeStr + `,
   497  			"has_multiple_single_files": false,
   498  			"suspended_by": {
   499  				"login": "l",
   500  				"id": 1,
   501  				"avatar_url": "a",
   502  				"gravatar_id": "g",
   503  				"name": "n",
   504  				"company": "c",
   505  				"blog": "b",
   506  				"location": "l",
   507  				"email": "e",
   508  				"hireable": true,
   509  				"bio": "b",
   510  				"twitter_username": "t",
   511  				"public_repos": 1,
   512  				"followers": 1,
   513  				"following": 1,
   514  				"created_at": ` + referenceTimeStr + `,
   515  				"suspended_at": ` + referenceTimeStr + `,
   516  				"url": "u"
   517  			},
   518  			"suspended_at": ` + referenceTimeStr + `
   519  		}
   520  	}`
   521  
   522  	testJSONMarshal(t, u, want)
   523  }
   524  
   525  func TestStarEvent_Marshal(t *testing.T) {
   526  	testJSONMarshal(t, &StarEvent{}, "{}")
   527  
   528  	u := &StarEvent{
   529  		Action:    String("a"),
   530  		StarredAt: &Timestamp{referenceTime},
   531  		Org: &Organization{
   532  			BillingEmail:                         String("be"),
   533  			Blog:                                 String("b"),
   534  			Company:                              String("c"),
   535  			Email:                                String("e"),
   536  			TwitterUsername:                      String("tu"),
   537  			Location:                             String("loc"),
   538  			Name:                                 String("n"),
   539  			Description:                          String("d"),
   540  			IsVerified:                           Bool(true),
   541  			HasOrganizationProjects:              Bool(true),
   542  			HasRepositoryProjects:                Bool(true),
   543  			DefaultRepoPermission:                String("drp"),
   544  			MembersCanCreateRepos:                Bool(true),
   545  			MembersCanCreateInternalRepos:        Bool(true),
   546  			MembersCanCreatePrivateRepos:         Bool(true),
   547  			MembersCanCreatePublicRepos:          Bool(false),
   548  			MembersAllowedRepositoryCreationType: String("marct"),
   549  			MembersCanCreatePages:                Bool(true),
   550  			MembersCanCreatePublicPages:          Bool(false),
   551  			MembersCanCreatePrivatePages:         Bool(true),
   552  		},
   553  		Repo: &Repository{
   554  			ID:   Int64(1),
   555  			URL:  String("s"),
   556  			Name: String("n"),
   557  		},
   558  		Sender: &User{
   559  			Login:     String("l"),
   560  			ID:        Int64(1),
   561  			NodeID:    String("n"),
   562  			URL:       String("u"),
   563  			ReposURL:  String("r"),
   564  			EventsURL: String("e"),
   565  			AvatarURL: String("a"),
   566  		},
   567  	}
   568  
   569  	want := `{
   570  		"action": "a",
   571  		"starred_at": ` + referenceTimeStr + `,
   572  		"organization": {
   573  			"name": "n",
   574  			"company": "c",
   575  			"blog": "b",
   576  			"location": "loc",
   577  			"email": "e",
   578  			"twitter_username": "tu",
   579  			"description": "d",
   580  			"billing_email": "be",
   581  			"is_verified": true,
   582  			"has_organization_projects": true,
   583  			"has_repository_projects": true,
   584  			"default_repository_permission": "drp",
   585  			"members_can_create_repositories": true,
   586  			"members_can_create_public_repositories": false,
   587  			"members_can_create_private_repositories": true,
   588  			"members_can_create_internal_repositories": true,
   589  			"members_allowed_repository_creation_type": "marct",
   590  			"members_can_create_pages": true,
   591  			"members_can_create_public_pages": false,
   592  			"members_can_create_private_pages": true
   593  		},
   594  		"repository": {
   595  			"id": 1,
   596  			"name": "n",
   597  			"url": "s"
   598  		},
   599  		"sender": {
   600  			"login": "l",
   601  			"id": 1,
   602  			"node_id": "n",
   603  			"avatar_url": "a",
   604  			"url": "u",
   605  			"events_url": "e",
   606  			"repos_url": "r"
   607  		}
   608  	}`
   609  
   610  	testJSONMarshal(t, u, want)
   611  }
   612  
   613  func TestTeamEvent_Marshal(t *testing.T) {
   614  	testJSONMarshal(t, &TeamEvent{}, "{}")
   615  
   616  	u := &TeamEvent{
   617  		Action: String("a"),
   618  		Team: &Team{
   619  			ID:              Int64(1),
   620  			NodeID:          String("n"),
   621  			Name:            String("n"),
   622  			Description:     String("d"),
   623  			URL:             String("u"),
   624  			Slug:            String("s"),
   625  			Permission:      String("p"),
   626  			Privacy:         String("p"),
   627  			MembersCount:    Int(1),
   628  			ReposCount:      Int(1),
   629  			MembersURL:      String("m"),
   630  			RepositoriesURL: String("r"),
   631  			Organization: &Organization{
   632  				Login:     String("l"),
   633  				ID:        Int64(1),
   634  				NodeID:    String("n"),
   635  				AvatarURL: String("a"),
   636  				HTMLURL:   String("h"),
   637  				Name:      String("n"),
   638  				Company:   String("c"),
   639  				Blog:      String("b"),
   640  				Location:  String("l"),
   641  				Email:     String("e"),
   642  			},
   643  			Parent: &Team{
   644  				ID:           Int64(1),
   645  				NodeID:       String("n"),
   646  				Name:         String("n"),
   647  				Description:  String("d"),
   648  				URL:          String("u"),
   649  				Slug:         String("s"),
   650  				Permission:   String("p"),
   651  				Privacy:      String("p"),
   652  				MembersCount: Int(1),
   653  				ReposCount:   Int(1),
   654  			},
   655  			LDAPDN: String("l"),
   656  		},
   657  		Changes: &TeamChange{
   658  			Description: &TeamDescription{
   659  				From: String("from"),
   660  			},
   661  			Name: &TeamName{
   662  				From: String("from"),
   663  			},
   664  			Privacy: &TeamPrivacy{
   665  				From: String("from"),
   666  			},
   667  			Repository: &TeamRepository{
   668  				Permissions: &TeamPermissions{
   669  					From: &TeamPermissionsFrom{
   670  						Admin: Bool(true),
   671  						Pull:  Bool(true),
   672  						Push:  Bool(true),
   673  					},
   674  				},
   675  			},
   676  		},
   677  		Repo: &Repository{
   678  			ID:   Int64(1),
   679  			URL:  String("s"),
   680  			Name: String("n"),
   681  		},
   682  		Org: &Organization{
   683  			BillingEmail:                         String("be"),
   684  			Blog:                                 String("b"),
   685  			Company:                              String("c"),
   686  			Email:                                String("e"),
   687  			TwitterUsername:                      String("tu"),
   688  			Location:                             String("loc"),
   689  			Name:                                 String("n"),
   690  			Description:                          String("d"),
   691  			IsVerified:                           Bool(true),
   692  			HasOrganizationProjects:              Bool(true),
   693  			HasRepositoryProjects:                Bool(true),
   694  			DefaultRepoPermission:                String("drp"),
   695  			MembersCanCreateRepos:                Bool(true),
   696  			MembersCanCreateInternalRepos:        Bool(true),
   697  			MembersCanCreatePrivateRepos:         Bool(true),
   698  			MembersCanCreatePublicRepos:          Bool(false),
   699  			MembersAllowedRepositoryCreationType: String("marct"),
   700  			MembersCanCreatePages:                Bool(true),
   701  			MembersCanCreatePublicPages:          Bool(false),
   702  			MembersCanCreatePrivatePages:         Bool(true),
   703  		},
   704  		Sender: &User{
   705  			Login:     String("l"),
   706  			ID:        Int64(1),
   707  			NodeID:    String("n"),
   708  			URL:       String("u"),
   709  			ReposURL:  String("r"),
   710  			EventsURL: String("e"),
   711  			AvatarURL: String("a"),
   712  		},
   713  		Installation: &Installation{
   714  			ID:       Int64(1),
   715  			NodeID:   String("nid"),
   716  			AppID:    Int64(1),
   717  			AppSlug:  String("as"),
   718  			TargetID: Int64(1),
   719  			Account: &User{
   720  				Login:           String("l"),
   721  				ID:              Int64(1),
   722  				URL:             String("u"),
   723  				AvatarURL:       String("a"),
   724  				GravatarID:      String("g"),
   725  				Name:            String("n"),
   726  				Company:         String("c"),
   727  				Blog:            String("b"),
   728  				Location:        String("l"),
   729  				Email:           String("e"),
   730  				Hireable:        Bool(true),
   731  				Bio:             String("b"),
   732  				TwitterUsername: String("t"),
   733  				PublicRepos:     Int(1),
   734  				Followers:       Int(1),
   735  				Following:       Int(1),
   736  				CreatedAt:       &Timestamp{referenceTime},
   737  				SuspendedAt:     &Timestamp{referenceTime},
   738  			},
   739  			AccessTokensURL:     String("atu"),
   740  			RepositoriesURL:     String("ru"),
   741  			HTMLURL:             String("hu"),
   742  			TargetType:          String("tt"),
   743  			SingleFileName:      String("sfn"),
   744  			RepositorySelection: String("rs"),
   745  			Events:              []string{"e"},
   746  			SingleFilePaths:     []string{"s"},
   747  			Permissions: &InstallationPermissions{
   748  				Actions:                       String("a"),
   749  				Administration:                String("ad"),
   750  				Checks:                        String("c"),
   751  				Contents:                      String("co"),
   752  				ContentReferences:             String("cr"),
   753  				Deployments:                   String("d"),
   754  				Environments:                  String("e"),
   755  				Issues:                        String("i"),
   756  				Metadata:                      String("md"),
   757  				Members:                       String("m"),
   758  				OrganizationAdministration:    String("oa"),
   759  				OrganizationHooks:             String("oh"),
   760  				OrganizationPlan:              String("op"),
   761  				OrganizationPreReceiveHooks:   String("opr"),
   762  				OrganizationProjects:          String("op"),
   763  				OrganizationSecrets:           String("os"),
   764  				OrganizationSelfHostedRunners: String("osh"),
   765  				OrganizationUserBlocking:      String("oub"),
   766  				Packages:                      String("pkg"),
   767  				Pages:                         String("pg"),
   768  				PullRequests:                  String("pr"),
   769  				RepositoryHooks:               String("rh"),
   770  				RepositoryProjects:            String("rp"),
   771  				RepositoryPreReceiveHooks:     String("rprh"),
   772  				Secrets:                       String("s"),
   773  				SecretScanningAlerts:          String("ssa"),
   774  				SecurityEvents:                String("se"),
   775  				SingleFile:                    String("sf"),
   776  				Statuses:                      String("s"),
   777  				TeamDiscussions:               String("td"),
   778  				VulnerabilityAlerts:           String("va"),
   779  				Workflows:                     String("w"),
   780  			},
   781  			CreatedAt:              &Timestamp{referenceTime},
   782  			UpdatedAt:              &Timestamp{referenceTime},
   783  			HasMultipleSingleFiles: Bool(false),
   784  			SuspendedBy: &User{
   785  				Login:           String("l"),
   786  				ID:              Int64(1),
   787  				URL:             String("u"),
   788  				AvatarURL:       String("a"),
   789  				GravatarID:      String("g"),
   790  				Name:            String("n"),
   791  				Company:         String("c"),
   792  				Blog:            String("b"),
   793  				Location:        String("l"),
   794  				Email:           String("e"),
   795  				Hireable:        Bool(true),
   796  				Bio:             String("b"),
   797  				TwitterUsername: String("t"),
   798  				PublicRepos:     Int(1),
   799  				Followers:       Int(1),
   800  				Following:       Int(1),
   801  				CreatedAt:       &Timestamp{referenceTime},
   802  				SuspendedAt:     &Timestamp{referenceTime},
   803  			},
   804  			SuspendedAt: &Timestamp{referenceTime},
   805  		},
   806  	}
   807  
   808  	want := `{
   809  		"action": "a",
   810  		"team": {
   811  			"id": 1,
   812  			"node_id": "n",
   813  			"name": "n",
   814  			"description": "d",
   815  			"url": "u",
   816  			"slug": "s",
   817  			"permission": "p",
   818  			"privacy": "p",
   819  			"members_count": 1,
   820  			"repos_count": 1,
   821  			"organization": {
   822  				"login": "l",
   823  				"id": 1,
   824  				"node_id": "n",
   825  				"avatar_url": "a",
   826  				"html_url": "h",
   827  				"name": "n",
   828  				"company": "c",
   829  				"blog": "b",
   830  				"location": "l",
   831  				"email": "e"
   832  			},
   833  			"members_url": "m",
   834  			"repositories_url": "r",
   835  			"parent": {
   836  				"id": 1,
   837  				"node_id": "n",
   838  				"name": "n",
   839  				"description": "d",
   840  				"url": "u",
   841  				"slug": "s",
   842  				"permission": "p",
   843  				"privacy": "p",
   844  				"members_count": 1,
   845  				"repos_count": 1
   846  			},
   847  			"ldap_dn": "l"
   848  		},
   849  		"changes": {
   850  			"description": {
   851  				"from": "from"
   852  			},
   853  			"name": {
   854  				"from": "from"
   855  			},
   856  			"privacy": {
   857  				"from": "from"
   858  			},
   859  			"repository": {
   860  				"permissions": {
   861  					"from": {
   862  						"admin": true,
   863  						"pull": true,
   864  						"push": true
   865  					}
   866  				}
   867  			}
   868  		},
   869  		"repository": {
   870  			"id": 1,
   871  			"name": "n",
   872  			"url": "s"
   873  		},
   874  		"organization": {
   875  			"name": "n",
   876  			"company": "c",
   877  			"blog": "b",
   878  			"location": "loc",
   879  			"email": "e",
   880  			"twitter_username": "tu",
   881  			"description": "d",
   882  			"billing_email": "be",
   883  			"is_verified": true,
   884  			"has_organization_projects": true,
   885  			"has_repository_projects": true,
   886  			"default_repository_permission": "drp",
   887  			"members_can_create_repositories": true,
   888  			"members_can_create_public_repositories": false,
   889  			"members_can_create_private_repositories": true,
   890  			"members_can_create_internal_repositories": true,
   891  			"members_allowed_repository_creation_type": "marct",
   892  			"members_can_create_pages": true,
   893  			"members_can_create_public_pages": false,
   894  			"members_can_create_private_pages": true
   895  		},
   896  		"sender": {
   897  			"login": "l",
   898  			"id": 1,
   899  			"node_id": "n",
   900  			"avatar_url": "a",
   901  			"url": "u",
   902  			"events_url": "e",
   903  			"repos_url": "r"
   904  		},
   905  		"installation": {
   906  			"id": 1,
   907  			"node_id": "nid",
   908  			"app_id": 1,
   909  			"app_slug": "as",
   910  			"target_id": 1,
   911  			"account": {
   912  				"login": "l",
   913  				"id": 1,
   914  				"avatar_url": "a",
   915  				"gravatar_id": "g",
   916  				"name": "n",
   917  				"company": "c",
   918  				"blog": "b",
   919  				"location": "l",
   920  				"email": "e",
   921  				"hireable": true,
   922  				"bio": "b",
   923  				"twitter_username": "t",
   924  				"public_repos": 1,
   925  				"followers": 1,
   926  				"following": 1,
   927  				"created_at": ` + referenceTimeStr + `,
   928  				"suspended_at": ` + referenceTimeStr + `,
   929  				"url": "u"
   930  			},
   931  			"access_tokens_url": "atu",
   932  			"repositories_url": "ru",
   933  			"html_url": "hu",
   934  			"target_type": "tt",
   935  			"single_file_name": "sfn",
   936  			"repository_selection": "rs",
   937  			"events": [
   938  				"e"
   939  			],
   940  			"single_file_paths": [
   941  				"s"
   942  			],
   943  			"permissions": {
   944  				"actions": "a",
   945  				"administration": "ad",
   946  				"checks": "c",
   947  				"contents": "co",
   948  				"content_references": "cr",
   949  				"deployments": "d",
   950  				"environments": "e",
   951  				"issues": "i",
   952  				"metadata": "md",
   953  				"members": "m",
   954  				"organization_administration": "oa",
   955  				"organization_hooks": "oh",
   956  				"organization_plan": "op",
   957  				"organization_pre_receive_hooks": "opr",
   958  				"organization_projects": "op",
   959  				"organization_secrets": "os",
   960  				"organization_self_hosted_runners": "osh",
   961  				"organization_user_blocking": "oub",
   962  				"packages": "pkg",
   963  				"pages": "pg",
   964  				"pull_requests": "pr",
   965  				"repository_hooks": "rh",
   966  				"repository_projects": "rp",
   967  				"repository_pre_receive_hooks": "rprh",
   968  				"secrets": "s",
   969  				"secret_scanning_alerts": "ssa",
   970  				"security_events": "se",
   971  				"single_file": "sf",
   972  				"statuses": "s",
   973  				"team_discussions": "td",
   974  				"vulnerability_alerts": "va",
   975  				"workflows": "w"
   976  			},
   977  			"created_at": ` + referenceTimeStr + `,
   978  			"updated_at": ` + referenceTimeStr + `,
   979  			"has_multiple_single_files": false,
   980  			"suspended_by": {
   981  				"login": "l",
   982  				"id": 1,
   983  				"avatar_url": "a",
   984  				"gravatar_id": "g",
   985  				"name": "n",
   986  				"company": "c",
   987  				"blog": "b",
   988  				"location": "l",
   989  				"email": "e",
   990  				"hireable": true,
   991  				"bio": "b",
   992  				"twitter_username": "t",
   993  				"public_repos": 1,
   994  				"followers": 1,
   995  				"following": 1,
   996  				"created_at": ` + referenceTimeStr + `,
   997  				"suspended_at": ` + referenceTimeStr + `,
   998  				"url": "u"
   999  			},
  1000  			"suspended_at": ` + referenceTimeStr + `
  1001  		}
  1002  	}`
  1003  
  1004  	testJSONMarshal(t, u, want)
  1005  }
  1006  
  1007  func TestInstallationRepositoriesEvent_Marshal(t *testing.T) {
  1008  	testJSONMarshal(t, &InstallationRepositoriesEvent{}, "{}")
  1009  
  1010  	u := &InstallationRepositoriesEvent{
  1011  		Action: String("a"),
  1012  		RepositoriesAdded: []*Repository{
  1013  			{
  1014  				ID:   Int64(1),
  1015  				URL:  String("s"),
  1016  				Name: String("n"),
  1017  			},
  1018  		},
  1019  		RepositoriesRemoved: []*Repository{
  1020  			{
  1021  				ID:   Int64(1),
  1022  				URL:  String("s"),
  1023  				Name: String("n"),
  1024  			},
  1025  		},
  1026  		RepositorySelection: String("rs"),
  1027  		Sender: &User{
  1028  			Login:     String("l"),
  1029  			ID:        Int64(1),
  1030  			NodeID:    String("n"),
  1031  			URL:       String("u"),
  1032  			ReposURL:  String("r"),
  1033  			EventsURL: String("e"),
  1034  			AvatarURL: String("a"),
  1035  		},
  1036  		Installation: &Installation{
  1037  			ID:       Int64(1),
  1038  			NodeID:   String("nid"),
  1039  			AppID:    Int64(1),
  1040  			AppSlug:  String("as"),
  1041  			TargetID: Int64(1),
  1042  			Account: &User{
  1043  				Login:           String("l"),
  1044  				ID:              Int64(1),
  1045  				URL:             String("u"),
  1046  				AvatarURL:       String("a"),
  1047  				GravatarID:      String("g"),
  1048  				Name:            String("n"),
  1049  				Company:         String("c"),
  1050  				Blog:            String("b"),
  1051  				Location:        String("l"),
  1052  				Email:           String("e"),
  1053  				Hireable:        Bool(true),
  1054  				Bio:             String("b"),
  1055  				TwitterUsername: String("t"),
  1056  				PublicRepos:     Int(1),
  1057  				Followers:       Int(1),
  1058  				Following:       Int(1),
  1059  				CreatedAt:       &Timestamp{referenceTime},
  1060  				SuspendedAt:     &Timestamp{referenceTime},
  1061  			},
  1062  			AccessTokensURL:     String("atu"),
  1063  			RepositoriesURL:     String("ru"),
  1064  			HTMLURL:             String("hu"),
  1065  			TargetType:          String("tt"),
  1066  			SingleFileName:      String("sfn"),
  1067  			RepositorySelection: String("rs"),
  1068  			Events:              []string{"e"},
  1069  			SingleFilePaths:     []string{"s"},
  1070  			Permissions: &InstallationPermissions{
  1071  				Actions:                       String("a"),
  1072  				Administration:                String("ad"),
  1073  				Checks:                        String("c"),
  1074  				Contents:                      String("co"),
  1075  				ContentReferences:             String("cr"),
  1076  				Deployments:                   String("d"),
  1077  				Environments:                  String("e"),
  1078  				Issues:                        String("i"),
  1079  				Metadata:                      String("md"),
  1080  				Members:                       String("m"),
  1081  				OrganizationAdministration:    String("oa"),
  1082  				OrganizationHooks:             String("oh"),
  1083  				OrganizationPlan:              String("op"),
  1084  				OrganizationPreReceiveHooks:   String("opr"),
  1085  				OrganizationProjects:          String("op"),
  1086  				OrganizationSecrets:           String("os"),
  1087  				OrganizationSelfHostedRunners: String("osh"),
  1088  				OrganizationUserBlocking:      String("oub"),
  1089  				Packages:                      String("pkg"),
  1090  				Pages:                         String("pg"),
  1091  				PullRequests:                  String("pr"),
  1092  				RepositoryHooks:               String("rh"),
  1093  				RepositoryProjects:            String("rp"),
  1094  				RepositoryPreReceiveHooks:     String("rprh"),
  1095  				Secrets:                       String("s"),
  1096  				SecretScanningAlerts:          String("ssa"),
  1097  				SecurityEvents:                String("se"),
  1098  				SingleFile:                    String("sf"),
  1099  				Statuses:                      String("s"),
  1100  				TeamDiscussions:               String("td"),
  1101  				VulnerabilityAlerts:           String("va"),
  1102  				Workflows:                     String("w"),
  1103  			},
  1104  			CreatedAt:              &Timestamp{referenceTime},
  1105  			UpdatedAt:              &Timestamp{referenceTime},
  1106  			HasMultipleSingleFiles: Bool(false),
  1107  			SuspendedBy: &User{
  1108  				Login:           String("l"),
  1109  				ID:              Int64(1),
  1110  				URL:             String("u"),
  1111  				AvatarURL:       String("a"),
  1112  				GravatarID:      String("g"),
  1113  				Name:            String("n"),
  1114  				Company:         String("c"),
  1115  				Blog:            String("b"),
  1116  				Location:        String("l"),
  1117  				Email:           String("e"),
  1118  				Hireable:        Bool(true),
  1119  				Bio:             String("b"),
  1120  				TwitterUsername: String("t"),
  1121  				PublicRepos:     Int(1),
  1122  				Followers:       Int(1),
  1123  				Following:       Int(1),
  1124  				CreatedAt:       &Timestamp{referenceTime},
  1125  				SuspendedAt:     &Timestamp{referenceTime},
  1126  			},
  1127  			SuspendedAt: &Timestamp{referenceTime},
  1128  		},
  1129  	}
  1130  
  1131  	want := `{
  1132  		"action": "a",
  1133  		"repositories_added": [
  1134  			{
  1135  				"id": 1,
  1136  				"name": "n",
  1137  				"url": "s"
  1138  			}
  1139  		],
  1140  		"repositories_removed": [
  1141  			{
  1142  				"id": 1,
  1143  				"name": "n",
  1144  				"url": "s"
  1145  			}
  1146  		],
  1147  		"repository_selection": "rs",
  1148  		"sender": {
  1149  			"login": "l",
  1150  			"id": 1,
  1151  			"node_id": "n",
  1152  			"avatar_url": "a",
  1153  			"url": "u",
  1154  			"events_url": "e",
  1155  			"repos_url": "r"
  1156  		},
  1157  		"installation": {
  1158  			"id": 1,
  1159  			"node_id": "nid",
  1160  			"app_id": 1,
  1161  			"app_slug": "as",
  1162  			"target_id": 1,
  1163  			"account": {
  1164  				"login": "l",
  1165  				"id": 1,
  1166  				"avatar_url": "a",
  1167  				"gravatar_id": "g",
  1168  				"name": "n",
  1169  				"company": "c",
  1170  				"blog": "b",
  1171  				"location": "l",
  1172  				"email": "e",
  1173  				"hireable": true,
  1174  				"bio": "b",
  1175  				"twitter_username": "t",
  1176  				"public_repos": 1,
  1177  				"followers": 1,
  1178  				"following": 1,
  1179  				"created_at": ` + referenceTimeStr + `,
  1180  				"suspended_at": ` + referenceTimeStr + `,
  1181  				"url": "u"
  1182  			},
  1183  			"access_tokens_url": "atu",
  1184  			"repositories_url": "ru",
  1185  			"html_url": "hu",
  1186  			"target_type": "tt",
  1187  			"single_file_name": "sfn",
  1188  			"repository_selection": "rs",
  1189  			"events": [
  1190  				"e"
  1191  			],
  1192  			"single_file_paths": [
  1193  				"s"
  1194  			],
  1195  			"permissions": {
  1196  				"actions": "a",
  1197  				"administration": "ad",
  1198  				"checks": "c",
  1199  				"contents": "co",
  1200  				"content_references": "cr",
  1201  				"deployments": "d",
  1202  				"environments": "e",
  1203  				"issues": "i",
  1204  				"metadata": "md",
  1205  				"members": "m",
  1206  				"organization_administration": "oa",
  1207  				"organization_hooks": "oh",
  1208  				"organization_plan": "op",
  1209  				"organization_pre_receive_hooks": "opr",
  1210  				"organization_projects": "op",
  1211  				"organization_secrets": "os",
  1212  				"organization_self_hosted_runners": "osh",
  1213  				"organization_user_blocking": "oub",
  1214  				"packages": "pkg",
  1215  				"pages": "pg",
  1216  				"pull_requests": "pr",
  1217  				"repository_hooks": "rh",
  1218  				"repository_projects": "rp",
  1219  				"repository_pre_receive_hooks": "rprh",
  1220  				"secrets": "s",
  1221  				"secret_scanning_alerts": "ssa",
  1222  				"security_events": "se",
  1223  				"single_file": "sf",
  1224  				"statuses": "s",
  1225  				"team_discussions": "td",
  1226  				"vulnerability_alerts": "va",
  1227  				"workflows": "w"
  1228  			},
  1229  			"created_at": ` + referenceTimeStr + `,
  1230  			"updated_at": ` + referenceTimeStr + `,
  1231  			"has_multiple_single_files": false,
  1232  			"suspended_by": {
  1233  				"login": "l",
  1234  				"id": 1,
  1235  				"avatar_url": "a",
  1236  				"gravatar_id": "g",
  1237  				"name": "n",
  1238  				"company": "c",
  1239  				"blog": "b",
  1240  				"location": "l",
  1241  				"email": "e",
  1242  				"hireable": true,
  1243  				"bio": "b",
  1244  				"twitter_username": "t",
  1245  				"public_repos": 1,
  1246  				"followers": 1,
  1247  				"following": 1,
  1248  				"created_at": ` + referenceTimeStr + `,
  1249  				"suspended_at": ` + referenceTimeStr + `,
  1250  				"url": "u"
  1251  			},
  1252  			"suspended_at": ` + referenceTimeStr + `
  1253  		}
  1254  	}`
  1255  
  1256  	testJSONMarshal(t, u, want)
  1257  }
  1258  
  1259  func TestEditTitle_Marshal(t *testing.T) {
  1260  	testJSONMarshal(t, &EditTitle{}, "{}")
  1261  
  1262  	u := &EditTitle{
  1263  		From: String("EditTitleFrom"),
  1264  	}
  1265  
  1266  	want := `{
  1267  		"from": "EditTitleFrom"
  1268  	}`
  1269  
  1270  	testJSONMarshal(t, u, want)
  1271  }
  1272  
  1273  func TestEditBody_Marshal(t *testing.T) {
  1274  	testJSONMarshal(t, &EditBody{}, "{}")
  1275  
  1276  	u := &EditBody{
  1277  		From: String("EditBodyFrom"),
  1278  	}
  1279  
  1280  	want := `{
  1281  		"from": "EditBodyFrom"
  1282  	}`
  1283  
  1284  	testJSONMarshal(t, u, want)
  1285  }
  1286  
  1287  func TestEditBase_Marshal(t *testing.T) {
  1288  	testJSONMarshal(t, &EditBase{}, "{}")
  1289  
  1290  	u := &EditBase{
  1291  		Ref: &EditRef{
  1292  			From: String("EditRefFrom"),
  1293  		},
  1294  		SHA: &EditSHA{
  1295  			From: String("EditSHAFrom"),
  1296  		},
  1297  	}
  1298  
  1299  	want := `{
  1300  		"ref": {
  1301  			"from": "EditRefFrom"
  1302  		},
  1303  		"sha": {
  1304  			"from": "EditSHAFrom"
  1305  		}
  1306  	}`
  1307  
  1308  	testJSONMarshal(t, u, want)
  1309  }
  1310  
  1311  func TestEditRef_Marshal(t *testing.T) {
  1312  	testJSONMarshal(t, &EditRef{}, "{}")
  1313  
  1314  	u := &EditRef{
  1315  		From: String("EditRefFrom"),
  1316  	}
  1317  
  1318  	want := `{
  1319  		"from": "EditRefFrom"
  1320  	}`
  1321  
  1322  	testJSONMarshal(t, u, want)
  1323  }
  1324  
  1325  func TestEditSHA_Marshal(t *testing.T) {
  1326  	testJSONMarshal(t, &EditSHA{}, "{}")
  1327  
  1328  	u := &EditSHA{
  1329  		From: String("EditSHAFrom"),
  1330  	}
  1331  
  1332  	want := `{
  1333  		"from": "EditSHAFrom"
  1334  	}`
  1335  
  1336  	testJSONMarshal(t, u, want)
  1337  }
  1338  
  1339  func TestProjectName_Marshal(t *testing.T) {
  1340  	testJSONMarshal(t, &ProjectName{}, "{}")
  1341  
  1342  	u := &ProjectName{
  1343  		From: String("ProjectNameFrom"),
  1344  	}
  1345  
  1346  	want := `{
  1347  		"from": "ProjectNameFrom"
  1348  	}`
  1349  
  1350  	testJSONMarshal(t, u, want)
  1351  }
  1352  
  1353  func TestProjectBody_Marshal(t *testing.T) {
  1354  	testJSONMarshal(t, &ProjectBody{}, "{}")
  1355  
  1356  	u := &ProjectBody{
  1357  		From: String("ProjectBodyFrom"),
  1358  	}
  1359  
  1360  	want := `{
  1361  		"from": "ProjectBodyFrom"
  1362  	}`
  1363  
  1364  	testJSONMarshal(t, u, want)
  1365  }
  1366  
  1367  func TestProjectCardNote_Marshal(t *testing.T) {
  1368  	testJSONMarshal(t, &ProjectCardNote{}, "{}")
  1369  
  1370  	u := &ProjectCardNote{
  1371  		From: String("ProjectCardNoteFrom"),
  1372  	}
  1373  
  1374  	want := `{
  1375  		"from": "ProjectCardNoteFrom"
  1376  	}`
  1377  
  1378  	testJSONMarshal(t, u, want)
  1379  }
  1380  
  1381  func TestProjectColumnName_Marshal(t *testing.T) {
  1382  	testJSONMarshal(t, &ProjectColumnName{}, "{}")
  1383  
  1384  	u := &ProjectColumnName{
  1385  		From: String("ProjectColumnNameFrom"),
  1386  	}
  1387  
  1388  	want := `{
  1389  		"from": "ProjectColumnNameFrom"
  1390  	}`
  1391  
  1392  	testJSONMarshal(t, u, want)
  1393  }
  1394  
  1395  func TestTeamDescription_Marshal(t *testing.T) {
  1396  	testJSONMarshal(t, &TeamDescription{}, "{}")
  1397  
  1398  	u := &TeamDescription{
  1399  		From: String("TeamDescriptionFrom"),
  1400  	}
  1401  
  1402  	want := `{
  1403  		"from": "TeamDescriptionFrom"
  1404  	}`
  1405  
  1406  	testJSONMarshal(t, u, want)
  1407  }
  1408  
  1409  func TestTeamName_Marshal(t *testing.T) {
  1410  	testJSONMarshal(t, &TeamName{}, "{}")
  1411  
  1412  	u := &TeamName{
  1413  		From: String("TeamNameFrom"),
  1414  	}
  1415  
  1416  	want := `{
  1417  		"from": "TeamNameFrom"
  1418  	}`
  1419  
  1420  	testJSONMarshal(t, u, want)
  1421  }
  1422  
  1423  func TestTeamPrivacy_Marshal(t *testing.T) {
  1424  	testJSONMarshal(t, &TeamPrivacy{}, "{}")
  1425  
  1426  	u := &TeamPrivacy{
  1427  		From: String("TeamPrivacyFrom"),
  1428  	}
  1429  
  1430  	want := `{
  1431  		"from": "TeamPrivacyFrom"
  1432  	}`
  1433  
  1434  	testJSONMarshal(t, u, want)
  1435  }
  1436  
  1437  func TestTeamRepository_Marshal(t *testing.T) {
  1438  	testJSONMarshal(t, &TeamRepository{}, "{}")
  1439  
  1440  	u := &TeamRepository{
  1441  		Permissions: &TeamPermissions{
  1442  			From: &TeamPermissionsFrom{
  1443  				Admin: Bool(true),
  1444  				Pull:  Bool(true),
  1445  				Push:  Bool(true),
  1446  			},
  1447  		},
  1448  	}
  1449  
  1450  	want := `{
  1451  		"permissions": {
  1452  			"from": {
  1453  				"admin": true,
  1454  				"pull": true,
  1455  				"push": true
  1456  			}
  1457  		}
  1458  	}`
  1459  
  1460  	testJSONMarshal(t, u, want)
  1461  }
  1462  
  1463  func TestTeamPermissions_Marshal(t *testing.T) {
  1464  	testJSONMarshal(t, &TeamPermissions{}, "{}")
  1465  
  1466  	u := &TeamPermissions{
  1467  		From: &TeamPermissionsFrom{
  1468  			Admin: Bool(true),
  1469  			Pull:  Bool(true),
  1470  			Push:  Bool(true),
  1471  		},
  1472  	}
  1473  
  1474  	want := `{
  1475  		"from": {
  1476  			"admin": true,
  1477  			"pull": true,
  1478  			"push": true
  1479  		}
  1480  	}`
  1481  
  1482  	testJSONMarshal(t, u, want)
  1483  }
  1484  
  1485  func TestTeamPermissionsFrom_Marshal(t *testing.T) {
  1486  	testJSONMarshal(t, &TeamPermissionsFrom{}, "{}")
  1487  
  1488  	u := &TeamPermissionsFrom{
  1489  		Admin: Bool(true),
  1490  		Pull:  Bool(true),
  1491  		Push:  Bool(true),
  1492  	}
  1493  
  1494  	want := `{
  1495  		"admin": true,
  1496  		"pull": true,
  1497  		"push": true
  1498  	}`
  1499  
  1500  	testJSONMarshal(t, u, want)
  1501  }
  1502  
  1503  func TestRepositoryVulnerabilityAlert_Marshal(t *testing.T) {
  1504  	testJSONMarshal(t, &RepositoryVulnerabilityAlert{}, "{}")
  1505  
  1506  	u := &RepositoryVulnerabilityAlert{
  1507  		ID:                  Int64(1),
  1508  		AffectedRange:       String("ar"),
  1509  		AffectedPackageName: String("apn"),
  1510  		ExternalReference:   String("er"),
  1511  		ExternalIdentifier:  String("ei"),
  1512  		FixedIn:             String("fi"),
  1513  		Dismisser: &User{
  1514  			Login:     String("l"),
  1515  			ID:        Int64(1),
  1516  			NodeID:    String("n"),
  1517  			URL:       String("u"),
  1518  			ReposURL:  String("r"),
  1519  			EventsURL: String("e"),
  1520  			AvatarURL: String("a"),
  1521  		},
  1522  		DismissReason: String("dr"),
  1523  		DismissedAt:   &Timestamp{referenceTime},
  1524  	}
  1525  
  1526  	want := `{
  1527  		"id": 1,
  1528  		"affected_range": "ar",
  1529  		"affected_package_name": "apn",
  1530  		"external_reference": "er",
  1531  		"external_identifier": "ei",
  1532  		"fixed_in": "fi",
  1533  		"dismisser": {
  1534  			"login": "l",
  1535  			"id": 1,
  1536  			"node_id": "n",
  1537  			"avatar_url": "a",
  1538  			"url": "u",
  1539  			"events_url": "e",
  1540  			"repos_url": "r"
  1541  		},
  1542  		"dismiss_reason": "dr",
  1543  		"dismissed_at": ` + referenceTimeStr + `
  1544  	}`
  1545  
  1546  	testJSONMarshal(t, u, want)
  1547  }
  1548  
  1549  func TestPage_Marshal(t *testing.T) {
  1550  	testJSONMarshal(t, &Page{}, "{}")
  1551  
  1552  	u := &Page{
  1553  		PageName: String("p"),
  1554  		Title:    String("t"),
  1555  		Summary:  String("s"),
  1556  		Action:   String("a"),
  1557  		SHA:      String("s"),
  1558  		HTMLURL:  String("h"),
  1559  	}
  1560  
  1561  	want := `{
  1562  		"page_name": "p",
  1563  		"title": "t",
  1564  		"summary": "s",
  1565  		"action": "a",
  1566  		"sha": "s",
  1567  		"html_url": "h"
  1568  	}`
  1569  
  1570  	testJSONMarshal(t, u, want)
  1571  }
  1572  
  1573  func TestTeamChange_Marshal(t *testing.T) {
  1574  	testJSONMarshal(t, &TeamChange{}, "{}")
  1575  
  1576  	u := &TeamChange{
  1577  		Description: &TeamDescription{
  1578  			From: String("DescriptionFrom"),
  1579  		},
  1580  		Name: &TeamName{
  1581  			From: String("NameFrom"),
  1582  		},
  1583  		Privacy: &TeamPrivacy{
  1584  			From: String("PrivacyFrom"),
  1585  		},
  1586  		Repository: &TeamRepository{
  1587  			Permissions: &TeamPermissions{
  1588  				From: &TeamPermissionsFrom{
  1589  					Admin: Bool(false),
  1590  					Pull:  Bool(false),
  1591  					Push:  Bool(false),
  1592  				},
  1593  			},
  1594  		},
  1595  	}
  1596  
  1597  	want := `{
  1598  		"description": {
  1599  			"from": "DescriptionFrom"
  1600  		},
  1601  		"name": {
  1602  			"from": "NameFrom"
  1603  		},
  1604  		"privacy": {
  1605  			"from": "PrivacyFrom"
  1606  		},
  1607  		"repository": {
  1608  			"permissions": {
  1609  				"from": {
  1610  					"admin": false,
  1611  					"pull": false,
  1612  					"push": false
  1613  				}
  1614  			}
  1615  		}
  1616  	}`
  1617  
  1618  	testJSONMarshal(t, u, want)
  1619  }
  1620  
  1621  func TestIssueCommentEvent_Marshal(t *testing.T) {
  1622  	testJSONMarshal(t, &IssueCommentEvent{}, "{}")
  1623  
  1624  	u := &IssueCommentEvent{
  1625  		Action:  String("a"),
  1626  		Issue:   &Issue{ID: Int64(1)},
  1627  		Comment: &IssueComment{ID: Int64(1)},
  1628  		Changes: &EditChange{
  1629  			Title: &EditTitle{
  1630  				From: String("TitleFrom"),
  1631  			},
  1632  			Body: &EditBody{
  1633  				From: String("BodyFrom"),
  1634  			},
  1635  			Base: &EditBase{
  1636  				Ref: &EditRef{
  1637  					From: String("BaseRefFrom"),
  1638  				},
  1639  				SHA: &EditSHA{
  1640  					From: String("BaseSHAFrom"),
  1641  				},
  1642  			},
  1643  		},
  1644  		Repo: &Repository{
  1645  			ID:   Int64(1),
  1646  			URL:  String("s"),
  1647  			Name: String("n"),
  1648  		},
  1649  		Sender: &User{
  1650  			Login:     String("l"),
  1651  			ID:        Int64(1),
  1652  			NodeID:    String("n"),
  1653  			URL:       String("u"),
  1654  			ReposURL:  String("r"),
  1655  			EventsURL: String("e"),
  1656  			AvatarURL: String("a"),
  1657  		},
  1658  		Installation: &Installation{
  1659  			ID:       Int64(1),
  1660  			NodeID:   String("nid"),
  1661  			AppID:    Int64(1),
  1662  			AppSlug:  String("as"),
  1663  			TargetID: Int64(1),
  1664  			Account: &User{
  1665  				Login:           String("l"),
  1666  				ID:              Int64(1),
  1667  				URL:             String("u"),
  1668  				AvatarURL:       String("a"),
  1669  				GravatarID:      String("g"),
  1670  				Name:            String("n"),
  1671  				Company:         String("c"),
  1672  				Blog:            String("b"),
  1673  				Location:        String("l"),
  1674  				Email:           String("e"),
  1675  				Hireable:        Bool(true),
  1676  				Bio:             String("b"),
  1677  				TwitterUsername: String("t"),
  1678  				PublicRepos:     Int(1),
  1679  				Followers:       Int(1),
  1680  				Following:       Int(1),
  1681  				CreatedAt:       &Timestamp{referenceTime},
  1682  				SuspendedAt:     &Timestamp{referenceTime},
  1683  			},
  1684  			AccessTokensURL:     String("atu"),
  1685  			RepositoriesURL:     String("ru"),
  1686  			HTMLURL:             String("hu"),
  1687  			TargetType:          String("tt"),
  1688  			SingleFileName:      String("sfn"),
  1689  			RepositorySelection: String("rs"),
  1690  			Events:              []string{"e"},
  1691  			SingleFilePaths:     []string{"s"},
  1692  			Permissions: &InstallationPermissions{
  1693  				Actions:                       String("a"),
  1694  				Administration:                String("ad"),
  1695  				Checks:                        String("c"),
  1696  				Contents:                      String("co"),
  1697  				ContentReferences:             String("cr"),
  1698  				Deployments:                   String("d"),
  1699  				Environments:                  String("e"),
  1700  				Issues:                        String("i"),
  1701  				Metadata:                      String("md"),
  1702  				Members:                       String("m"),
  1703  				OrganizationAdministration:    String("oa"),
  1704  				OrganizationHooks:             String("oh"),
  1705  				OrganizationPlan:              String("op"),
  1706  				OrganizationPreReceiveHooks:   String("opr"),
  1707  				OrganizationProjects:          String("op"),
  1708  				OrganizationSecrets:           String("os"),
  1709  				OrganizationSelfHostedRunners: String("osh"),
  1710  				OrganizationUserBlocking:      String("oub"),
  1711  				Packages:                      String("pkg"),
  1712  				Pages:                         String("pg"),
  1713  				PullRequests:                  String("pr"),
  1714  				RepositoryHooks:               String("rh"),
  1715  				RepositoryProjects:            String("rp"),
  1716  				RepositoryPreReceiveHooks:     String("rprh"),
  1717  				Secrets:                       String("s"),
  1718  				SecretScanningAlerts:          String("ssa"),
  1719  				SecurityEvents:                String("se"),
  1720  				SingleFile:                    String("sf"),
  1721  				Statuses:                      String("s"),
  1722  				TeamDiscussions:               String("td"),
  1723  				VulnerabilityAlerts:           String("va"),
  1724  				Workflows:                     String("w"),
  1725  			},
  1726  			CreatedAt:              &Timestamp{referenceTime},
  1727  			UpdatedAt:              &Timestamp{referenceTime},
  1728  			HasMultipleSingleFiles: Bool(false),
  1729  			SuspendedBy: &User{
  1730  				Login:           String("l"),
  1731  				ID:              Int64(1),
  1732  				URL:             String("u"),
  1733  				AvatarURL:       String("a"),
  1734  				GravatarID:      String("g"),
  1735  				Name:            String("n"),
  1736  				Company:         String("c"),
  1737  				Blog:            String("b"),
  1738  				Location:        String("l"),
  1739  				Email:           String("e"),
  1740  				Hireable:        Bool(true),
  1741  				Bio:             String("b"),
  1742  				TwitterUsername: String("t"),
  1743  				PublicRepos:     Int(1),
  1744  				Followers:       Int(1),
  1745  				Following:       Int(1),
  1746  				CreatedAt:       &Timestamp{referenceTime},
  1747  				SuspendedAt:     &Timestamp{referenceTime},
  1748  			},
  1749  			SuspendedAt: &Timestamp{referenceTime},
  1750  		},
  1751  		Organization: &Organization{
  1752  			BillingEmail:                         String("be"),
  1753  			Blog:                                 String("b"),
  1754  			Company:                              String("c"),
  1755  			Email:                                String("e"),
  1756  			TwitterUsername:                      String("tu"),
  1757  			Location:                             String("loc"),
  1758  			Name:                                 String("n"),
  1759  			Description:                          String("d"),
  1760  			IsVerified:                           Bool(true),
  1761  			HasOrganizationProjects:              Bool(true),
  1762  			HasRepositoryProjects:                Bool(true),
  1763  			DefaultRepoPermission:                String("drp"),
  1764  			MembersCanCreateRepos:                Bool(true),
  1765  			MembersCanCreateInternalRepos:        Bool(true),
  1766  			MembersCanCreatePrivateRepos:         Bool(true),
  1767  			MembersCanCreatePublicRepos:          Bool(false),
  1768  			MembersAllowedRepositoryCreationType: String("marct"),
  1769  			MembersCanCreatePages:                Bool(true),
  1770  			MembersCanCreatePublicPages:          Bool(false),
  1771  			MembersCanCreatePrivatePages:         Bool(true),
  1772  		},
  1773  	}
  1774  
  1775  	want := `{
  1776  		"action": "a",
  1777  		"issue": {
  1778  			"id": 1
  1779  		},
  1780  		"comment": {
  1781  			"id": 1
  1782  		},
  1783  		"changes": {
  1784  			"title": {
  1785  				"from": "TitleFrom"
  1786  			},
  1787  			"body": {
  1788  				"from": "BodyFrom"
  1789  			},
  1790  			"base": {
  1791  				"ref": {
  1792  					"from": "BaseRefFrom"
  1793  				},
  1794  				"sha": {
  1795  					"from": "BaseSHAFrom"
  1796  				}
  1797  			}
  1798  		},
  1799  		"repository": {
  1800  			"id": 1,
  1801  			"name": "n",
  1802  			"url": "s"
  1803  		},
  1804  		"sender": {
  1805  			"login": "l",
  1806  			"id": 1,
  1807  			"node_id": "n",
  1808  			"avatar_url": "a",
  1809  			"url": "u",
  1810  			"events_url": "e",
  1811  			"repos_url": "r"
  1812  		},
  1813  		"installation": {
  1814  			"id": 1,
  1815  			"node_id": "nid",
  1816  			"app_id": 1,
  1817  			"app_slug": "as",
  1818  			"target_id": 1,
  1819  			"account": {
  1820  				"login": "l",
  1821  				"id": 1,
  1822  				"avatar_url": "a",
  1823  				"gravatar_id": "g",
  1824  				"name": "n",
  1825  				"company": "c",
  1826  				"blog": "b",
  1827  				"location": "l",
  1828  				"email": "e",
  1829  				"hireable": true,
  1830  				"bio": "b",
  1831  				"twitter_username": "t",
  1832  				"public_repos": 1,
  1833  				"followers": 1,
  1834  				"following": 1,
  1835  				"created_at": ` + referenceTimeStr + `,
  1836  				"suspended_at": ` + referenceTimeStr + `,
  1837  				"url": "u"
  1838  			},
  1839  			"access_tokens_url": "atu",
  1840  			"repositories_url": "ru",
  1841  			"html_url": "hu",
  1842  			"target_type": "tt",
  1843  			"single_file_name": "sfn",
  1844  			"repository_selection": "rs",
  1845  			"events": [
  1846  				"e"
  1847  			],
  1848  			"single_file_paths": [
  1849  				"s"
  1850  			],
  1851  			"permissions": {
  1852  				"actions": "a",
  1853  				"administration": "ad",
  1854  				"checks": "c",
  1855  				"contents": "co",
  1856  				"content_references": "cr",
  1857  				"deployments": "d",
  1858  				"environments": "e",
  1859  				"issues": "i",
  1860  				"metadata": "md",
  1861  				"members": "m",
  1862  				"organization_administration": "oa",
  1863  				"organization_hooks": "oh",
  1864  				"organization_plan": "op",
  1865  				"organization_pre_receive_hooks": "opr",
  1866  				"organization_projects": "op",
  1867  				"organization_secrets": "os",
  1868  				"organization_self_hosted_runners": "osh",
  1869  				"organization_user_blocking": "oub",
  1870  				"packages": "pkg",
  1871  				"pages": "pg",
  1872  				"pull_requests": "pr",
  1873  				"repository_hooks": "rh",
  1874  				"repository_projects": "rp",
  1875  				"repository_pre_receive_hooks": "rprh",
  1876  				"secrets": "s",
  1877  				"secret_scanning_alerts": "ssa",
  1878  				"security_events": "se",
  1879  				"single_file": "sf",
  1880  				"statuses": "s",
  1881  				"team_discussions": "td",
  1882  				"vulnerability_alerts": "va",
  1883  				"workflows": "w"
  1884  			},
  1885  			"created_at": ` + referenceTimeStr + `,
  1886  			"updated_at": ` + referenceTimeStr + `,
  1887  			"has_multiple_single_files": false,
  1888  			"suspended_by": {
  1889  				"login": "l",
  1890  				"id": 1,
  1891  				"avatar_url": "a",
  1892  				"gravatar_id": "g",
  1893  				"name": "n",
  1894  				"company": "c",
  1895  				"blog": "b",
  1896  				"location": "l",
  1897  				"email": "e",
  1898  				"hireable": true,
  1899  				"bio": "b",
  1900  				"twitter_username": "t",
  1901  				"public_repos": 1,
  1902  				"followers": 1,
  1903  				"following": 1,
  1904  				"created_at": ` + referenceTimeStr + `,
  1905  				"suspended_at": ` + referenceTimeStr + `,
  1906  				"url": "u"
  1907  			},
  1908  			"suspended_at": ` + referenceTimeStr + `
  1909  		},
  1910  		"organization": {
  1911  			"name": "n",
  1912  			"company": "c",
  1913  			"blog": "b",
  1914  			"location": "loc",
  1915  			"email": "e",
  1916  			"twitter_username": "tu",
  1917  			"description": "d",
  1918  			"billing_email": "be",
  1919  			"is_verified": true,
  1920  			"has_organization_projects": true,
  1921  			"has_repository_projects": true,
  1922  			"default_repository_permission": "drp",
  1923  			"members_can_create_repositories": true,
  1924  			"members_can_create_public_repositories": false,
  1925  			"members_can_create_private_repositories": true,
  1926  			"members_can_create_internal_repositories": true,
  1927  			"members_allowed_repository_creation_type": "marct",
  1928  			"members_can_create_pages": true,
  1929  			"members_can_create_public_pages": false,
  1930  			"members_can_create_private_pages": true
  1931  		}
  1932  	}`
  1933  
  1934  	testJSONMarshal(t, u, want)
  1935  }
  1936  
  1937  func TestIssuesEvent_Marshal(t *testing.T) {
  1938  	testJSONMarshal(t, &IssuesEvent{}, "{}")
  1939  
  1940  	u := &IssuesEvent{
  1941  		Action: String("a"),
  1942  		Issue:  &Issue{ID: Int64(1)},
  1943  		Assignee: &User{
  1944  			Login:     String("l"),
  1945  			ID:        Int64(1),
  1946  			NodeID:    String("n"),
  1947  			URL:       String("u"),
  1948  			ReposURL:  String("r"),
  1949  			EventsURL: String("e"),
  1950  			AvatarURL: String("a"),
  1951  		},
  1952  		Label: &Label{ID: Int64(1)},
  1953  		Changes: &EditChange{
  1954  			Title: &EditTitle{
  1955  				From: String("TitleFrom"),
  1956  			},
  1957  			Body: &EditBody{
  1958  				From: String("BodyFrom"),
  1959  			},
  1960  			Base: &EditBase{
  1961  				Ref: &EditRef{
  1962  					From: String("BaseRefFrom"),
  1963  				},
  1964  				SHA: &EditSHA{
  1965  					From: String("BaseSHAFrom"),
  1966  				},
  1967  			},
  1968  		},
  1969  		Repo: &Repository{
  1970  			ID:   Int64(1),
  1971  			URL:  String("s"),
  1972  			Name: String("n"),
  1973  		},
  1974  		Sender: &User{
  1975  			Login:     String("l"),
  1976  			ID:        Int64(1),
  1977  			NodeID:    String("n"),
  1978  			URL:       String("u"),
  1979  			ReposURL:  String("r"),
  1980  			EventsURL: String("e"),
  1981  			AvatarURL: String("a"),
  1982  		},
  1983  		Installation: &Installation{
  1984  			ID:       Int64(1),
  1985  			NodeID:   String("nid"),
  1986  			AppID:    Int64(1),
  1987  			AppSlug:  String("as"),
  1988  			TargetID: Int64(1),
  1989  			Account: &User{
  1990  				Login:           String("l"),
  1991  				ID:              Int64(1),
  1992  				URL:             String("u"),
  1993  				AvatarURL:       String("a"),
  1994  				GravatarID:      String("g"),
  1995  				Name:            String("n"),
  1996  				Company:         String("c"),
  1997  				Blog:            String("b"),
  1998  				Location:        String("l"),
  1999  				Email:           String("e"),
  2000  				Hireable:        Bool(true),
  2001  				Bio:             String("b"),
  2002  				TwitterUsername: String("t"),
  2003  				PublicRepos:     Int(1),
  2004  				Followers:       Int(1),
  2005  				Following:       Int(1),
  2006  				CreatedAt:       &Timestamp{referenceTime},
  2007  				SuspendedAt:     &Timestamp{referenceTime},
  2008  			},
  2009  			AccessTokensURL:     String("atu"),
  2010  			RepositoriesURL:     String("ru"),
  2011  			HTMLURL:             String("hu"),
  2012  			TargetType:          String("tt"),
  2013  			SingleFileName:      String("sfn"),
  2014  			RepositorySelection: String("rs"),
  2015  			Events:              []string{"e"},
  2016  			SingleFilePaths:     []string{"s"},
  2017  			Permissions: &InstallationPermissions{
  2018  				Actions:                       String("a"),
  2019  				Administration:                String("ad"),
  2020  				Checks:                        String("c"),
  2021  				Contents:                      String("co"),
  2022  				ContentReferences:             String("cr"),
  2023  				Deployments:                   String("d"),
  2024  				Environments:                  String("e"),
  2025  				Issues:                        String("i"),
  2026  				Metadata:                      String("md"),
  2027  				Members:                       String("m"),
  2028  				OrganizationAdministration:    String("oa"),
  2029  				OrganizationHooks:             String("oh"),
  2030  				OrganizationPlan:              String("op"),
  2031  				OrganizationPreReceiveHooks:   String("opr"),
  2032  				OrganizationProjects:          String("op"),
  2033  				OrganizationSecrets:           String("os"),
  2034  				OrganizationSelfHostedRunners: String("osh"),
  2035  				OrganizationUserBlocking:      String("oub"),
  2036  				Packages:                      String("pkg"),
  2037  				Pages:                         String("pg"),
  2038  				PullRequests:                  String("pr"),
  2039  				RepositoryHooks:               String("rh"),
  2040  				RepositoryProjects:            String("rp"),
  2041  				RepositoryPreReceiveHooks:     String("rprh"),
  2042  				Secrets:                       String("s"),
  2043  				SecretScanningAlerts:          String("ssa"),
  2044  				SecurityEvents:                String("se"),
  2045  				SingleFile:                    String("sf"),
  2046  				Statuses:                      String("s"),
  2047  				TeamDiscussions:               String("td"),
  2048  				VulnerabilityAlerts:           String("va"),
  2049  				Workflows:                     String("w"),
  2050  			},
  2051  			CreatedAt:              &Timestamp{referenceTime},
  2052  			UpdatedAt:              &Timestamp{referenceTime},
  2053  			HasMultipleSingleFiles: Bool(false),
  2054  			SuspendedBy: &User{
  2055  				Login:           String("l"),
  2056  				ID:              Int64(1),
  2057  				URL:             String("u"),
  2058  				AvatarURL:       String("a"),
  2059  				GravatarID:      String("g"),
  2060  				Name:            String("n"),
  2061  				Company:         String("c"),
  2062  				Blog:            String("b"),
  2063  				Location:        String("l"),
  2064  				Email:           String("e"),
  2065  				Hireable:        Bool(true),
  2066  				Bio:             String("b"),
  2067  				TwitterUsername: String("t"),
  2068  				PublicRepos:     Int(1),
  2069  				Followers:       Int(1),
  2070  				Following:       Int(1),
  2071  				CreatedAt:       &Timestamp{referenceTime},
  2072  				SuspendedAt:     &Timestamp{referenceTime},
  2073  			},
  2074  			SuspendedAt: &Timestamp{referenceTime},
  2075  		},
  2076  	}
  2077  
  2078  	want := `{
  2079  		"action": "a",
  2080  		"issue": {
  2081  			"id": 1
  2082  		},
  2083  		"assignee": {
  2084  			"login": "l",
  2085  			"id": 1,
  2086  			"node_id": "n",
  2087  			"avatar_url": "a",
  2088  			"url": "u",
  2089  			"events_url": "e",
  2090  			"repos_url": "r"
  2091  		},
  2092  		"label": {
  2093  			"id": 1
  2094  		},
  2095  		"changes": {
  2096  			"title": {
  2097  				"from": "TitleFrom"
  2098  			},
  2099  			"body": {
  2100  				"from": "BodyFrom"
  2101  			},
  2102  			"base": {
  2103  				"ref": {
  2104  					"from": "BaseRefFrom"
  2105  				},
  2106  				"sha": {
  2107  					"from": "BaseSHAFrom"
  2108  				}
  2109  			}
  2110  		},
  2111  		"repository": {
  2112  			"id": 1,
  2113  			"name": "n",
  2114  			"url": "s"
  2115  		},
  2116  		"sender": {
  2117  			"login": "l",
  2118  			"id": 1,
  2119  			"node_id": "n",
  2120  			"avatar_url": "a",
  2121  			"url": "u",
  2122  			"events_url": "e",
  2123  			"repos_url": "r"
  2124  		},
  2125  		"installation": {
  2126  			"id": 1,
  2127  			"node_id": "nid",
  2128  			"app_id": 1,
  2129  			"app_slug": "as",
  2130  			"target_id": 1,
  2131  			"account": {
  2132  				"login": "l",
  2133  				"id": 1,
  2134  				"avatar_url": "a",
  2135  				"gravatar_id": "g",
  2136  				"name": "n",
  2137  				"company": "c",
  2138  				"blog": "b",
  2139  				"location": "l",
  2140  				"email": "e",
  2141  				"hireable": true,
  2142  				"bio": "b",
  2143  				"twitter_username": "t",
  2144  				"public_repos": 1,
  2145  				"followers": 1,
  2146  				"following": 1,
  2147  				"created_at": ` + referenceTimeStr + `,
  2148  				"suspended_at": ` + referenceTimeStr + `,
  2149  				"url": "u"
  2150  			},
  2151  			"access_tokens_url": "atu",
  2152  			"repositories_url": "ru",
  2153  			"html_url": "hu",
  2154  			"target_type": "tt",
  2155  			"single_file_name": "sfn",
  2156  			"repository_selection": "rs",
  2157  			"events": [
  2158  				"e"
  2159  			],
  2160  			"single_file_paths": [
  2161  				"s"
  2162  			],
  2163  			"permissions": {
  2164  				"actions": "a",
  2165  				"administration": "ad",
  2166  				"checks": "c",
  2167  				"contents": "co",
  2168  				"content_references": "cr",
  2169  				"deployments": "d",
  2170  				"environments": "e",
  2171  				"issues": "i",
  2172  				"metadata": "md",
  2173  				"members": "m",
  2174  				"organization_administration": "oa",
  2175  				"organization_hooks": "oh",
  2176  				"organization_plan": "op",
  2177  				"organization_pre_receive_hooks": "opr",
  2178  				"organization_projects": "op",
  2179  				"organization_secrets": "os",
  2180  				"organization_self_hosted_runners": "osh",
  2181  				"organization_user_blocking": "oub",
  2182  				"packages": "pkg",
  2183  				"pages": "pg",
  2184  				"pull_requests": "pr",
  2185  				"repository_hooks": "rh",
  2186  				"repository_projects": "rp",
  2187  				"repository_pre_receive_hooks": "rprh",
  2188  				"secrets": "s",
  2189  				"secret_scanning_alerts": "ssa",
  2190  				"security_events": "se",
  2191  				"single_file": "sf",
  2192  				"statuses": "s",
  2193  				"team_discussions": "td",
  2194  				"vulnerability_alerts": "va",
  2195  				"workflows": "w"
  2196  			},
  2197  			"created_at": ` + referenceTimeStr + `,
  2198  			"updated_at": ` + referenceTimeStr + `,
  2199  			"has_multiple_single_files": false,
  2200  			"suspended_by": {
  2201  				"login": "l",
  2202  				"id": 1,
  2203  				"avatar_url": "a",
  2204  				"gravatar_id": "g",
  2205  				"name": "n",
  2206  				"company": "c",
  2207  				"blog": "b",
  2208  				"location": "l",
  2209  				"email": "e",
  2210  				"hireable": true,
  2211  				"bio": "b",
  2212  				"twitter_username": "t",
  2213  				"public_repos": 1,
  2214  				"followers": 1,
  2215  				"following": 1,
  2216  				"created_at": ` + referenceTimeStr + `,
  2217  				"suspended_at": ` + referenceTimeStr + `,
  2218  				"url": "u"
  2219  			},
  2220  			"suspended_at": ` + referenceTimeStr + `
  2221  		}
  2222  	}`
  2223  
  2224  	testJSONMarshal(t, u, want)
  2225  }
  2226  
  2227  func TestLabelEvent_Marshal(t *testing.T) {
  2228  	testJSONMarshal(t, &LabelEvent{}, "{}")
  2229  
  2230  	u := &LabelEvent{
  2231  		Action: String("a"),
  2232  		Label:  &Label{ID: Int64(1)},
  2233  		Changes: &EditChange{
  2234  			Title: &EditTitle{
  2235  				From: String("TitleFrom"),
  2236  			},
  2237  			Body: &EditBody{
  2238  				From: String("BodyFrom"),
  2239  			},
  2240  			Base: &EditBase{
  2241  				Ref: &EditRef{
  2242  					From: String("BaseRefFrom"),
  2243  				},
  2244  				SHA: &EditSHA{
  2245  					From: String("BaseSHAFrom"),
  2246  				},
  2247  			},
  2248  		},
  2249  		Repo: &Repository{
  2250  			ID:   Int64(1),
  2251  			URL:  String("s"),
  2252  			Name: String("n"),
  2253  		},
  2254  		Org: &Organization{
  2255  			BillingEmail:                         String("be"),
  2256  			Blog:                                 String("b"),
  2257  			Company:                              String("c"),
  2258  			Email:                                String("e"),
  2259  			TwitterUsername:                      String("tu"),
  2260  			Location:                             String("loc"),
  2261  			Name:                                 String("n"),
  2262  			Description:                          String("d"),
  2263  			IsVerified:                           Bool(true),
  2264  			HasOrganizationProjects:              Bool(true),
  2265  			HasRepositoryProjects:                Bool(true),
  2266  			DefaultRepoPermission:                String("drp"),
  2267  			MembersCanCreateRepos:                Bool(true),
  2268  			MembersCanCreateInternalRepos:        Bool(true),
  2269  			MembersCanCreatePrivateRepos:         Bool(true),
  2270  			MembersCanCreatePublicRepos:          Bool(false),
  2271  			MembersAllowedRepositoryCreationType: String("marct"),
  2272  			MembersCanCreatePages:                Bool(true),
  2273  			MembersCanCreatePublicPages:          Bool(false),
  2274  			MembersCanCreatePrivatePages:         Bool(true),
  2275  		},
  2276  		Installation: &Installation{
  2277  			ID:       Int64(1),
  2278  			NodeID:   String("nid"),
  2279  			AppID:    Int64(1),
  2280  			AppSlug:  String("as"),
  2281  			TargetID: Int64(1),
  2282  			Account: &User{
  2283  				Login:           String("l"),
  2284  				ID:              Int64(1),
  2285  				URL:             String("u"),
  2286  				AvatarURL:       String("a"),
  2287  				GravatarID:      String("g"),
  2288  				Name:            String("n"),
  2289  				Company:         String("c"),
  2290  				Blog:            String("b"),
  2291  				Location:        String("l"),
  2292  				Email:           String("e"),
  2293  				Hireable:        Bool(true),
  2294  				Bio:             String("b"),
  2295  				TwitterUsername: String("t"),
  2296  				PublicRepos:     Int(1),
  2297  				Followers:       Int(1),
  2298  				Following:       Int(1),
  2299  				CreatedAt:       &Timestamp{referenceTime},
  2300  				SuspendedAt:     &Timestamp{referenceTime},
  2301  			},
  2302  			AccessTokensURL:     String("atu"),
  2303  			RepositoriesURL:     String("ru"),
  2304  			HTMLURL:             String("hu"),
  2305  			TargetType:          String("tt"),
  2306  			SingleFileName:      String("sfn"),
  2307  			RepositorySelection: String("rs"),
  2308  			Events:              []string{"e"},
  2309  			SingleFilePaths:     []string{"s"},
  2310  			Permissions: &InstallationPermissions{
  2311  				Actions:                       String("a"),
  2312  				Administration:                String("ad"),
  2313  				Checks:                        String("c"),
  2314  				Contents:                      String("co"),
  2315  				ContentReferences:             String("cr"),
  2316  				Deployments:                   String("d"),
  2317  				Environments:                  String("e"),
  2318  				Issues:                        String("i"),
  2319  				Metadata:                      String("md"),
  2320  				Members:                       String("m"),
  2321  				OrganizationAdministration:    String("oa"),
  2322  				OrganizationHooks:             String("oh"),
  2323  				OrganizationPlan:              String("op"),
  2324  				OrganizationPreReceiveHooks:   String("opr"),
  2325  				OrganizationProjects:          String("op"),
  2326  				OrganizationSecrets:           String("os"),
  2327  				OrganizationSelfHostedRunners: String("osh"),
  2328  				OrganizationUserBlocking:      String("oub"),
  2329  				Packages:                      String("pkg"),
  2330  				Pages:                         String("pg"),
  2331  				PullRequests:                  String("pr"),
  2332  				RepositoryHooks:               String("rh"),
  2333  				RepositoryProjects:            String("rp"),
  2334  				RepositoryPreReceiveHooks:     String("rprh"),
  2335  				Secrets:                       String("s"),
  2336  				SecretScanningAlerts:          String("ssa"),
  2337  				SecurityEvents:                String("se"),
  2338  				SingleFile:                    String("sf"),
  2339  				Statuses:                      String("s"),
  2340  				TeamDiscussions:               String("td"),
  2341  				VulnerabilityAlerts:           String("va"),
  2342  				Workflows:                     String("w"),
  2343  			},
  2344  			CreatedAt:              &Timestamp{referenceTime},
  2345  			UpdatedAt:              &Timestamp{referenceTime},
  2346  			HasMultipleSingleFiles: Bool(false),
  2347  			SuspendedBy: &User{
  2348  				Login:           String("l"),
  2349  				ID:              Int64(1),
  2350  				URL:             String("u"),
  2351  				AvatarURL:       String("a"),
  2352  				GravatarID:      String("g"),
  2353  				Name:            String("n"),
  2354  				Company:         String("c"),
  2355  				Blog:            String("b"),
  2356  				Location:        String("l"),
  2357  				Email:           String("e"),
  2358  				Hireable:        Bool(true),
  2359  				Bio:             String("b"),
  2360  				TwitterUsername: String("t"),
  2361  				PublicRepos:     Int(1),
  2362  				Followers:       Int(1),
  2363  				Following:       Int(1),
  2364  				CreatedAt:       &Timestamp{referenceTime},
  2365  				SuspendedAt:     &Timestamp{referenceTime},
  2366  			},
  2367  			SuspendedAt: &Timestamp{referenceTime},
  2368  		},
  2369  	}
  2370  
  2371  	want := `{
  2372  		"action": "a",
  2373  		"label": {
  2374  			"id": 1
  2375  		},
  2376  		"changes": {
  2377  			"title": {
  2378  				"from": "TitleFrom"
  2379  			},
  2380  			"body": {
  2381  				"from": "BodyFrom"
  2382  			},
  2383  			"base": {
  2384  				"ref": {
  2385  					"from": "BaseRefFrom"
  2386  				},
  2387  				"sha": {
  2388  					"from": "BaseSHAFrom"
  2389  				}
  2390  			}
  2391  		},
  2392  		"repository": {
  2393  			"id": 1,
  2394  			"name": "n",
  2395  			"url": "s"
  2396  		},
  2397  		"organization": {
  2398  			"name": "n",
  2399  			"company": "c",
  2400  			"blog": "b",
  2401  			"location": "loc",
  2402  			"email": "e",
  2403  			"twitter_username": "tu",
  2404  			"description": "d",
  2405  			"billing_email": "be",
  2406  			"is_verified": true,
  2407  			"has_organization_projects": true,
  2408  			"has_repository_projects": true,
  2409  			"default_repository_permission": "drp",
  2410  			"members_can_create_repositories": true,
  2411  			"members_can_create_public_repositories": false,
  2412  			"members_can_create_private_repositories": true,
  2413  			"members_can_create_internal_repositories": true,
  2414  			"members_allowed_repository_creation_type": "marct",
  2415  			"members_can_create_pages": true,
  2416  			"members_can_create_public_pages": false,
  2417  			"members_can_create_private_pages": true
  2418  		},
  2419  		"installation": {
  2420  			"id": 1,
  2421  			"node_id": "nid",
  2422  			"app_id": 1,
  2423  			"app_slug": "as",
  2424  			"target_id": 1,
  2425  			"account": {
  2426  				"login": "l",
  2427  				"id": 1,
  2428  				"avatar_url": "a",
  2429  				"gravatar_id": "g",
  2430  				"name": "n",
  2431  				"company": "c",
  2432  				"blog": "b",
  2433  				"location": "l",
  2434  				"email": "e",
  2435  				"hireable": true,
  2436  				"bio": "b",
  2437  				"twitter_username": "t",
  2438  				"public_repos": 1,
  2439  				"followers": 1,
  2440  				"following": 1,
  2441  				"created_at": ` + referenceTimeStr + `,
  2442  				"suspended_at": ` + referenceTimeStr + `,
  2443  				"url": "u"
  2444  			},
  2445  			"access_tokens_url": "atu",
  2446  			"repositories_url": "ru",
  2447  			"html_url": "hu",
  2448  			"target_type": "tt",
  2449  			"single_file_name": "sfn",
  2450  			"repository_selection": "rs",
  2451  			"events": [
  2452  				"e"
  2453  			],
  2454  			"single_file_paths": [
  2455  				"s"
  2456  			],
  2457  			"permissions": {
  2458  				"actions": "a",
  2459  				"administration": "ad",
  2460  				"checks": "c",
  2461  				"contents": "co",
  2462  				"content_references": "cr",
  2463  				"deployments": "d",
  2464  				"environments": "e",
  2465  				"issues": "i",
  2466  				"metadata": "md",
  2467  				"members": "m",
  2468  				"organization_administration": "oa",
  2469  				"organization_hooks": "oh",
  2470  				"organization_plan": "op",
  2471  				"organization_pre_receive_hooks": "opr",
  2472  				"organization_projects": "op",
  2473  				"organization_secrets": "os",
  2474  				"organization_self_hosted_runners": "osh",
  2475  				"organization_user_blocking": "oub",
  2476  				"packages": "pkg",
  2477  				"pages": "pg",
  2478  				"pull_requests": "pr",
  2479  				"repository_hooks": "rh",
  2480  				"repository_projects": "rp",
  2481  				"repository_pre_receive_hooks": "rprh",
  2482  				"secrets": "s",
  2483  				"secret_scanning_alerts": "ssa",
  2484  				"security_events": "se",
  2485  				"single_file": "sf",
  2486  				"statuses": "s",
  2487  				"team_discussions": "td",
  2488  				"vulnerability_alerts": "va",
  2489  				"workflows": "w"
  2490  			},
  2491  			"created_at": ` + referenceTimeStr + `,
  2492  			"updated_at": ` + referenceTimeStr + `,
  2493  			"has_multiple_single_files": false,
  2494  			"suspended_by": {
  2495  				"login": "l",
  2496  				"id": 1,
  2497  				"avatar_url": "a",
  2498  				"gravatar_id": "g",
  2499  				"name": "n",
  2500  				"company": "c",
  2501  				"blog": "b",
  2502  				"location": "l",
  2503  				"email": "e",
  2504  				"hireable": true,
  2505  				"bio": "b",
  2506  				"twitter_username": "t",
  2507  				"public_repos": 1,
  2508  				"followers": 1,
  2509  				"following": 1,
  2510  				"created_at": ` + referenceTimeStr + `,
  2511  				"suspended_at": ` + referenceTimeStr + `,
  2512  				"url": "u"
  2513  			},
  2514  			"suspended_at": ` + referenceTimeStr + `
  2515  		}
  2516  	}`
  2517  
  2518  	testJSONMarshal(t, u, want)
  2519  }
  2520  
  2521  func TestMilestoneEvent_Marshal(t *testing.T) {
  2522  	testJSONMarshal(t, &MilestoneEvent{}, "{}")
  2523  
  2524  	u := &MilestoneEvent{
  2525  		Action:    String("a"),
  2526  		Milestone: &Milestone{ID: Int64(1)},
  2527  		Changes: &EditChange{
  2528  			Title: &EditTitle{
  2529  				From: String("TitleFrom"),
  2530  			},
  2531  			Body: &EditBody{
  2532  				From: String("BodyFrom"),
  2533  			},
  2534  			Base: &EditBase{
  2535  				Ref: &EditRef{
  2536  					From: String("BaseRefFrom"),
  2537  				},
  2538  				SHA: &EditSHA{
  2539  					From: String("BaseSHAFrom"),
  2540  				},
  2541  			},
  2542  		},
  2543  		Repo: &Repository{
  2544  			ID:   Int64(1),
  2545  			URL:  String("s"),
  2546  			Name: String("n"),
  2547  		},
  2548  		Sender: &User{
  2549  			Login:     String("l"),
  2550  			ID:        Int64(1),
  2551  			NodeID:    String("n"),
  2552  			URL:       String("u"),
  2553  			ReposURL:  String("r"),
  2554  			EventsURL: String("e"),
  2555  			AvatarURL: String("a"),
  2556  		},
  2557  		Org: &Organization{
  2558  			BillingEmail:                         String("be"),
  2559  			Blog:                                 String("b"),
  2560  			Company:                              String("c"),
  2561  			Email:                                String("e"),
  2562  			TwitterUsername:                      String("tu"),
  2563  			Location:                             String("loc"),
  2564  			Name:                                 String("n"),
  2565  			Description:                          String("d"),
  2566  			IsVerified:                           Bool(true),
  2567  			HasOrganizationProjects:              Bool(true),
  2568  			HasRepositoryProjects:                Bool(true),
  2569  			DefaultRepoPermission:                String("drp"),
  2570  			MembersCanCreateRepos:                Bool(true),
  2571  			MembersCanCreateInternalRepos:        Bool(true),
  2572  			MembersCanCreatePrivateRepos:         Bool(true),
  2573  			MembersCanCreatePublicRepos:          Bool(false),
  2574  			MembersAllowedRepositoryCreationType: String("marct"),
  2575  			MembersCanCreatePages:                Bool(true),
  2576  			MembersCanCreatePublicPages:          Bool(false),
  2577  			MembersCanCreatePrivatePages:         Bool(true),
  2578  		},
  2579  		Installation: &Installation{
  2580  			ID:       Int64(1),
  2581  			NodeID:   String("nid"),
  2582  			AppID:    Int64(1),
  2583  			AppSlug:  String("as"),
  2584  			TargetID: Int64(1),
  2585  			Account: &User{
  2586  				Login:           String("l"),
  2587  				ID:              Int64(1),
  2588  				URL:             String("u"),
  2589  				AvatarURL:       String("a"),
  2590  				GravatarID:      String("g"),
  2591  				Name:            String("n"),
  2592  				Company:         String("c"),
  2593  				Blog:            String("b"),
  2594  				Location:        String("l"),
  2595  				Email:           String("e"),
  2596  				Hireable:        Bool(true),
  2597  				Bio:             String("b"),
  2598  				TwitterUsername: String("t"),
  2599  				PublicRepos:     Int(1),
  2600  				Followers:       Int(1),
  2601  				Following:       Int(1),
  2602  				CreatedAt:       &Timestamp{referenceTime},
  2603  				SuspendedAt:     &Timestamp{referenceTime},
  2604  			},
  2605  			AccessTokensURL:     String("atu"),
  2606  			RepositoriesURL:     String("ru"),
  2607  			HTMLURL:             String("hu"),
  2608  			TargetType:          String("tt"),
  2609  			SingleFileName:      String("sfn"),
  2610  			RepositorySelection: String("rs"),
  2611  			Events:              []string{"e"},
  2612  			SingleFilePaths:     []string{"s"},
  2613  			Permissions: &InstallationPermissions{
  2614  				Actions:                       String("a"),
  2615  				Administration:                String("ad"),
  2616  				Checks:                        String("c"),
  2617  				Contents:                      String("co"),
  2618  				ContentReferences:             String("cr"),
  2619  				Deployments:                   String("d"),
  2620  				Environments:                  String("e"),
  2621  				Issues:                        String("i"),
  2622  				Metadata:                      String("md"),
  2623  				Members:                       String("m"),
  2624  				OrganizationAdministration:    String("oa"),
  2625  				OrganizationHooks:             String("oh"),
  2626  				OrganizationPlan:              String("op"),
  2627  				OrganizationPreReceiveHooks:   String("opr"),
  2628  				OrganizationProjects:          String("op"),
  2629  				OrganizationSecrets:           String("os"),
  2630  				OrganizationSelfHostedRunners: String("osh"),
  2631  				OrganizationUserBlocking:      String("oub"),
  2632  				Packages:                      String("pkg"),
  2633  				Pages:                         String("pg"),
  2634  				PullRequests:                  String("pr"),
  2635  				RepositoryHooks:               String("rh"),
  2636  				RepositoryProjects:            String("rp"),
  2637  				RepositoryPreReceiveHooks:     String("rprh"),
  2638  				Secrets:                       String("s"),
  2639  				SecretScanningAlerts:          String("ssa"),
  2640  				SecurityEvents:                String("se"),
  2641  				SingleFile:                    String("sf"),
  2642  				Statuses:                      String("s"),
  2643  				TeamDiscussions:               String("td"),
  2644  				VulnerabilityAlerts:           String("va"),
  2645  				Workflows:                     String("w"),
  2646  			},
  2647  			CreatedAt:              &Timestamp{referenceTime},
  2648  			UpdatedAt:              &Timestamp{referenceTime},
  2649  			HasMultipleSingleFiles: Bool(false),
  2650  			SuspendedBy: &User{
  2651  				Login:           String("l"),
  2652  				ID:              Int64(1),
  2653  				URL:             String("u"),
  2654  				AvatarURL:       String("a"),
  2655  				GravatarID:      String("g"),
  2656  				Name:            String("n"),
  2657  				Company:         String("c"),
  2658  				Blog:            String("b"),
  2659  				Location:        String("l"),
  2660  				Email:           String("e"),
  2661  				Hireable:        Bool(true),
  2662  				Bio:             String("b"),
  2663  				TwitterUsername: String("t"),
  2664  				PublicRepos:     Int(1),
  2665  				Followers:       Int(1),
  2666  				Following:       Int(1),
  2667  				CreatedAt:       &Timestamp{referenceTime},
  2668  				SuspendedAt:     &Timestamp{referenceTime},
  2669  			},
  2670  			SuspendedAt: &Timestamp{referenceTime},
  2671  		},
  2672  	}
  2673  
  2674  	want := `{
  2675  		"action": "a",
  2676  		"milestone": {
  2677  			"id": 1
  2678  		},
  2679  		"changes": {
  2680  			"title": {
  2681  				"from": "TitleFrom"
  2682  			},
  2683  			"body": {
  2684  				"from": "BodyFrom"
  2685  			},
  2686  			"base": {
  2687  				"ref": {
  2688  					"from": "BaseRefFrom"
  2689  				},
  2690  				"sha": {
  2691  					"from": "BaseSHAFrom"
  2692  				}
  2693  			}
  2694  		},
  2695  		"repository": {
  2696  			"id": 1,
  2697  			"name": "n",
  2698  			"url": "s"
  2699  		},
  2700  		"sender": {
  2701  			"login": "l",
  2702  			"id": 1,
  2703  			"node_id": "n",
  2704  			"avatar_url": "a",
  2705  			"url": "u",
  2706  			"events_url": "e",
  2707  			"repos_url": "r"
  2708  		},
  2709  		"organization": {
  2710  			"name": "n",
  2711  			"company": "c",
  2712  			"blog": "b",
  2713  			"location": "loc",
  2714  			"email": "e",
  2715  			"twitter_username": "tu",
  2716  			"description": "d",
  2717  			"billing_email": "be",
  2718  			"is_verified": true,
  2719  			"has_organization_projects": true,
  2720  			"has_repository_projects": true,
  2721  			"default_repository_permission": "drp",
  2722  			"members_can_create_repositories": true,
  2723  			"members_can_create_public_repositories": false,
  2724  			"members_can_create_private_repositories": true,
  2725  			"members_can_create_internal_repositories": true,
  2726  			"members_allowed_repository_creation_type": "marct",
  2727  			"members_can_create_pages": true,
  2728  			"members_can_create_public_pages": false,
  2729  			"members_can_create_private_pages": true
  2730  		},
  2731  		"installation": {
  2732  			"id": 1,
  2733  			"node_id": "nid",
  2734  			"app_id": 1,
  2735  			"app_slug": "as",
  2736  			"target_id": 1,
  2737  			"account": {
  2738  				"login": "l",
  2739  				"id": 1,
  2740  				"avatar_url": "a",
  2741  				"gravatar_id": "g",
  2742  				"name": "n",
  2743  				"company": "c",
  2744  				"blog": "b",
  2745  				"location": "l",
  2746  				"email": "e",
  2747  				"hireable": true,
  2748  				"bio": "b",
  2749  				"twitter_username": "t",
  2750  				"public_repos": 1,
  2751  				"followers": 1,
  2752  				"following": 1,
  2753  				"created_at": ` + referenceTimeStr + `,
  2754  				"suspended_at": ` + referenceTimeStr + `,
  2755  				"url": "u"
  2756  			},
  2757  			"access_tokens_url": "atu",
  2758  			"repositories_url": "ru",
  2759  			"html_url": "hu",
  2760  			"target_type": "tt",
  2761  			"single_file_name": "sfn",
  2762  			"repository_selection": "rs",
  2763  			"events": [
  2764  				"e"
  2765  			],
  2766  			"single_file_paths": [
  2767  				"s"
  2768  			],
  2769  			"permissions": {
  2770  				"actions": "a",
  2771  				"administration": "ad",
  2772  				"checks": "c",
  2773  				"contents": "co",
  2774  				"content_references": "cr",
  2775  				"deployments": "d",
  2776  				"environments": "e",
  2777  				"issues": "i",
  2778  				"metadata": "md",
  2779  				"members": "m",
  2780  				"organization_administration": "oa",
  2781  				"organization_hooks": "oh",
  2782  				"organization_plan": "op",
  2783  				"organization_pre_receive_hooks": "opr",
  2784  				"organization_projects": "op",
  2785  				"organization_secrets": "os",
  2786  				"organization_self_hosted_runners": "osh",
  2787  				"organization_user_blocking": "oub",
  2788  				"packages": "pkg",
  2789  				"pages": "pg",
  2790  				"pull_requests": "pr",
  2791  				"repository_hooks": "rh",
  2792  				"repository_projects": "rp",
  2793  				"repository_pre_receive_hooks": "rprh",
  2794  				"secrets": "s",
  2795  				"secret_scanning_alerts": "ssa",
  2796  				"security_events": "se",
  2797  				"single_file": "sf",
  2798  				"statuses": "s",
  2799  				"team_discussions": "td",
  2800  				"vulnerability_alerts": "va",
  2801  				"workflows": "w"
  2802  			},
  2803  			"created_at": ` + referenceTimeStr + `,
  2804  			"updated_at": ` + referenceTimeStr + `,
  2805  			"has_multiple_single_files": false,
  2806  			"suspended_by": {
  2807  				"login": "l",
  2808  				"id": 1,
  2809  				"avatar_url": "a",
  2810  				"gravatar_id": "g",
  2811  				"name": "n",
  2812  				"company": "c",
  2813  				"blog": "b",
  2814  				"location": "l",
  2815  				"email": "e",
  2816  				"hireable": true,
  2817  				"bio": "b",
  2818  				"twitter_username": "t",
  2819  				"public_repos": 1,
  2820  				"followers": 1,
  2821  				"following": 1,
  2822  				"created_at": ` + referenceTimeStr + `,
  2823  				"suspended_at": ` + referenceTimeStr + `,
  2824  				"url": "u"
  2825  			},
  2826  			"suspended_at": ` + referenceTimeStr + `
  2827  		}
  2828  	}`
  2829  
  2830  	testJSONMarshal(t, u, want)
  2831  }
  2832  
  2833  func TestPublicEvent_Marshal(t *testing.T) {
  2834  	testJSONMarshal(t, &PublicEvent{}, "{}")
  2835  
  2836  	u := &PublicEvent{
  2837  		Repo: &Repository{
  2838  			ID:   Int64(1),
  2839  			URL:  String("s"),
  2840  			Name: String("n"),
  2841  		},
  2842  		Sender: &User{
  2843  			Login:     String("l"),
  2844  			ID:        Int64(1),
  2845  			NodeID:    String("n"),
  2846  			URL:       String("u"),
  2847  			ReposURL:  String("r"),
  2848  			EventsURL: String("e"),
  2849  			AvatarURL: String("a"),
  2850  		},
  2851  		Installation: &Installation{
  2852  			ID:       Int64(1),
  2853  			NodeID:   String("nid"),
  2854  			AppID:    Int64(1),
  2855  			AppSlug:  String("as"),
  2856  			TargetID: Int64(1),
  2857  			Account: &User{
  2858  				Login:           String("l"),
  2859  				ID:              Int64(1),
  2860  				URL:             String("u"),
  2861  				AvatarURL:       String("a"),
  2862  				GravatarID:      String("g"),
  2863  				Name:            String("n"),
  2864  				Company:         String("c"),
  2865  				Blog:            String("b"),
  2866  				Location:        String("l"),
  2867  				Email:           String("e"),
  2868  				Hireable:        Bool(true),
  2869  				Bio:             String("b"),
  2870  				TwitterUsername: String("t"),
  2871  				PublicRepos:     Int(1),
  2872  				Followers:       Int(1),
  2873  				Following:       Int(1),
  2874  				CreatedAt:       &Timestamp{referenceTime},
  2875  				SuspendedAt:     &Timestamp{referenceTime},
  2876  			},
  2877  			AccessTokensURL:     String("atu"),
  2878  			RepositoriesURL:     String("ru"),
  2879  			HTMLURL:             String("hu"),
  2880  			TargetType:          String("tt"),
  2881  			SingleFileName:      String("sfn"),
  2882  			RepositorySelection: String("rs"),
  2883  			Events:              []string{"e"},
  2884  			SingleFilePaths:     []string{"s"},
  2885  			Permissions: &InstallationPermissions{
  2886  				Actions:                       String("a"),
  2887  				Administration:                String("ad"),
  2888  				Checks:                        String("c"),
  2889  				Contents:                      String("co"),
  2890  				ContentReferences:             String("cr"),
  2891  				Deployments:                   String("d"),
  2892  				Environments:                  String("e"),
  2893  				Issues:                        String("i"),
  2894  				Metadata:                      String("md"),
  2895  				Members:                       String("m"),
  2896  				OrganizationAdministration:    String("oa"),
  2897  				OrganizationHooks:             String("oh"),
  2898  				OrganizationPlan:              String("op"),
  2899  				OrganizationPreReceiveHooks:   String("opr"),
  2900  				OrganizationProjects:          String("op"),
  2901  				OrganizationSecrets:           String("os"),
  2902  				OrganizationSelfHostedRunners: String("osh"),
  2903  				OrganizationUserBlocking:      String("oub"),
  2904  				Packages:                      String("pkg"),
  2905  				Pages:                         String("pg"),
  2906  				PullRequests:                  String("pr"),
  2907  				RepositoryHooks:               String("rh"),
  2908  				RepositoryProjects:            String("rp"),
  2909  				RepositoryPreReceiveHooks:     String("rprh"),
  2910  				Secrets:                       String("s"),
  2911  				SecretScanningAlerts:          String("ssa"),
  2912  				SecurityEvents:                String("se"),
  2913  				SingleFile:                    String("sf"),
  2914  				Statuses:                      String("s"),
  2915  				TeamDiscussions:               String("td"),
  2916  				VulnerabilityAlerts:           String("va"),
  2917  				Workflows:                     String("w"),
  2918  			},
  2919  			CreatedAt:              &Timestamp{referenceTime},
  2920  			UpdatedAt:              &Timestamp{referenceTime},
  2921  			HasMultipleSingleFiles: Bool(false),
  2922  			SuspendedBy: &User{
  2923  				Login:           String("l"),
  2924  				ID:              Int64(1),
  2925  				URL:             String("u"),
  2926  				AvatarURL:       String("a"),
  2927  				GravatarID:      String("g"),
  2928  				Name:            String("n"),
  2929  				Company:         String("c"),
  2930  				Blog:            String("b"),
  2931  				Location:        String("l"),
  2932  				Email:           String("e"),
  2933  				Hireable:        Bool(true),
  2934  				Bio:             String("b"),
  2935  				TwitterUsername: String("t"),
  2936  				PublicRepos:     Int(1),
  2937  				Followers:       Int(1),
  2938  				Following:       Int(1),
  2939  				CreatedAt:       &Timestamp{referenceTime},
  2940  				SuspendedAt:     &Timestamp{referenceTime},
  2941  			},
  2942  			SuspendedAt: &Timestamp{referenceTime},
  2943  		},
  2944  	}
  2945  
  2946  	want := `{
  2947  		"repository": {
  2948  			"id": 1,
  2949  			"name": "n",
  2950  			"url": "s"
  2951  		},
  2952  		"sender": {
  2953  			"login": "l",
  2954  			"id": 1,
  2955  			"node_id": "n",
  2956  			"avatar_url": "a",
  2957  			"url": "u",
  2958  			"events_url": "e",
  2959  			"repos_url": "r"
  2960  		},
  2961  		"installation": {
  2962  			"id": 1,
  2963  			"node_id": "nid",
  2964  			"app_id": 1,
  2965  			"app_slug": "as",
  2966  			"target_id": 1,
  2967  			"account": {
  2968  				"login": "l",
  2969  				"id": 1,
  2970  				"avatar_url": "a",
  2971  				"gravatar_id": "g",
  2972  				"name": "n",
  2973  				"company": "c",
  2974  				"blog": "b",
  2975  				"location": "l",
  2976  				"email": "e",
  2977  				"hireable": true,
  2978  				"bio": "b",
  2979  				"twitter_username": "t",
  2980  				"public_repos": 1,
  2981  				"followers": 1,
  2982  				"following": 1,
  2983  				"created_at": ` + referenceTimeStr + `,
  2984  				"suspended_at": ` + referenceTimeStr + `,
  2985  				"url": "u"
  2986  			},
  2987  			"access_tokens_url": "atu",
  2988  			"repositories_url": "ru",
  2989  			"html_url": "hu",
  2990  			"target_type": "tt",
  2991  			"single_file_name": "sfn",
  2992  			"repository_selection": "rs",
  2993  			"events": [
  2994  				"e"
  2995  			],
  2996  			"single_file_paths": [
  2997  				"s"
  2998  			],
  2999  			"permissions": {
  3000  				"actions": "a",
  3001  				"administration": "ad",
  3002  				"checks": "c",
  3003  				"contents": "co",
  3004  				"content_references": "cr",
  3005  				"deployments": "d",
  3006  				"environments": "e",
  3007  				"issues": "i",
  3008  				"metadata": "md",
  3009  				"members": "m",
  3010  				"organization_administration": "oa",
  3011  				"organization_hooks": "oh",
  3012  				"organization_plan": "op",
  3013  				"organization_pre_receive_hooks": "opr",
  3014  				"organization_projects": "op",
  3015  				"organization_secrets": "os",
  3016  				"organization_self_hosted_runners": "osh",
  3017  				"organization_user_blocking": "oub",
  3018  				"packages": "pkg",
  3019  				"pages": "pg",
  3020  				"pull_requests": "pr",
  3021  				"repository_hooks": "rh",
  3022  				"repository_projects": "rp",
  3023  				"repository_pre_receive_hooks": "rprh",
  3024  				"secrets": "s",
  3025  				"secret_scanning_alerts": "ssa",
  3026  				"security_events": "se",
  3027  				"single_file": "sf",
  3028  				"statuses": "s",
  3029  				"team_discussions": "td",
  3030  				"vulnerability_alerts": "va",
  3031  				"workflows": "w"
  3032  			},
  3033  			"created_at": ` + referenceTimeStr + `,
  3034  			"updated_at": ` + referenceTimeStr + `,
  3035  			"has_multiple_single_files": false,
  3036  			"suspended_by": {
  3037  				"login": "l",
  3038  				"id": 1,
  3039  				"avatar_url": "a",
  3040  				"gravatar_id": "g",
  3041  				"name": "n",
  3042  				"company": "c",
  3043  				"blog": "b",
  3044  				"location": "l",
  3045  				"email": "e",
  3046  				"hireable": true,
  3047  				"bio": "b",
  3048  				"twitter_username": "t",
  3049  				"public_repos": 1,
  3050  				"followers": 1,
  3051  				"following": 1,
  3052  				"created_at": ` + referenceTimeStr + `,
  3053  				"suspended_at": ` + referenceTimeStr + `,
  3054  				"url": "u"
  3055  			},
  3056  			"suspended_at": ` + referenceTimeStr + `
  3057  		}
  3058  	}`
  3059  
  3060  	testJSONMarshal(t, u, want)
  3061  }
  3062  
  3063  func TestPullRequestReviewEvent_Marshal(t *testing.T) {
  3064  	testJSONMarshal(t, &PullRequestReviewEvent{}, "{}")
  3065  
  3066  	u := &PullRequestReviewEvent{
  3067  		Action:      String("a"),
  3068  		Review:      &PullRequestReview{ID: Int64(1)},
  3069  		PullRequest: &PullRequest{ID: Int64(1)},
  3070  		Repo: &Repository{
  3071  			ID:   Int64(1),
  3072  			URL:  String("s"),
  3073  			Name: String("n"),
  3074  		},
  3075  		Sender: &User{
  3076  			Login:     String("l"),
  3077  			ID:        Int64(1),
  3078  			NodeID:    String("n"),
  3079  			URL:       String("u"),
  3080  			ReposURL:  String("r"),
  3081  			EventsURL: String("e"),
  3082  			AvatarURL: String("a"),
  3083  		},
  3084  		Installation: &Installation{
  3085  			ID:       Int64(1),
  3086  			NodeID:   String("nid"),
  3087  			AppID:    Int64(1),
  3088  			AppSlug:  String("as"),
  3089  			TargetID: Int64(1),
  3090  			Account: &User{
  3091  				Login:           String("l"),
  3092  				ID:              Int64(1),
  3093  				URL:             String("u"),
  3094  				AvatarURL:       String("a"),
  3095  				GravatarID:      String("g"),
  3096  				Name:            String("n"),
  3097  				Company:         String("c"),
  3098  				Blog:            String("b"),
  3099  				Location:        String("l"),
  3100  				Email:           String("e"),
  3101  				Hireable:        Bool(true),
  3102  				Bio:             String("b"),
  3103  				TwitterUsername: String("t"),
  3104  				PublicRepos:     Int(1),
  3105  				Followers:       Int(1),
  3106  				Following:       Int(1),
  3107  				CreatedAt:       &Timestamp{referenceTime},
  3108  				SuspendedAt:     &Timestamp{referenceTime},
  3109  			},
  3110  			AccessTokensURL:     String("atu"),
  3111  			RepositoriesURL:     String("ru"),
  3112  			HTMLURL:             String("hu"),
  3113  			TargetType:          String("tt"),
  3114  			SingleFileName:      String("sfn"),
  3115  			RepositorySelection: String("rs"),
  3116  			Events:              []string{"e"},
  3117  			SingleFilePaths:     []string{"s"},
  3118  			Permissions: &InstallationPermissions{
  3119  				Actions:                       String("a"),
  3120  				Administration:                String("ad"),
  3121  				Checks:                        String("c"),
  3122  				Contents:                      String("co"),
  3123  				ContentReferences:             String("cr"),
  3124  				Deployments:                   String("d"),
  3125  				Environments:                  String("e"),
  3126  				Issues:                        String("i"),
  3127  				Metadata:                      String("md"),
  3128  				Members:                       String("m"),
  3129  				OrganizationAdministration:    String("oa"),
  3130  				OrganizationHooks:             String("oh"),
  3131  				OrganizationPlan:              String("op"),
  3132  				OrganizationPreReceiveHooks:   String("opr"),
  3133  				OrganizationProjects:          String("op"),
  3134  				OrganizationSecrets:           String("os"),
  3135  				OrganizationSelfHostedRunners: String("osh"),
  3136  				OrganizationUserBlocking:      String("oub"),
  3137  				Packages:                      String("pkg"),
  3138  				Pages:                         String("pg"),
  3139  				PullRequests:                  String("pr"),
  3140  				RepositoryHooks:               String("rh"),
  3141  				RepositoryProjects:            String("rp"),
  3142  				RepositoryPreReceiveHooks:     String("rprh"),
  3143  				Secrets:                       String("s"),
  3144  				SecretScanningAlerts:          String("ssa"),
  3145  				SecurityEvents:                String("se"),
  3146  				SingleFile:                    String("sf"),
  3147  				Statuses:                      String("s"),
  3148  				TeamDiscussions:               String("td"),
  3149  				VulnerabilityAlerts:           String("va"),
  3150  				Workflows:                     String("w"),
  3151  			},
  3152  			CreatedAt:              &Timestamp{referenceTime},
  3153  			UpdatedAt:              &Timestamp{referenceTime},
  3154  			HasMultipleSingleFiles: Bool(false),
  3155  			SuspendedBy: &User{
  3156  				Login:           String("l"),
  3157  				ID:              Int64(1),
  3158  				URL:             String("u"),
  3159  				AvatarURL:       String("a"),
  3160  				GravatarID:      String("g"),
  3161  				Name:            String("n"),
  3162  				Company:         String("c"),
  3163  				Blog:            String("b"),
  3164  				Location:        String("l"),
  3165  				Email:           String("e"),
  3166  				Hireable:        Bool(true),
  3167  				Bio:             String("b"),
  3168  				TwitterUsername: String("t"),
  3169  				PublicRepos:     Int(1),
  3170  				Followers:       Int(1),
  3171  				Following:       Int(1),
  3172  				CreatedAt:       &Timestamp{referenceTime},
  3173  				SuspendedAt:     &Timestamp{referenceTime},
  3174  			},
  3175  			SuspendedAt: &Timestamp{referenceTime},
  3176  		},
  3177  		Organization: &Organization{
  3178  			BillingEmail:                         String("be"),
  3179  			Blog:                                 String("b"),
  3180  			Company:                              String("c"),
  3181  			Email:                                String("e"),
  3182  			TwitterUsername:                      String("tu"),
  3183  			Location:                             String("loc"),
  3184  			Name:                                 String("n"),
  3185  			Description:                          String("d"),
  3186  			IsVerified:                           Bool(true),
  3187  			HasOrganizationProjects:              Bool(true),
  3188  			HasRepositoryProjects:                Bool(true),
  3189  			DefaultRepoPermission:                String("drp"),
  3190  			MembersCanCreateRepos:                Bool(true),
  3191  			MembersCanCreateInternalRepos:        Bool(true),
  3192  			MembersCanCreatePrivateRepos:         Bool(true),
  3193  			MembersCanCreatePublicRepos:          Bool(false),
  3194  			MembersAllowedRepositoryCreationType: String("marct"),
  3195  			MembersCanCreatePages:                Bool(true),
  3196  			MembersCanCreatePublicPages:          Bool(false),
  3197  			MembersCanCreatePrivatePages:         Bool(true),
  3198  		},
  3199  	}
  3200  
  3201  	want := `{
  3202  		"action": "a",
  3203  		"review": {
  3204  			"id": 1
  3205  		},
  3206  		"pull_request": {
  3207  			"id": 1
  3208  		},
  3209  		"repository": {
  3210  			"id": 1,
  3211  			"name": "n",
  3212  			"url": "s"
  3213  		},
  3214  		"sender": {
  3215  			"login": "l",
  3216  			"id": 1,
  3217  			"node_id": "n",
  3218  			"avatar_url": "a",
  3219  			"url": "u",
  3220  			"events_url": "e",
  3221  			"repos_url": "r"
  3222  		},
  3223  		"installation": {
  3224  			"id": 1,
  3225  			"node_id": "nid",
  3226  			"app_id": 1,
  3227  			"app_slug": "as",
  3228  			"target_id": 1,
  3229  			"account": {
  3230  				"login": "l",
  3231  				"id": 1,
  3232  				"avatar_url": "a",
  3233  				"gravatar_id": "g",
  3234  				"name": "n",
  3235  				"company": "c",
  3236  				"blog": "b",
  3237  				"location": "l",
  3238  				"email": "e",
  3239  				"hireable": true,
  3240  				"bio": "b",
  3241  				"twitter_username": "t",
  3242  				"public_repos": 1,
  3243  				"followers": 1,
  3244  				"following": 1,
  3245  				"created_at": ` + referenceTimeStr + `,
  3246  				"suspended_at": ` + referenceTimeStr + `,
  3247  				"url": "u"
  3248  			},
  3249  			"access_tokens_url": "atu",
  3250  			"repositories_url": "ru",
  3251  			"html_url": "hu",
  3252  			"target_type": "tt",
  3253  			"single_file_name": "sfn",
  3254  			"repository_selection": "rs",
  3255  			"events": [
  3256  				"e"
  3257  			],
  3258  			"single_file_paths": [
  3259  				"s"
  3260  			],
  3261  			"permissions": {
  3262  				"actions": "a",
  3263  				"administration": "ad",
  3264  				"checks": "c",
  3265  				"contents": "co",
  3266  				"content_references": "cr",
  3267  				"deployments": "d",
  3268  				"environments": "e",
  3269  				"issues": "i",
  3270  				"metadata": "md",
  3271  				"members": "m",
  3272  				"organization_administration": "oa",
  3273  				"organization_hooks": "oh",
  3274  				"organization_plan": "op",
  3275  				"organization_pre_receive_hooks": "opr",
  3276  				"organization_projects": "op",
  3277  				"organization_secrets": "os",
  3278  				"organization_self_hosted_runners": "osh",
  3279  				"organization_user_blocking": "oub",
  3280  				"packages": "pkg",
  3281  				"pages": "pg",
  3282  				"pull_requests": "pr",
  3283  				"repository_hooks": "rh",
  3284  				"repository_projects": "rp",
  3285  				"repository_pre_receive_hooks": "rprh",
  3286  				"secrets": "s",
  3287  				"secret_scanning_alerts": "ssa",
  3288  				"security_events": "se",
  3289  				"single_file": "sf",
  3290  				"statuses": "s",
  3291  				"team_discussions": "td",
  3292  				"vulnerability_alerts": "va",
  3293  				"workflows": "w"
  3294  			},
  3295  			"created_at": ` + referenceTimeStr + `,
  3296  			"updated_at": ` + referenceTimeStr + `,
  3297  			"has_multiple_single_files": false,
  3298  			"suspended_by": {
  3299  				"login": "l",
  3300  				"id": 1,
  3301  				"avatar_url": "a",
  3302  				"gravatar_id": "g",
  3303  				"name": "n",
  3304  				"company": "c",
  3305  				"blog": "b",
  3306  				"location": "l",
  3307  				"email": "e",
  3308  				"hireable": true,
  3309  				"bio": "b",
  3310  				"twitter_username": "t",
  3311  				"public_repos": 1,
  3312  				"followers": 1,
  3313  				"following": 1,
  3314  				"created_at": ` + referenceTimeStr + `,
  3315  				"suspended_at": ` + referenceTimeStr + `,
  3316  				"url": "u"
  3317  			},
  3318  			"suspended_at": ` + referenceTimeStr + `
  3319  		},
  3320  		"organization": {
  3321  			"name": "n",
  3322  			"company": "c",
  3323  			"blog": "b",
  3324  			"location": "loc",
  3325  			"email": "e",
  3326  			"twitter_username": "tu",
  3327  			"description": "d",
  3328  			"billing_email": "be",
  3329  			"is_verified": true,
  3330  			"has_organization_projects": true,
  3331  			"has_repository_projects": true,
  3332  			"default_repository_permission": "drp",
  3333  			"members_can_create_repositories": true,
  3334  			"members_can_create_public_repositories": false,
  3335  			"members_can_create_private_repositories": true,
  3336  			"members_can_create_internal_repositories": true,
  3337  			"members_allowed_repository_creation_type": "marct",
  3338  			"members_can_create_pages": true,
  3339  			"members_can_create_public_pages": false,
  3340  			"members_can_create_private_pages": true
  3341  		}
  3342  	}`
  3343  
  3344  	testJSONMarshal(t, u, want)
  3345  }
  3346  
  3347  func TestPushEvent_Marshal(t *testing.T) {
  3348  	testJSONMarshal(t, &PushEvent{}, "{}")
  3349  
  3350  	u := &PushEvent{
  3351  		PushID: Int64(1),
  3352  		Head:   String("h"),
  3353  		Ref:    String("ref"),
  3354  		Size:   Int(1),
  3355  		Commits: []*HeadCommit{
  3356  			{ID: String("id")},
  3357  		},
  3358  		Before:       String("b"),
  3359  		DistinctSize: Int(1),
  3360  		After:        String("a"),
  3361  		Created:      Bool(true),
  3362  		Deleted:      Bool(true),
  3363  		Forced:       Bool(true),
  3364  		BaseRef:      String("a"),
  3365  		Compare:      String("a"),
  3366  		Repo:         &PushEventRepository{ID: Int64(1)},
  3367  		HeadCommit:   &HeadCommit{ID: String("id")},
  3368  		Pusher: &User{
  3369  			Login:     String("l"),
  3370  			ID:        Int64(1),
  3371  			NodeID:    String("n"),
  3372  			URL:       String("u"),
  3373  			ReposURL:  String("r"),
  3374  			EventsURL: String("e"),
  3375  			AvatarURL: String("a"),
  3376  		},
  3377  		Sender: &User{
  3378  			Login:     String("l"),
  3379  			ID:        Int64(1),
  3380  			NodeID:    String("n"),
  3381  			URL:       String("u"),
  3382  			ReposURL:  String("r"),
  3383  			EventsURL: String("e"),
  3384  			AvatarURL: String("a"),
  3385  		},
  3386  		Installation: &Installation{
  3387  			ID:       Int64(1),
  3388  			NodeID:   String("nid"),
  3389  			AppID:    Int64(1),
  3390  			AppSlug:  String("as"),
  3391  			TargetID: Int64(1),
  3392  			Account: &User{
  3393  				Login:           String("l"),
  3394  				ID:              Int64(1),
  3395  				URL:             String("u"),
  3396  				AvatarURL:       String("a"),
  3397  				GravatarID:      String("g"),
  3398  				Name:            String("n"),
  3399  				Company:         String("c"),
  3400  				Blog:            String("b"),
  3401  				Location:        String("l"),
  3402  				Email:           String("e"),
  3403  				Hireable:        Bool(true),
  3404  				Bio:             String("b"),
  3405  				TwitterUsername: String("t"),
  3406  				PublicRepos:     Int(1),
  3407  				Followers:       Int(1),
  3408  				Following:       Int(1),
  3409  				CreatedAt:       &Timestamp{referenceTime},
  3410  				SuspendedAt:     &Timestamp{referenceTime},
  3411  			},
  3412  			AccessTokensURL:     String("atu"),
  3413  			RepositoriesURL:     String("ru"),
  3414  			HTMLURL:             String("hu"),
  3415  			TargetType:          String("tt"),
  3416  			SingleFileName:      String("sfn"),
  3417  			RepositorySelection: String("rs"),
  3418  			Events:              []string{"e"},
  3419  			SingleFilePaths:     []string{"s"},
  3420  			Permissions: &InstallationPermissions{
  3421  				Actions:                       String("a"),
  3422  				Administration:                String("ad"),
  3423  				Checks:                        String("c"),
  3424  				Contents:                      String("co"),
  3425  				ContentReferences:             String("cr"),
  3426  				Deployments:                   String("d"),
  3427  				Environments:                  String("e"),
  3428  				Issues:                        String("i"),
  3429  				Metadata:                      String("md"),
  3430  				Members:                       String("m"),
  3431  				OrganizationAdministration:    String("oa"),
  3432  				OrganizationHooks:             String("oh"),
  3433  				OrganizationPlan:              String("op"),
  3434  				OrganizationPreReceiveHooks:   String("opr"),
  3435  				OrganizationProjects:          String("op"),
  3436  				OrganizationSecrets:           String("os"),
  3437  				OrganizationSelfHostedRunners: String("osh"),
  3438  				OrganizationUserBlocking:      String("oub"),
  3439  				Packages:                      String("pkg"),
  3440  				Pages:                         String("pg"),
  3441  				PullRequests:                  String("pr"),
  3442  				RepositoryHooks:               String("rh"),
  3443  				RepositoryProjects:            String("rp"),
  3444  				RepositoryPreReceiveHooks:     String("rprh"),
  3445  				Secrets:                       String("s"),
  3446  				SecretScanningAlerts:          String("ssa"),
  3447  				SecurityEvents:                String("se"),
  3448  				SingleFile:                    String("sf"),
  3449  				Statuses:                      String("s"),
  3450  				TeamDiscussions:               String("td"),
  3451  				VulnerabilityAlerts:           String("va"),
  3452  				Workflows:                     String("w"),
  3453  			},
  3454  			CreatedAt:              &Timestamp{referenceTime},
  3455  			UpdatedAt:              &Timestamp{referenceTime},
  3456  			HasMultipleSingleFiles: Bool(false),
  3457  			SuspendedBy: &User{
  3458  				Login:           String("l"),
  3459  				ID:              Int64(1),
  3460  				URL:             String("u"),
  3461  				AvatarURL:       String("a"),
  3462  				GravatarID:      String("g"),
  3463  				Name:            String("n"),
  3464  				Company:         String("c"),
  3465  				Blog:            String("b"),
  3466  				Location:        String("l"),
  3467  				Email:           String("e"),
  3468  				Hireable:        Bool(true),
  3469  				Bio:             String("b"),
  3470  				TwitterUsername: String("t"),
  3471  				PublicRepos:     Int(1),
  3472  				Followers:       Int(1),
  3473  				Following:       Int(1),
  3474  				CreatedAt:       &Timestamp{referenceTime},
  3475  				SuspendedAt:     &Timestamp{referenceTime},
  3476  			},
  3477  			SuspendedAt: &Timestamp{referenceTime},
  3478  		},
  3479  		Organization: &Organization{
  3480  			BillingEmail:                         String("be"),
  3481  			Blog:                                 String("b"),
  3482  			Company:                              String("c"),
  3483  			Email:                                String("e"),
  3484  			TwitterUsername:                      String("tu"),
  3485  			Location:                             String("loc"),
  3486  			Name:                                 String("n"),
  3487  			Description:                          String("d"),
  3488  			IsVerified:                           Bool(true),
  3489  			HasOrganizationProjects:              Bool(true),
  3490  			HasRepositoryProjects:                Bool(true),
  3491  			DefaultRepoPermission:                String("drp"),
  3492  			MembersCanCreateRepos:                Bool(true),
  3493  			MembersCanCreateInternalRepos:        Bool(true),
  3494  			MembersCanCreatePrivateRepos:         Bool(true),
  3495  			MembersCanCreatePublicRepos:          Bool(false),
  3496  			MembersAllowedRepositoryCreationType: String("marct"),
  3497  			MembersCanCreatePages:                Bool(true),
  3498  			MembersCanCreatePublicPages:          Bool(false),
  3499  			MembersCanCreatePrivatePages:         Bool(true),
  3500  		},
  3501  	}
  3502  
  3503  	want := `{
  3504  		"push_id": 1,
  3505  		"head": "h",
  3506  		"ref": "ref",
  3507  		"size": 1,
  3508  		"commits": [
  3509  			{
  3510  				"id": "id"
  3511  			}
  3512  		],
  3513  		"before": "b",
  3514  		"distinct_size": 1,
  3515  		"after": "a",
  3516  		"created": true,
  3517  		"deleted": true,
  3518  		"forced": true,
  3519  		"base_ref": "a",
  3520  		"compare": "a",
  3521  		"repository": {
  3522  			"id": 1
  3523  		},
  3524  		"head_commit": {
  3525  			"id": "id"
  3526  		},
  3527  		"pusher": {
  3528  			"login": "l",
  3529  			"id": 1,
  3530  			"node_id": "n",
  3531  			"avatar_url": "a",
  3532  			"url": "u",
  3533  			"events_url": "e",
  3534  			"repos_url": "r"
  3535  		},
  3536  		"sender": {
  3537  			"login": "l",
  3538  			"id": 1,
  3539  			"node_id": "n",
  3540  			"avatar_url": "a",
  3541  			"url": "u",
  3542  			"events_url": "e",
  3543  			"repos_url": "r"
  3544  		},
  3545  		"installation": {
  3546  			"id": 1,
  3547  			"node_id": "nid",
  3548  			"app_id": 1,
  3549  			"app_slug": "as",
  3550  			"target_id": 1,
  3551  			"account": {
  3552  				"login": "l",
  3553  				"id": 1,
  3554  				"avatar_url": "a",
  3555  				"gravatar_id": "g",
  3556  				"name": "n",
  3557  				"company": "c",
  3558  				"blog": "b",
  3559  				"location": "l",
  3560  				"email": "e",
  3561  				"hireable": true,
  3562  				"bio": "b",
  3563  				"twitter_username": "t",
  3564  				"public_repos": 1,
  3565  				"followers": 1,
  3566  				"following": 1,
  3567  				"created_at": ` + referenceTimeStr + `,
  3568  				"suspended_at": ` + referenceTimeStr + `,
  3569  				"url": "u"
  3570  			},
  3571  			"access_tokens_url": "atu",
  3572  			"repositories_url": "ru",
  3573  			"html_url": "hu",
  3574  			"target_type": "tt",
  3575  			"single_file_name": "sfn",
  3576  			"repository_selection": "rs",
  3577  			"events": [
  3578  				"e"
  3579  			],
  3580  			"single_file_paths": [
  3581  				"s"
  3582  			],
  3583  			"permissions": {
  3584  				"actions": "a",
  3585  				"administration": "ad",
  3586  				"checks": "c",
  3587  				"contents": "co",
  3588  				"content_references": "cr",
  3589  				"deployments": "d",
  3590  				"environments": "e",
  3591  				"issues": "i",
  3592  				"metadata": "md",
  3593  				"members": "m",
  3594  				"organization_administration": "oa",
  3595  				"organization_hooks": "oh",
  3596  				"organization_plan": "op",
  3597  				"organization_pre_receive_hooks": "opr",
  3598  				"organization_projects": "op",
  3599  				"organization_secrets": "os",
  3600  				"organization_self_hosted_runners": "osh",
  3601  				"organization_user_blocking": "oub",
  3602  				"packages": "pkg",
  3603  				"pages": "pg",
  3604  				"pull_requests": "pr",
  3605  				"repository_hooks": "rh",
  3606  				"repository_projects": "rp",
  3607  				"repository_pre_receive_hooks": "rprh",
  3608  				"secrets": "s",
  3609  				"secret_scanning_alerts": "ssa",
  3610  				"security_events": "se",
  3611  				"single_file": "sf",
  3612  				"statuses": "s",
  3613  				"team_discussions": "td",
  3614  				"vulnerability_alerts": "va",
  3615  				"workflows": "w"
  3616  			},
  3617  			"created_at": ` + referenceTimeStr + `,
  3618  			"updated_at": ` + referenceTimeStr + `,
  3619  			"has_multiple_single_files": false,
  3620  			"suspended_by": {
  3621  				"login": "l",
  3622  				"id": 1,
  3623  				"avatar_url": "a",
  3624  				"gravatar_id": "g",
  3625  				"name": "n",
  3626  				"company": "c",
  3627  				"blog": "b",
  3628  				"location": "l",
  3629  				"email": "e",
  3630  				"hireable": true,
  3631  				"bio": "b",
  3632  				"twitter_username": "t",
  3633  				"public_repos": 1,
  3634  				"followers": 1,
  3635  				"following": 1,
  3636  				"created_at": ` + referenceTimeStr + `,
  3637  				"suspended_at": ` + referenceTimeStr + `,
  3638  				"url": "u"
  3639  			},
  3640  			"suspended_at": ` + referenceTimeStr + `
  3641  		},
  3642  		"organization": {
  3643  			"name": "n",
  3644  			"company": "c",
  3645  			"blog": "b",
  3646  			"location": "loc",
  3647  			"email": "e",
  3648  			"twitter_username": "tu",
  3649  			"description": "d",
  3650  			"billing_email": "be",
  3651  			"is_verified": true,
  3652  			"has_organization_projects": true,
  3653  			"has_repository_projects": true,
  3654  			"default_repository_permission": "drp",
  3655  			"members_can_create_repositories": true,
  3656  			"members_can_create_public_repositories": false,
  3657  			"members_can_create_private_repositories": true,
  3658  			"members_can_create_internal_repositories": true,
  3659  			"members_allowed_repository_creation_type": "marct",
  3660  			"members_can_create_pages": true,
  3661  			"members_can_create_public_pages": false,
  3662  			"members_can_create_private_pages": true
  3663  		}
  3664  	}`
  3665  
  3666  	testJSONMarshal(t, u, want)
  3667  }
  3668  
  3669  func TestStatusEvent_Marshal(t *testing.T) {
  3670  	testJSONMarshal(t, &StatusEvent{}, "{}")
  3671  
  3672  	u := &StatusEvent{
  3673  		SHA:         String("sha"),
  3674  		State:       String("s"),
  3675  		Description: String("d"),
  3676  		TargetURL:   String("turl"),
  3677  		Branches: []*Branch{
  3678  			{
  3679  				Name:      String("n"),
  3680  				Commit:    &RepositoryCommit{NodeID: String("nid")},
  3681  				Protected: Bool(false),
  3682  			},
  3683  		},
  3684  		ID:        Int64(1),
  3685  		Name:      String("n"),
  3686  		Context:   String("c"),
  3687  		Commit:    &RepositoryCommit{NodeID: String("nid")},
  3688  		CreatedAt: &Timestamp{referenceTime},
  3689  		UpdatedAt: &Timestamp{referenceTime},
  3690  		Sender: &User{
  3691  			Login:     String("l"),
  3692  			ID:        Int64(1),
  3693  			NodeID:    String("n"),
  3694  			URL:       String("u"),
  3695  			ReposURL:  String("r"),
  3696  			EventsURL: String("e"),
  3697  			AvatarURL: String("a"),
  3698  		},
  3699  		Installation: &Installation{
  3700  			ID:       Int64(1),
  3701  			NodeID:   String("nid"),
  3702  			AppID:    Int64(1),
  3703  			AppSlug:  String("as"),
  3704  			TargetID: Int64(1),
  3705  			Account: &User{
  3706  				Login:           String("l"),
  3707  				ID:              Int64(1),
  3708  				URL:             String("u"),
  3709  				AvatarURL:       String("a"),
  3710  				GravatarID:      String("g"),
  3711  				Name:            String("n"),
  3712  				Company:         String("c"),
  3713  				Blog:            String("b"),
  3714  				Location:        String("l"),
  3715  				Email:           String("e"),
  3716  				Hireable:        Bool(true),
  3717  				Bio:             String("b"),
  3718  				TwitterUsername: String("t"),
  3719  				PublicRepos:     Int(1),
  3720  				Followers:       Int(1),
  3721  				Following:       Int(1),
  3722  				CreatedAt:       &Timestamp{referenceTime},
  3723  				SuspendedAt:     &Timestamp{referenceTime},
  3724  			},
  3725  			AccessTokensURL:     String("atu"),
  3726  			RepositoriesURL:     String("ru"),
  3727  			HTMLURL:             String("hu"),
  3728  			TargetType:          String("tt"),
  3729  			SingleFileName:      String("sfn"),
  3730  			RepositorySelection: String("rs"),
  3731  			Events:              []string{"e"},
  3732  			SingleFilePaths:     []string{"s"},
  3733  			Permissions: &InstallationPermissions{
  3734  				Actions:                       String("a"),
  3735  				Administration:                String("ad"),
  3736  				Checks:                        String("c"),
  3737  				Contents:                      String("co"),
  3738  				ContentReferences:             String("cr"),
  3739  				Deployments:                   String("d"),
  3740  				Environments:                  String("e"),
  3741  				Issues:                        String("i"),
  3742  				Metadata:                      String("md"),
  3743  				Members:                       String("m"),
  3744  				OrganizationAdministration:    String("oa"),
  3745  				OrganizationHooks:             String("oh"),
  3746  				OrganizationPlan:              String("op"),
  3747  				OrganizationPreReceiveHooks:   String("opr"),
  3748  				OrganizationProjects:          String("op"),
  3749  				OrganizationSecrets:           String("os"),
  3750  				OrganizationSelfHostedRunners: String("osh"),
  3751  				OrganizationUserBlocking:      String("oub"),
  3752  				Packages:                      String("pkg"),
  3753  				Pages:                         String("pg"),
  3754  				PullRequests:                  String("pr"),
  3755  				RepositoryHooks:               String("rh"),
  3756  				RepositoryProjects:            String("rp"),
  3757  				RepositoryPreReceiveHooks:     String("rprh"),
  3758  				Secrets:                       String("s"),
  3759  				SecretScanningAlerts:          String("ssa"),
  3760  				SecurityEvents:                String("se"),
  3761  				SingleFile:                    String("sf"),
  3762  				Statuses:                      String("s"),
  3763  				TeamDiscussions:               String("td"),
  3764  				VulnerabilityAlerts:           String("va"),
  3765  				Workflows:                     String("w"),
  3766  			},
  3767  			CreatedAt:              &Timestamp{referenceTime},
  3768  			UpdatedAt:              &Timestamp{referenceTime},
  3769  			HasMultipleSingleFiles: Bool(false),
  3770  			SuspendedBy: &User{
  3771  				Login:           String("l"),
  3772  				ID:              Int64(1),
  3773  				URL:             String("u"),
  3774  				AvatarURL:       String("a"),
  3775  				GravatarID:      String("g"),
  3776  				Name:            String("n"),
  3777  				Company:         String("c"),
  3778  				Blog:            String("b"),
  3779  				Location:        String("l"),
  3780  				Email:           String("e"),
  3781  				Hireable:        Bool(true),
  3782  				Bio:             String("b"),
  3783  				TwitterUsername: String("t"),
  3784  				PublicRepos:     Int(1),
  3785  				Followers:       Int(1),
  3786  				Following:       Int(1),
  3787  				CreatedAt:       &Timestamp{referenceTime},
  3788  				SuspendedAt:     &Timestamp{referenceTime},
  3789  			},
  3790  			SuspendedAt: &Timestamp{referenceTime},
  3791  		},
  3792  	}
  3793  
  3794  	want := `{
  3795  		"sha": "sha",
  3796  		"state": "s",
  3797  		"description": "d",
  3798  		"target_url": "turl",
  3799  		"branches": [
  3800  			{
  3801  				"name": "n",
  3802  				"commit": {
  3803  					"node_id": "nid"
  3804  				},
  3805  				"protected": false
  3806  			}
  3807  		],
  3808  		"id": 1,
  3809  		"name": "n",
  3810  		"context": "c",
  3811  		"commit": {
  3812  			"node_id": "nid"
  3813  		},
  3814  		"created_at": ` + referenceTimeStr + `,
  3815  		"updated_at": ` + referenceTimeStr + `,
  3816  		"sender": {
  3817  			"login": "l",
  3818  			"id": 1,
  3819  			"node_id": "n",
  3820  			"avatar_url": "a",
  3821  			"url": "u",
  3822  			"events_url": "e",
  3823  			"repos_url": "r"
  3824  		},
  3825  		"installation": {
  3826  			"id": 1,
  3827  			"node_id": "nid",
  3828  			"app_id": 1,
  3829  			"app_slug": "as",
  3830  			"target_id": 1,
  3831  			"account": {
  3832  				"login": "l",
  3833  				"id": 1,
  3834  				"avatar_url": "a",
  3835  				"gravatar_id": "g",
  3836  				"name": "n",
  3837  				"company": "c",
  3838  				"blog": "b",
  3839  				"location": "l",
  3840  				"email": "e",
  3841  				"hireable": true,
  3842  				"bio": "b",
  3843  				"twitter_username": "t",
  3844  				"public_repos": 1,
  3845  				"followers": 1,
  3846  				"following": 1,
  3847  				"created_at": ` + referenceTimeStr + `,
  3848  				"suspended_at": ` + referenceTimeStr + `,
  3849  				"url": "u"
  3850  			},
  3851  			"access_tokens_url": "atu",
  3852  			"repositories_url": "ru",
  3853  			"html_url": "hu",
  3854  			"target_type": "tt",
  3855  			"single_file_name": "sfn",
  3856  			"repository_selection": "rs",
  3857  			"events": [
  3858  				"e"
  3859  			],
  3860  			"single_file_paths": [
  3861  				"s"
  3862  			],
  3863  			"permissions": {
  3864  				"actions": "a",
  3865  				"administration": "ad",
  3866  				"checks": "c",
  3867  				"contents": "co",
  3868  				"content_references": "cr",
  3869  				"deployments": "d",
  3870  				"environments": "e",
  3871  				"issues": "i",
  3872  				"metadata": "md",
  3873  				"members": "m",
  3874  				"organization_administration": "oa",
  3875  				"organization_hooks": "oh",
  3876  				"organization_plan": "op",
  3877  				"organization_pre_receive_hooks": "opr",
  3878  				"organization_projects": "op",
  3879  				"organization_secrets": "os",
  3880  				"organization_self_hosted_runners": "osh",
  3881  				"organization_user_blocking": "oub",
  3882  				"packages": "pkg",
  3883  				"pages": "pg",
  3884  				"pull_requests": "pr",
  3885  				"repository_hooks": "rh",
  3886  				"repository_projects": "rp",
  3887  				"repository_pre_receive_hooks": "rprh",
  3888  				"secrets": "s",
  3889  				"secret_scanning_alerts": "ssa",
  3890  				"security_events": "se",
  3891  				"single_file": "sf",
  3892  				"statuses": "s",
  3893  				"team_discussions": "td",
  3894  				"vulnerability_alerts": "va",
  3895  				"workflows": "w"
  3896  			},
  3897  			"created_at": ` + referenceTimeStr + `,
  3898  			"updated_at": ` + referenceTimeStr + `,
  3899  			"has_multiple_single_files": false,
  3900  			"suspended_by": {
  3901  				"login": "l",
  3902  				"id": 1,
  3903  				"avatar_url": "a",
  3904  				"gravatar_id": "g",
  3905  				"name": "n",
  3906  				"company": "c",
  3907  				"blog": "b",
  3908  				"location": "l",
  3909  				"email": "e",
  3910  				"hireable": true,
  3911  				"bio": "b",
  3912  				"twitter_username": "t",
  3913  				"public_repos": 1,
  3914  				"followers": 1,
  3915  				"following": 1,
  3916  				"created_at": ` + referenceTimeStr + `,
  3917  				"suspended_at": ` + referenceTimeStr + `,
  3918  				"url": "u"
  3919  			},
  3920  			"suspended_at": ` + referenceTimeStr + `
  3921  		}
  3922  	}`
  3923  
  3924  	testJSONMarshal(t, u, want)
  3925  }
  3926  
  3927  func TestMarketplacePurchaseEvent_Marshal(t *testing.T) {
  3928  	testJSONMarshal(t, &MarketplacePurchaseEvent{}, "{}")
  3929  
  3930  	u := &MarketplacePurchaseEvent{
  3931  		Action:        String("a"),
  3932  		EffectiveDate: &Timestamp{referenceTime},
  3933  		MarketplacePurchase: &MarketplacePurchase{
  3934  			BillingCycle:    String("bc"),
  3935  			NextBillingDate: &Timestamp{referenceTime},
  3936  			UnitCount:       Int(1),
  3937  			Plan: &MarketplacePlan{
  3938  				URL:                 String("u"),
  3939  				AccountsURL:         String("au"),
  3940  				ID:                  Int64(1),
  3941  				Number:              Int(1),
  3942  				Name:                String("n"),
  3943  				Description:         String("d"),
  3944  				MonthlyPriceInCents: Int(1),
  3945  				YearlyPriceInCents:  Int(1),
  3946  				PriceModel:          String("pm"),
  3947  				UnitName:            String("un"),
  3948  				Bullets:             &[]string{"b"},
  3949  				State:               String("s"),
  3950  				HasFreeTrial:        Bool(false),
  3951  			},
  3952  			OnFreeTrial:     Bool(false),
  3953  			FreeTrialEndsOn: &Timestamp{referenceTime},
  3954  			UpdatedAt:       &Timestamp{referenceTime},
  3955  		},
  3956  		PreviousMarketplacePurchase: &MarketplacePurchase{
  3957  			BillingCycle:    String("bc"),
  3958  			NextBillingDate: &Timestamp{referenceTime},
  3959  			UnitCount:       Int(1),
  3960  			Plan: &MarketplacePlan{
  3961  				URL:                 String("u"),
  3962  				AccountsURL:         String("au"),
  3963  				ID:                  Int64(1),
  3964  				Number:              Int(1),
  3965  				Name:                String("n"),
  3966  				Description:         String("d"),
  3967  				MonthlyPriceInCents: Int(1),
  3968  				YearlyPriceInCents:  Int(1),
  3969  				PriceModel:          String("pm"),
  3970  				UnitName:            String("un"),
  3971  				Bullets:             &[]string{"b"},
  3972  				State:               String("s"),
  3973  				HasFreeTrial:        Bool(false),
  3974  			},
  3975  			OnFreeTrial:     Bool(false),
  3976  			FreeTrialEndsOn: &Timestamp{referenceTime},
  3977  			UpdatedAt:       &Timestamp{referenceTime},
  3978  		},
  3979  		Sender: &User{
  3980  			Login:     String("l"),
  3981  			ID:        Int64(1),
  3982  			NodeID:    String("n"),
  3983  			URL:       String("u"),
  3984  			ReposURL:  String("r"),
  3985  			EventsURL: String("e"),
  3986  			AvatarURL: String("a"),
  3987  		},
  3988  		Installation: &Installation{
  3989  			ID:       Int64(1),
  3990  			NodeID:   String("nid"),
  3991  			AppID:    Int64(1),
  3992  			AppSlug:  String("as"),
  3993  			TargetID: Int64(1),
  3994  			Account: &User{
  3995  				Login:           String("l"),
  3996  				ID:              Int64(1),
  3997  				URL:             String("u"),
  3998  				AvatarURL:       String("a"),
  3999  				GravatarID:      String("g"),
  4000  				Name:            String("n"),
  4001  				Company:         String("c"),
  4002  				Blog:            String("b"),
  4003  				Location:        String("l"),
  4004  				Email:           String("e"),
  4005  				Hireable:        Bool(true),
  4006  				Bio:             String("b"),
  4007  				TwitterUsername: String("t"),
  4008  				PublicRepos:     Int(1),
  4009  				Followers:       Int(1),
  4010  				Following:       Int(1),
  4011  				CreatedAt:       &Timestamp{referenceTime},
  4012  				SuspendedAt:     &Timestamp{referenceTime},
  4013  			},
  4014  			AccessTokensURL:     String("atu"),
  4015  			RepositoriesURL:     String("ru"),
  4016  			HTMLURL:             String("hu"),
  4017  			TargetType:          String("tt"),
  4018  			SingleFileName:      String("sfn"),
  4019  			RepositorySelection: String("rs"),
  4020  			Events:              []string{"e"},
  4021  			SingleFilePaths:     []string{"s"},
  4022  			Permissions: &InstallationPermissions{
  4023  				Actions:                       String("a"),
  4024  				Administration:                String("ad"),
  4025  				Checks:                        String("c"),
  4026  				Contents:                      String("co"),
  4027  				ContentReferences:             String("cr"),
  4028  				Deployments:                   String("d"),
  4029  				Environments:                  String("e"),
  4030  				Issues:                        String("i"),
  4031  				Metadata:                      String("md"),
  4032  				Members:                       String("m"),
  4033  				OrganizationAdministration:    String("oa"),
  4034  				OrganizationHooks:             String("oh"),
  4035  				OrganizationPlan:              String("op"),
  4036  				OrganizationPreReceiveHooks:   String("opr"),
  4037  				OrganizationProjects:          String("op"),
  4038  				OrganizationSecrets:           String("os"),
  4039  				OrganizationSelfHostedRunners: String("osh"),
  4040  				OrganizationUserBlocking:      String("oub"),
  4041  				Packages:                      String("pkg"),
  4042  				Pages:                         String("pg"),
  4043  				PullRequests:                  String("pr"),
  4044  				RepositoryHooks:               String("rh"),
  4045  				RepositoryProjects:            String("rp"),
  4046  				RepositoryPreReceiveHooks:     String("rprh"),
  4047  				Secrets:                       String("s"),
  4048  				SecretScanningAlerts:          String("ssa"),
  4049  				SecurityEvents:                String("se"),
  4050  				SingleFile:                    String("sf"),
  4051  				Statuses:                      String("s"),
  4052  				TeamDiscussions:               String("td"),
  4053  				VulnerabilityAlerts:           String("va"),
  4054  				Workflows:                     String("w"),
  4055  			},
  4056  			CreatedAt:              &Timestamp{referenceTime},
  4057  			UpdatedAt:              &Timestamp{referenceTime},
  4058  			HasMultipleSingleFiles: Bool(false),
  4059  			SuspendedBy: &User{
  4060  				Login:           String("l"),
  4061  				ID:              Int64(1),
  4062  				URL:             String("u"),
  4063  				AvatarURL:       String("a"),
  4064  				GravatarID:      String("g"),
  4065  				Name:            String("n"),
  4066  				Company:         String("c"),
  4067  				Blog:            String("b"),
  4068  				Location:        String("l"),
  4069  				Email:           String("e"),
  4070  				Hireable:        Bool(true),
  4071  				Bio:             String("b"),
  4072  				TwitterUsername: String("t"),
  4073  				PublicRepos:     Int(1),
  4074  				Followers:       Int(1),
  4075  				Following:       Int(1),
  4076  				CreatedAt:       &Timestamp{referenceTime},
  4077  				SuspendedAt:     &Timestamp{referenceTime},
  4078  			},
  4079  			SuspendedAt: &Timestamp{referenceTime},
  4080  		},
  4081  	}
  4082  
  4083  	want := `{
  4084  		"action": "a",
  4085  		"effective_date": ` + referenceTimeStr + `,
  4086  		"marketplace_purchase": {
  4087  			"billing_cycle": "bc",
  4088  			"next_billing_date": ` + referenceTimeStr + `,
  4089  			"unit_count": 1,
  4090  			"plan": {
  4091  				"url": "u",
  4092  				"accounts_url": "au",
  4093  				"id": 1,
  4094  				"number": 1,
  4095  				"name": "n",
  4096  				"description": "d",
  4097  				"monthly_price_in_cents": 1,
  4098  				"yearly_price_in_cents": 1,
  4099  				"price_model": "pm",
  4100  				"unit_name": "un",
  4101  				"bullets": [
  4102  					"b"
  4103  				],
  4104  				"state": "s",
  4105  				"has_free_trial": false
  4106  			},
  4107  			"on_free_trial": false,
  4108  			"free_trial_ends_on": ` + referenceTimeStr + `,
  4109  			"updated_at": ` + referenceTimeStr + `
  4110  		},
  4111  		"previous_marketplace_purchase": {
  4112  			"billing_cycle": "bc",
  4113  			"next_billing_date": ` + referenceTimeStr + `,
  4114  			"unit_count": 1,
  4115  			"plan": {
  4116  				"url": "u",
  4117  				"accounts_url": "au",
  4118  				"id": 1,
  4119  				"number": 1,
  4120  				"name": "n",
  4121  				"description": "d",
  4122  				"monthly_price_in_cents": 1,
  4123  				"yearly_price_in_cents": 1,
  4124  				"price_model": "pm",
  4125  				"unit_name": "un",
  4126  				"bullets": [
  4127  					"b"
  4128  				],
  4129  				"state": "s",
  4130  				"has_free_trial": false
  4131  			},
  4132  			"on_free_trial": false,
  4133  			"free_trial_ends_on": ` + referenceTimeStr + `,
  4134  			"updated_at": ` + referenceTimeStr + `
  4135  		},
  4136  		"sender": {
  4137  			"login": "l",
  4138  			"id": 1,
  4139  			"node_id": "n",
  4140  			"avatar_url": "a",
  4141  			"url": "u",
  4142  			"events_url": "e",
  4143  			"repos_url": "r"
  4144  		},
  4145  		"installation": {
  4146  			"id": 1,
  4147  			"node_id": "nid",
  4148  			"app_id": 1,
  4149  			"app_slug": "as",
  4150  			"target_id": 1,
  4151  			"account": {
  4152  				"login": "l",
  4153  				"id": 1,
  4154  				"avatar_url": "a",
  4155  				"gravatar_id": "g",
  4156  				"name": "n",
  4157  				"company": "c",
  4158  				"blog": "b",
  4159  				"location": "l",
  4160  				"email": "e",
  4161  				"hireable": true,
  4162  				"bio": "b",
  4163  				"twitter_username": "t",
  4164  				"public_repos": 1,
  4165  				"followers": 1,
  4166  				"following": 1,
  4167  				"created_at": ` + referenceTimeStr + `,
  4168  				"suspended_at": ` + referenceTimeStr + `,
  4169  				"url": "u"
  4170  			},
  4171  			"access_tokens_url": "atu",
  4172  			"repositories_url": "ru",
  4173  			"html_url": "hu",
  4174  			"target_type": "tt",
  4175  			"single_file_name": "sfn",
  4176  			"repository_selection": "rs",
  4177  			"events": [
  4178  				"e"
  4179  			],
  4180  			"single_file_paths": [
  4181  				"s"
  4182  			],
  4183  			"permissions": {
  4184  				"actions": "a",
  4185  				"administration": "ad",
  4186  				"checks": "c",
  4187  				"contents": "co",
  4188  				"content_references": "cr",
  4189  				"deployments": "d",
  4190  				"environments": "e",
  4191  				"issues": "i",
  4192  				"metadata": "md",
  4193  				"members": "m",
  4194  				"organization_administration": "oa",
  4195  				"organization_hooks": "oh",
  4196  				"organization_plan": "op",
  4197  				"organization_pre_receive_hooks": "opr",
  4198  				"organization_projects": "op",
  4199  				"organization_secrets": "os",
  4200  				"organization_self_hosted_runners": "osh",
  4201  				"organization_user_blocking": "oub",
  4202  				"packages": "pkg",
  4203  				"pages": "pg",
  4204  				"pull_requests": "pr",
  4205  				"repository_hooks": "rh",
  4206  				"repository_projects": "rp",
  4207  				"repository_pre_receive_hooks": "rprh",
  4208  				"secrets": "s",
  4209  				"secret_scanning_alerts": "ssa",
  4210  				"security_events": "se",
  4211  				"single_file": "sf",
  4212  				"statuses": "s",
  4213  				"team_discussions": "td",
  4214  				"vulnerability_alerts": "va",
  4215  				"workflows": "w"
  4216  			},
  4217  			"created_at": ` + referenceTimeStr + `,
  4218  			"updated_at": ` + referenceTimeStr + `,
  4219  			"has_multiple_single_files": false,
  4220  			"suspended_by": {
  4221  				"login": "l",
  4222  				"id": 1,
  4223  				"avatar_url": "a",
  4224  				"gravatar_id": "g",
  4225  				"name": "n",
  4226  				"company": "c",
  4227  				"blog": "b",
  4228  				"location": "l",
  4229  				"email": "e",
  4230  				"hireable": true,
  4231  				"bio": "b",
  4232  				"twitter_username": "t",
  4233  				"public_repos": 1,
  4234  				"followers": 1,
  4235  				"following": 1,
  4236  				"created_at": ` + referenceTimeStr + `,
  4237  				"suspended_at": ` + referenceTimeStr + `,
  4238  				"url": "u"
  4239  			},
  4240  			"suspended_at": ` + referenceTimeStr + `
  4241  		}
  4242  	}`
  4243  
  4244  	testJSONMarshal(t, u, want)
  4245  }
  4246  
  4247  func TestOrganizationEvent_Marshal(t *testing.T) {
  4248  	testJSONMarshal(t, &OrganizationEvent{}, "{}")
  4249  
  4250  	u := &OrganizationEvent{
  4251  		Action:     String("a"),
  4252  		Invitation: &Invitation{ID: Int64(1)},
  4253  		Membership: &Membership{
  4254  			URL:             String("url"),
  4255  			State:           String("s"),
  4256  			Role:            String("r"),
  4257  			OrganizationURL: String("ou"),
  4258  			Organization: &Organization{
  4259  				BillingEmail:                         String("be"),
  4260  				Blog:                                 String("b"),
  4261  				Company:                              String("c"),
  4262  				Email:                                String("e"),
  4263  				TwitterUsername:                      String("tu"),
  4264  				Location:                             String("loc"),
  4265  				Name:                                 String("n"),
  4266  				Description:                          String("d"),
  4267  				IsVerified:                           Bool(true),
  4268  				HasOrganizationProjects:              Bool(true),
  4269  				HasRepositoryProjects:                Bool(true),
  4270  				DefaultRepoPermission:                String("drp"),
  4271  				MembersCanCreateRepos:                Bool(true),
  4272  				MembersCanCreateInternalRepos:        Bool(true),
  4273  				MembersCanCreatePrivateRepos:         Bool(true),
  4274  				MembersCanCreatePublicRepos:          Bool(false),
  4275  				MembersAllowedRepositoryCreationType: String("marct"),
  4276  				MembersCanCreatePages:                Bool(true),
  4277  				MembersCanCreatePublicPages:          Bool(false),
  4278  				MembersCanCreatePrivatePages:         Bool(true),
  4279  			},
  4280  			User: &User{
  4281  				Login:     String("l"),
  4282  				ID:        Int64(1),
  4283  				NodeID:    String("n"),
  4284  				URL:       String("u"),
  4285  				ReposURL:  String("r"),
  4286  				EventsURL: String("e"),
  4287  				AvatarURL: String("a"),
  4288  			},
  4289  		},
  4290  		Organization: &Organization{
  4291  			BillingEmail:                         String("be"),
  4292  			Blog:                                 String("b"),
  4293  			Company:                              String("c"),
  4294  			Email:                                String("e"),
  4295  			TwitterUsername:                      String("tu"),
  4296  			Location:                             String("loc"),
  4297  			Name:                                 String("n"),
  4298  			Description:                          String("d"),
  4299  			IsVerified:                           Bool(true),
  4300  			HasOrganizationProjects:              Bool(true),
  4301  			HasRepositoryProjects:                Bool(true),
  4302  			DefaultRepoPermission:                String("drp"),
  4303  			MembersCanCreateRepos:                Bool(true),
  4304  			MembersCanCreateInternalRepos:        Bool(true),
  4305  			MembersCanCreatePrivateRepos:         Bool(true),
  4306  			MembersCanCreatePublicRepos:          Bool(false),
  4307  			MembersAllowedRepositoryCreationType: String("marct"),
  4308  			MembersCanCreatePages:                Bool(true),
  4309  			MembersCanCreatePublicPages:          Bool(false),
  4310  			MembersCanCreatePrivatePages:         Bool(true),
  4311  		},
  4312  		Sender: &User{
  4313  			Login:     String("l"),
  4314  			ID:        Int64(1),
  4315  			NodeID:    String("n"),
  4316  			URL:       String("u"),
  4317  			ReposURL:  String("r"),
  4318  			EventsURL: String("e"),
  4319  			AvatarURL: String("a"),
  4320  		},
  4321  		Installation: &Installation{
  4322  			ID:       Int64(1),
  4323  			NodeID:   String("nid"),
  4324  			AppID:    Int64(1),
  4325  			AppSlug:  String("as"),
  4326  			TargetID: Int64(1),
  4327  			Account: &User{
  4328  				Login:           String("l"),
  4329  				ID:              Int64(1),
  4330  				URL:             String("u"),
  4331  				AvatarURL:       String("a"),
  4332  				GravatarID:      String("g"),
  4333  				Name:            String("n"),
  4334  				Company:         String("c"),
  4335  				Blog:            String("b"),
  4336  				Location:        String("l"),
  4337  				Email:           String("e"),
  4338  				Hireable:        Bool(true),
  4339  				Bio:             String("b"),
  4340  				TwitterUsername: String("t"),
  4341  				PublicRepos:     Int(1),
  4342  				Followers:       Int(1),
  4343  				Following:       Int(1),
  4344  				CreatedAt:       &Timestamp{referenceTime},
  4345  				SuspendedAt:     &Timestamp{referenceTime},
  4346  			},
  4347  			AccessTokensURL:     String("atu"),
  4348  			RepositoriesURL:     String("ru"),
  4349  			HTMLURL:             String("hu"),
  4350  			TargetType:          String("tt"),
  4351  			SingleFileName:      String("sfn"),
  4352  			RepositorySelection: String("rs"),
  4353  			Events:              []string{"e"},
  4354  			SingleFilePaths:     []string{"s"},
  4355  			Permissions: &InstallationPermissions{
  4356  				Actions:                       String("a"),
  4357  				Administration:                String("ad"),
  4358  				Checks:                        String("c"),
  4359  				Contents:                      String("co"),
  4360  				ContentReferences:             String("cr"),
  4361  				Deployments:                   String("d"),
  4362  				Environments:                  String("e"),
  4363  				Issues:                        String("i"),
  4364  				Metadata:                      String("md"),
  4365  				Members:                       String("m"),
  4366  				OrganizationAdministration:    String("oa"),
  4367  				OrganizationHooks:             String("oh"),
  4368  				OrganizationPlan:              String("op"),
  4369  				OrganizationPreReceiveHooks:   String("opr"),
  4370  				OrganizationProjects:          String("op"),
  4371  				OrganizationSecrets:           String("os"),
  4372  				OrganizationSelfHostedRunners: String("osh"),
  4373  				OrganizationUserBlocking:      String("oub"),
  4374  				Packages:                      String("pkg"),
  4375  				Pages:                         String("pg"),
  4376  				PullRequests:                  String("pr"),
  4377  				RepositoryHooks:               String("rh"),
  4378  				RepositoryProjects:            String("rp"),
  4379  				RepositoryPreReceiveHooks:     String("rprh"),
  4380  				Secrets:                       String("s"),
  4381  				SecretScanningAlerts:          String("ssa"),
  4382  				SecurityEvents:                String("se"),
  4383  				SingleFile:                    String("sf"),
  4384  				Statuses:                      String("s"),
  4385  				TeamDiscussions:               String("td"),
  4386  				VulnerabilityAlerts:           String("va"),
  4387  				Workflows:                     String("w"),
  4388  			},
  4389  			CreatedAt:              &Timestamp{referenceTime},
  4390  			UpdatedAt:              &Timestamp{referenceTime},
  4391  			HasMultipleSingleFiles: Bool(false),
  4392  			SuspendedBy: &User{
  4393  				Login:           String("l"),
  4394  				ID:              Int64(1),
  4395  				URL:             String("u"),
  4396  				AvatarURL:       String("a"),
  4397  				GravatarID:      String("g"),
  4398  				Name:            String("n"),
  4399  				Company:         String("c"),
  4400  				Blog:            String("b"),
  4401  				Location:        String("l"),
  4402  				Email:           String("e"),
  4403  				Hireable:        Bool(true),
  4404  				Bio:             String("b"),
  4405  				TwitterUsername: String("t"),
  4406  				PublicRepos:     Int(1),
  4407  				Followers:       Int(1),
  4408  				Following:       Int(1),
  4409  				CreatedAt:       &Timestamp{referenceTime},
  4410  				SuspendedAt:     &Timestamp{referenceTime},
  4411  			},
  4412  			SuspendedAt: &Timestamp{referenceTime},
  4413  		},
  4414  	}
  4415  
  4416  	want := `{
  4417  		"action": "a",
  4418  		"invitation": {
  4419  			"id": 1
  4420  		},
  4421  		"membership": {
  4422  			"url": "url",
  4423  			"state": "s",
  4424  			"role": "r",
  4425  			"organization_url": "ou",
  4426  			"organization": {
  4427  				"name": "n",
  4428  				"company": "c",
  4429  				"blog": "b",
  4430  				"location": "loc",
  4431  				"email": "e",
  4432  				"twitter_username": "tu",
  4433  				"description": "d",
  4434  				"billing_email": "be",
  4435  				"is_verified": true,
  4436  				"has_organization_projects": true,
  4437  				"has_repository_projects": true,
  4438  				"default_repository_permission": "drp",
  4439  				"members_can_create_repositories": true,
  4440  				"members_can_create_public_repositories": false,
  4441  				"members_can_create_private_repositories": true,
  4442  				"members_can_create_internal_repositories": true,
  4443  				"members_allowed_repository_creation_type": "marct",
  4444  				"members_can_create_pages": true,
  4445  				"members_can_create_public_pages": false,
  4446  				"members_can_create_private_pages": true
  4447  			},
  4448  			"user": {
  4449  				"login": "l",
  4450  				"id": 1,
  4451  				"node_id": "n",
  4452  				"avatar_url": "a",
  4453  				"url": "u",
  4454  				"events_url": "e",
  4455  				"repos_url": "r"
  4456  			}
  4457  		},
  4458  		"organization": {
  4459  			"name": "n",
  4460  			"company": "c",
  4461  			"blog": "b",
  4462  			"location": "loc",
  4463  			"email": "e",
  4464  			"twitter_username": "tu",
  4465  			"description": "d",
  4466  			"billing_email": "be",
  4467  			"is_verified": true,
  4468  			"has_organization_projects": true,
  4469  			"has_repository_projects": true,
  4470  			"default_repository_permission": "drp",
  4471  			"members_can_create_repositories": true,
  4472  			"members_can_create_public_repositories": false,
  4473  			"members_can_create_private_repositories": true,
  4474  			"members_can_create_internal_repositories": true,
  4475  			"members_allowed_repository_creation_type": "marct",
  4476  			"members_can_create_pages": true,
  4477  			"members_can_create_public_pages": false,
  4478  			"members_can_create_private_pages": true
  4479  		},
  4480  		"sender": {
  4481  			"login": "l",
  4482  			"id": 1,
  4483  			"node_id": "n",
  4484  			"avatar_url": "a",
  4485  			"url": "u",
  4486  			"events_url": "e",
  4487  			"repos_url": "r"
  4488  		},
  4489  		"installation": {
  4490  			"id": 1,
  4491  			"node_id": "nid",
  4492  			"app_id": 1,
  4493  			"app_slug": "as",
  4494  			"target_id": 1,
  4495  			"account": {
  4496  				"login": "l",
  4497  				"id": 1,
  4498  				"avatar_url": "a",
  4499  				"gravatar_id": "g",
  4500  				"name": "n",
  4501  				"company": "c",
  4502  				"blog": "b",
  4503  				"location": "l",
  4504  				"email": "e",
  4505  				"hireable": true,
  4506  				"bio": "b",
  4507  				"twitter_username": "t",
  4508  				"public_repos": 1,
  4509  				"followers": 1,
  4510  				"following": 1,
  4511  				"created_at": ` + referenceTimeStr + `,
  4512  				"suspended_at": ` + referenceTimeStr + `,
  4513  				"url": "u"
  4514  			},
  4515  			"access_tokens_url": "atu",
  4516  			"repositories_url": "ru",
  4517  			"html_url": "hu",
  4518  			"target_type": "tt",
  4519  			"single_file_name": "sfn",
  4520  			"repository_selection": "rs",
  4521  			"events": [
  4522  				"e"
  4523  			],
  4524  			"single_file_paths": [
  4525  				"s"
  4526  			],
  4527  			"permissions": {
  4528  				"actions": "a",
  4529  				"administration": "ad",
  4530  				"checks": "c",
  4531  				"contents": "co",
  4532  				"content_references": "cr",
  4533  				"deployments": "d",
  4534  				"environments": "e",
  4535  				"issues": "i",
  4536  				"metadata": "md",
  4537  				"members": "m",
  4538  				"organization_administration": "oa",
  4539  				"organization_hooks": "oh",
  4540  				"organization_plan": "op",
  4541  				"organization_pre_receive_hooks": "opr",
  4542  				"organization_projects": "op",
  4543  				"organization_secrets": "os",
  4544  				"organization_self_hosted_runners": "osh",
  4545  				"organization_user_blocking": "oub",
  4546  				"packages": "pkg",
  4547  				"pages": "pg",
  4548  				"pull_requests": "pr",
  4549  				"repository_hooks": "rh",
  4550  				"repository_projects": "rp",
  4551  				"repository_pre_receive_hooks": "rprh",
  4552  				"secrets": "s",
  4553  				"secret_scanning_alerts": "ssa",
  4554  				"security_events": "se",
  4555  				"single_file": "sf",
  4556  				"statuses": "s",
  4557  				"team_discussions": "td",
  4558  				"vulnerability_alerts": "va",
  4559  				"workflows": "w"
  4560  			},
  4561  			"created_at": ` + referenceTimeStr + `,
  4562  			"updated_at": ` + referenceTimeStr + `,
  4563  			"has_multiple_single_files": false,
  4564  			"suspended_by": {
  4565  				"login": "l",
  4566  				"id": 1,
  4567  				"avatar_url": "a",
  4568  				"gravatar_id": "g",
  4569  				"name": "n",
  4570  				"company": "c",
  4571  				"blog": "b",
  4572  				"location": "l",
  4573  				"email": "e",
  4574  				"hireable": true,
  4575  				"bio": "b",
  4576  				"twitter_username": "t",
  4577  				"public_repos": 1,
  4578  				"followers": 1,
  4579  				"following": 1,
  4580  				"created_at": ` + referenceTimeStr + `,
  4581  				"suspended_at": ` + referenceTimeStr + `,
  4582  				"url": "u"
  4583  			},
  4584  			"suspended_at": ` + referenceTimeStr + `
  4585  		}
  4586  	}`
  4587  
  4588  	testJSONMarshal(t, u, want)
  4589  }
  4590  
  4591  func TestPageBuildEvent_Marshal(t *testing.T) {
  4592  	testJSONMarshal(t, &PageBuildEvent{}, "{}")
  4593  
  4594  	u := &PageBuildEvent{
  4595  		Build: &PagesBuild{URL: String("url")},
  4596  		ID:    Int64(1),
  4597  		Repo: &Repository{
  4598  			ID:   Int64(1),
  4599  			URL:  String("s"),
  4600  			Name: String("n"),
  4601  		},
  4602  		Sender: &User{
  4603  			Login:     String("l"),
  4604  			ID:        Int64(1),
  4605  			NodeID:    String("n"),
  4606  			URL:       String("u"),
  4607  			ReposURL:  String("r"),
  4608  			EventsURL: String("e"),
  4609  			AvatarURL: String("a"),
  4610  		},
  4611  		Installation: &Installation{
  4612  			ID:       Int64(1),
  4613  			NodeID:   String("nid"),
  4614  			AppID:    Int64(1),
  4615  			AppSlug:  String("as"),
  4616  			TargetID: Int64(1),
  4617  			Account: &User{
  4618  				Login:           String("l"),
  4619  				ID:              Int64(1),
  4620  				URL:             String("u"),
  4621  				AvatarURL:       String("a"),
  4622  				GravatarID:      String("g"),
  4623  				Name:            String("n"),
  4624  				Company:         String("c"),
  4625  				Blog:            String("b"),
  4626  				Location:        String("l"),
  4627  				Email:           String("e"),
  4628  				Hireable:        Bool(true),
  4629  				Bio:             String("b"),
  4630  				TwitterUsername: String("t"),
  4631  				PublicRepos:     Int(1),
  4632  				Followers:       Int(1),
  4633  				Following:       Int(1),
  4634  				CreatedAt:       &Timestamp{referenceTime},
  4635  				SuspendedAt:     &Timestamp{referenceTime},
  4636  			},
  4637  			AccessTokensURL:     String("atu"),
  4638  			RepositoriesURL:     String("ru"),
  4639  			HTMLURL:             String("hu"),
  4640  			TargetType:          String("tt"),
  4641  			SingleFileName:      String("sfn"),
  4642  			RepositorySelection: String("rs"),
  4643  			Events:              []string{"e"},
  4644  			SingleFilePaths:     []string{"s"},
  4645  			Permissions: &InstallationPermissions{
  4646  				Actions:                       String("a"),
  4647  				Administration:                String("ad"),
  4648  				Checks:                        String("c"),
  4649  				Contents:                      String("co"),
  4650  				ContentReferences:             String("cr"),
  4651  				Deployments:                   String("d"),
  4652  				Environments:                  String("e"),
  4653  				Issues:                        String("i"),
  4654  				Metadata:                      String("md"),
  4655  				Members:                       String("m"),
  4656  				OrganizationAdministration:    String("oa"),
  4657  				OrganizationHooks:             String("oh"),
  4658  				OrganizationPlan:              String("op"),
  4659  				OrganizationPreReceiveHooks:   String("opr"),
  4660  				OrganizationProjects:          String("op"),
  4661  				OrganizationSecrets:           String("os"),
  4662  				OrganizationSelfHostedRunners: String("osh"),
  4663  				OrganizationUserBlocking:      String("oub"),
  4664  				Packages:                      String("pkg"),
  4665  				Pages:                         String("pg"),
  4666  				PullRequests:                  String("pr"),
  4667  				RepositoryHooks:               String("rh"),
  4668  				RepositoryProjects:            String("rp"),
  4669  				RepositoryPreReceiveHooks:     String("rprh"),
  4670  				Secrets:                       String("s"),
  4671  				SecretScanningAlerts:          String("ssa"),
  4672  				SecurityEvents:                String("se"),
  4673  				SingleFile:                    String("sf"),
  4674  				Statuses:                      String("s"),
  4675  				TeamDiscussions:               String("td"),
  4676  				VulnerabilityAlerts:           String("va"),
  4677  				Workflows:                     String("w"),
  4678  			},
  4679  			CreatedAt:              &Timestamp{referenceTime},
  4680  			UpdatedAt:              &Timestamp{referenceTime},
  4681  			HasMultipleSingleFiles: Bool(false),
  4682  			SuspendedBy: &User{
  4683  				Login:           String("l"),
  4684  				ID:              Int64(1),
  4685  				URL:             String("u"),
  4686  				AvatarURL:       String("a"),
  4687  				GravatarID:      String("g"),
  4688  				Name:            String("n"),
  4689  				Company:         String("c"),
  4690  				Blog:            String("b"),
  4691  				Location:        String("l"),
  4692  				Email:           String("e"),
  4693  				Hireable:        Bool(true),
  4694  				Bio:             String("b"),
  4695  				TwitterUsername: String("t"),
  4696  				PublicRepos:     Int(1),
  4697  				Followers:       Int(1),
  4698  				Following:       Int(1),
  4699  				CreatedAt:       &Timestamp{referenceTime},
  4700  				SuspendedAt:     &Timestamp{referenceTime},
  4701  			},
  4702  			SuspendedAt: &Timestamp{referenceTime},
  4703  		},
  4704  	}
  4705  
  4706  	want := `{
  4707  		"build": {
  4708  			"url": "url"
  4709  		},
  4710  		"id": 1,
  4711  		"repository": {
  4712  			"id": 1,
  4713  			"name": "n",
  4714  			"url": "s"
  4715  		},
  4716  		"sender": {
  4717  			"login": "l",
  4718  			"id": 1,
  4719  			"node_id": "n",
  4720  			"avatar_url": "a",
  4721  			"url": "u",
  4722  			"events_url": "e",
  4723  			"repos_url": "r"
  4724  		},
  4725  		"installation": {
  4726  			"id": 1,
  4727  			"node_id": "nid",
  4728  			"app_id": 1,
  4729  			"app_slug": "as",
  4730  			"target_id": 1,
  4731  			"account": {
  4732  				"login": "l",
  4733  				"id": 1,
  4734  				"avatar_url": "a",
  4735  				"gravatar_id": "g",
  4736  				"name": "n",
  4737  				"company": "c",
  4738  				"blog": "b",
  4739  				"location": "l",
  4740  				"email": "e",
  4741  				"hireable": true,
  4742  				"bio": "b",
  4743  				"twitter_username": "t",
  4744  				"public_repos": 1,
  4745  				"followers": 1,
  4746  				"following": 1,
  4747  				"created_at": ` + referenceTimeStr + `,
  4748  				"suspended_at": ` + referenceTimeStr + `,
  4749  				"url": "u"
  4750  			},
  4751  			"access_tokens_url": "atu",
  4752  			"repositories_url": "ru",
  4753  			"html_url": "hu",
  4754  			"target_type": "tt",
  4755  			"single_file_name": "sfn",
  4756  			"repository_selection": "rs",
  4757  			"events": [
  4758  				"e"
  4759  			],
  4760  			"single_file_paths": [
  4761  				"s"
  4762  			],
  4763  			"permissions": {
  4764  				"actions": "a",
  4765  				"administration": "ad",
  4766  				"checks": "c",
  4767  				"contents": "co",
  4768  				"content_references": "cr",
  4769  				"deployments": "d",
  4770  				"environments": "e",
  4771  				"issues": "i",
  4772  				"metadata": "md",
  4773  				"members": "m",
  4774  				"organization_administration": "oa",
  4775  				"organization_hooks": "oh",
  4776  				"organization_plan": "op",
  4777  				"organization_pre_receive_hooks": "opr",
  4778  				"organization_projects": "op",
  4779  				"organization_secrets": "os",
  4780  				"organization_self_hosted_runners": "osh",
  4781  				"organization_user_blocking": "oub",
  4782  				"packages": "pkg",
  4783  				"pages": "pg",
  4784  				"pull_requests": "pr",
  4785  				"repository_hooks": "rh",
  4786  				"repository_projects": "rp",
  4787  				"repository_pre_receive_hooks": "rprh",
  4788  				"secrets": "s",
  4789  				"secret_scanning_alerts": "ssa",
  4790  				"security_events": "se",
  4791  				"single_file": "sf",
  4792  				"statuses": "s",
  4793  				"team_discussions": "td",
  4794  				"vulnerability_alerts": "va",
  4795  				"workflows": "w"
  4796  			},
  4797  			"created_at": ` + referenceTimeStr + `,
  4798  			"updated_at": ` + referenceTimeStr + `,
  4799  			"has_multiple_single_files": false,
  4800  			"suspended_by": {
  4801  				"login": "l",
  4802  				"id": 1,
  4803  				"avatar_url": "a",
  4804  				"gravatar_id": "g",
  4805  				"name": "n",
  4806  				"company": "c",
  4807  				"blog": "b",
  4808  				"location": "l",
  4809  				"email": "e",
  4810  				"hireable": true,
  4811  				"bio": "b",
  4812  				"twitter_username": "t",
  4813  				"public_repos": 1,
  4814  				"followers": 1,
  4815  				"following": 1,
  4816  				"created_at": ` + referenceTimeStr + `,
  4817  				"suspended_at": ` + referenceTimeStr + `,
  4818  				"url": "u"
  4819  			},
  4820  			"suspended_at": ` + referenceTimeStr + `
  4821  		}
  4822  	}`
  4823  
  4824  	testJSONMarshal(t, u, want)
  4825  }
  4826  
  4827  func TestCommitCommentEvent_Marshal(t *testing.T) {
  4828  	testJSONMarshal(t, &CommitCommentEvent{}, "{}")
  4829  
  4830  	u := &CommitCommentEvent{
  4831  		Comment: &RepositoryComment{
  4832  			HTMLURL:  String("hurl"),
  4833  			URL:      String("url"),
  4834  			ID:       Int64(1),
  4835  			NodeID:   String("nid"),
  4836  			CommitID: String("cid"),
  4837  			User: &User{
  4838  				Login:     String("l"),
  4839  				ID:        Int64(1),
  4840  				NodeID:    String("n"),
  4841  				URL:       String("u"),
  4842  				ReposURL:  String("r"),
  4843  				EventsURL: String("e"),
  4844  				AvatarURL: String("a"),
  4845  			},
  4846  			Reactions: &Reactions{
  4847  				TotalCount: Int(1),
  4848  				PlusOne:    Int(1),
  4849  				MinusOne:   Int(1),
  4850  				Laugh:      Int(1),
  4851  				Confused:   Int(1),
  4852  				Heart:      Int(1),
  4853  				Hooray:     Int(1),
  4854  				Rocket:     Int(1),
  4855  				Eyes:       Int(1),
  4856  				URL:        String("url"),
  4857  			},
  4858  			CreatedAt: &Timestamp{referenceTime},
  4859  			UpdatedAt: &Timestamp{referenceTime},
  4860  			Body:      String("b"),
  4861  			Path:      String("path"),
  4862  			Position:  Int(1),
  4863  		},
  4864  		Action: String("a"),
  4865  		Repo: &Repository{
  4866  			ID:   Int64(1),
  4867  			URL:  String("s"),
  4868  			Name: String("n"),
  4869  		},
  4870  		Sender: &User{
  4871  			Login:     String("l"),
  4872  			ID:        Int64(1),
  4873  			NodeID:    String("n"),
  4874  			URL:       String("u"),
  4875  			ReposURL:  String("r"),
  4876  			EventsURL: String("e"),
  4877  			AvatarURL: String("a"),
  4878  		},
  4879  		Installation: &Installation{
  4880  			ID:       Int64(1),
  4881  			NodeID:   String("nid"),
  4882  			AppID:    Int64(1),
  4883  			AppSlug:  String("as"),
  4884  			TargetID: Int64(1),
  4885  			Account: &User{
  4886  				Login:           String("l"),
  4887  				ID:              Int64(1),
  4888  				URL:             String("u"),
  4889  				AvatarURL:       String("a"),
  4890  				GravatarID:      String("g"),
  4891  				Name:            String("n"),
  4892  				Company:         String("c"),
  4893  				Blog:            String("b"),
  4894  				Location:        String("l"),
  4895  				Email:           String("e"),
  4896  				Hireable:        Bool(true),
  4897  				Bio:             String("b"),
  4898  				TwitterUsername: String("t"),
  4899  				PublicRepos:     Int(1),
  4900  				Followers:       Int(1),
  4901  				Following:       Int(1),
  4902  				CreatedAt:       &Timestamp{referenceTime},
  4903  				SuspendedAt:     &Timestamp{referenceTime},
  4904  			},
  4905  			AccessTokensURL:     String("atu"),
  4906  			RepositoriesURL:     String("ru"),
  4907  			HTMLURL:             String("hu"),
  4908  			TargetType:          String("tt"),
  4909  			SingleFileName:      String("sfn"),
  4910  			RepositorySelection: String("rs"),
  4911  			Events:              []string{"e"},
  4912  			SingleFilePaths:     []string{"s"},
  4913  			Permissions: &InstallationPermissions{
  4914  				Actions:                       String("a"),
  4915  				Administration:                String("ad"),
  4916  				Checks:                        String("c"),
  4917  				Contents:                      String("co"),
  4918  				ContentReferences:             String("cr"),
  4919  				Deployments:                   String("d"),
  4920  				Environments:                  String("e"),
  4921  				Issues:                        String("i"),
  4922  				Metadata:                      String("md"),
  4923  				Members:                       String("m"),
  4924  				OrganizationAdministration:    String("oa"),
  4925  				OrganizationHooks:             String("oh"),
  4926  				OrganizationPlan:              String("op"),
  4927  				OrganizationPreReceiveHooks:   String("opr"),
  4928  				OrganizationProjects:          String("op"),
  4929  				OrganizationSecrets:           String("os"),
  4930  				OrganizationSelfHostedRunners: String("osh"),
  4931  				OrganizationUserBlocking:      String("oub"),
  4932  				Packages:                      String("pkg"),
  4933  				Pages:                         String("pg"),
  4934  				PullRequests:                  String("pr"),
  4935  				RepositoryHooks:               String("rh"),
  4936  				RepositoryProjects:            String("rp"),
  4937  				RepositoryPreReceiveHooks:     String("rprh"),
  4938  				Secrets:                       String("s"),
  4939  				SecretScanningAlerts:          String("ssa"),
  4940  				SecurityEvents:                String("se"),
  4941  				SingleFile:                    String("sf"),
  4942  				Statuses:                      String("s"),
  4943  				TeamDiscussions:               String("td"),
  4944  				VulnerabilityAlerts:           String("va"),
  4945  				Workflows:                     String("w"),
  4946  			},
  4947  			CreatedAt:              &Timestamp{referenceTime},
  4948  			UpdatedAt:              &Timestamp{referenceTime},
  4949  			HasMultipleSingleFiles: Bool(false),
  4950  			SuspendedBy: &User{
  4951  				Login:           String("l"),
  4952  				ID:              Int64(1),
  4953  				URL:             String("u"),
  4954  				AvatarURL:       String("a"),
  4955  				GravatarID:      String("g"),
  4956  				Name:            String("n"),
  4957  				Company:         String("c"),
  4958  				Blog:            String("b"),
  4959  				Location:        String("l"),
  4960  				Email:           String("e"),
  4961  				Hireable:        Bool(true),
  4962  				Bio:             String("b"),
  4963  				TwitterUsername: String("t"),
  4964  				PublicRepos:     Int(1),
  4965  				Followers:       Int(1),
  4966  				Following:       Int(1),
  4967  				CreatedAt:       &Timestamp{referenceTime},
  4968  				SuspendedAt:     &Timestamp{referenceTime},
  4969  			},
  4970  			SuspendedAt: &Timestamp{referenceTime},
  4971  		},
  4972  	}
  4973  
  4974  	want := `{
  4975  		"comment": {
  4976  			"html_url": "hurl",
  4977  			"url": "url",
  4978  			"id": 1,
  4979  			"node_id": "nid",
  4980  			"commit_id": "cid",
  4981  			"user": {
  4982  				"login": "l",
  4983  				"id": 1,
  4984  				"node_id": "n",
  4985  				"avatar_url": "a",
  4986  				"url": "u",
  4987  				"events_url": "e",
  4988  				"repos_url": "r"
  4989  			},
  4990  			"reactions": {
  4991  				"total_count": 1,
  4992  				"+1": 1,
  4993  				"-1": 1,
  4994  				"laugh": 1,
  4995  				"confused": 1,
  4996  				"heart": 1,
  4997  				"hooray": 1,
  4998  				"rocket": 1,
  4999  				"eyes": 1,
  5000  				"url": "url"
  5001  			},
  5002  			"created_at": ` + referenceTimeStr + `,
  5003  			"updated_at": ` + referenceTimeStr + `,
  5004  			"body": "b",
  5005  			"path": "path",
  5006  			"position": 1
  5007  		},
  5008  		"action": "a",
  5009  		"repository": {
  5010  			"id": 1,
  5011  			"name": "n",
  5012  			"url": "s"
  5013  		},
  5014  		"sender": {
  5015  			"login": "l",
  5016  			"id": 1,
  5017  			"node_id": "n",
  5018  			"avatar_url": "a",
  5019  			"url": "u",
  5020  			"events_url": "e",
  5021  			"repos_url": "r"
  5022  		},
  5023  		"installation": {
  5024  			"id": 1,
  5025  			"node_id": "nid",
  5026  			"app_id": 1,
  5027  			"app_slug": "as",
  5028  			"target_id": 1,
  5029  			"account": {
  5030  				"login": "l",
  5031  				"id": 1,
  5032  				"avatar_url": "a",
  5033  				"gravatar_id": "g",
  5034  				"name": "n",
  5035  				"company": "c",
  5036  				"blog": "b",
  5037  				"location": "l",
  5038  				"email": "e",
  5039  				"hireable": true,
  5040  				"bio": "b",
  5041  				"twitter_username": "t",
  5042  				"public_repos": 1,
  5043  				"followers": 1,
  5044  				"following": 1,
  5045  				"created_at": ` + referenceTimeStr + `,
  5046  				"suspended_at": ` + referenceTimeStr + `,
  5047  				"url": "u"
  5048  			},
  5049  			"access_tokens_url": "atu",
  5050  			"repositories_url": "ru",
  5051  			"html_url": "hu",
  5052  			"target_type": "tt",
  5053  			"single_file_name": "sfn",
  5054  			"repository_selection": "rs",
  5055  			"events": [
  5056  				"e"
  5057  			],
  5058  			"single_file_paths": [
  5059  				"s"
  5060  			],
  5061  			"permissions": {
  5062  				"actions": "a",
  5063  				"administration": "ad",
  5064  				"checks": "c",
  5065  				"contents": "co",
  5066  				"content_references": "cr",
  5067  				"deployments": "d",
  5068  				"environments": "e",
  5069  				"issues": "i",
  5070  				"metadata": "md",
  5071  				"members": "m",
  5072  				"organization_administration": "oa",
  5073  				"organization_hooks": "oh",
  5074  				"organization_plan": "op",
  5075  				"organization_pre_receive_hooks": "opr",
  5076  				"organization_projects": "op",
  5077  				"organization_secrets": "os",
  5078  				"organization_self_hosted_runners": "osh",
  5079  				"organization_user_blocking": "oub",
  5080  				"packages": "pkg",
  5081  				"pages": "pg",
  5082  				"pull_requests": "pr",
  5083  				"repository_hooks": "rh",
  5084  				"repository_projects": "rp",
  5085  				"repository_pre_receive_hooks": "rprh",
  5086  				"secrets": "s",
  5087  				"secret_scanning_alerts": "ssa",
  5088  				"security_events": "se",
  5089  				"single_file": "sf",
  5090  				"statuses": "s",
  5091  				"team_discussions": "td",
  5092  				"vulnerability_alerts": "va",
  5093  				"workflows": "w"
  5094  			},
  5095  			"created_at": ` + referenceTimeStr + `,
  5096  			"updated_at": ` + referenceTimeStr + `,
  5097  			"has_multiple_single_files": false,
  5098  			"suspended_by": {
  5099  				"login": "l",
  5100  				"id": 1,
  5101  				"avatar_url": "a",
  5102  				"gravatar_id": "g",
  5103  				"name": "n",
  5104  				"company": "c",
  5105  				"blog": "b",
  5106  				"location": "l",
  5107  				"email": "e",
  5108  				"hireable": true,
  5109  				"bio": "b",
  5110  				"twitter_username": "t",
  5111  				"public_repos": 1,
  5112  				"followers": 1,
  5113  				"following": 1,
  5114  				"created_at": ` + referenceTimeStr + `,
  5115  				"suspended_at": ` + referenceTimeStr + `,
  5116  				"url": "u"
  5117  			},
  5118  			"suspended_at": ` + referenceTimeStr + `
  5119  		}
  5120  	}`
  5121  
  5122  	testJSONMarshal(t, u, want)
  5123  }
  5124  
  5125  func TestDeploymentEvent_Marshal(t *testing.T) {
  5126  	testJSONMarshal(t, &DeploymentEvent{}, "{}")
  5127  
  5128  	l := make(map[string]interface{})
  5129  	l["key"] = "value"
  5130  
  5131  	jsonMsg, _ := json.Marshal(&l)
  5132  
  5133  	u := &DeploymentEvent{
  5134  		Deployment: &Deployment{
  5135  			URL:         String("url"),
  5136  			ID:          Int64(1),
  5137  			SHA:         String("sha"),
  5138  			Ref:         String("ref"),
  5139  			Task:        String("t"),
  5140  			Payload:     jsonMsg,
  5141  			Environment: String("e"),
  5142  			Description: String("d"),
  5143  			Creator: &User{
  5144  				Login:     String("l"),
  5145  				ID:        Int64(1),
  5146  				NodeID:    String("n"),
  5147  				URL:       String("u"),
  5148  				ReposURL:  String("r"),
  5149  				EventsURL: String("e"),
  5150  				AvatarURL: String("a"),
  5151  			},
  5152  			CreatedAt:     &Timestamp{referenceTime},
  5153  			UpdatedAt:     &Timestamp{referenceTime},
  5154  			StatusesURL:   String("surl"),
  5155  			RepositoryURL: String("rurl"),
  5156  			NodeID:        String("nid"),
  5157  		},
  5158  		Repo: &Repository{
  5159  			ID:   Int64(1),
  5160  			URL:  String("s"),
  5161  			Name: String("n"),
  5162  		},
  5163  		Sender: &User{
  5164  			Login:     String("l"),
  5165  			ID:        Int64(1),
  5166  			NodeID:    String("n"),
  5167  			URL:       String("u"),
  5168  			ReposURL:  String("r"),
  5169  			EventsURL: String("e"),
  5170  			AvatarURL: String("a"),
  5171  		},
  5172  		Installation: &Installation{
  5173  			ID:       Int64(1),
  5174  			NodeID:   String("nid"),
  5175  			AppID:    Int64(1),
  5176  			AppSlug:  String("as"),
  5177  			TargetID: Int64(1),
  5178  			Account: &User{
  5179  				Login:           String("l"),
  5180  				ID:              Int64(1),
  5181  				URL:             String("u"),
  5182  				AvatarURL:       String("a"),
  5183  				GravatarID:      String("g"),
  5184  				Name:            String("n"),
  5185  				Company:         String("c"),
  5186  				Blog:            String("b"),
  5187  				Location:        String("l"),
  5188  				Email:           String("e"),
  5189  				Hireable:        Bool(true),
  5190  				Bio:             String("b"),
  5191  				TwitterUsername: String("t"),
  5192  				PublicRepos:     Int(1),
  5193  				Followers:       Int(1),
  5194  				Following:       Int(1),
  5195  				CreatedAt:       &Timestamp{referenceTime},
  5196  				SuspendedAt:     &Timestamp{referenceTime},
  5197  			},
  5198  			AccessTokensURL:     String("atu"),
  5199  			RepositoriesURL:     String("ru"),
  5200  			HTMLURL:             String("hu"),
  5201  			TargetType:          String("tt"),
  5202  			SingleFileName:      String("sfn"),
  5203  			RepositorySelection: String("rs"),
  5204  			Events:              []string{"e"},
  5205  			SingleFilePaths:     []string{"s"},
  5206  			Permissions: &InstallationPermissions{
  5207  				Actions:                       String("a"),
  5208  				Administration:                String("ad"),
  5209  				Checks:                        String("c"),
  5210  				Contents:                      String("co"),
  5211  				ContentReferences:             String("cr"),
  5212  				Deployments:                   String("d"),
  5213  				Environments:                  String("e"),
  5214  				Issues:                        String("i"),
  5215  				Metadata:                      String("md"),
  5216  				Members:                       String("m"),
  5217  				OrganizationAdministration:    String("oa"),
  5218  				OrganizationHooks:             String("oh"),
  5219  				OrganizationPlan:              String("op"),
  5220  				OrganizationPreReceiveHooks:   String("opr"),
  5221  				OrganizationProjects:          String("op"),
  5222  				OrganizationSecrets:           String("os"),
  5223  				OrganizationSelfHostedRunners: String("osh"),
  5224  				OrganizationUserBlocking:      String("oub"),
  5225  				Packages:                      String("pkg"),
  5226  				Pages:                         String("pg"),
  5227  				PullRequests:                  String("pr"),
  5228  				RepositoryHooks:               String("rh"),
  5229  				RepositoryProjects:            String("rp"),
  5230  				RepositoryPreReceiveHooks:     String("rprh"),
  5231  				Secrets:                       String("s"),
  5232  				SecretScanningAlerts:          String("ssa"),
  5233  				SecurityEvents:                String("se"),
  5234  				SingleFile:                    String("sf"),
  5235  				Statuses:                      String("s"),
  5236  				TeamDiscussions:               String("td"),
  5237  				VulnerabilityAlerts:           String("va"),
  5238  				Workflows:                     String("w"),
  5239  			},
  5240  			CreatedAt:              &Timestamp{referenceTime},
  5241  			UpdatedAt:              &Timestamp{referenceTime},
  5242  			HasMultipleSingleFiles: Bool(false),
  5243  			SuspendedBy: &User{
  5244  				Login:           String("l"),
  5245  				ID:              Int64(1),
  5246  				URL:             String("u"),
  5247  				AvatarURL:       String("a"),
  5248  				GravatarID:      String("g"),
  5249  				Name:            String("n"),
  5250  				Company:         String("c"),
  5251  				Blog:            String("b"),
  5252  				Location:        String("l"),
  5253  				Email:           String("e"),
  5254  				Hireable:        Bool(true),
  5255  				Bio:             String("b"),
  5256  				TwitterUsername: String("t"),
  5257  				PublicRepos:     Int(1),
  5258  				Followers:       Int(1),
  5259  				Following:       Int(1),
  5260  				CreatedAt:       &Timestamp{referenceTime},
  5261  				SuspendedAt:     &Timestamp{referenceTime},
  5262  			},
  5263  			SuspendedAt: &Timestamp{referenceTime},
  5264  		},
  5265  	}
  5266  
  5267  	want := `{
  5268  		"deployment": {
  5269  			"url": "url",
  5270  			"id": 1,
  5271  			"sha": "sha",
  5272  			"ref": "ref",
  5273  			"task": "t",
  5274  			"payload": {
  5275  				"key": "value"
  5276  			},
  5277  			"environment": "e",
  5278  			"description": "d",
  5279  			"creator": {
  5280  				"login": "l",
  5281  				"id": 1,
  5282  				"node_id": "n",
  5283  				"avatar_url": "a",
  5284  				"url": "u",
  5285  				"events_url": "e",
  5286  				"repos_url": "r"
  5287  			},
  5288  			"created_at": ` + referenceTimeStr + `,
  5289  			"updated_at": ` + referenceTimeStr + `,
  5290  			"statuses_url": "surl",
  5291  			"repository_url": "rurl",
  5292  			"node_id": "nid"
  5293  		},
  5294  		"repository": {
  5295  			"id": 1,
  5296  			"name": "n",
  5297  			"url": "s"
  5298  		},
  5299  		"sender": {
  5300  			"login": "l",
  5301  			"id": 1,
  5302  			"node_id": "n",
  5303  			"avatar_url": "a",
  5304  			"url": "u",
  5305  			"events_url": "e",
  5306  			"repos_url": "r"
  5307  		},
  5308  		"installation": {
  5309  			"id": 1,
  5310  			"node_id": "nid",
  5311  			"app_id": 1,
  5312  			"app_slug": "as",
  5313  			"target_id": 1,
  5314  			"account": {
  5315  				"login": "l",
  5316  				"id": 1,
  5317  				"avatar_url": "a",
  5318  				"gravatar_id": "g",
  5319  				"name": "n",
  5320  				"company": "c",
  5321  				"blog": "b",
  5322  				"location": "l",
  5323  				"email": "e",
  5324  				"hireable": true,
  5325  				"bio": "b",
  5326  				"twitter_username": "t",
  5327  				"public_repos": 1,
  5328  				"followers": 1,
  5329  				"following": 1,
  5330  				"created_at": ` + referenceTimeStr + `,
  5331  				"suspended_at": ` + referenceTimeStr + `,
  5332  				"url": "u"
  5333  			},
  5334  			"access_tokens_url": "atu",
  5335  			"repositories_url": "ru",
  5336  			"html_url": "hu",
  5337  			"target_type": "tt",
  5338  			"single_file_name": "sfn",
  5339  			"repository_selection": "rs",
  5340  			"events": [
  5341  				"e"
  5342  			],
  5343  			"single_file_paths": [
  5344  				"s"
  5345  			],
  5346  			"permissions": {
  5347  				"actions": "a",
  5348  				"administration": "ad",
  5349  				"checks": "c",
  5350  				"contents": "co",
  5351  				"content_references": "cr",
  5352  				"deployments": "d",
  5353  				"environments": "e",
  5354  				"issues": "i",
  5355  				"metadata": "md",
  5356  				"members": "m",
  5357  				"organization_administration": "oa",
  5358  				"organization_hooks": "oh",
  5359  				"organization_plan": "op",
  5360  				"organization_pre_receive_hooks": "opr",
  5361  				"organization_projects": "op",
  5362  				"organization_secrets": "os",
  5363  				"organization_self_hosted_runners": "osh",
  5364  				"organization_user_blocking": "oub",
  5365  				"packages": "pkg",
  5366  				"pages": "pg",
  5367  				"pull_requests": "pr",
  5368  				"repository_hooks": "rh",
  5369  				"repository_projects": "rp",
  5370  				"repository_pre_receive_hooks": "rprh",
  5371  				"secrets": "s",
  5372  				"secret_scanning_alerts": "ssa",
  5373  				"security_events": "se",
  5374  				"single_file": "sf",
  5375  				"statuses": "s",
  5376  				"team_discussions": "td",
  5377  				"vulnerability_alerts": "va",
  5378  				"workflows": "w"
  5379  			},
  5380  			"created_at": ` + referenceTimeStr + `,
  5381  			"updated_at": ` + referenceTimeStr + `,
  5382  			"has_multiple_single_files": false,
  5383  			"suspended_by": {
  5384  				"login": "l",
  5385  				"id": 1,
  5386  				"avatar_url": "a",
  5387  				"gravatar_id": "g",
  5388  				"name": "n",
  5389  				"company": "c",
  5390  				"blog": "b",
  5391  				"location": "l",
  5392  				"email": "e",
  5393  				"hireable": true,
  5394  				"bio": "b",
  5395  				"twitter_username": "t",
  5396  				"public_repos": 1,
  5397  				"followers": 1,
  5398  				"following": 1,
  5399  				"created_at": ` + referenceTimeStr + `,
  5400  				"suspended_at": ` + referenceTimeStr + `,
  5401  				"url": "u"
  5402  			},
  5403  			"suspended_at": ` + referenceTimeStr + `
  5404  		}
  5405  	}`
  5406  
  5407  	testJSONMarshal(t, u, want)
  5408  }
  5409  
  5410  func TestDeploymentStatusEvent_Marshal(t *testing.T) {
  5411  	testJSONMarshal(t, &DeploymentStatusEvent{}, "{}")
  5412  
  5413  	l := make(map[string]interface{})
  5414  	l["key"] = "value"
  5415  
  5416  	jsonMsg, _ := json.Marshal(&l)
  5417  
  5418  	u := &DeploymentStatusEvent{
  5419  		Deployment: &Deployment{
  5420  			URL:         String("url"),
  5421  			ID:          Int64(1),
  5422  			SHA:         String("sha"),
  5423  			Ref:         String("ref"),
  5424  			Task:        String("t"),
  5425  			Payload:     jsonMsg,
  5426  			Environment: String("e"),
  5427  			Description: String("d"),
  5428  			Creator: &User{
  5429  				Login:     String("l"),
  5430  				ID:        Int64(1),
  5431  				NodeID:    String("n"),
  5432  				URL:       String("u"),
  5433  				ReposURL:  String("r"),
  5434  				EventsURL: String("e"),
  5435  				AvatarURL: String("a"),
  5436  			},
  5437  			CreatedAt:     &Timestamp{referenceTime},
  5438  			UpdatedAt:     &Timestamp{referenceTime},
  5439  			StatusesURL:   String("surl"),
  5440  			RepositoryURL: String("rurl"),
  5441  			NodeID:        String("nid"),
  5442  		},
  5443  		DeploymentStatus: &DeploymentStatus{
  5444  			ID:    Int64(1),
  5445  			State: String("s"),
  5446  			Creator: &User{
  5447  				Login:     String("l"),
  5448  				ID:        Int64(1),
  5449  				NodeID:    String("n"),
  5450  				URL:       String("u"),
  5451  				ReposURL:  String("r"),
  5452  				EventsURL: String("e"),
  5453  				AvatarURL: String("a"),
  5454  			},
  5455  			Description:    String("s"),
  5456  			Environment:    String("s"),
  5457  			NodeID:         String("s"),
  5458  			CreatedAt:      &Timestamp{referenceTime},
  5459  			UpdatedAt:      &Timestamp{referenceTime},
  5460  			TargetURL:      String("s"),
  5461  			DeploymentURL:  String("s"),
  5462  			RepositoryURL:  String("s"),
  5463  			EnvironmentURL: String("s"),
  5464  			LogURL:         String("s"),
  5465  			URL:            String("s"),
  5466  		},
  5467  		Repo: &Repository{
  5468  			ID:   Int64(1),
  5469  			URL:  String("s"),
  5470  			Name: String("n"),
  5471  		},
  5472  		Sender: &User{
  5473  			Login:     String("l"),
  5474  			ID:        Int64(1),
  5475  			NodeID:    String("n"),
  5476  			URL:       String("u"),
  5477  			ReposURL:  String("r"),
  5478  			EventsURL: String("e"),
  5479  			AvatarURL: String("a"),
  5480  		},
  5481  		Installation: &Installation{
  5482  			ID:       Int64(1),
  5483  			NodeID:   String("nid"),
  5484  			AppID:    Int64(1),
  5485  			AppSlug:  String("as"),
  5486  			TargetID: Int64(1),
  5487  			Account: &User{
  5488  				Login:           String("l"),
  5489  				ID:              Int64(1),
  5490  				URL:             String("u"),
  5491  				AvatarURL:       String("a"),
  5492  				GravatarID:      String("g"),
  5493  				Name:            String("n"),
  5494  				Company:         String("c"),
  5495  				Blog:            String("b"),
  5496  				Location:        String("l"),
  5497  				Email:           String("e"),
  5498  				Hireable:        Bool(true),
  5499  				Bio:             String("b"),
  5500  				TwitterUsername: String("t"),
  5501  				PublicRepos:     Int(1),
  5502  				Followers:       Int(1),
  5503  				Following:       Int(1),
  5504  				CreatedAt:       &Timestamp{referenceTime},
  5505  				SuspendedAt:     &Timestamp{referenceTime},
  5506  			},
  5507  			AccessTokensURL:     String("atu"),
  5508  			RepositoriesURL:     String("ru"),
  5509  			HTMLURL:             String("hu"),
  5510  			TargetType:          String("tt"),
  5511  			SingleFileName:      String("sfn"),
  5512  			RepositorySelection: String("rs"),
  5513  			Events:              []string{"e"},
  5514  			SingleFilePaths:     []string{"s"},
  5515  			Permissions: &InstallationPermissions{
  5516  				Actions:                       String("a"),
  5517  				Administration:                String("ad"),
  5518  				Checks:                        String("c"),
  5519  				Contents:                      String("co"),
  5520  				ContentReferences:             String("cr"),
  5521  				Deployments:                   String("d"),
  5522  				Environments:                  String("e"),
  5523  				Issues:                        String("i"),
  5524  				Metadata:                      String("md"),
  5525  				Members:                       String("m"),
  5526  				OrganizationAdministration:    String("oa"),
  5527  				OrganizationHooks:             String("oh"),
  5528  				OrganizationPlan:              String("op"),
  5529  				OrganizationPreReceiveHooks:   String("opr"),
  5530  				OrganizationProjects:          String("op"),
  5531  				OrganizationSecrets:           String("os"),
  5532  				OrganizationSelfHostedRunners: String("osh"),
  5533  				OrganizationUserBlocking:      String("oub"),
  5534  				Packages:                      String("pkg"),
  5535  				Pages:                         String("pg"),
  5536  				PullRequests:                  String("pr"),
  5537  				RepositoryHooks:               String("rh"),
  5538  				RepositoryProjects:            String("rp"),
  5539  				RepositoryPreReceiveHooks:     String("rprh"),
  5540  				Secrets:                       String("s"),
  5541  				SecretScanningAlerts:          String("ssa"),
  5542  				SecurityEvents:                String("se"),
  5543  				SingleFile:                    String("sf"),
  5544  				Statuses:                      String("s"),
  5545  				TeamDiscussions:               String("td"),
  5546  				VulnerabilityAlerts:           String("va"),
  5547  				Workflows:                     String("w"),
  5548  			},
  5549  			CreatedAt:              &Timestamp{referenceTime},
  5550  			UpdatedAt:              &Timestamp{referenceTime},
  5551  			HasMultipleSingleFiles: Bool(false),
  5552  			SuspendedBy: &User{
  5553  				Login:           String("l"),
  5554  				ID:              Int64(1),
  5555  				URL:             String("u"),
  5556  				AvatarURL:       String("a"),
  5557  				GravatarID:      String("g"),
  5558  				Name:            String("n"),
  5559  				Company:         String("c"),
  5560  				Blog:            String("b"),
  5561  				Location:        String("l"),
  5562  				Email:           String("e"),
  5563  				Hireable:        Bool(true),
  5564  				Bio:             String("b"),
  5565  				TwitterUsername: String("t"),
  5566  				PublicRepos:     Int(1),
  5567  				Followers:       Int(1),
  5568  				Following:       Int(1),
  5569  				CreatedAt:       &Timestamp{referenceTime},
  5570  				SuspendedAt:     &Timestamp{referenceTime},
  5571  			},
  5572  			SuspendedAt: &Timestamp{referenceTime},
  5573  		},
  5574  	}
  5575  
  5576  	want := `{
  5577  		"deployment": {
  5578  			"url": "url",
  5579  			"id": 1,
  5580  			"sha": "sha",
  5581  			"ref": "ref",
  5582  			"task": "t",
  5583  			"payload": {
  5584  				"key": "value"
  5585  			},
  5586  			"environment": "e",
  5587  			"description": "d",
  5588  			"creator": {
  5589  				"login": "l",
  5590  				"id": 1,
  5591  				"node_id": "n",
  5592  				"avatar_url": "a",
  5593  				"url": "u",
  5594  				"events_url": "e",
  5595  				"repos_url": "r"
  5596  			},
  5597  			"created_at": ` + referenceTimeStr + `,
  5598  			"updated_at": ` + referenceTimeStr + `,
  5599  			"statuses_url": "surl",
  5600  			"repository_url": "rurl",
  5601  			"node_id": "nid"
  5602  		},
  5603  		"deployment_status": {
  5604  			"id": 1,
  5605  			"state": "s",
  5606  			"creator": {
  5607  				"login": "l",
  5608  				"id": 1,
  5609  				"node_id": "n",
  5610  				"avatar_url": "a",
  5611  				"url": "u",
  5612  				"events_url": "e",
  5613  				"repos_url": "r"
  5614  			},
  5615  			"description": "s",
  5616  			"environment": "s",
  5617  			"node_id": "s",
  5618  			"created_at": ` + referenceTimeStr + `,
  5619  			"updated_at": ` + referenceTimeStr + `,
  5620  			"target_url": "s",
  5621  			"deployment_url": "s",
  5622  			"repository_url": "s",
  5623  			"environment_url": "s",
  5624  			"log_url": "s",
  5625  			"url": "s"
  5626  		},
  5627  		"repository": {
  5628  			"id": 1,
  5629  			"name": "n",
  5630  			"url": "s"
  5631  		},
  5632  		"sender": {
  5633  			"login": "l",
  5634  			"id": 1,
  5635  			"node_id": "n",
  5636  			"avatar_url": "a",
  5637  			"url": "u",
  5638  			"events_url": "e",
  5639  			"repos_url": "r"
  5640  		},
  5641  		"installation": {
  5642  			"id": 1,
  5643  			"node_id": "nid",
  5644  			"app_id": 1,
  5645  			"app_slug": "as",
  5646  			"target_id": 1,
  5647  			"account": {
  5648  				"login": "l",
  5649  				"id": 1,
  5650  				"avatar_url": "a",
  5651  				"gravatar_id": "g",
  5652  				"name": "n",
  5653  				"company": "c",
  5654  				"blog": "b",
  5655  				"location": "l",
  5656  				"email": "e",
  5657  				"hireable": true,
  5658  				"bio": "b",
  5659  				"twitter_username": "t",
  5660  				"public_repos": 1,
  5661  				"followers": 1,
  5662  				"following": 1,
  5663  				"created_at": ` + referenceTimeStr + `,
  5664  				"suspended_at": ` + referenceTimeStr + `,
  5665  				"url": "u"
  5666  			},
  5667  			"access_tokens_url": "atu",
  5668  			"repositories_url": "ru",
  5669  			"html_url": "hu",
  5670  			"target_type": "tt",
  5671  			"single_file_name": "sfn",
  5672  			"repository_selection": "rs",
  5673  			"events": [
  5674  				"e"
  5675  			],
  5676  			"single_file_paths": [
  5677  				"s"
  5678  			],
  5679  			"permissions": {
  5680  				"actions": "a",
  5681  				"administration": "ad",
  5682  				"checks": "c",
  5683  				"contents": "co",
  5684  				"content_references": "cr",
  5685  				"deployments": "d",
  5686  				"environments": "e",
  5687  				"issues": "i",
  5688  				"metadata": "md",
  5689  				"members": "m",
  5690  				"organization_administration": "oa",
  5691  				"organization_hooks": "oh",
  5692  				"organization_plan": "op",
  5693  				"organization_pre_receive_hooks": "opr",
  5694  				"organization_projects": "op",
  5695  				"organization_secrets": "os",
  5696  				"organization_self_hosted_runners": "osh",
  5697  				"organization_user_blocking": "oub",
  5698  				"packages": "pkg",
  5699  				"pages": "pg",
  5700  				"pull_requests": "pr",
  5701  				"repository_hooks": "rh",
  5702  				"repository_projects": "rp",
  5703  				"repository_pre_receive_hooks": "rprh",
  5704  				"secrets": "s",
  5705  				"secret_scanning_alerts": "ssa",
  5706  				"security_events": "se",
  5707  				"single_file": "sf",
  5708  				"statuses": "s",
  5709  				"team_discussions": "td",
  5710  				"vulnerability_alerts": "va",
  5711  				"workflows": "w"
  5712  			},
  5713  			"created_at": ` + referenceTimeStr + `,
  5714  			"updated_at": ` + referenceTimeStr + `,
  5715  			"has_multiple_single_files": false,
  5716  			"suspended_by": {
  5717  				"login": "l",
  5718  				"id": 1,
  5719  				"avatar_url": "a",
  5720  				"gravatar_id": "g",
  5721  				"name": "n",
  5722  				"company": "c",
  5723  				"blog": "b",
  5724  				"location": "l",
  5725  				"email": "e",
  5726  				"hireable": true,
  5727  				"bio": "b",
  5728  				"twitter_username": "t",
  5729  				"public_repos": 1,
  5730  				"followers": 1,
  5731  				"following": 1,
  5732  				"created_at": ` + referenceTimeStr + `,
  5733  				"suspended_at": ` + referenceTimeStr + `,
  5734  				"url": "u"
  5735  			},
  5736  			"suspended_at": ` + referenceTimeStr + `
  5737  		}
  5738  	}`
  5739  
  5740  	testJSONMarshal(t, u, want)
  5741  }
  5742  
  5743  func TestDiscussionCommentEvent_Marshal(t *testing.T) {
  5744  	testJSONMarshal(t, &DiscussionCommentEvent{}, "{}")
  5745  
  5746  	u := &DiscussionCommentEvent{
  5747  		Comment: &CommentDiscussion{
  5748  			AuthorAssociation: String("aa"),
  5749  			Body:              String("bo"),
  5750  			ChildCommentCount: Int(1),
  5751  			CreatedAt:         &Timestamp{referenceTime},
  5752  			DiscussionID:      Int64(1),
  5753  			HTMLURL:           String("hurl"),
  5754  			ID:                Int64(1),
  5755  			NodeID:            String("nid"),
  5756  			ParentID:          Int64(1),
  5757  			Reactions: &Reactions{
  5758  				TotalCount: Int(1),
  5759  				PlusOne:    Int(1),
  5760  				MinusOne:   Int(1),
  5761  				Laugh:      Int(1),
  5762  				Confused:   Int(1),
  5763  				Heart:      Int(1),
  5764  				Hooray:     Int(1),
  5765  				Rocket:     Int(1),
  5766  				Eyes:       Int(1),
  5767  				URL:        String("url"),
  5768  			},
  5769  			RepositoryURL: String("rurl"),
  5770  			UpdatedAt:     &Timestamp{referenceTime},
  5771  			User: &User{
  5772  				Login:     String("l"),
  5773  				ID:        Int64(1),
  5774  				NodeID:    String("n"),
  5775  				URL:       String("u"),
  5776  				ReposURL:  String("r"),
  5777  				EventsURL: String("e"),
  5778  				AvatarURL: String("a"),
  5779  			},
  5780  		},
  5781  		Discussion: &Discussion{
  5782  			RepositoryURL: String("rurl"),
  5783  			DiscussionCategory: &DiscussionCategory{
  5784  				ID:           Int64(1),
  5785  				NodeID:       String("nid"),
  5786  				RepositoryID: Int64(1),
  5787  				Emoji:        String("emoji"),
  5788  				Name:         String("name"),
  5789  				Description:  String("description"),
  5790  				CreatedAt:    &Timestamp{referenceTime},
  5791  				UpdatedAt:    &Timestamp{referenceTime},
  5792  				Slug:         String("slug"),
  5793  				IsAnswerable: Bool(false),
  5794  			},
  5795  			HTMLURL: String("hurl"),
  5796  			ID:      Int64(1),
  5797  			NodeID:  String("nurl"),
  5798  			Number:  Int(1),
  5799  			Title:   String("title"),
  5800  			User: &User{
  5801  				Login:     String("l"),
  5802  				ID:        Int64(1),
  5803  				NodeID:    String("n"),
  5804  				URL:       String("u"),
  5805  				ReposURL:  String("r"),
  5806  				EventsURL: String("e"),
  5807  				AvatarURL: String("a"),
  5808  			},
  5809  			State:             String("st"),
  5810  			Locked:            Bool(false),
  5811  			Comments:          Int(1),
  5812  			CreatedAt:         &Timestamp{referenceTime},
  5813  			UpdatedAt:         &Timestamp{referenceTime},
  5814  			AuthorAssociation: String("aa"),
  5815  			Body:              String("bo"),
  5816  		},
  5817  		Repo: &Repository{
  5818  			ID:   Int64(1),
  5819  			URL:  String("s"),
  5820  			Name: String("n"),
  5821  		},
  5822  		Org: &Organization{
  5823  			BillingEmail:                         String("be"),
  5824  			Blog:                                 String("b"),
  5825  			Company:                              String("c"),
  5826  			Email:                                String("e"),
  5827  			TwitterUsername:                      String("tu"),
  5828  			Location:                             String("loc"),
  5829  			Name:                                 String("n"),
  5830  			Description:                          String("d"),
  5831  			IsVerified:                           Bool(true),
  5832  			HasOrganizationProjects:              Bool(true),
  5833  			HasRepositoryProjects:                Bool(true),
  5834  			DefaultRepoPermission:                String("drp"),
  5835  			MembersCanCreateRepos:                Bool(true),
  5836  			MembersCanCreateInternalRepos:        Bool(true),
  5837  			MembersCanCreatePrivateRepos:         Bool(true),
  5838  			MembersCanCreatePublicRepos:          Bool(false),
  5839  			MembersAllowedRepositoryCreationType: String("marct"),
  5840  			MembersCanCreatePages:                Bool(true),
  5841  			MembersCanCreatePublicPages:          Bool(false),
  5842  			MembersCanCreatePrivatePages:         Bool(true),
  5843  		},
  5844  		Sender: &User{
  5845  			Login:     String("l"),
  5846  			ID:        Int64(1),
  5847  			NodeID:    String("n"),
  5848  			URL:       String("u"),
  5849  			ReposURL:  String("r"),
  5850  			EventsURL: String("e"),
  5851  			AvatarURL: String("a"),
  5852  		},
  5853  		Installation: &Installation{
  5854  			ID:       Int64(1),
  5855  			NodeID:   String("nid"),
  5856  			AppID:    Int64(1),
  5857  			AppSlug:  String("as"),
  5858  			TargetID: Int64(1),
  5859  			Account: &User{
  5860  				Login:           String("l"),
  5861  				ID:              Int64(1),
  5862  				URL:             String("u"),
  5863  				AvatarURL:       String("a"),
  5864  				GravatarID:      String("g"),
  5865  				Name:            String("n"),
  5866  				Company:         String("c"),
  5867  				Blog:            String("b"),
  5868  				Location:        String("l"),
  5869  				Email:           String("e"),
  5870  				Hireable:        Bool(true),
  5871  				Bio:             String("b"),
  5872  				TwitterUsername: String("t"),
  5873  				PublicRepos:     Int(1),
  5874  				Followers:       Int(1),
  5875  				Following:       Int(1),
  5876  				CreatedAt:       &Timestamp{referenceTime},
  5877  				SuspendedAt:     &Timestamp{referenceTime},
  5878  			},
  5879  			AccessTokensURL:     String("atu"),
  5880  			RepositoriesURL:     String("ru"),
  5881  			HTMLURL:             String("hu"),
  5882  			TargetType:          String("tt"),
  5883  			SingleFileName:      String("sfn"),
  5884  			RepositorySelection: String("rs"),
  5885  			Events:              []string{"e"},
  5886  			SingleFilePaths:     []string{"s"},
  5887  			Permissions: &InstallationPermissions{
  5888  				Actions:                       String("a"),
  5889  				Administration:                String("ad"),
  5890  				Checks:                        String("c"),
  5891  				Contents:                      String("co"),
  5892  				ContentReferences:             String("cr"),
  5893  				Deployments:                   String("d"),
  5894  				Environments:                  String("e"),
  5895  				Issues:                        String("i"),
  5896  				Metadata:                      String("md"),
  5897  				Members:                       String("m"),
  5898  				OrganizationAdministration:    String("oa"),
  5899  				OrganizationHooks:             String("oh"),
  5900  				OrganizationPlan:              String("op"),
  5901  				OrganizationPreReceiveHooks:   String("opr"),
  5902  				OrganizationProjects:          String("op"),
  5903  				OrganizationSecrets:           String("os"),
  5904  				OrganizationSelfHostedRunners: String("osh"),
  5905  				OrganizationUserBlocking:      String("oub"),
  5906  				Packages:                      String("pkg"),
  5907  				Pages:                         String("pg"),
  5908  				PullRequests:                  String("pr"),
  5909  				RepositoryHooks:               String("rh"),
  5910  				RepositoryProjects:            String("rp"),
  5911  				RepositoryPreReceiveHooks:     String("rprh"),
  5912  				Secrets:                       String("s"),
  5913  				SecretScanningAlerts:          String("ssa"),
  5914  				SecurityEvents:                String("se"),
  5915  				SingleFile:                    String("sf"),
  5916  				Statuses:                      String("s"),
  5917  				TeamDiscussions:               String("td"),
  5918  				VulnerabilityAlerts:           String("va"),
  5919  				Workflows:                     String("w"),
  5920  			},
  5921  			CreatedAt:              &Timestamp{referenceTime},
  5922  			UpdatedAt:              &Timestamp{referenceTime},
  5923  			HasMultipleSingleFiles: Bool(false),
  5924  			SuspendedBy: &User{
  5925  				Login:           String("l"),
  5926  				ID:              Int64(1),
  5927  				URL:             String("u"),
  5928  				AvatarURL:       String("a"),
  5929  				GravatarID:      String("g"),
  5930  				Name:            String("n"),
  5931  				Company:         String("c"),
  5932  				Blog:            String("b"),
  5933  				Location:        String("l"),
  5934  				Email:           String("e"),
  5935  				Hireable:        Bool(true),
  5936  				Bio:             String("b"),
  5937  				TwitterUsername: String("t"),
  5938  				PublicRepos:     Int(1),
  5939  				Followers:       Int(1),
  5940  				Following:       Int(1),
  5941  				CreatedAt:       &Timestamp{referenceTime},
  5942  				SuspendedAt:     &Timestamp{referenceTime},
  5943  			},
  5944  			SuspendedAt: &Timestamp{referenceTime},
  5945  		},
  5946  	}
  5947  
  5948  	want := `{
  5949  		"comment": {
  5950  			"author_association": "aa",
  5951  			"body": "bo",
  5952  			"child_comment_count": 1,
  5953  			"created_at": ` + referenceTimeStr + `,
  5954  			"discussion_id": 1,
  5955  			"html_url": "hurl",
  5956  			"id": 1,
  5957  			"node_id": "nid",
  5958  			"parent_id": 1,
  5959  			"reactions": {
  5960  				"total_count": 1,
  5961  				"+1": 1,
  5962  				"-1": 1,
  5963  				"laugh": 1,
  5964  				"confused": 1,
  5965  				"heart": 1,
  5966  				"hooray": 1,
  5967  				"rocket": 1,
  5968  				"eyes": 1,
  5969  				"url": "url"
  5970  			},
  5971  			"repository_url": "rurl",
  5972  			"updated_at": ` + referenceTimeStr + `,
  5973  			"user": {
  5974  				"login": "l",
  5975  				"id": 1,
  5976  				"node_id": "n",
  5977  				"avatar_url": "a",
  5978  				"url": "u",
  5979  				"events_url": "e",
  5980  				"repos_url": "r"
  5981  			}
  5982  		},
  5983  		"discussion": {
  5984  			"repository_url": "rurl",
  5985  			"category": {
  5986  				"id": 1,
  5987  				"node_id": "nid",
  5988  				"repository_id": 1,
  5989  				"emoji": "emoji",
  5990  				"name": "name",
  5991  				"description": "description",
  5992  				"created_at": ` + referenceTimeStr + `,
  5993  				"updated_at": ` + referenceTimeStr + `,
  5994  				"slug": "slug",
  5995  				"is_answerable": false
  5996  			},
  5997  			"html_url": "hurl",
  5998  			"id": 1,
  5999  			"node_id": "nurl",
  6000  			"number": 1,
  6001  			"title": "title",
  6002  			"user": {
  6003  				"login": "l",
  6004  				"id": 1,
  6005  				"node_id": "n",
  6006  				"avatar_url": "a",
  6007  				"url": "u",
  6008  				"events_url": "e",
  6009  				"repos_url": "r"
  6010  			},
  6011  			"state": "st",
  6012  			"locked": false,
  6013  			"comments": 1,
  6014  			"created_at": ` + referenceTimeStr + `,
  6015  			"updated_at": ` + referenceTimeStr + `,
  6016  			"author_association": "aa",
  6017  			"body": "bo"
  6018  		},
  6019  		"repository": {
  6020  			"id": 1,
  6021  			"name": "n",
  6022  			"url": "s"
  6023  		},
  6024  		"organization": {
  6025  			"name": "n",
  6026  			"company": "c",
  6027  			"blog": "b",
  6028  			"location": "loc",
  6029  			"email": "e",
  6030  			"twitter_username": "tu",
  6031  			"description": "d",
  6032  			"billing_email": "be",
  6033  			"is_verified": true,
  6034  			"has_organization_projects": true,
  6035  			"has_repository_projects": true,
  6036  			"default_repository_permission": "drp",
  6037  			"members_can_create_repositories": true,
  6038  			"members_can_create_public_repositories": false,
  6039  			"members_can_create_private_repositories": true,
  6040  			"members_can_create_internal_repositories": true,
  6041  			"members_allowed_repository_creation_type": "marct",
  6042  			"members_can_create_pages": true,
  6043  			"members_can_create_public_pages": false,
  6044  			"members_can_create_private_pages": true
  6045  		},
  6046  		"sender": {
  6047  			"login": "l",
  6048  			"id": 1,
  6049  			"node_id": "n",
  6050  			"avatar_url": "a",
  6051  			"url": "u",
  6052  			"events_url": "e",
  6053  			"repos_url": "r"
  6054  		},
  6055  		"installation": {
  6056  			"id": 1,
  6057  			"node_id": "nid",
  6058  			"app_id": 1,
  6059  			"app_slug": "as",
  6060  			"target_id": 1,
  6061  			"account": {
  6062  				"login": "l",
  6063  				"id": 1,
  6064  				"avatar_url": "a",
  6065  				"gravatar_id": "g",
  6066  				"name": "n",
  6067  				"company": "c",
  6068  				"blog": "b",
  6069  				"location": "l",
  6070  				"email": "e",
  6071  				"hireable": true,
  6072  				"bio": "b",
  6073  				"twitter_username": "t",
  6074  				"public_repos": 1,
  6075  				"followers": 1,
  6076  				"following": 1,
  6077  				"created_at": ` + referenceTimeStr + `,
  6078  				"suspended_at": ` + referenceTimeStr + `,
  6079  				"url": "u"
  6080  			},
  6081  			"access_tokens_url": "atu",
  6082  			"repositories_url": "ru",
  6083  			"html_url": "hu",
  6084  			"target_type": "tt",
  6085  			"single_file_name": "sfn",
  6086  			"repository_selection": "rs",
  6087  			"events": [
  6088  				"e"
  6089  			],
  6090  			"single_file_paths": [
  6091  				"s"
  6092  			],
  6093  			"permissions": {
  6094  				"actions": "a",
  6095  				"administration": "ad",
  6096  				"checks": "c",
  6097  				"contents": "co",
  6098  				"content_references": "cr",
  6099  				"deployments": "d",
  6100  				"environments": "e",
  6101  				"issues": "i",
  6102  				"metadata": "md",
  6103  				"members": "m",
  6104  				"organization_administration": "oa",
  6105  				"organization_hooks": "oh",
  6106  				"organization_plan": "op",
  6107  				"organization_pre_receive_hooks": "opr",
  6108  				"organization_projects": "op",
  6109  				"organization_secrets": "os",
  6110  				"organization_self_hosted_runners": "osh",
  6111  				"organization_user_blocking": "oub",
  6112  				"packages": "pkg",
  6113  				"pages": "pg",
  6114  				"pull_requests": "pr",
  6115  				"repository_hooks": "rh",
  6116  				"repository_projects": "rp",
  6117  				"repository_pre_receive_hooks": "rprh",
  6118  				"secrets": "s",
  6119  				"secret_scanning_alerts": "ssa",
  6120  				"security_events": "se",
  6121  				"single_file": "sf",
  6122  				"statuses": "s",
  6123  				"team_discussions": "td",
  6124  				"vulnerability_alerts": "va",
  6125  				"workflows": "w"
  6126  			},
  6127  			"created_at": ` + referenceTimeStr + `,
  6128  			"updated_at": ` + referenceTimeStr + `,
  6129  			"has_multiple_single_files": false,
  6130  			"suspended_by": {
  6131  				"login": "l",
  6132  				"id": 1,
  6133  				"avatar_url": "a",
  6134  				"gravatar_id": "g",
  6135  				"name": "n",
  6136  				"company": "c",
  6137  				"blog": "b",
  6138  				"location": "l",
  6139  				"email": "e",
  6140  				"hireable": true,
  6141  				"bio": "b",
  6142  				"twitter_username": "t",
  6143  				"public_repos": 1,
  6144  				"followers": 1,
  6145  				"following": 1,
  6146  				"created_at": ` + referenceTimeStr + `,
  6147  				"suspended_at": ` + referenceTimeStr + `,
  6148  				"url": "u"
  6149  			},
  6150  			"suspended_at": ` + referenceTimeStr + `
  6151  		}
  6152  	}`
  6153  
  6154  	testJSONMarshal(t, u, want)
  6155  }
  6156  
  6157  func TestDiscussionEvent_Marshal(t *testing.T) {
  6158  	testJSONMarshal(t, &DiscussionEvent{}, "{}")
  6159  
  6160  	u := &DiscussionEvent{
  6161  		Discussion: &Discussion{
  6162  			RepositoryURL: String("rurl"),
  6163  			DiscussionCategory: &DiscussionCategory{
  6164  				ID:           Int64(1),
  6165  				NodeID:       String("nid"),
  6166  				RepositoryID: Int64(1),
  6167  				Emoji:        String("emoji"),
  6168  				Name:         String("name"),
  6169  				Description:  String("description"),
  6170  				CreatedAt:    &Timestamp{referenceTime},
  6171  				UpdatedAt:    &Timestamp{referenceTime},
  6172  				Slug:         String("slug"),
  6173  				IsAnswerable: Bool(false),
  6174  			},
  6175  			HTMLURL: String("hurl"),
  6176  			ID:      Int64(1),
  6177  			NodeID:  String("nurl"),
  6178  			Number:  Int(1),
  6179  			Title:   String("title"),
  6180  			User: &User{
  6181  				Login:     String("l"),
  6182  				ID:        Int64(1),
  6183  				NodeID:    String("n"),
  6184  				URL:       String("u"),
  6185  				ReposURL:  String("r"),
  6186  				EventsURL: String("e"),
  6187  				AvatarURL: String("a"),
  6188  			},
  6189  			State:             String("st"),
  6190  			Locked:            Bool(false),
  6191  			Comments:          Int(1),
  6192  			CreatedAt:         &Timestamp{referenceTime},
  6193  			UpdatedAt:         &Timestamp{referenceTime},
  6194  			AuthorAssociation: String("aa"),
  6195  			Body:              String("bo"),
  6196  		},
  6197  		Repo: &Repository{
  6198  			ID:   Int64(1),
  6199  			URL:  String("s"),
  6200  			Name: String("n"),
  6201  		},
  6202  		Org: &Organization{
  6203  			BillingEmail:                         String("be"),
  6204  			Blog:                                 String("b"),
  6205  			Company:                              String("c"),
  6206  			Email:                                String("e"),
  6207  			TwitterUsername:                      String("tu"),
  6208  			Location:                             String("loc"),
  6209  			Name:                                 String("n"),
  6210  			Description:                          String("d"),
  6211  			IsVerified:                           Bool(true),
  6212  			HasOrganizationProjects:              Bool(true),
  6213  			HasRepositoryProjects:                Bool(true),
  6214  			DefaultRepoPermission:                String("drp"),
  6215  			MembersCanCreateRepos:                Bool(true),
  6216  			MembersCanCreateInternalRepos:        Bool(true),
  6217  			MembersCanCreatePrivateRepos:         Bool(true),
  6218  			MembersCanCreatePublicRepos:          Bool(false),
  6219  			MembersAllowedRepositoryCreationType: String("marct"),
  6220  			MembersCanCreatePages:                Bool(true),
  6221  			MembersCanCreatePublicPages:          Bool(false),
  6222  			MembersCanCreatePrivatePages:         Bool(true),
  6223  		},
  6224  		Sender: &User{
  6225  			Login:     String("l"),
  6226  			ID:        Int64(1),
  6227  			NodeID:    String("n"),
  6228  			URL:       String("u"),
  6229  			ReposURL:  String("r"),
  6230  			EventsURL: String("e"),
  6231  			AvatarURL: String("a"),
  6232  		},
  6233  		Installation: &Installation{
  6234  			ID:       Int64(1),
  6235  			NodeID:   String("nid"),
  6236  			AppID:    Int64(1),
  6237  			AppSlug:  String("as"),
  6238  			TargetID: Int64(1),
  6239  			Account: &User{
  6240  				Login:           String("l"),
  6241  				ID:              Int64(1),
  6242  				URL:             String("u"),
  6243  				AvatarURL:       String("a"),
  6244  				GravatarID:      String("g"),
  6245  				Name:            String("n"),
  6246  				Company:         String("c"),
  6247  				Blog:            String("b"),
  6248  				Location:        String("l"),
  6249  				Email:           String("e"),
  6250  				Hireable:        Bool(true),
  6251  				Bio:             String("b"),
  6252  				TwitterUsername: String("t"),
  6253  				PublicRepos:     Int(1),
  6254  				Followers:       Int(1),
  6255  				Following:       Int(1),
  6256  				CreatedAt:       &Timestamp{referenceTime},
  6257  				SuspendedAt:     &Timestamp{referenceTime},
  6258  			},
  6259  			AccessTokensURL:     String("atu"),
  6260  			RepositoriesURL:     String("ru"),
  6261  			HTMLURL:             String("hu"),
  6262  			TargetType:          String("tt"),
  6263  			SingleFileName:      String("sfn"),
  6264  			RepositorySelection: String("rs"),
  6265  			Events:              []string{"e"},
  6266  			SingleFilePaths:     []string{"s"},
  6267  			Permissions: &InstallationPermissions{
  6268  				Actions:                       String("a"),
  6269  				Administration:                String("ad"),
  6270  				Checks:                        String("c"),
  6271  				Contents:                      String("co"),
  6272  				ContentReferences:             String("cr"),
  6273  				Deployments:                   String("d"),
  6274  				Environments:                  String("e"),
  6275  				Issues:                        String("i"),
  6276  				Metadata:                      String("md"),
  6277  				Members:                       String("m"),
  6278  				OrganizationAdministration:    String("oa"),
  6279  				OrganizationHooks:             String("oh"),
  6280  				OrganizationPlan:              String("op"),
  6281  				OrganizationPreReceiveHooks:   String("opr"),
  6282  				OrganizationProjects:          String("op"),
  6283  				OrganizationSecrets:           String("os"),
  6284  				OrganizationSelfHostedRunners: String("osh"),
  6285  				OrganizationUserBlocking:      String("oub"),
  6286  				Packages:                      String("pkg"),
  6287  				Pages:                         String("pg"),
  6288  				PullRequests:                  String("pr"),
  6289  				RepositoryHooks:               String("rh"),
  6290  				RepositoryProjects:            String("rp"),
  6291  				RepositoryPreReceiveHooks:     String("rprh"),
  6292  				Secrets:                       String("s"),
  6293  				SecretScanningAlerts:          String("ssa"),
  6294  				SecurityEvents:                String("se"),
  6295  				SingleFile:                    String("sf"),
  6296  				Statuses:                      String("s"),
  6297  				TeamDiscussions:               String("td"),
  6298  				VulnerabilityAlerts:           String("va"),
  6299  				Workflows:                     String("w"),
  6300  			},
  6301  			CreatedAt:              &Timestamp{referenceTime},
  6302  			UpdatedAt:              &Timestamp{referenceTime},
  6303  			HasMultipleSingleFiles: Bool(false),
  6304  			SuspendedBy: &User{
  6305  				Login:           String("l"),
  6306  				ID:              Int64(1),
  6307  				URL:             String("u"),
  6308  				AvatarURL:       String("a"),
  6309  				GravatarID:      String("g"),
  6310  				Name:            String("n"),
  6311  				Company:         String("c"),
  6312  				Blog:            String("b"),
  6313  				Location:        String("l"),
  6314  				Email:           String("e"),
  6315  				Hireable:        Bool(true),
  6316  				Bio:             String("b"),
  6317  				TwitterUsername: String("t"),
  6318  				PublicRepos:     Int(1),
  6319  				Followers:       Int(1),
  6320  				Following:       Int(1),
  6321  				CreatedAt:       &Timestamp{referenceTime},
  6322  				SuspendedAt:     &Timestamp{referenceTime},
  6323  			},
  6324  			SuspendedAt: &Timestamp{referenceTime},
  6325  		},
  6326  	}
  6327  
  6328  	want := `{
  6329  		"discussion": {
  6330  			"repository_url": "rurl",
  6331  			"category": {
  6332  				"id": 1,
  6333  				"node_id": "nid",
  6334  				"repository_id": 1,
  6335  				"emoji": "emoji",
  6336  				"name": "name",
  6337  				"description": "description",
  6338  				"created_at": ` + referenceTimeStr + `,
  6339  				"updated_at": ` + referenceTimeStr + `,
  6340  				"slug": "slug",
  6341  				"is_answerable": false
  6342  			},
  6343  			"html_url": "hurl",
  6344  			"id": 1,
  6345  			"node_id": "nurl",
  6346  			"number": 1,
  6347  			"title": "title",
  6348  			"user": {
  6349  				"login": "l",
  6350  				"id": 1,
  6351  				"node_id": "n",
  6352  				"avatar_url": "a",
  6353  				"url": "u",
  6354  				"events_url": "e",
  6355  				"repos_url": "r"
  6356  			},
  6357  			"state": "st",
  6358  			"locked": false,
  6359  			"comments": 1,
  6360  			"created_at": ` + referenceTimeStr + `,
  6361  			"updated_at": ` + referenceTimeStr + `,
  6362  			"author_association": "aa",
  6363  			"body": "bo"
  6364  		},
  6365  		"repository": {
  6366  			"id": 1,
  6367  			"name": "n",
  6368  			"url": "s"
  6369  		},
  6370  		"organization": {
  6371  			"name": "n",
  6372  			"company": "c",
  6373  			"blog": "b",
  6374  			"location": "loc",
  6375  			"email": "e",
  6376  			"twitter_username": "tu",
  6377  			"description": "d",
  6378  			"billing_email": "be",
  6379  			"is_verified": true,
  6380  			"has_organization_projects": true,
  6381  			"has_repository_projects": true,
  6382  			"default_repository_permission": "drp",
  6383  			"members_can_create_repositories": true,
  6384  			"members_can_create_public_repositories": false,
  6385  			"members_can_create_private_repositories": true,
  6386  			"members_can_create_internal_repositories": true,
  6387  			"members_allowed_repository_creation_type": "marct",
  6388  			"members_can_create_pages": true,
  6389  			"members_can_create_public_pages": false,
  6390  			"members_can_create_private_pages": true
  6391  		},
  6392  		"sender": {
  6393  			"login": "l",
  6394  			"id": 1,
  6395  			"node_id": "n",
  6396  			"avatar_url": "a",
  6397  			"url": "u",
  6398  			"events_url": "e",
  6399  			"repos_url": "r"
  6400  		},
  6401  		"installation": {
  6402  			"id": 1,
  6403  			"node_id": "nid",
  6404  			"app_id": 1,
  6405  			"app_slug": "as",
  6406  			"target_id": 1,
  6407  			"account": {
  6408  				"login": "l",
  6409  				"id": 1,
  6410  				"avatar_url": "a",
  6411  				"gravatar_id": "g",
  6412  				"name": "n",
  6413  				"company": "c",
  6414  				"blog": "b",
  6415  				"location": "l",
  6416  				"email": "e",
  6417  				"hireable": true,
  6418  				"bio": "b",
  6419  				"twitter_username": "t",
  6420  				"public_repos": 1,
  6421  				"followers": 1,
  6422  				"following": 1,
  6423  				"created_at": ` + referenceTimeStr + `,
  6424  				"suspended_at": ` + referenceTimeStr + `,
  6425  				"url": "u"
  6426  			},
  6427  			"access_tokens_url": "atu",
  6428  			"repositories_url": "ru",
  6429  			"html_url": "hu",
  6430  			"target_type": "tt",
  6431  			"single_file_name": "sfn",
  6432  			"repository_selection": "rs",
  6433  			"events": [
  6434  				"e"
  6435  			],
  6436  			"single_file_paths": [
  6437  				"s"
  6438  			],
  6439  			"permissions": {
  6440  				"actions": "a",
  6441  				"administration": "ad",
  6442  				"checks": "c",
  6443  				"contents": "co",
  6444  				"content_references": "cr",
  6445  				"deployments": "d",
  6446  				"environments": "e",
  6447  				"issues": "i",
  6448  				"metadata": "md",
  6449  				"members": "m",
  6450  				"organization_administration": "oa",
  6451  				"organization_hooks": "oh",
  6452  				"organization_plan": "op",
  6453  				"organization_pre_receive_hooks": "opr",
  6454  				"organization_projects": "op",
  6455  				"organization_secrets": "os",
  6456  				"organization_self_hosted_runners": "osh",
  6457  				"organization_user_blocking": "oub",
  6458  				"packages": "pkg",
  6459  				"pages": "pg",
  6460  				"pull_requests": "pr",
  6461  				"repository_hooks": "rh",
  6462  				"repository_projects": "rp",
  6463  				"repository_pre_receive_hooks": "rprh",
  6464  				"secrets": "s",
  6465  				"secret_scanning_alerts": "ssa",
  6466  				"security_events": "se",
  6467  				"single_file": "sf",
  6468  				"statuses": "s",
  6469  				"team_discussions": "td",
  6470  				"vulnerability_alerts": "va",
  6471  				"workflows": "w"
  6472  			},
  6473  			"created_at": ` + referenceTimeStr + `,
  6474  			"updated_at": ` + referenceTimeStr + `,
  6475  			"has_multiple_single_files": false,
  6476  			"suspended_by": {
  6477  				"login": "l",
  6478  				"id": 1,
  6479  				"avatar_url": "a",
  6480  				"gravatar_id": "g",
  6481  				"name": "n",
  6482  				"company": "c",
  6483  				"blog": "b",
  6484  				"location": "l",
  6485  				"email": "e",
  6486  				"hireable": true,
  6487  				"bio": "b",
  6488  				"twitter_username": "t",
  6489  				"public_repos": 1,
  6490  				"followers": 1,
  6491  				"following": 1,
  6492  				"created_at": ` + referenceTimeStr + `,
  6493  				"suspended_at": ` + referenceTimeStr + `,
  6494  				"url": "u"
  6495  			},
  6496  			"suspended_at": ` + referenceTimeStr + `
  6497  		}
  6498  	}`
  6499  
  6500  	testJSONMarshal(t, u, want)
  6501  }
  6502  
  6503  func TestPackageEvent_Marshal(t *testing.T) {
  6504  	testJSONMarshal(t, &PackageEvent{}, "{}")
  6505  
  6506  	u := &PackageEvent{
  6507  		Action: String("a"),
  6508  		Package: &Package{
  6509  			ID:          Int64(1),
  6510  			Name:        String("n"),
  6511  			PackageType: String("pt"),
  6512  			HTMLURL:     String("hurl"),
  6513  			CreatedAt:   &Timestamp{referenceTime},
  6514  			UpdatedAt:   &Timestamp{referenceTime},
  6515  			Owner: &User{
  6516  				Login:     String("l"),
  6517  				ID:        Int64(1),
  6518  				NodeID:    String("n"),
  6519  				URL:       String("u"),
  6520  				ReposURL:  String("r"),
  6521  				EventsURL: String("e"),
  6522  				AvatarURL: String("a"),
  6523  			},
  6524  			PackageVersion: &PackageVersion{ID: Int64(1)},
  6525  			Registry:       &PackageRegistry{Name: String("n")},
  6526  		},
  6527  		Repo: &Repository{
  6528  			ID:   Int64(1),
  6529  			URL:  String("s"),
  6530  			Name: String("n"),
  6531  		},
  6532  		Org: &Organization{
  6533  			BillingEmail:                         String("be"),
  6534  			Blog:                                 String("b"),
  6535  			Company:                              String("c"),
  6536  			Email:                                String("e"),
  6537  			TwitterUsername:                      String("tu"),
  6538  			Location:                             String("loc"),
  6539  			Name:                                 String("n"),
  6540  			Description:                          String("d"),
  6541  			IsVerified:                           Bool(true),
  6542  			HasOrganizationProjects:              Bool(true),
  6543  			HasRepositoryProjects:                Bool(true),
  6544  			DefaultRepoPermission:                String("drp"),
  6545  			MembersCanCreateRepos:                Bool(true),
  6546  			MembersCanCreateInternalRepos:        Bool(true),
  6547  			MembersCanCreatePrivateRepos:         Bool(true),
  6548  			MembersCanCreatePublicRepos:          Bool(false),
  6549  			MembersAllowedRepositoryCreationType: String("marct"),
  6550  			MembersCanCreatePages:                Bool(true),
  6551  			MembersCanCreatePublicPages:          Bool(false),
  6552  			MembersCanCreatePrivatePages:         Bool(true),
  6553  		},
  6554  		Sender: &User{
  6555  			Login:     String("l"),
  6556  			ID:        Int64(1),
  6557  			NodeID:    String("n"),
  6558  			URL:       String("u"),
  6559  			ReposURL:  String("r"),
  6560  			EventsURL: String("e"),
  6561  			AvatarURL: String("a"),
  6562  		},
  6563  	}
  6564  
  6565  	want := `{
  6566  		"action": "a",
  6567  		"package": {
  6568  			"id": 1,
  6569  			"name": "n",
  6570  			"package_type": "pt",
  6571  			"html_url": "hurl",
  6572  			"created_at": ` + referenceTimeStr + `,
  6573  			"updated_at": ` + referenceTimeStr + `,
  6574  			"owner": {
  6575  				"login": "l",
  6576  				"id": 1,
  6577  				"node_id": "n",
  6578  				"avatar_url": "a",
  6579  				"url": "u",
  6580  				"events_url": "e",
  6581  				"repos_url": "r"
  6582  			},
  6583  			"package_version": {
  6584  				"id": 1
  6585  			},
  6586  			"registry": {
  6587  				"name": "n"
  6588  			}
  6589  		},
  6590  		"repository": {
  6591  			"id": 1,
  6592  			"name": "n",
  6593  			"url": "s"
  6594  		},
  6595  		"organization": {
  6596  			"name": "n",
  6597  			"company": "c",
  6598  			"blog": "b",
  6599  			"location": "loc",
  6600  			"email": "e",
  6601  			"twitter_username": "tu",
  6602  			"description": "d",
  6603  			"billing_email": "be",
  6604  			"is_verified": true,
  6605  			"has_organization_projects": true,
  6606  			"has_repository_projects": true,
  6607  			"default_repository_permission": "drp",
  6608  			"members_can_create_repositories": true,
  6609  			"members_can_create_public_repositories": false,
  6610  			"members_can_create_private_repositories": true,
  6611  			"members_can_create_internal_repositories": true,
  6612  			"members_allowed_repository_creation_type": "marct",
  6613  			"members_can_create_pages": true,
  6614  			"members_can_create_public_pages": false,
  6615  			"members_can_create_private_pages": true
  6616  		},
  6617  		"sender": {
  6618  			"login": "l",
  6619  			"id": 1,
  6620  			"node_id": "n",
  6621  			"avatar_url": "a",
  6622  			"url": "u",
  6623  			"events_url": "e",
  6624  			"repos_url": "r"
  6625  		}
  6626  	}`
  6627  
  6628  	testJSONMarshal(t, u, want)
  6629  }
  6630  
  6631  func TestPingEvent_Marshal(t *testing.T) {
  6632  	testJSONMarshal(t, &PingEvent{}, "{}")
  6633  
  6634  	l := make(map[string]interface{})
  6635  	l["key"] = "value"
  6636  
  6637  	u := &PingEvent{
  6638  		Zen:    String("z"),
  6639  		HookID: Int64(1),
  6640  		Hook: &Hook{
  6641  			CreatedAt:    &Timestamp{referenceTime},
  6642  			UpdatedAt:    &Timestamp{referenceTime},
  6643  			URL:          String("url"),
  6644  			ID:           Int64(1),
  6645  			Type:         String("t"),
  6646  			Name:         String("n"),
  6647  			TestURL:      String("tu"),
  6648  			PingURL:      String("pu"),
  6649  			LastResponse: l,
  6650  			Config:       l,
  6651  			Events:       []string{"a"},
  6652  			Active:       Bool(true),
  6653  		},
  6654  		Installation: &Installation{
  6655  			ID:       Int64(1),
  6656  			NodeID:   String("nid"),
  6657  			AppID:    Int64(1),
  6658  			AppSlug:  String("as"),
  6659  			TargetID: Int64(1),
  6660  			Account: &User{
  6661  				Login:           String("l"),
  6662  				ID:              Int64(1),
  6663  				URL:             String("u"),
  6664  				AvatarURL:       String("a"),
  6665  				GravatarID:      String("g"),
  6666  				Name:            String("n"),
  6667  				Company:         String("c"),
  6668  				Blog:            String("b"),
  6669  				Location:        String("l"),
  6670  				Email:           String("e"),
  6671  				Hireable:        Bool(true),
  6672  				Bio:             String("b"),
  6673  				TwitterUsername: String("t"),
  6674  				PublicRepos:     Int(1),
  6675  				Followers:       Int(1),
  6676  				Following:       Int(1),
  6677  				CreatedAt:       &Timestamp{referenceTime},
  6678  				SuspendedAt:     &Timestamp{referenceTime},
  6679  			},
  6680  			AccessTokensURL:     String("atu"),
  6681  			RepositoriesURL:     String("ru"),
  6682  			HTMLURL:             String("hu"),
  6683  			TargetType:          String("tt"),
  6684  			SingleFileName:      String("sfn"),
  6685  			RepositorySelection: String("rs"),
  6686  			Events:              []string{"e"},
  6687  			SingleFilePaths:     []string{"s"},
  6688  			Permissions: &InstallationPermissions{
  6689  				Actions:                       String("a"),
  6690  				Administration:                String("ad"),
  6691  				Checks:                        String("c"),
  6692  				Contents:                      String("co"),
  6693  				ContentReferences:             String("cr"),
  6694  				Deployments:                   String("d"),
  6695  				Environments:                  String("e"),
  6696  				Issues:                        String("i"),
  6697  				Metadata:                      String("md"),
  6698  				Members:                       String("m"),
  6699  				OrganizationAdministration:    String("oa"),
  6700  				OrganizationHooks:             String("oh"),
  6701  				OrganizationPlan:              String("op"),
  6702  				OrganizationPreReceiveHooks:   String("opr"),
  6703  				OrganizationProjects:          String("op"),
  6704  				OrganizationSecrets:           String("os"),
  6705  				OrganizationSelfHostedRunners: String("osh"),
  6706  				OrganizationUserBlocking:      String("oub"),
  6707  				Packages:                      String("pkg"),
  6708  				Pages:                         String("pg"),
  6709  				PullRequests:                  String("pr"),
  6710  				RepositoryHooks:               String("rh"),
  6711  				RepositoryProjects:            String("rp"),
  6712  				RepositoryPreReceiveHooks:     String("rprh"),
  6713  				Secrets:                       String("s"),
  6714  				SecretScanningAlerts:          String("ssa"),
  6715  				SecurityEvents:                String("se"),
  6716  				SingleFile:                    String("sf"),
  6717  				Statuses:                      String("s"),
  6718  				TeamDiscussions:               String("td"),
  6719  				VulnerabilityAlerts:           String("va"),
  6720  				Workflows:                     String("w"),
  6721  			},
  6722  			CreatedAt:              &Timestamp{referenceTime},
  6723  			UpdatedAt:              &Timestamp{referenceTime},
  6724  			HasMultipleSingleFiles: Bool(false),
  6725  			SuspendedBy: &User{
  6726  				Login:           String("l"),
  6727  				ID:              Int64(1),
  6728  				URL:             String("u"),
  6729  				AvatarURL:       String("a"),
  6730  				GravatarID:      String("g"),
  6731  				Name:            String("n"),
  6732  				Company:         String("c"),
  6733  				Blog:            String("b"),
  6734  				Location:        String("l"),
  6735  				Email:           String("e"),
  6736  				Hireable:        Bool(true),
  6737  				Bio:             String("b"),
  6738  				TwitterUsername: String("t"),
  6739  				PublicRepos:     Int(1),
  6740  				Followers:       Int(1),
  6741  				Following:       Int(1),
  6742  				CreatedAt:       &Timestamp{referenceTime},
  6743  				SuspendedAt:     &Timestamp{referenceTime},
  6744  			},
  6745  			SuspendedAt: &Timestamp{referenceTime},
  6746  		},
  6747  	}
  6748  
  6749  	want := `{
  6750  		"zen": "z",
  6751  		"hook_id": 1,
  6752  		"hook": {
  6753  			"created_at": ` + referenceTimeStr + `,
  6754  			"updated_at": ` + referenceTimeStr + `,
  6755  			"url": "url",
  6756  			"id": 1,
  6757  			"type": "t",
  6758  			"name": "n",
  6759  			"test_url": "tu",
  6760  			"ping_url": "pu",
  6761  			"last_response": {
  6762  				"key": "value"
  6763  			},
  6764  			"config": {
  6765  				"key": "value"
  6766  			},
  6767  			"events": [
  6768  				"a"
  6769  			],
  6770  			"active": true
  6771  		},
  6772  		"installation": {
  6773  			"id": 1,
  6774  			"node_id": "nid",
  6775  			"app_id": 1,
  6776  			"app_slug": "as",
  6777  			"target_id": 1,
  6778  			"account": {
  6779  				"login": "l",
  6780  				"id": 1,
  6781  				"avatar_url": "a",
  6782  				"gravatar_id": "g",
  6783  				"name": "n",
  6784  				"company": "c",
  6785  				"blog": "b",
  6786  				"location": "l",
  6787  				"email": "e",
  6788  				"hireable": true,
  6789  				"bio": "b",
  6790  				"twitter_username": "t",
  6791  				"public_repos": 1,
  6792  				"followers": 1,
  6793  				"following": 1,
  6794  				"created_at": ` + referenceTimeStr + `,
  6795  				"suspended_at": ` + referenceTimeStr + `,
  6796  				"url": "u"
  6797  			},
  6798  			"access_tokens_url": "atu",
  6799  			"repositories_url": "ru",
  6800  			"html_url": "hu",
  6801  			"target_type": "tt",
  6802  			"single_file_name": "sfn",
  6803  			"repository_selection": "rs",
  6804  			"events": [
  6805  				"e"
  6806  			],
  6807  			"single_file_paths": [
  6808  				"s"
  6809  			],
  6810  			"permissions": {
  6811  				"actions": "a",
  6812  				"administration": "ad",
  6813  				"checks": "c",
  6814  				"contents": "co",
  6815  				"content_references": "cr",
  6816  				"deployments": "d",
  6817  				"environments": "e",
  6818  				"issues": "i",
  6819  				"metadata": "md",
  6820  				"members": "m",
  6821  				"organization_administration": "oa",
  6822  				"organization_hooks": "oh",
  6823  				"organization_plan": "op",
  6824  				"organization_pre_receive_hooks": "opr",
  6825  				"organization_projects": "op",
  6826  				"organization_secrets": "os",
  6827  				"organization_self_hosted_runners": "osh",
  6828  				"organization_user_blocking": "oub",
  6829  				"packages": "pkg",
  6830  				"pages": "pg",
  6831  				"pull_requests": "pr",
  6832  				"repository_hooks": "rh",
  6833  				"repository_projects": "rp",
  6834  				"repository_pre_receive_hooks": "rprh",
  6835  				"secrets": "s",
  6836  				"secret_scanning_alerts": "ssa",
  6837  				"security_events": "se",
  6838  				"single_file": "sf",
  6839  				"statuses": "s",
  6840  				"team_discussions": "td",
  6841  				"vulnerability_alerts": "va",
  6842  				"workflows": "w"
  6843  			},
  6844  			"created_at": ` + referenceTimeStr + `,
  6845  			"updated_at": ` + referenceTimeStr + `,
  6846  			"has_multiple_single_files": false,
  6847  			"suspended_by": {
  6848  				"login": "l",
  6849  				"id": 1,
  6850  				"avatar_url": "a",
  6851  				"gravatar_id": "g",
  6852  				"name": "n",
  6853  				"company": "c",
  6854  				"blog": "b",
  6855  				"location": "l",
  6856  				"email": "e",
  6857  				"hireable": true,
  6858  				"bio": "b",
  6859  				"twitter_username": "t",
  6860  				"public_repos": 1,
  6861  				"followers": 1,
  6862  				"following": 1,
  6863  				"created_at": ` + referenceTimeStr + `,
  6864  				"suspended_at": ` + referenceTimeStr + `,
  6865  				"url": "u"
  6866  			},
  6867  			"suspended_at": ` + referenceTimeStr + `
  6868  		}
  6869  	}`
  6870  
  6871  	testJSONMarshal(t, u, want)
  6872  }
  6873  
  6874  func TestRepositoryDispatchEvent_Marshal(t *testing.T) {
  6875  	testJSONMarshal(t, &RepositoryDispatchEvent{}, "{}")
  6876  
  6877  	l := make(map[string]interface{})
  6878  	l["key"] = "value"
  6879  
  6880  	jsonMsg, _ := json.Marshal(&l)
  6881  
  6882  	u := &RepositoryDispatchEvent{
  6883  		Action:        String("a"),
  6884  		Branch:        String("b"),
  6885  		ClientPayload: jsonMsg,
  6886  		Repo: &Repository{
  6887  
  6888  			ID:   Int64(1),
  6889  			URL:  String("s"),
  6890  			Name: String("n"),
  6891  		},
  6892  		Org: &Organization{
  6893  			BillingEmail:                         String("be"),
  6894  			Blog:                                 String("b"),
  6895  			Company:                              String("c"),
  6896  			Email:                                String("e"),
  6897  			TwitterUsername:                      String("tu"),
  6898  			Location:                             String("loc"),
  6899  			Name:                                 String("n"),
  6900  			Description:                          String("d"),
  6901  			IsVerified:                           Bool(true),
  6902  			HasOrganizationProjects:              Bool(true),
  6903  			HasRepositoryProjects:                Bool(true),
  6904  			DefaultRepoPermission:                String("drp"),
  6905  			MembersCanCreateRepos:                Bool(true),
  6906  			MembersCanCreateInternalRepos:        Bool(true),
  6907  			MembersCanCreatePrivateRepos:         Bool(true),
  6908  			MembersCanCreatePublicRepos:          Bool(false),
  6909  			MembersAllowedRepositoryCreationType: String("marct"),
  6910  			MembersCanCreatePages:                Bool(true),
  6911  			MembersCanCreatePublicPages:          Bool(false),
  6912  			MembersCanCreatePrivatePages:         Bool(true),
  6913  		},
  6914  		Sender: &User{
  6915  			Login:     String("l"),
  6916  			ID:        Int64(1),
  6917  			NodeID:    String("n"),
  6918  			URL:       String("u"),
  6919  			ReposURL:  String("r"),
  6920  			EventsURL: String("e"),
  6921  			AvatarURL: String("a"),
  6922  		},
  6923  		Installation: &Installation{
  6924  			ID:       Int64(1),
  6925  			NodeID:   String("nid"),
  6926  			AppID:    Int64(1),
  6927  			AppSlug:  String("as"),
  6928  			TargetID: Int64(1),
  6929  			Account: &User{
  6930  				Login:           String("l"),
  6931  				ID:              Int64(1),
  6932  				URL:             String("u"),
  6933  				AvatarURL:       String("a"),
  6934  				GravatarID:      String("g"),
  6935  				Name:            String("n"),
  6936  				Company:         String("c"),
  6937  				Blog:            String("b"),
  6938  				Location:        String("l"),
  6939  				Email:           String("e"),
  6940  				Hireable:        Bool(true),
  6941  				Bio:             String("b"),
  6942  				TwitterUsername: String("t"),
  6943  				PublicRepos:     Int(1),
  6944  				Followers:       Int(1),
  6945  				Following:       Int(1),
  6946  				CreatedAt:       &Timestamp{referenceTime},
  6947  				SuspendedAt:     &Timestamp{referenceTime},
  6948  			},
  6949  			AccessTokensURL:     String("atu"),
  6950  			RepositoriesURL:     String("ru"),
  6951  			HTMLURL:             String("hu"),
  6952  			TargetType:          String("tt"),
  6953  			SingleFileName:      String("sfn"),
  6954  			RepositorySelection: String("rs"),
  6955  			Events:              []string{"e"},
  6956  			SingleFilePaths:     []string{"s"},
  6957  			Permissions: &InstallationPermissions{
  6958  				Actions:                       String("a"),
  6959  				Administration:                String("ad"),
  6960  				Checks:                        String("c"),
  6961  				Contents:                      String("co"),
  6962  				ContentReferences:             String("cr"),
  6963  				Deployments:                   String("d"),
  6964  				Environments:                  String("e"),
  6965  				Issues:                        String("i"),
  6966  				Metadata:                      String("md"),
  6967  				Members:                       String("m"),
  6968  				OrganizationAdministration:    String("oa"),
  6969  				OrganizationHooks:             String("oh"),
  6970  				OrganizationPlan:              String("op"),
  6971  				OrganizationPreReceiveHooks:   String("opr"),
  6972  				OrganizationProjects:          String("op"),
  6973  				OrganizationSecrets:           String("os"),
  6974  				OrganizationSelfHostedRunners: String("osh"),
  6975  				OrganizationUserBlocking:      String("oub"),
  6976  				Packages:                      String("pkg"),
  6977  				Pages:                         String("pg"),
  6978  				PullRequests:                  String("pr"),
  6979  				RepositoryHooks:               String("rh"),
  6980  				RepositoryProjects:            String("rp"),
  6981  				RepositoryPreReceiveHooks:     String("rprh"),
  6982  				Secrets:                       String("s"),
  6983  				SecretScanningAlerts:          String("ssa"),
  6984  				SecurityEvents:                String("se"),
  6985  				SingleFile:                    String("sf"),
  6986  				Statuses:                      String("s"),
  6987  				TeamDiscussions:               String("td"),
  6988  				VulnerabilityAlerts:           String("va"),
  6989  				Workflows:                     String("w"),
  6990  			},
  6991  			CreatedAt:              &Timestamp{referenceTime},
  6992  			UpdatedAt:              &Timestamp{referenceTime},
  6993  			HasMultipleSingleFiles: Bool(false),
  6994  			SuspendedBy: &User{
  6995  				Login:           String("l"),
  6996  				ID:              Int64(1),
  6997  				URL:             String("u"),
  6998  				AvatarURL:       String("a"),
  6999  				GravatarID:      String("g"),
  7000  				Name:            String("n"),
  7001  				Company:         String("c"),
  7002  				Blog:            String("b"),
  7003  				Location:        String("l"),
  7004  				Email:           String("e"),
  7005  				Hireable:        Bool(true),
  7006  				Bio:             String("b"),
  7007  				TwitterUsername: String("t"),
  7008  				PublicRepos:     Int(1),
  7009  				Followers:       Int(1),
  7010  				Following:       Int(1),
  7011  				CreatedAt:       &Timestamp{referenceTime},
  7012  				SuspendedAt:     &Timestamp{referenceTime},
  7013  			},
  7014  			SuspendedAt: &Timestamp{referenceTime},
  7015  		},
  7016  	}
  7017  
  7018  	want := `{
  7019  		"action": "a",
  7020  		"branch": "b",
  7021  		"client_payload": {
  7022  			"key": "value"
  7023  		},
  7024  		"repository": {
  7025  			"id": 1,
  7026  			"name": "n",
  7027  			"url": "s"
  7028  		},
  7029  		"organization": {
  7030  			"name": "n",
  7031  			"company": "c",
  7032  			"blog": "b",
  7033  			"location": "loc",
  7034  			"email": "e",
  7035  			"twitter_username": "tu",
  7036  			"description": "d",
  7037  			"billing_email": "be",
  7038  			"is_verified": true,
  7039  			"has_organization_projects": true,
  7040  			"has_repository_projects": true,
  7041  			"default_repository_permission": "drp",
  7042  			"members_can_create_repositories": true,
  7043  			"members_can_create_public_repositories": false,
  7044  			"members_can_create_private_repositories": true,
  7045  			"members_can_create_internal_repositories": true,
  7046  			"members_allowed_repository_creation_type": "marct",
  7047  			"members_can_create_pages": true,
  7048  			"members_can_create_public_pages": false,
  7049  			"members_can_create_private_pages": true
  7050  		},
  7051  		"sender": {
  7052  			"login": "l",
  7053  			"id": 1,
  7054  			"node_id": "n",
  7055  			"avatar_url": "a",
  7056  			"url": "u",
  7057  			"events_url": "e",
  7058  			"repos_url": "r"
  7059  		},
  7060  		"installation": {
  7061  			"id": 1,
  7062  			"node_id": "nid",
  7063  			"app_id": 1,
  7064  			"app_slug": "as",
  7065  			"target_id": 1,
  7066  			"account": {
  7067  				"login": "l",
  7068  				"id": 1,
  7069  				"avatar_url": "a",
  7070  				"gravatar_id": "g",
  7071  				"name": "n",
  7072  				"company": "c",
  7073  				"blog": "b",
  7074  				"location": "l",
  7075  				"email": "e",
  7076  				"hireable": true,
  7077  				"bio": "b",
  7078  				"twitter_username": "t",
  7079  				"public_repos": 1,
  7080  				"followers": 1,
  7081  				"following": 1,
  7082  				"created_at": ` + referenceTimeStr + `,
  7083  				"suspended_at": ` + referenceTimeStr + `,
  7084  				"url": "u"
  7085  			},
  7086  			"access_tokens_url": "atu",
  7087  			"repositories_url": "ru",
  7088  			"html_url": "hu",
  7089  			"target_type": "tt",
  7090  			"single_file_name": "sfn",
  7091  			"repository_selection": "rs",
  7092  			"events": [
  7093  				"e"
  7094  			],
  7095  			"single_file_paths": [
  7096  				"s"
  7097  			],
  7098  			"permissions": {
  7099  				"actions": "a",
  7100  				"administration": "ad",
  7101  				"checks": "c",
  7102  				"contents": "co",
  7103  				"content_references": "cr",
  7104  				"deployments": "d",
  7105  				"environments": "e",
  7106  				"issues": "i",
  7107  				"metadata": "md",
  7108  				"members": "m",
  7109  				"organization_administration": "oa",
  7110  				"organization_hooks": "oh",
  7111  				"organization_plan": "op",
  7112  				"organization_pre_receive_hooks": "opr",
  7113  				"organization_projects": "op",
  7114  				"organization_secrets": "os",
  7115  				"organization_self_hosted_runners": "osh",
  7116  				"organization_user_blocking": "oub",
  7117  				"packages": "pkg",
  7118  				"pages": "pg",
  7119  				"pull_requests": "pr",
  7120  				"repository_hooks": "rh",
  7121  				"repository_projects": "rp",
  7122  				"repository_pre_receive_hooks": "rprh",
  7123  				"secrets": "s",
  7124  				"secret_scanning_alerts": "ssa",
  7125  				"security_events": "se",
  7126  				"single_file": "sf",
  7127  				"statuses": "s",
  7128  				"team_discussions": "td",
  7129  				"vulnerability_alerts": "va",
  7130  				"workflows": "w"
  7131  			},
  7132  			"created_at": ` + referenceTimeStr + `,
  7133  			"updated_at": ` + referenceTimeStr + `,
  7134  			"has_multiple_single_files": false,
  7135  			"suspended_by": {
  7136  				"login": "l",
  7137  				"id": 1,
  7138  				"avatar_url": "a",
  7139  				"gravatar_id": "g",
  7140  				"name": "n",
  7141  				"company": "c",
  7142  				"blog": "b",
  7143  				"location": "l",
  7144  				"email": "e",
  7145  				"hireable": true,
  7146  				"bio": "b",
  7147  				"twitter_username": "t",
  7148  				"public_repos": 1,
  7149  				"followers": 1,
  7150  				"following": 1,
  7151  				"created_at": ` + referenceTimeStr + `,
  7152  				"suspended_at": ` + referenceTimeStr + `,
  7153  				"url": "u"
  7154  			},
  7155  			"suspended_at": ` + referenceTimeStr + `
  7156  		}
  7157  	}`
  7158  
  7159  	testJSONMarshal(t, u, want)
  7160  }
  7161  
  7162  func TestRepositoryImportEvent_Marshal(t *testing.T) {
  7163  	testJSONMarshal(t, &RepositoryImportEvent{}, "{}")
  7164  
  7165  	u := &RepositoryImportEvent{
  7166  		Status: String("success"),
  7167  		Repo: &Repository{
  7168  			ID:   Int64(1),
  7169  			URL:  String("s"),
  7170  			Name: String("n"),
  7171  		},
  7172  		Org: &Organization{
  7173  			BillingEmail:                         String("be"),
  7174  			Blog:                                 String("b"),
  7175  			Company:                              String("c"),
  7176  			Email:                                String("e"),
  7177  			TwitterUsername:                      String("tu"),
  7178  			Location:                             String("loc"),
  7179  			Name:                                 String("n"),
  7180  			Description:                          String("d"),
  7181  			IsVerified:                           Bool(true),
  7182  			HasOrganizationProjects:              Bool(true),
  7183  			HasRepositoryProjects:                Bool(true),
  7184  			DefaultRepoPermission:                String("drp"),
  7185  			MembersCanCreateRepos:                Bool(true),
  7186  			MembersCanCreateInternalRepos:        Bool(true),
  7187  			MembersCanCreatePrivateRepos:         Bool(true),
  7188  			MembersCanCreatePublicRepos:          Bool(false),
  7189  			MembersAllowedRepositoryCreationType: String("marct"),
  7190  			MembersCanCreatePages:                Bool(true),
  7191  			MembersCanCreatePublicPages:          Bool(false),
  7192  			MembersCanCreatePrivatePages:         Bool(true),
  7193  		},
  7194  		Sender: &User{
  7195  			Login:     String("l"),
  7196  			ID:        Int64(1),
  7197  			NodeID:    String("n"),
  7198  			URL:       String("u"),
  7199  			ReposURL:  String("r"),
  7200  			EventsURL: String("e"),
  7201  			AvatarURL: String("a"),
  7202  		},
  7203  	}
  7204  
  7205  	want := `{
  7206  		"status": "success",
  7207  		"repository": {
  7208  			"id": 1,
  7209  			"name": "n",
  7210  			"url": "s"
  7211  		},
  7212  		"organization": {
  7213  			"name": "n",
  7214  			"company": "c",
  7215  			"blog": "b",
  7216  			"location": "loc",
  7217  			"email": "e",
  7218  			"twitter_username": "tu",
  7219  			"description": "d",
  7220  			"billing_email": "be",
  7221  			"is_verified": true,
  7222  			"has_organization_projects": true,
  7223  			"has_repository_projects": true,
  7224  			"default_repository_permission": "drp",
  7225  			"members_can_create_repositories": true,
  7226  			"members_can_create_public_repositories": false,
  7227  			"members_can_create_private_repositories": true,
  7228  			"members_can_create_internal_repositories": true,
  7229  			"members_allowed_repository_creation_type": "marct",
  7230  			"members_can_create_pages": true,
  7231  			"members_can_create_public_pages": false,
  7232  			"members_can_create_private_pages": true
  7233  		},
  7234  		"sender": {
  7235  			"login": "l",
  7236  			"id": 1,
  7237  			"node_id": "n",
  7238  			"avatar_url": "a",
  7239  			"url": "u",
  7240  			"events_url": "e",
  7241  			"repos_url": "r"
  7242  		}
  7243  	}`
  7244  
  7245  	testJSONMarshal(t, u, want)
  7246  }
  7247  
  7248  func TestRepositoryEvent_Marshal(t *testing.T) {
  7249  	testJSONMarshal(t, &RepositoryEvent{}, "{}")
  7250  
  7251  	u := &RepositoryEvent{
  7252  		Action: String("a"),
  7253  		Repo: &Repository{
  7254  			ID:   Int64(1),
  7255  			URL:  String("s"),
  7256  			Name: String("n"),
  7257  		},
  7258  		Org: &Organization{
  7259  			BillingEmail:                         String("be"),
  7260  			Blog:                                 String("b"),
  7261  			Company:                              String("c"),
  7262  			Email:                                String("e"),
  7263  			TwitterUsername:                      String("tu"),
  7264  			Location:                             String("loc"),
  7265  			Name:                                 String("n"),
  7266  			Description:                          String("d"),
  7267  			IsVerified:                           Bool(true),
  7268  			HasOrganizationProjects:              Bool(true),
  7269  			HasRepositoryProjects:                Bool(true),
  7270  			DefaultRepoPermission:                String("drp"),
  7271  			MembersCanCreateRepos:                Bool(true),
  7272  			MembersCanCreateInternalRepos:        Bool(true),
  7273  			MembersCanCreatePrivateRepos:         Bool(true),
  7274  			MembersCanCreatePublicRepos:          Bool(false),
  7275  			MembersAllowedRepositoryCreationType: String("marct"),
  7276  			MembersCanCreatePages:                Bool(true),
  7277  			MembersCanCreatePublicPages:          Bool(false),
  7278  			MembersCanCreatePrivatePages:         Bool(true),
  7279  		},
  7280  		Sender: &User{
  7281  			Login:     String("l"),
  7282  			ID:        Int64(1),
  7283  			NodeID:    String("n"),
  7284  			URL:       String("u"),
  7285  			ReposURL:  String("r"),
  7286  			EventsURL: String("e"),
  7287  			AvatarURL: String("a"),
  7288  		},
  7289  		Installation: &Installation{
  7290  			ID:       Int64(1),
  7291  			NodeID:   String("nid"),
  7292  			AppID:    Int64(1),
  7293  			AppSlug:  String("as"),
  7294  			TargetID: Int64(1),
  7295  			Account: &User{
  7296  				Login:           String("l"),
  7297  				ID:              Int64(1),
  7298  				URL:             String("u"),
  7299  				AvatarURL:       String("a"),
  7300  				GravatarID:      String("g"),
  7301  				Name:            String("n"),
  7302  				Company:         String("c"),
  7303  				Blog:            String("b"),
  7304  				Location:        String("l"),
  7305  				Email:           String("e"),
  7306  				Hireable:        Bool(true),
  7307  				Bio:             String("b"),
  7308  				TwitterUsername: String("t"),
  7309  				PublicRepos:     Int(1),
  7310  				Followers:       Int(1),
  7311  				Following:       Int(1),
  7312  				CreatedAt:       &Timestamp{referenceTime},
  7313  				SuspendedAt:     &Timestamp{referenceTime},
  7314  			},
  7315  			AccessTokensURL:     String("atu"),
  7316  			RepositoriesURL:     String("ru"),
  7317  			HTMLURL:             String("hu"),
  7318  			TargetType:          String("tt"),
  7319  			SingleFileName:      String("sfn"),
  7320  			RepositorySelection: String("rs"),
  7321  			Events:              []string{"e"},
  7322  			SingleFilePaths:     []string{"s"},
  7323  			Permissions: &InstallationPermissions{
  7324  				Actions:                       String("a"),
  7325  				Administration:                String("ad"),
  7326  				Checks:                        String("c"),
  7327  				Contents:                      String("co"),
  7328  				ContentReferences:             String("cr"),
  7329  				Deployments:                   String("d"),
  7330  				Environments:                  String("e"),
  7331  				Issues:                        String("i"),
  7332  				Metadata:                      String("md"),
  7333  				Members:                       String("m"),
  7334  				OrganizationAdministration:    String("oa"),
  7335  				OrganizationHooks:             String("oh"),
  7336  				OrganizationPlan:              String("op"),
  7337  				OrganizationPreReceiveHooks:   String("opr"),
  7338  				OrganizationProjects:          String("op"),
  7339  				OrganizationSecrets:           String("os"),
  7340  				OrganizationSelfHostedRunners: String("osh"),
  7341  				OrganizationUserBlocking:      String("oub"),
  7342  				Packages:                      String("pkg"),
  7343  				Pages:                         String("pg"),
  7344  				PullRequests:                  String("pr"),
  7345  				RepositoryHooks:               String("rh"),
  7346  				RepositoryProjects:            String("rp"),
  7347  				RepositoryPreReceiveHooks:     String("rprh"),
  7348  				Secrets:                       String("s"),
  7349  				SecretScanningAlerts:          String("ssa"),
  7350  				SecurityEvents:                String("se"),
  7351  				SingleFile:                    String("sf"),
  7352  				Statuses:                      String("s"),
  7353  				TeamDiscussions:               String("td"),
  7354  				VulnerabilityAlerts:           String("va"),
  7355  				Workflows:                     String("w"),
  7356  			},
  7357  			CreatedAt:              &Timestamp{referenceTime},
  7358  			UpdatedAt:              &Timestamp{referenceTime},
  7359  			HasMultipleSingleFiles: Bool(false),
  7360  			SuspendedBy: &User{
  7361  				Login:           String("l"),
  7362  				ID:              Int64(1),
  7363  				URL:             String("u"),
  7364  				AvatarURL:       String("a"),
  7365  				GravatarID:      String("g"),
  7366  				Name:            String("n"),
  7367  				Company:         String("c"),
  7368  				Blog:            String("b"),
  7369  				Location:        String("l"),
  7370  				Email:           String("e"),
  7371  				Hireable:        Bool(true),
  7372  				Bio:             String("b"),
  7373  				TwitterUsername: String("t"),
  7374  				PublicRepos:     Int(1),
  7375  				Followers:       Int(1),
  7376  				Following:       Int(1),
  7377  				CreatedAt:       &Timestamp{referenceTime},
  7378  				SuspendedAt:     &Timestamp{referenceTime},
  7379  			},
  7380  			SuspendedAt: &Timestamp{referenceTime},
  7381  		},
  7382  	}
  7383  
  7384  	want := `{
  7385  		"action": "a",
  7386  		"repository": {
  7387  			"id": 1,
  7388  			"name": "n",
  7389  			"url": "s"
  7390  		},
  7391  		"organization": {
  7392  			"name": "n",
  7393  			"company": "c",
  7394  			"blog": "b",
  7395  			"location": "loc",
  7396  			"email": "e",
  7397  			"twitter_username": "tu",
  7398  			"description": "d",
  7399  			"billing_email": "be",
  7400  			"is_verified": true,
  7401  			"has_organization_projects": true,
  7402  			"has_repository_projects": true,
  7403  			"default_repository_permission": "drp",
  7404  			"members_can_create_repositories": true,
  7405  			"members_can_create_public_repositories": false,
  7406  			"members_can_create_private_repositories": true,
  7407  			"members_can_create_internal_repositories": true,
  7408  			"members_allowed_repository_creation_type": "marct",
  7409  			"members_can_create_pages": true,
  7410  			"members_can_create_public_pages": false,
  7411  			"members_can_create_private_pages": true
  7412  		},
  7413  		"sender": {
  7414  			"login": "l",
  7415  			"id": 1,
  7416  			"node_id": "n",
  7417  			"avatar_url": "a",
  7418  			"url": "u",
  7419  			"events_url": "e",
  7420  			"repos_url": "r"
  7421  		},
  7422  		"installation": {
  7423  			"id": 1,
  7424  			"node_id": "nid",
  7425  			"app_id": 1,
  7426  			"app_slug": "as",
  7427  			"target_id": 1,
  7428  			"account": {
  7429  				"login": "l",
  7430  				"id": 1,
  7431  				"avatar_url": "a",
  7432  				"gravatar_id": "g",
  7433  				"name": "n",
  7434  				"company": "c",
  7435  				"blog": "b",
  7436  				"location": "l",
  7437  				"email": "e",
  7438  				"hireable": true,
  7439  				"bio": "b",
  7440  				"twitter_username": "t",
  7441  				"public_repos": 1,
  7442  				"followers": 1,
  7443  				"following": 1,
  7444  				"created_at": ` + referenceTimeStr + `,
  7445  				"suspended_at": ` + referenceTimeStr + `,
  7446  				"url": "u"
  7447  			},
  7448  			"access_tokens_url": "atu",
  7449  			"repositories_url": "ru",
  7450  			"html_url": "hu",
  7451  			"target_type": "tt",
  7452  			"single_file_name": "sfn",
  7453  			"repository_selection": "rs",
  7454  			"events": [
  7455  				"e"
  7456  			],
  7457  			"single_file_paths": [
  7458  				"s"
  7459  			],
  7460  			"permissions": {
  7461  				"actions": "a",
  7462  				"administration": "ad",
  7463  				"checks": "c",
  7464  				"contents": "co",
  7465  				"content_references": "cr",
  7466  				"deployments": "d",
  7467  				"environments": "e",
  7468  				"issues": "i",
  7469  				"metadata": "md",
  7470  				"members": "m",
  7471  				"organization_administration": "oa",
  7472  				"organization_hooks": "oh",
  7473  				"organization_plan": "op",
  7474  				"organization_pre_receive_hooks": "opr",
  7475  				"organization_projects": "op",
  7476  				"organization_secrets": "os",
  7477  				"organization_self_hosted_runners": "osh",
  7478  				"organization_user_blocking": "oub",
  7479  				"packages": "pkg",
  7480  				"pages": "pg",
  7481  				"pull_requests": "pr",
  7482  				"repository_hooks": "rh",
  7483  				"repository_projects": "rp",
  7484  				"repository_pre_receive_hooks": "rprh",
  7485  				"secrets": "s",
  7486  				"secret_scanning_alerts": "ssa",
  7487  				"security_events": "se",
  7488  				"single_file": "sf",
  7489  				"statuses": "s",
  7490  				"team_discussions": "td",
  7491  				"vulnerability_alerts": "va",
  7492  				"workflows": "w"
  7493  			},
  7494  			"created_at": ` + referenceTimeStr + `,
  7495  			"updated_at": ` + referenceTimeStr + `,
  7496  			"has_multiple_single_files": false,
  7497  			"suspended_by": {
  7498  				"login": "l",
  7499  				"id": 1,
  7500  				"avatar_url": "a",
  7501  				"gravatar_id": "g",
  7502  				"name": "n",
  7503  				"company": "c",
  7504  				"blog": "b",
  7505  				"location": "l",
  7506  				"email": "e",
  7507  				"hireable": true,
  7508  				"bio": "b",
  7509  				"twitter_username": "t",
  7510  				"public_repos": 1,
  7511  				"followers": 1,
  7512  				"following": 1,
  7513  				"created_at": ` + referenceTimeStr + `,
  7514  				"suspended_at": ` + referenceTimeStr + `,
  7515  				"url": "u"
  7516  			},
  7517  			"suspended_at": ` + referenceTimeStr + `
  7518  		}
  7519  	}`
  7520  
  7521  	testJSONMarshal(t, u, want)
  7522  }
  7523  
  7524  func TestReleaseEvent_Marshal(t *testing.T) {
  7525  	testJSONMarshal(t, &ReleaseEvent{}, "{}")
  7526  
  7527  	u := &ReleaseEvent{
  7528  		Action: String("a"),
  7529  		Release: &RepositoryRelease{
  7530  			Name:                   String("n"),
  7531  			DiscussionCategoryName: String("dcn"),
  7532  			ID:                     Int64(2),
  7533  			CreatedAt:              &Timestamp{referenceTime},
  7534  			PublishedAt:            &Timestamp{referenceTime},
  7535  			URL:                    String("url"),
  7536  			HTMLURL:                String("htmlurl"),
  7537  			AssetsURL:              String("assetsurl"),
  7538  			Assets:                 []*ReleaseAsset{{ID: Int64(1)}},
  7539  			UploadURL:              String("uploadurl"),
  7540  			ZipballURL:             String("zipballurl"),
  7541  			TarballURL:             String("tarballurl"),
  7542  			Author:                 &User{Name: String("octocat")},
  7543  			NodeID:                 String("nid"),
  7544  		},
  7545  		Repo: &Repository{
  7546  			ID:   Int64(1),
  7547  			URL:  String("s"),
  7548  			Name: String("n"),
  7549  		},
  7550  		Sender: &User{
  7551  			Login:     String("l"),
  7552  			ID:        Int64(1),
  7553  			NodeID:    String("n"),
  7554  			URL:       String("u"),
  7555  			ReposURL:  String("r"),
  7556  			EventsURL: String("e"),
  7557  			AvatarURL: String("a"),
  7558  		},
  7559  		Installation: &Installation{
  7560  			ID:       Int64(1),
  7561  			NodeID:   String("nid"),
  7562  			AppID:    Int64(1),
  7563  			AppSlug:  String("as"),
  7564  			TargetID: Int64(1),
  7565  			Account: &User{
  7566  				Login:           String("l"),
  7567  				ID:              Int64(1),
  7568  				URL:             String("u"),
  7569  				AvatarURL:       String("a"),
  7570  				GravatarID:      String("g"),
  7571  				Name:            String("n"),
  7572  				Company:         String("c"),
  7573  				Blog:            String("b"),
  7574  				Location:        String("l"),
  7575  				Email:           String("e"),
  7576  				Hireable:        Bool(true),
  7577  				Bio:             String("b"),
  7578  				TwitterUsername: String("t"),
  7579  				PublicRepos:     Int(1),
  7580  				Followers:       Int(1),
  7581  				Following:       Int(1),
  7582  				CreatedAt:       &Timestamp{referenceTime},
  7583  				SuspendedAt:     &Timestamp{referenceTime},
  7584  			},
  7585  			AccessTokensURL:     String("atu"),
  7586  			RepositoriesURL:     String("ru"),
  7587  			HTMLURL:             String("hu"),
  7588  			TargetType:          String("tt"),
  7589  			SingleFileName:      String("sfn"),
  7590  			RepositorySelection: String("rs"),
  7591  			Events:              []string{"e"},
  7592  			SingleFilePaths:     []string{"s"},
  7593  			Permissions: &InstallationPermissions{
  7594  				Actions:                       String("a"),
  7595  				Administration:                String("ad"),
  7596  				Checks:                        String("c"),
  7597  				Contents:                      String("co"),
  7598  				ContentReferences:             String("cr"),
  7599  				Deployments:                   String("d"),
  7600  				Environments:                  String("e"),
  7601  				Issues:                        String("i"),
  7602  				Metadata:                      String("md"),
  7603  				Members:                       String("m"),
  7604  				OrganizationAdministration:    String("oa"),
  7605  				OrganizationHooks:             String("oh"),
  7606  				OrganizationPlan:              String("op"),
  7607  				OrganizationPreReceiveHooks:   String("opr"),
  7608  				OrganizationProjects:          String("op"),
  7609  				OrganizationSecrets:           String("os"),
  7610  				OrganizationSelfHostedRunners: String("osh"),
  7611  				OrganizationUserBlocking:      String("oub"),
  7612  				Packages:                      String("pkg"),
  7613  				Pages:                         String("pg"),
  7614  				PullRequests:                  String("pr"),
  7615  				RepositoryHooks:               String("rh"),
  7616  				RepositoryProjects:            String("rp"),
  7617  				RepositoryPreReceiveHooks:     String("rprh"),
  7618  				Secrets:                       String("s"),
  7619  				SecretScanningAlerts:          String("ssa"),
  7620  				SecurityEvents:                String("se"),
  7621  				SingleFile:                    String("sf"),
  7622  				Statuses:                      String("s"),
  7623  				TeamDiscussions:               String("td"),
  7624  				VulnerabilityAlerts:           String("va"),
  7625  				Workflows:                     String("w"),
  7626  			},
  7627  			CreatedAt:              &Timestamp{referenceTime},
  7628  			UpdatedAt:              &Timestamp{referenceTime},
  7629  			HasMultipleSingleFiles: Bool(false),
  7630  			SuspendedBy: &User{
  7631  				Login:           String("l"),
  7632  				ID:              Int64(1),
  7633  				URL:             String("u"),
  7634  				AvatarURL:       String("a"),
  7635  				GravatarID:      String("g"),
  7636  				Name:            String("n"),
  7637  				Company:         String("c"),
  7638  				Blog:            String("b"),
  7639  				Location:        String("l"),
  7640  				Email:           String("e"),
  7641  				Hireable:        Bool(true),
  7642  				Bio:             String("b"),
  7643  				TwitterUsername: String("t"),
  7644  				PublicRepos:     Int(1),
  7645  				Followers:       Int(1),
  7646  				Following:       Int(1),
  7647  				CreatedAt:       &Timestamp{referenceTime},
  7648  				SuspendedAt:     &Timestamp{referenceTime},
  7649  			},
  7650  			SuspendedAt: &Timestamp{referenceTime},
  7651  		},
  7652  	}
  7653  
  7654  	want := `{
  7655  		"action": "a",
  7656  		"release": {
  7657  			"name": "n",
  7658  			"discussion_category_name": "dcn",
  7659  			"id": 2,
  7660  			"created_at": ` + referenceTimeStr + `,
  7661  			"published_at": ` + referenceTimeStr + `,
  7662  			"url": "url",
  7663  			"html_url": "htmlurl",
  7664  			"assets_url": "assetsurl",
  7665  			"assets": [
  7666  				{
  7667  					"id": 1
  7668  				}
  7669  			],
  7670  			"upload_url": "uploadurl",
  7671  			"zipball_url": "zipballurl",
  7672  			"tarball_url": "tarballurl",
  7673  			"author": {
  7674  				"name": "octocat"
  7675  			},
  7676  			"node_id": "nid"
  7677  		},
  7678  		"repository": {
  7679  			"id": 1,
  7680  			"name": "n",
  7681  			"url": "s"
  7682  		},
  7683  		"sender": {
  7684  			"login": "l",
  7685  			"id": 1,
  7686  			"node_id": "n",
  7687  			"avatar_url": "a",
  7688  			"url": "u",
  7689  			"events_url": "e",
  7690  			"repos_url": "r"
  7691  		},
  7692  		"installation": {
  7693  			"id": 1,
  7694  			"node_id": "nid",
  7695  			"app_id": 1,
  7696  			"app_slug": "as",
  7697  			"target_id": 1,
  7698  			"account": {
  7699  				"login": "l",
  7700  				"id": 1,
  7701  				"avatar_url": "a",
  7702  				"gravatar_id": "g",
  7703  				"name": "n",
  7704  				"company": "c",
  7705  				"blog": "b",
  7706  				"location": "l",
  7707  				"email": "e",
  7708  				"hireable": true,
  7709  				"bio": "b",
  7710  				"twitter_username": "t",
  7711  				"public_repos": 1,
  7712  				"followers": 1,
  7713  				"following": 1,
  7714  				"created_at": ` + referenceTimeStr + `,
  7715  				"suspended_at": ` + referenceTimeStr + `,
  7716  				"url": "u"
  7717  			},
  7718  			"access_tokens_url": "atu",
  7719  			"repositories_url": "ru",
  7720  			"html_url": "hu",
  7721  			"target_type": "tt",
  7722  			"single_file_name": "sfn",
  7723  			"repository_selection": "rs",
  7724  			"events": [
  7725  				"e"
  7726  			],
  7727  			"single_file_paths": [
  7728  				"s"
  7729  			],
  7730  			"permissions": {
  7731  				"actions": "a",
  7732  				"administration": "ad",
  7733  				"checks": "c",
  7734  				"contents": "co",
  7735  				"content_references": "cr",
  7736  				"deployments": "d",
  7737  				"environments": "e",
  7738  				"issues": "i",
  7739  				"metadata": "md",
  7740  				"members": "m",
  7741  				"organization_administration": "oa",
  7742  				"organization_hooks": "oh",
  7743  				"organization_plan": "op",
  7744  				"organization_pre_receive_hooks": "opr",
  7745  				"organization_projects": "op",
  7746  				"organization_secrets": "os",
  7747  				"organization_self_hosted_runners": "osh",
  7748  				"organization_user_blocking": "oub",
  7749  				"packages": "pkg",
  7750  				"pages": "pg",
  7751  				"pull_requests": "pr",
  7752  				"repository_hooks": "rh",
  7753  				"repository_projects": "rp",
  7754  				"repository_pre_receive_hooks": "rprh",
  7755  				"secrets": "s",
  7756  				"secret_scanning_alerts": "ssa",
  7757  				"security_events": "se",
  7758  				"single_file": "sf",
  7759  				"statuses": "s",
  7760  				"team_discussions": "td",
  7761  				"vulnerability_alerts": "va",
  7762  				"workflows": "w"
  7763  			},
  7764  			"created_at": ` + referenceTimeStr + `,
  7765  			"updated_at": ` + referenceTimeStr + `,
  7766  			"has_multiple_single_files": false,
  7767  			"suspended_by": {
  7768  				"login": "l",
  7769  				"id": 1,
  7770  				"avatar_url": "a",
  7771  				"gravatar_id": "g",
  7772  				"name": "n",
  7773  				"company": "c",
  7774  				"blog": "b",
  7775  				"location": "l",
  7776  				"email": "e",
  7777  				"hireable": true,
  7778  				"bio": "b",
  7779  				"twitter_username": "t",
  7780  				"public_repos": 1,
  7781  				"followers": 1,
  7782  				"following": 1,
  7783  				"created_at": ` + referenceTimeStr + `,
  7784  				"suspended_at": ` + referenceTimeStr + `,
  7785  				"url": "u"
  7786  			},
  7787  			"suspended_at": ` + referenceTimeStr + `
  7788  		}
  7789  	}`
  7790  
  7791  	testJSONMarshal(t, u, want)
  7792  }
  7793  
  7794  func TestContentReferenceEvent_Marshal(t *testing.T) {
  7795  	testJSONMarshal(t, &ContentReferenceEvent{}, "{}")
  7796  
  7797  	u := &ContentReferenceEvent{
  7798  		Action: String("a"),
  7799  		ContentReference: &ContentReference{
  7800  			ID:        Int64(1),
  7801  			NodeID:    String("nid"),
  7802  			Reference: String("ref"),
  7803  		},
  7804  		Repo: &Repository{
  7805  			ID:   Int64(1),
  7806  			URL:  String("s"),
  7807  			Name: String("n"),
  7808  		},
  7809  		Sender: &User{
  7810  			Login:     String("l"),
  7811  			ID:        Int64(1),
  7812  			NodeID:    String("n"),
  7813  			URL:       String("u"),
  7814  			ReposURL:  String("r"),
  7815  			EventsURL: String("e"),
  7816  			AvatarURL: String("a"),
  7817  		},
  7818  		Installation: &Installation{
  7819  			ID:       Int64(1),
  7820  			NodeID:   String("nid"),
  7821  			AppID:    Int64(1),
  7822  			AppSlug:  String("as"),
  7823  			TargetID: Int64(1),
  7824  			Account: &User{
  7825  				Login:           String("l"),
  7826  				ID:              Int64(1),
  7827  				URL:             String("u"),
  7828  				AvatarURL:       String("a"),
  7829  				GravatarID:      String("g"),
  7830  				Name:            String("n"),
  7831  				Company:         String("c"),
  7832  				Blog:            String("b"),
  7833  				Location:        String("l"),
  7834  				Email:           String("e"),
  7835  				Hireable:        Bool(true),
  7836  				Bio:             String("b"),
  7837  				TwitterUsername: String("t"),
  7838  				PublicRepos:     Int(1),
  7839  				Followers:       Int(1),
  7840  				Following:       Int(1),
  7841  				CreatedAt:       &Timestamp{referenceTime},
  7842  				SuspendedAt:     &Timestamp{referenceTime},
  7843  			},
  7844  			AccessTokensURL:     String("atu"),
  7845  			RepositoriesURL:     String("ru"),
  7846  			HTMLURL:             String("hu"),
  7847  			TargetType:          String("tt"),
  7848  			SingleFileName:      String("sfn"),
  7849  			RepositorySelection: String("rs"),
  7850  			Events:              []string{"e"},
  7851  			SingleFilePaths:     []string{"s"},
  7852  			Permissions: &InstallationPermissions{
  7853  				Actions:                       String("a"),
  7854  				Administration:                String("ad"),
  7855  				Checks:                        String("c"),
  7856  				Contents:                      String("co"),
  7857  				ContentReferences:             String("cr"),
  7858  				Deployments:                   String("d"),
  7859  				Environments:                  String("e"),
  7860  				Issues:                        String("i"),
  7861  				Metadata:                      String("md"),
  7862  				Members:                       String("m"),
  7863  				OrganizationAdministration:    String("oa"),
  7864  				OrganizationHooks:             String("oh"),
  7865  				OrganizationPlan:              String("op"),
  7866  				OrganizationPreReceiveHooks:   String("opr"),
  7867  				OrganizationProjects:          String("op"),
  7868  				OrganizationSecrets:           String("os"),
  7869  				OrganizationSelfHostedRunners: String("osh"),
  7870  				OrganizationUserBlocking:      String("oub"),
  7871  				Packages:                      String("pkg"),
  7872  				Pages:                         String("pg"),
  7873  				PullRequests:                  String("pr"),
  7874  				RepositoryHooks:               String("rh"),
  7875  				RepositoryProjects:            String("rp"),
  7876  				RepositoryPreReceiveHooks:     String("rprh"),
  7877  				Secrets:                       String("s"),
  7878  				SecretScanningAlerts:          String("ssa"),
  7879  				SecurityEvents:                String("se"),
  7880  				SingleFile:                    String("sf"),
  7881  				Statuses:                      String("s"),
  7882  				TeamDiscussions:               String("td"),
  7883  				VulnerabilityAlerts:           String("va"),
  7884  				Workflows:                     String("w"),
  7885  			},
  7886  			CreatedAt:              &Timestamp{referenceTime},
  7887  			UpdatedAt:              &Timestamp{referenceTime},
  7888  			HasMultipleSingleFiles: Bool(false),
  7889  			SuspendedBy: &User{
  7890  				Login:           String("l"),
  7891  				ID:              Int64(1),
  7892  				URL:             String("u"),
  7893  				AvatarURL:       String("a"),
  7894  				GravatarID:      String("g"),
  7895  				Name:            String("n"),
  7896  				Company:         String("c"),
  7897  				Blog:            String("b"),
  7898  				Location:        String("l"),
  7899  				Email:           String("e"),
  7900  				Hireable:        Bool(true),
  7901  				Bio:             String("b"),
  7902  				TwitterUsername: String("t"),
  7903  				PublicRepos:     Int(1),
  7904  				Followers:       Int(1),
  7905  				Following:       Int(1),
  7906  				CreatedAt:       &Timestamp{referenceTime},
  7907  				SuspendedAt:     &Timestamp{referenceTime},
  7908  			},
  7909  			SuspendedAt: &Timestamp{referenceTime},
  7910  		},
  7911  	}
  7912  
  7913  	want := `{
  7914  		"action": "a",
  7915  		"content_reference": {
  7916  			"id": 1,
  7917  			"node_id": "nid",
  7918  			"reference": "ref"
  7919  		},
  7920  		"repository": {
  7921  			"id": 1,
  7922  			"name": "n",
  7923  			"url": "s"
  7924  		},
  7925  		"sender": {
  7926  			"login": "l",
  7927  			"id": 1,
  7928  			"node_id": "n",
  7929  			"avatar_url": "a",
  7930  			"url": "u",
  7931  			"events_url": "e",
  7932  			"repos_url": "r"
  7933  		},
  7934  		"installation": {
  7935  			"id": 1,
  7936  			"node_id": "nid",
  7937  			"app_id": 1,
  7938  			"app_slug": "as",
  7939  			"target_id": 1,
  7940  			"account": {
  7941  				"login": "l",
  7942  				"id": 1,
  7943  				"avatar_url": "a",
  7944  				"gravatar_id": "g",
  7945  				"name": "n",
  7946  				"company": "c",
  7947  				"blog": "b",
  7948  				"location": "l",
  7949  				"email": "e",
  7950  				"hireable": true,
  7951  				"bio": "b",
  7952  				"twitter_username": "t",
  7953  				"public_repos": 1,
  7954  				"followers": 1,
  7955  				"following": 1,
  7956  				"created_at": ` + referenceTimeStr + `,
  7957  				"suspended_at": ` + referenceTimeStr + `,
  7958  				"url": "u"
  7959  			},
  7960  			"access_tokens_url": "atu",
  7961  			"repositories_url": "ru",
  7962  			"html_url": "hu",
  7963  			"target_type": "tt",
  7964  			"single_file_name": "sfn",
  7965  			"repository_selection": "rs",
  7966  			"events": [
  7967  				"e"
  7968  			],
  7969  			"single_file_paths": [
  7970  				"s"
  7971  			],
  7972  			"permissions": {
  7973  				"actions": "a",
  7974  				"administration": "ad",
  7975  				"checks": "c",
  7976  				"contents": "co",
  7977  				"content_references": "cr",
  7978  				"deployments": "d",
  7979  				"environments": "e",
  7980  				"issues": "i",
  7981  				"metadata": "md",
  7982  				"members": "m",
  7983  				"organization_administration": "oa",
  7984  				"organization_hooks": "oh",
  7985  				"organization_plan": "op",
  7986  				"organization_pre_receive_hooks": "opr",
  7987  				"organization_projects": "op",
  7988  				"organization_secrets": "os",
  7989  				"organization_self_hosted_runners": "osh",
  7990  				"organization_user_blocking": "oub",
  7991  				"packages": "pkg",
  7992  				"pages": "pg",
  7993  				"pull_requests": "pr",
  7994  				"repository_hooks": "rh",
  7995  				"repository_projects": "rp",
  7996  				"repository_pre_receive_hooks": "rprh",
  7997  				"secrets": "s",
  7998  				"secret_scanning_alerts": "ssa",
  7999  				"security_events": "se",
  8000  				"single_file": "sf",
  8001  				"statuses": "s",
  8002  				"team_discussions": "td",
  8003  				"vulnerability_alerts": "va",
  8004  				"workflows": "w"
  8005  			},
  8006  			"created_at": ` + referenceTimeStr + `,
  8007  			"updated_at": ` + referenceTimeStr + `,
  8008  			"has_multiple_single_files": false,
  8009  			"suspended_by": {
  8010  				"login": "l",
  8011  				"id": 1,
  8012  				"avatar_url": "a",
  8013  				"gravatar_id": "g",
  8014  				"name": "n",
  8015  				"company": "c",
  8016  				"blog": "b",
  8017  				"location": "l",
  8018  				"email": "e",
  8019  				"hireable": true,
  8020  				"bio": "b",
  8021  				"twitter_username": "t",
  8022  				"public_repos": 1,
  8023  				"followers": 1,
  8024  				"following": 1,
  8025  				"created_at": ` + referenceTimeStr + `,
  8026  				"suspended_at": ` + referenceTimeStr + `,
  8027  				"url": "u"
  8028  			},
  8029  			"suspended_at": ` + referenceTimeStr + `
  8030  		}
  8031  	}`
  8032  
  8033  	testJSONMarshal(t, u, want)
  8034  }
  8035  
  8036  func TestMemberEvent_Marshal(t *testing.T) {
  8037  	testJSONMarshal(t, &MemberEvent{}, "{}")
  8038  
  8039  	u := &MemberEvent{
  8040  		Action: String("a"),
  8041  		Member: &User{
  8042  			Login:     String("l"),
  8043  			ID:        Int64(1),
  8044  			NodeID:    String("n"),
  8045  			URL:       String("u"),
  8046  			ReposURL:  String("r"),
  8047  			EventsURL: String("e"),
  8048  			AvatarURL: String("a"),
  8049  		},
  8050  		Repo: &Repository{
  8051  			ID:   Int64(1),
  8052  			URL:  String("s"),
  8053  			Name: String("n"),
  8054  		},
  8055  		Sender: &User{
  8056  			Login:     String("l"),
  8057  			ID:        Int64(1),
  8058  			NodeID:    String("n"),
  8059  			URL:       String("u"),
  8060  			ReposURL:  String("r"),
  8061  			EventsURL: String("e"),
  8062  			AvatarURL: String("a"),
  8063  		},
  8064  		Installation: &Installation{
  8065  			ID:       Int64(1),
  8066  			NodeID:   String("nid"),
  8067  			AppID:    Int64(1),
  8068  			AppSlug:  String("as"),
  8069  			TargetID: Int64(1),
  8070  			Account: &User{
  8071  				Login:           String("l"),
  8072  				ID:              Int64(1),
  8073  				URL:             String("u"),
  8074  				AvatarURL:       String("a"),
  8075  				GravatarID:      String("g"),
  8076  				Name:            String("n"),
  8077  				Company:         String("c"),
  8078  				Blog:            String("b"),
  8079  				Location:        String("l"),
  8080  				Email:           String("e"),
  8081  				Hireable:        Bool(true),
  8082  				Bio:             String("b"),
  8083  				TwitterUsername: String("t"),
  8084  				PublicRepos:     Int(1),
  8085  				Followers:       Int(1),
  8086  				Following:       Int(1),
  8087  				CreatedAt:       &Timestamp{referenceTime},
  8088  				SuspendedAt:     &Timestamp{referenceTime},
  8089  			},
  8090  			AccessTokensURL:     String("atu"),
  8091  			RepositoriesURL:     String("ru"),
  8092  			HTMLURL:             String("hu"),
  8093  			TargetType:          String("tt"),
  8094  			SingleFileName:      String("sfn"),
  8095  			RepositorySelection: String("rs"),
  8096  			Events:              []string{"e"},
  8097  			SingleFilePaths:     []string{"s"},
  8098  			Permissions: &InstallationPermissions{
  8099  				Actions:                       String("a"),
  8100  				Administration:                String("ad"),
  8101  				Checks:                        String("c"),
  8102  				Contents:                      String("co"),
  8103  				ContentReferences:             String("cr"),
  8104  				Deployments:                   String("d"),
  8105  				Environments:                  String("e"),
  8106  				Issues:                        String("i"),
  8107  				Metadata:                      String("md"),
  8108  				Members:                       String("m"),
  8109  				OrganizationAdministration:    String("oa"),
  8110  				OrganizationHooks:             String("oh"),
  8111  				OrganizationPlan:              String("op"),
  8112  				OrganizationPreReceiveHooks:   String("opr"),
  8113  				OrganizationProjects:          String("op"),
  8114  				OrganizationSecrets:           String("os"),
  8115  				OrganizationSelfHostedRunners: String("osh"),
  8116  				OrganizationUserBlocking:      String("oub"),
  8117  				Packages:                      String("pkg"),
  8118  				Pages:                         String("pg"),
  8119  				PullRequests:                  String("pr"),
  8120  				RepositoryHooks:               String("rh"),
  8121  				RepositoryProjects:            String("rp"),
  8122  				RepositoryPreReceiveHooks:     String("rprh"),
  8123  				Secrets:                       String("s"),
  8124  				SecretScanningAlerts:          String("ssa"),
  8125  				SecurityEvents:                String("se"),
  8126  				SingleFile:                    String("sf"),
  8127  				Statuses:                      String("s"),
  8128  				TeamDiscussions:               String("td"),
  8129  				VulnerabilityAlerts:           String("va"),
  8130  				Workflows:                     String("w"),
  8131  			},
  8132  			CreatedAt:              &Timestamp{referenceTime},
  8133  			UpdatedAt:              &Timestamp{referenceTime},
  8134  			HasMultipleSingleFiles: Bool(false),
  8135  			SuspendedBy: &User{
  8136  				Login:           String("l"),
  8137  				ID:              Int64(1),
  8138  				URL:             String("u"),
  8139  				AvatarURL:       String("a"),
  8140  				GravatarID:      String("g"),
  8141  				Name:            String("n"),
  8142  				Company:         String("c"),
  8143  				Blog:            String("b"),
  8144  				Location:        String("l"),
  8145  				Email:           String("e"),
  8146  				Hireable:        Bool(true),
  8147  				Bio:             String("b"),
  8148  				TwitterUsername: String("t"),
  8149  				PublicRepos:     Int(1),
  8150  				Followers:       Int(1),
  8151  				Following:       Int(1),
  8152  				CreatedAt:       &Timestamp{referenceTime},
  8153  				SuspendedAt:     &Timestamp{referenceTime},
  8154  			},
  8155  			SuspendedAt: &Timestamp{referenceTime},
  8156  		},
  8157  	}
  8158  
  8159  	want := `{
  8160  		"action": "a",
  8161  		"member": {
  8162  			"login": "l",
  8163  			"id": 1,
  8164  			"node_id": "n",
  8165  			"avatar_url": "a",
  8166  			"url": "u",
  8167  			"events_url": "e",
  8168  			"repos_url": "r"
  8169  		},
  8170  		"repository": {
  8171  			"id": 1,
  8172  			"name": "n",
  8173  			"url": "s"
  8174  		},
  8175  		"sender": {
  8176  			"login": "l",
  8177  			"id": 1,
  8178  			"node_id": "n",
  8179  			"avatar_url": "a",
  8180  			"url": "u",
  8181  			"events_url": "e",
  8182  			"repos_url": "r"
  8183  		},
  8184  		"installation": {
  8185  			"id": 1,
  8186  			"node_id": "nid",
  8187  			"app_id": 1,
  8188  			"app_slug": "as",
  8189  			"target_id": 1,
  8190  			"account": {
  8191  				"login": "l",
  8192  				"id": 1,
  8193  				"avatar_url": "a",
  8194  				"gravatar_id": "g",
  8195  				"name": "n",
  8196  				"company": "c",
  8197  				"blog": "b",
  8198  				"location": "l",
  8199  				"email": "e",
  8200  				"hireable": true,
  8201  				"bio": "b",
  8202  				"twitter_username": "t",
  8203  				"public_repos": 1,
  8204  				"followers": 1,
  8205  				"following": 1,
  8206  				"created_at": ` + referenceTimeStr + `,
  8207  				"suspended_at": ` + referenceTimeStr + `,
  8208  				"url": "u"
  8209  			},
  8210  			"access_tokens_url": "atu",
  8211  			"repositories_url": "ru",
  8212  			"html_url": "hu",
  8213  			"target_type": "tt",
  8214  			"single_file_name": "sfn",
  8215  			"repository_selection": "rs",
  8216  			"events": [
  8217  				"e"
  8218  			],
  8219  			"single_file_paths": [
  8220  				"s"
  8221  			],
  8222  			"permissions": {
  8223  				"actions": "a",
  8224  				"administration": "ad",
  8225  				"checks": "c",
  8226  				"contents": "co",
  8227  				"content_references": "cr",
  8228  				"deployments": "d",
  8229  				"environments": "e",
  8230  				"issues": "i",
  8231  				"metadata": "md",
  8232  				"members": "m",
  8233  				"organization_administration": "oa",
  8234  				"organization_hooks": "oh",
  8235  				"organization_plan": "op",
  8236  				"organization_pre_receive_hooks": "opr",
  8237  				"organization_projects": "op",
  8238  				"organization_secrets": "os",
  8239  				"organization_self_hosted_runners": "osh",
  8240  				"organization_user_blocking": "oub",
  8241  				"packages": "pkg",
  8242  				"pages": "pg",
  8243  				"pull_requests": "pr",
  8244  				"repository_hooks": "rh",
  8245  				"repository_projects": "rp",
  8246  				"repository_pre_receive_hooks": "rprh",
  8247  				"secrets": "s",
  8248  				"secret_scanning_alerts": "ssa",
  8249  				"security_events": "se",
  8250  				"single_file": "sf",
  8251  				"statuses": "s",
  8252  				"team_discussions": "td",
  8253  				"vulnerability_alerts": "va",
  8254  				"workflows": "w"
  8255  			},
  8256  			"created_at": ` + referenceTimeStr + `,
  8257  			"updated_at": ` + referenceTimeStr + `,
  8258  			"has_multiple_single_files": false,
  8259  			"suspended_by": {
  8260  				"login": "l",
  8261  				"id": 1,
  8262  				"avatar_url": "a",
  8263  				"gravatar_id": "g",
  8264  				"name": "n",
  8265  				"company": "c",
  8266  				"blog": "b",
  8267  				"location": "l",
  8268  				"email": "e",
  8269  				"hireable": true,
  8270  				"bio": "b",
  8271  				"twitter_username": "t",
  8272  				"public_repos": 1,
  8273  				"followers": 1,
  8274  				"following": 1,
  8275  				"created_at": ` + referenceTimeStr + `,
  8276  				"suspended_at": ` + referenceTimeStr + `,
  8277  				"url": "u"
  8278  			},
  8279  			"suspended_at": ` + referenceTimeStr + `
  8280  		}
  8281  	}`
  8282  
  8283  	testJSONMarshal(t, u, want)
  8284  }
  8285  
  8286  func TestMembershipEvent_Marshal(t *testing.T) {
  8287  	testJSONMarshal(t, &MembershipEvent{}, "{}")
  8288  
  8289  	u := &MembershipEvent{
  8290  		Action: String("a"),
  8291  		Scope:  String("s"),
  8292  		Member: &User{
  8293  			Login:     String("l"),
  8294  			ID:        Int64(1),
  8295  			NodeID:    String("n"),
  8296  			URL:       String("u"),
  8297  			ReposURL:  String("r"),
  8298  			EventsURL: String("e"),
  8299  			AvatarURL: String("a"),
  8300  		},
  8301  		Team: &Team{
  8302  			ID:              Int64(1),
  8303  			NodeID:          String("n"),
  8304  			Name:            String("n"),
  8305  			Description:     String("d"),
  8306  			URL:             String("u"),
  8307  			Slug:            String("s"),
  8308  			Permission:      String("p"),
  8309  			Privacy:         String("p"),
  8310  			MembersCount:    Int(1),
  8311  			ReposCount:      Int(1),
  8312  			MembersURL:      String("m"),
  8313  			RepositoriesURL: String("r"),
  8314  			Organization: &Organization{
  8315  				Login:     String("l"),
  8316  				ID:        Int64(1),
  8317  				NodeID:    String("n"),
  8318  				AvatarURL: String("a"),
  8319  				HTMLURL:   String("h"),
  8320  				Name:      String("n"),
  8321  				Company:   String("c"),
  8322  				Blog:      String("b"),
  8323  				Location:  String("l"),
  8324  				Email:     String("e"),
  8325  			},
  8326  			Parent: &Team{
  8327  				ID:           Int64(1),
  8328  				NodeID:       String("n"),
  8329  				Name:         String("n"),
  8330  				Description:  String("d"),
  8331  				URL:          String("u"),
  8332  				Slug:         String("s"),
  8333  				Permission:   String("p"),
  8334  				Privacy:      String("p"),
  8335  				MembersCount: Int(1),
  8336  				ReposCount:   Int(1),
  8337  			},
  8338  			LDAPDN: String("l"),
  8339  		},
  8340  		Org: &Organization{
  8341  			BillingEmail:                         String("be"),
  8342  			Blog:                                 String("b"),
  8343  			Company:                              String("c"),
  8344  			Email:                                String("e"),
  8345  			TwitterUsername:                      String("tu"),
  8346  			Location:                             String("loc"),
  8347  			Name:                                 String("n"),
  8348  			Description:                          String("d"),
  8349  			IsVerified:                           Bool(true),
  8350  			HasOrganizationProjects:              Bool(true),
  8351  			HasRepositoryProjects:                Bool(true),
  8352  			DefaultRepoPermission:                String("drp"),
  8353  			MembersCanCreateRepos:                Bool(true),
  8354  			MembersCanCreateInternalRepos:        Bool(true),
  8355  			MembersCanCreatePrivateRepos:         Bool(true),
  8356  			MembersCanCreatePublicRepos:          Bool(false),
  8357  			MembersAllowedRepositoryCreationType: String("marct"),
  8358  			MembersCanCreatePages:                Bool(true),
  8359  			MembersCanCreatePublicPages:          Bool(false),
  8360  			MembersCanCreatePrivatePages:         Bool(true),
  8361  		},
  8362  		Sender: &User{
  8363  			Login:     String("l"),
  8364  			ID:        Int64(1),
  8365  			NodeID:    String("n"),
  8366  			URL:       String("u"),
  8367  			ReposURL:  String("r"),
  8368  			EventsURL: String("e"),
  8369  			AvatarURL: String("a"),
  8370  		},
  8371  		Installation: &Installation{
  8372  			ID:       Int64(1),
  8373  			NodeID:   String("nid"),
  8374  			AppID:    Int64(1),
  8375  			AppSlug:  String("as"),
  8376  			TargetID: Int64(1),
  8377  			Account: &User{
  8378  				Login:           String("l"),
  8379  				ID:              Int64(1),
  8380  				URL:             String("u"),
  8381  				AvatarURL:       String("a"),
  8382  				GravatarID:      String("g"),
  8383  				Name:            String("n"),
  8384  				Company:         String("c"),
  8385  				Blog:            String("b"),
  8386  				Location:        String("l"),
  8387  				Email:           String("e"),
  8388  				Hireable:        Bool(true),
  8389  				Bio:             String("b"),
  8390  				TwitterUsername: String("t"),
  8391  				PublicRepos:     Int(1),
  8392  				Followers:       Int(1),
  8393  				Following:       Int(1),
  8394  				CreatedAt:       &Timestamp{referenceTime},
  8395  				SuspendedAt:     &Timestamp{referenceTime},
  8396  			},
  8397  			AccessTokensURL:     String("atu"),
  8398  			RepositoriesURL:     String("ru"),
  8399  			HTMLURL:             String("hu"),
  8400  			TargetType:          String("tt"),
  8401  			SingleFileName:      String("sfn"),
  8402  			RepositorySelection: String("rs"),
  8403  			Events:              []string{"e"},
  8404  			SingleFilePaths:     []string{"s"},
  8405  			Permissions: &InstallationPermissions{
  8406  				Actions:                       String("a"),
  8407  				Administration:                String("ad"),
  8408  				Checks:                        String("c"),
  8409  				Contents:                      String("co"),
  8410  				ContentReferences:             String("cr"),
  8411  				Deployments:                   String("d"),
  8412  				Environments:                  String("e"),
  8413  				Issues:                        String("i"),
  8414  				Metadata:                      String("md"),
  8415  				Members:                       String("m"),
  8416  				OrganizationAdministration:    String("oa"),
  8417  				OrganizationHooks:             String("oh"),
  8418  				OrganizationPlan:              String("op"),
  8419  				OrganizationPreReceiveHooks:   String("opr"),
  8420  				OrganizationProjects:          String("op"),
  8421  				OrganizationSecrets:           String("os"),
  8422  				OrganizationSelfHostedRunners: String("osh"),
  8423  				OrganizationUserBlocking:      String("oub"),
  8424  				Packages:                      String("pkg"),
  8425  				Pages:                         String("pg"),
  8426  				PullRequests:                  String("pr"),
  8427  				RepositoryHooks:               String("rh"),
  8428  				RepositoryProjects:            String("rp"),
  8429  				RepositoryPreReceiveHooks:     String("rprh"),
  8430  				Secrets:                       String("s"),
  8431  				SecretScanningAlerts:          String("ssa"),
  8432  				SecurityEvents:                String("se"),
  8433  				SingleFile:                    String("sf"),
  8434  				Statuses:                      String("s"),
  8435  				TeamDiscussions:               String("td"),
  8436  				VulnerabilityAlerts:           String("va"),
  8437  				Workflows:                     String("w"),
  8438  			},
  8439  			CreatedAt:              &Timestamp{referenceTime},
  8440  			UpdatedAt:              &Timestamp{referenceTime},
  8441  			HasMultipleSingleFiles: Bool(false),
  8442  			SuspendedBy: &User{
  8443  				Login:           String("l"),
  8444  				ID:              Int64(1),
  8445  				URL:             String("u"),
  8446  				AvatarURL:       String("a"),
  8447  				GravatarID:      String("g"),
  8448  				Name:            String("n"),
  8449  				Company:         String("c"),
  8450  				Blog:            String("b"),
  8451  				Location:        String("l"),
  8452  				Email:           String("e"),
  8453  				Hireable:        Bool(true),
  8454  				Bio:             String("b"),
  8455  				TwitterUsername: String("t"),
  8456  				PublicRepos:     Int(1),
  8457  				Followers:       Int(1),
  8458  				Following:       Int(1),
  8459  				CreatedAt:       &Timestamp{referenceTime},
  8460  				SuspendedAt:     &Timestamp{referenceTime},
  8461  			},
  8462  			SuspendedAt: &Timestamp{referenceTime},
  8463  		},
  8464  	}
  8465  
  8466  	want := `{
  8467  		"action": "a",
  8468  		"scope": "s",
  8469  		"member": {
  8470  			"login": "l",
  8471  			"id": 1,
  8472  			"node_id": "n",
  8473  			"avatar_url": "a",
  8474  			"url": "u",
  8475  			"events_url": "e",
  8476  			"repos_url": "r"
  8477  		},
  8478  		"team": {
  8479  			"id": 1,
  8480  			"node_id": "n",
  8481  			"name": "n",
  8482  			"description": "d",
  8483  			"url": "u",
  8484  			"slug": "s",
  8485  			"permission": "p",
  8486  			"privacy": "p",
  8487  			"members_count": 1,
  8488  			"repos_count": 1,
  8489  			"organization": {
  8490  				"login": "l",
  8491  				"id": 1,
  8492  				"node_id": "n",
  8493  				"avatar_url": "a",
  8494  				"html_url": "h",
  8495  				"name": "n",
  8496  				"company": "c",
  8497  				"blog": "b",
  8498  				"location": "l",
  8499  				"email": "e"
  8500  			},
  8501  			"members_url": "m",
  8502  			"repositories_url": "r",
  8503  			"parent": {
  8504  				"id": 1,
  8505  				"node_id": "n",
  8506  				"name": "n",
  8507  				"description": "d",
  8508  				"url": "u",
  8509  				"slug": "s",
  8510  				"permission": "p",
  8511  				"privacy": "p",
  8512  				"members_count": 1,
  8513  				"repos_count": 1
  8514  			},
  8515  			"ldap_dn": "l"
  8516  		},
  8517  		"organization": {
  8518  			"name": "n",
  8519  			"company": "c",
  8520  			"blog": "b",
  8521  			"location": "loc",
  8522  			"email": "e",
  8523  			"twitter_username": "tu",
  8524  			"description": "d",
  8525  			"billing_email": "be",
  8526  			"is_verified": true,
  8527  			"has_organization_projects": true,
  8528  			"has_repository_projects": true,
  8529  			"default_repository_permission": "drp",
  8530  			"members_can_create_repositories": true,
  8531  			"members_can_create_public_repositories": false,
  8532  			"members_can_create_private_repositories": true,
  8533  			"members_can_create_internal_repositories": true,
  8534  			"members_allowed_repository_creation_type": "marct",
  8535  			"members_can_create_pages": true,
  8536  			"members_can_create_public_pages": false,
  8537  			"members_can_create_private_pages": true
  8538  		},
  8539  		"sender": {
  8540  			"login": "l",
  8541  			"id": 1,
  8542  			"node_id": "n",
  8543  			"avatar_url": "a",
  8544  			"url": "u",
  8545  			"events_url": "e",
  8546  			"repos_url": "r"
  8547  		},
  8548  		"installation": {
  8549  			"id": 1,
  8550  			"node_id": "nid",
  8551  			"app_id": 1,
  8552  			"app_slug": "as",
  8553  			"target_id": 1,
  8554  			"account": {
  8555  				"login": "l",
  8556  				"id": 1,
  8557  				"avatar_url": "a",
  8558  				"gravatar_id": "g",
  8559  				"name": "n",
  8560  				"company": "c",
  8561  				"blog": "b",
  8562  				"location": "l",
  8563  				"email": "e",
  8564  				"hireable": true,
  8565  				"bio": "b",
  8566  				"twitter_username": "t",
  8567  				"public_repos": 1,
  8568  				"followers": 1,
  8569  				"following": 1,
  8570  				"created_at": ` + referenceTimeStr + `,
  8571  				"suspended_at": ` + referenceTimeStr + `,
  8572  				"url": "u"
  8573  			},
  8574  			"access_tokens_url": "atu",
  8575  			"repositories_url": "ru",
  8576  			"html_url": "hu",
  8577  			"target_type": "tt",
  8578  			"single_file_name": "sfn",
  8579  			"repository_selection": "rs",
  8580  			"events": [
  8581  				"e"
  8582  			],
  8583  			"single_file_paths": [
  8584  				"s"
  8585  			],
  8586  			"permissions": {
  8587  				"actions": "a",
  8588  				"administration": "ad",
  8589  				"checks": "c",
  8590  				"contents": "co",
  8591  				"content_references": "cr",
  8592  				"deployments": "d",
  8593  				"environments": "e",
  8594  				"issues": "i",
  8595  				"metadata": "md",
  8596  				"members": "m",
  8597  				"organization_administration": "oa",
  8598  				"organization_hooks": "oh",
  8599  				"organization_plan": "op",
  8600  				"organization_pre_receive_hooks": "opr",
  8601  				"organization_projects": "op",
  8602  				"organization_secrets": "os",
  8603  				"organization_self_hosted_runners": "osh",
  8604  				"organization_user_blocking": "oub",
  8605  				"packages": "pkg",
  8606  				"pages": "pg",
  8607  				"pull_requests": "pr",
  8608  				"repository_hooks": "rh",
  8609  				"repository_projects": "rp",
  8610  				"repository_pre_receive_hooks": "rprh",
  8611  				"secrets": "s",
  8612  				"secret_scanning_alerts": "ssa",
  8613  				"security_events": "se",
  8614  				"single_file": "sf",
  8615  				"statuses": "s",
  8616  				"team_discussions": "td",
  8617  				"vulnerability_alerts": "va",
  8618  				"workflows": "w"
  8619  			},
  8620  			"created_at": ` + referenceTimeStr + `,
  8621  			"updated_at": ` + referenceTimeStr + `,
  8622  			"has_multiple_single_files": false,
  8623  			"suspended_by": {
  8624  				"login": "l",
  8625  				"id": 1,
  8626  				"avatar_url": "a",
  8627  				"gravatar_id": "g",
  8628  				"name": "n",
  8629  				"company": "c",
  8630  				"blog": "b",
  8631  				"location": "l",
  8632  				"email": "e",
  8633  				"hireable": true,
  8634  				"bio": "b",
  8635  				"twitter_username": "t",
  8636  				"public_repos": 1,
  8637  				"followers": 1,
  8638  				"following": 1,
  8639  				"created_at": ` + referenceTimeStr + `,
  8640  				"suspended_at": ` + referenceTimeStr + `,
  8641  				"url": "u"
  8642  			},
  8643  			"suspended_at": ` + referenceTimeStr + `
  8644  		}
  8645  	}`
  8646  
  8647  	testJSONMarshal(t, u, want)
  8648  }
  8649  
  8650  func TestMergeGroupEvent_Marshal(t *testing.T) {
  8651  	testJSONMarshal(t, &MergeGroupEvent{}, "{}")
  8652  
  8653  	u := &MergeGroupEvent{
  8654  		Action: String("a"),
  8655  		MergeGroup: &MergeGroup{
  8656  			HeadSHA:    String("hs"),
  8657  			HeadRef:    String("hr"),
  8658  			BaseSHA:    String("bs"),
  8659  			BaseRef:    String("br"),
  8660  			HeadCommit: &Commit{NodeID: String("nid")},
  8661  		},
  8662  		Repo: &Repository{
  8663  			ID:   Int64(1),
  8664  			URL:  String("s"),
  8665  			Name: String("n"),
  8666  		},
  8667  		Org: &Organization{
  8668  			BillingEmail:                         String("be"),
  8669  			Blog:                                 String("b"),
  8670  			Company:                              String("c"),
  8671  			Email:                                String("e"),
  8672  			TwitterUsername:                      String("tu"),
  8673  			Location:                             String("loc"),
  8674  			Name:                                 String("n"),
  8675  			Description:                          String("d"),
  8676  			IsVerified:                           Bool(true),
  8677  			HasOrganizationProjects:              Bool(true),
  8678  			HasRepositoryProjects:                Bool(true),
  8679  			DefaultRepoPermission:                String("drp"),
  8680  			MembersCanCreateRepos:                Bool(true),
  8681  			MembersCanCreateInternalRepos:        Bool(true),
  8682  			MembersCanCreatePrivateRepos:         Bool(true),
  8683  			MembersCanCreatePublicRepos:          Bool(false),
  8684  			MembersAllowedRepositoryCreationType: String("marct"),
  8685  			MembersCanCreatePages:                Bool(true),
  8686  			MembersCanCreatePublicPages:          Bool(false),
  8687  			MembersCanCreatePrivatePages:         Bool(true),
  8688  		},
  8689  		Sender: &User{
  8690  			Login:     String("l"),
  8691  			ID:        Int64(1),
  8692  			NodeID:    String("n"),
  8693  			URL:       String("u"),
  8694  			ReposURL:  String("r"),
  8695  			EventsURL: String("e"),
  8696  			AvatarURL: String("a"),
  8697  		},
  8698  		Installation: &Installation{
  8699  			ID:       Int64(1),
  8700  			NodeID:   String("nid"),
  8701  			AppID:    Int64(1),
  8702  			AppSlug:  String("as"),
  8703  			TargetID: Int64(1),
  8704  			Account: &User{
  8705  				Login:           String("l"),
  8706  				ID:              Int64(1),
  8707  				URL:             String("u"),
  8708  				AvatarURL:       String("a"),
  8709  				GravatarID:      String("g"),
  8710  				Name:            String("n"),
  8711  				Company:         String("c"),
  8712  				Blog:            String("b"),
  8713  				Location:        String("l"),
  8714  				Email:           String("e"),
  8715  				Hireable:        Bool(true),
  8716  				Bio:             String("b"),
  8717  				TwitterUsername: String("t"),
  8718  				PublicRepos:     Int(1),
  8719  				Followers:       Int(1),
  8720  				Following:       Int(1),
  8721  				CreatedAt:       &Timestamp{referenceTime},
  8722  				SuspendedAt:     &Timestamp{referenceTime},
  8723  			},
  8724  			AccessTokensURL:     String("atu"),
  8725  			RepositoriesURL:     String("ru"),
  8726  			HTMLURL:             String("hu"),
  8727  			TargetType:          String("tt"),
  8728  			SingleFileName:      String("sfn"),
  8729  			RepositorySelection: String("rs"),
  8730  			Events:              []string{"e"},
  8731  			SingleFilePaths:     []string{"s"},
  8732  			Permissions: &InstallationPermissions{
  8733  				Actions:                       String("a"),
  8734  				Administration:                String("ad"),
  8735  				Checks:                        String("c"),
  8736  				Contents:                      String("co"),
  8737  				ContentReferences:             String("cr"),
  8738  				Deployments:                   String("d"),
  8739  				Environments:                  String("e"),
  8740  				Issues:                        String("i"),
  8741  				Metadata:                      String("md"),
  8742  				Members:                       String("m"),
  8743  				OrganizationAdministration:    String("oa"),
  8744  				OrganizationHooks:             String("oh"),
  8745  				OrganizationPlan:              String("op"),
  8746  				OrganizationPreReceiveHooks:   String("opr"),
  8747  				OrganizationProjects:          String("op"),
  8748  				OrganizationSecrets:           String("os"),
  8749  				OrganizationSelfHostedRunners: String("osh"),
  8750  				OrganizationUserBlocking:      String("oub"),
  8751  				Packages:                      String("pkg"),
  8752  				Pages:                         String("pg"),
  8753  				PullRequests:                  String("pr"),
  8754  				RepositoryHooks:               String("rh"),
  8755  				RepositoryProjects:            String("rp"),
  8756  				RepositoryPreReceiveHooks:     String("rprh"),
  8757  				Secrets:                       String("s"),
  8758  				SecretScanningAlerts:          String("ssa"),
  8759  				SecurityEvents:                String("se"),
  8760  				SingleFile:                    String("sf"),
  8761  				Statuses:                      String("s"),
  8762  				TeamDiscussions:               String("td"),
  8763  				VulnerabilityAlerts:           String("va"),
  8764  				Workflows:                     String("w"),
  8765  			},
  8766  			CreatedAt:              &Timestamp{referenceTime},
  8767  			UpdatedAt:              &Timestamp{referenceTime},
  8768  			HasMultipleSingleFiles: Bool(false),
  8769  			SuspendedBy: &User{
  8770  				Login:           String("l"),
  8771  				ID:              Int64(1),
  8772  				URL:             String("u"),
  8773  				AvatarURL:       String("a"),
  8774  				GravatarID:      String("g"),
  8775  				Name:            String("n"),
  8776  				Company:         String("c"),
  8777  				Blog:            String("b"),
  8778  				Location:        String("l"),
  8779  				Email:           String("e"),
  8780  				Hireable:        Bool(true),
  8781  				Bio:             String("b"),
  8782  				TwitterUsername: String("t"),
  8783  				PublicRepos:     Int(1),
  8784  				Followers:       Int(1),
  8785  				Following:       Int(1),
  8786  				CreatedAt:       &Timestamp{referenceTime},
  8787  				SuspendedAt:     &Timestamp{referenceTime},
  8788  			},
  8789  			SuspendedAt: &Timestamp{referenceTime},
  8790  		},
  8791  	}
  8792  
  8793  	want := `{
  8794  		"action": "a",
  8795  		"merge_group": {
  8796  			"head_sha": "hs",
  8797  			"head_ref": "hr",
  8798  			"base_sha": "bs",
  8799  			"base_ref": "br",
  8800  			"head_commit": {
  8801  				"node_id": "nid"
  8802  			}
  8803  		},
  8804  		"repository": {
  8805  			"id": 1,
  8806  			"name": "n",
  8807  			"url": "s"
  8808  		},
  8809  		"organization": {
  8810  			"name": "n",
  8811  			"company": "c",
  8812  			"blog": "b",
  8813  			"location": "loc",
  8814  			"email": "e",
  8815  			"twitter_username": "tu",
  8816  			"description": "d",
  8817  			"billing_email": "be",
  8818  			"is_verified": true,
  8819  			"has_organization_projects": true,
  8820  			"has_repository_projects": true,
  8821  			"default_repository_permission": "drp",
  8822  			"members_can_create_repositories": true,
  8823  			"members_can_create_public_repositories": false,
  8824  			"members_can_create_private_repositories": true,
  8825  			"members_can_create_internal_repositories": true,
  8826  			"members_allowed_repository_creation_type": "marct",
  8827  			"members_can_create_pages": true,
  8828  			"members_can_create_public_pages": false,
  8829  			"members_can_create_private_pages": true
  8830  		},
  8831  		"sender": {
  8832  			"login": "l",
  8833  			"id": 1,
  8834  			"node_id": "n",
  8835  			"avatar_url": "a",
  8836  			"url": "u",
  8837  			"events_url": "e",
  8838  			"repos_url": "r"
  8839  		},
  8840  		"installation": {
  8841  			"id": 1,
  8842  			"node_id": "nid",
  8843  			"app_id": 1,
  8844  			"app_slug": "as",
  8845  			"target_id": 1,
  8846  			"account": {
  8847  				"login": "l",
  8848  				"id": 1,
  8849  				"avatar_url": "a",
  8850  				"gravatar_id": "g",
  8851  				"name": "n",
  8852  				"company": "c",
  8853  				"blog": "b",
  8854  				"location": "l",
  8855  				"email": "e",
  8856  				"hireable": true,
  8857  				"bio": "b",
  8858  				"twitter_username": "t",
  8859  				"public_repos": 1,
  8860  				"followers": 1,
  8861  				"following": 1,
  8862  				"created_at": ` + referenceTimeStr + `,
  8863  				"suspended_at": ` + referenceTimeStr + `,
  8864  				"url": "u"
  8865  			},
  8866  			"access_tokens_url": "atu",
  8867  			"repositories_url": "ru",
  8868  			"html_url": "hu",
  8869  			"target_type": "tt",
  8870  			"single_file_name": "sfn",
  8871  			"repository_selection": "rs",
  8872  			"events": [
  8873  				"e"
  8874  			],
  8875  			"single_file_paths": [
  8876  				"s"
  8877  			],
  8878  			"permissions": {
  8879  				"actions": "a",
  8880  				"administration": "ad",
  8881  				"checks": "c",
  8882  				"contents": "co",
  8883  				"content_references": "cr",
  8884  				"deployments": "d",
  8885  				"environments": "e",
  8886  				"issues": "i",
  8887  				"metadata": "md",
  8888  				"members": "m",
  8889  				"organization_administration": "oa",
  8890  				"organization_hooks": "oh",
  8891  				"organization_plan": "op",
  8892  				"organization_pre_receive_hooks": "opr",
  8893  				"organization_projects": "op",
  8894  				"organization_secrets": "os",
  8895  				"organization_self_hosted_runners": "osh",
  8896  				"organization_user_blocking": "oub",
  8897  				"packages": "pkg",
  8898  				"pages": "pg",
  8899  				"pull_requests": "pr",
  8900  				"repository_hooks": "rh",
  8901  				"repository_projects": "rp",
  8902  				"repository_pre_receive_hooks": "rprh",
  8903  				"secrets": "s",
  8904  				"secret_scanning_alerts": "ssa",
  8905  				"security_events": "se",
  8906  				"single_file": "sf",
  8907  				"statuses": "s",
  8908  				"team_discussions": "td",
  8909  				"vulnerability_alerts": "va",
  8910  				"workflows": "w"
  8911  			},
  8912  			"created_at": ` + referenceTimeStr + `,
  8913  			"updated_at": ` + referenceTimeStr + `,
  8914  			"has_multiple_single_files": false,
  8915  			"suspended_by": {
  8916  				"login": "l",
  8917  				"id": 1,
  8918  				"avatar_url": "a",
  8919  				"gravatar_id": "g",
  8920  				"name": "n",
  8921  				"company": "c",
  8922  				"blog": "b",
  8923  				"location": "l",
  8924  				"email": "e",
  8925  				"hireable": true,
  8926  				"bio": "b",
  8927  				"twitter_username": "t",
  8928  				"public_repos": 1,
  8929  				"followers": 1,
  8930  				"following": 1,
  8931  				"created_at": ` + referenceTimeStr + `,
  8932  				"suspended_at": ` + referenceTimeStr + `,
  8933  				"url": "u"
  8934  			},
  8935  			"suspended_at": ` + referenceTimeStr + `
  8936  		}
  8937  	}`
  8938  
  8939  	testJSONMarshal(t, u, want)
  8940  }
  8941  
  8942  func TestOrgBlockEvent_Marshal(t *testing.T) {
  8943  	testJSONMarshal(t, &OrgBlockEvent{}, "{}")
  8944  
  8945  	u := &OrgBlockEvent{
  8946  		Action: String("a"),
  8947  		BlockedUser: &User{
  8948  			Login:     String("l"),
  8949  			ID:        Int64(1),
  8950  			NodeID:    String("n"),
  8951  			URL:       String("u"),
  8952  			ReposURL:  String("r"),
  8953  			EventsURL: String("e"),
  8954  			AvatarURL: String("a"),
  8955  		},
  8956  		Organization: &Organization{
  8957  			BillingEmail:                         String("be"),
  8958  			Blog:                                 String("b"),
  8959  			Company:                              String("c"),
  8960  			Email:                                String("e"),
  8961  			TwitterUsername:                      String("tu"),
  8962  			Location:                             String("loc"),
  8963  			Name:                                 String("n"),
  8964  			Description:                          String("d"),
  8965  			IsVerified:                           Bool(true),
  8966  			HasOrganizationProjects:              Bool(true),
  8967  			HasRepositoryProjects:                Bool(true),
  8968  			DefaultRepoPermission:                String("drp"),
  8969  			MembersCanCreateRepos:                Bool(true),
  8970  			MembersCanCreateInternalRepos:        Bool(true),
  8971  			MembersCanCreatePrivateRepos:         Bool(true),
  8972  			MembersCanCreatePublicRepos:          Bool(false),
  8973  			MembersAllowedRepositoryCreationType: String("marct"),
  8974  			MembersCanCreatePages:                Bool(true),
  8975  			MembersCanCreatePublicPages:          Bool(false),
  8976  			MembersCanCreatePrivatePages:         Bool(true),
  8977  		},
  8978  		Sender: &User{
  8979  			Login:     String("l"),
  8980  			ID:        Int64(1),
  8981  			NodeID:    String("n"),
  8982  			URL:       String("u"),
  8983  			ReposURL:  String("r"),
  8984  			EventsURL: String("e"),
  8985  			AvatarURL: String("a"),
  8986  		},
  8987  		Installation: &Installation{
  8988  			ID:       Int64(1),
  8989  			NodeID:   String("nid"),
  8990  			AppID:    Int64(1),
  8991  			AppSlug:  String("as"),
  8992  			TargetID: Int64(1),
  8993  			Account: &User{
  8994  				Login:           String("l"),
  8995  				ID:              Int64(1),
  8996  				URL:             String("u"),
  8997  				AvatarURL:       String("a"),
  8998  				GravatarID:      String("g"),
  8999  				Name:            String("n"),
  9000  				Company:         String("c"),
  9001  				Blog:            String("b"),
  9002  				Location:        String("l"),
  9003  				Email:           String("e"),
  9004  				Hireable:        Bool(true),
  9005  				Bio:             String("b"),
  9006  				TwitterUsername: String("t"),
  9007  				PublicRepos:     Int(1),
  9008  				Followers:       Int(1),
  9009  				Following:       Int(1),
  9010  				CreatedAt:       &Timestamp{referenceTime},
  9011  				SuspendedAt:     &Timestamp{referenceTime},
  9012  			},
  9013  			AccessTokensURL:     String("atu"),
  9014  			RepositoriesURL:     String("ru"),
  9015  			HTMLURL:             String("hu"),
  9016  			TargetType:          String("tt"),
  9017  			SingleFileName:      String("sfn"),
  9018  			RepositorySelection: String("rs"),
  9019  			Events:              []string{"e"},
  9020  			SingleFilePaths:     []string{"s"},
  9021  			Permissions: &InstallationPermissions{
  9022  				Actions:                       String("a"),
  9023  				Administration:                String("ad"),
  9024  				Checks:                        String("c"),
  9025  				Contents:                      String("co"),
  9026  				ContentReferences:             String("cr"),
  9027  				Deployments:                   String("d"),
  9028  				Environments:                  String("e"),
  9029  				Issues:                        String("i"),
  9030  				Metadata:                      String("md"),
  9031  				Members:                       String("m"),
  9032  				OrganizationAdministration:    String("oa"),
  9033  				OrganizationHooks:             String("oh"),
  9034  				OrganizationPlan:              String("op"),
  9035  				OrganizationPreReceiveHooks:   String("opr"),
  9036  				OrganizationProjects:          String("op"),
  9037  				OrganizationSecrets:           String("os"),
  9038  				OrganizationSelfHostedRunners: String("osh"),
  9039  				OrganizationUserBlocking:      String("oub"),
  9040  				Packages:                      String("pkg"),
  9041  				Pages:                         String("pg"),
  9042  				PullRequests:                  String("pr"),
  9043  				RepositoryHooks:               String("rh"),
  9044  				RepositoryProjects:            String("rp"),
  9045  				RepositoryPreReceiveHooks:     String("rprh"),
  9046  				Secrets:                       String("s"),
  9047  				SecretScanningAlerts:          String("ssa"),
  9048  				SecurityEvents:                String("se"),
  9049  				SingleFile:                    String("sf"),
  9050  				Statuses:                      String("s"),
  9051  				TeamDiscussions:               String("td"),
  9052  				VulnerabilityAlerts:           String("va"),
  9053  				Workflows:                     String("w"),
  9054  			},
  9055  			CreatedAt:              &Timestamp{referenceTime},
  9056  			UpdatedAt:              &Timestamp{referenceTime},
  9057  			HasMultipleSingleFiles: Bool(false),
  9058  			SuspendedBy: &User{
  9059  				Login:           String("l"),
  9060  				ID:              Int64(1),
  9061  				URL:             String("u"),
  9062  				AvatarURL:       String("a"),
  9063  				GravatarID:      String("g"),
  9064  				Name:            String("n"),
  9065  				Company:         String("c"),
  9066  				Blog:            String("b"),
  9067  				Location:        String("l"),
  9068  				Email:           String("e"),
  9069  				Hireable:        Bool(true),
  9070  				Bio:             String("b"),
  9071  				TwitterUsername: String("t"),
  9072  				PublicRepos:     Int(1),
  9073  				Followers:       Int(1),
  9074  				Following:       Int(1),
  9075  				CreatedAt:       &Timestamp{referenceTime},
  9076  				SuspendedAt:     &Timestamp{referenceTime},
  9077  			},
  9078  			SuspendedAt: &Timestamp{referenceTime},
  9079  		},
  9080  	}
  9081  
  9082  	want := `{
  9083  		"action": "a",
  9084  		"blocked_user": {
  9085  			"login": "l",
  9086  			"id": 1,
  9087  			"node_id": "n",
  9088  			"avatar_url": "a",
  9089  			"url": "u",
  9090  			"events_url": "e",
  9091  			"repos_url": "r"
  9092  		},
  9093  		"organization": {
  9094  			"name": "n",
  9095  			"company": "c",
  9096  			"blog": "b",
  9097  			"location": "loc",
  9098  			"email": "e",
  9099  			"twitter_username": "tu",
  9100  			"description": "d",
  9101  			"billing_email": "be",
  9102  			"is_verified": true,
  9103  			"has_organization_projects": true,
  9104  			"has_repository_projects": true,
  9105  			"default_repository_permission": "drp",
  9106  			"members_can_create_repositories": true,
  9107  			"members_can_create_public_repositories": false,
  9108  			"members_can_create_private_repositories": true,
  9109  			"members_can_create_internal_repositories": true,
  9110  			"members_allowed_repository_creation_type": "marct",
  9111  			"members_can_create_pages": true,
  9112  			"members_can_create_public_pages": false,
  9113  			"members_can_create_private_pages": true
  9114  		},
  9115  		"sender": {
  9116  			"login": "l",
  9117  			"id": 1,
  9118  			"node_id": "n",
  9119  			"avatar_url": "a",
  9120  			"url": "u",
  9121  			"events_url": "e",
  9122  			"repos_url": "r"
  9123  		},
  9124  		"installation": {
  9125  			"id": 1,
  9126  			"node_id": "nid",
  9127  			"app_id": 1,
  9128  			"app_slug": "as",
  9129  			"target_id": 1,
  9130  			"account": {
  9131  				"login": "l",
  9132  				"id": 1,
  9133  				"avatar_url": "a",
  9134  				"gravatar_id": "g",
  9135  				"name": "n",
  9136  				"company": "c",
  9137  				"blog": "b",
  9138  				"location": "l",
  9139  				"email": "e",
  9140  				"hireable": true,
  9141  				"bio": "b",
  9142  				"twitter_username": "t",
  9143  				"public_repos": 1,
  9144  				"followers": 1,
  9145  				"following": 1,
  9146  				"created_at": ` + referenceTimeStr + `,
  9147  				"suspended_at": ` + referenceTimeStr + `,
  9148  				"url": "u"
  9149  			},
  9150  			"access_tokens_url": "atu",
  9151  			"repositories_url": "ru",
  9152  			"html_url": "hu",
  9153  			"target_type": "tt",
  9154  			"single_file_name": "sfn",
  9155  			"repository_selection": "rs",
  9156  			"events": [
  9157  				"e"
  9158  			],
  9159  			"single_file_paths": [
  9160  				"s"
  9161  			],
  9162  			"permissions": {
  9163  				"actions": "a",
  9164  				"administration": "ad",
  9165  				"checks": "c",
  9166  				"contents": "co",
  9167  				"content_references": "cr",
  9168  				"deployments": "d",
  9169  				"environments": "e",
  9170  				"issues": "i",
  9171  				"metadata": "md",
  9172  				"members": "m",
  9173  				"organization_administration": "oa",
  9174  				"organization_hooks": "oh",
  9175  				"organization_plan": "op",
  9176  				"organization_pre_receive_hooks": "opr",
  9177  				"organization_projects": "op",
  9178  				"organization_secrets": "os",
  9179  				"organization_self_hosted_runners": "osh",
  9180  				"organization_user_blocking": "oub",
  9181  				"packages": "pkg",
  9182  				"pages": "pg",
  9183  				"pull_requests": "pr",
  9184  				"repository_hooks": "rh",
  9185  				"repository_projects": "rp",
  9186  				"repository_pre_receive_hooks": "rprh",
  9187  				"secrets": "s",
  9188  				"secret_scanning_alerts": "ssa",
  9189  				"security_events": "se",
  9190  				"single_file": "sf",
  9191  				"statuses": "s",
  9192  				"team_discussions": "td",
  9193  				"vulnerability_alerts": "va",
  9194  				"workflows": "w"
  9195  			},
  9196  			"created_at": ` + referenceTimeStr + `,
  9197  			"updated_at": ` + referenceTimeStr + `,
  9198  			"has_multiple_single_files": false,
  9199  			"suspended_by": {
  9200  				"login": "l",
  9201  				"id": 1,
  9202  				"avatar_url": "a",
  9203  				"gravatar_id": "g",
  9204  				"name": "n",
  9205  				"company": "c",
  9206  				"blog": "b",
  9207  				"location": "l",
  9208  				"email": "e",
  9209  				"hireable": true,
  9210  				"bio": "b",
  9211  				"twitter_username": "t",
  9212  				"public_repos": 1,
  9213  				"followers": 1,
  9214  				"following": 1,
  9215  				"created_at": ` + referenceTimeStr + `,
  9216  				"suspended_at": ` + referenceTimeStr + `,
  9217  				"url": "u"
  9218  			},
  9219  			"suspended_at": ` + referenceTimeStr + `
  9220  		}
  9221  	}`
  9222  
  9223  	testJSONMarshal(t, u, want)
  9224  }
  9225  
  9226  func TestGollumEvent_Marshal(t *testing.T) {
  9227  	testJSONMarshal(t, &GollumEvent{}, "{}")
  9228  
  9229  	u := &GollumEvent{
  9230  		Pages: []*Page{
  9231  			{
  9232  				PageName: String("pn"),
  9233  				Title:    String("t"),
  9234  				Summary:  String("s"),
  9235  				Action:   String("a"),
  9236  				SHA:      String("sha"),
  9237  				HTMLURL:  String("hu"),
  9238  			},
  9239  		},
  9240  		Repo: &Repository{
  9241  			ID:   Int64(1),
  9242  			URL:  String("s"),
  9243  			Name: String("n"),
  9244  		},
  9245  		Sender: &User{
  9246  			Login:     String("l"),
  9247  			ID:        Int64(1),
  9248  			NodeID:    String("n"),
  9249  			URL:       String("u"),
  9250  			ReposURL:  String("r"),
  9251  			EventsURL: String("e"),
  9252  			AvatarURL: String("a"),
  9253  		},
  9254  		Installation: &Installation{
  9255  			ID:       Int64(1),
  9256  			NodeID:   String("nid"),
  9257  			AppID:    Int64(1),
  9258  			AppSlug:  String("as"),
  9259  			TargetID: Int64(1),
  9260  			Account: &User{
  9261  				Login:           String("l"),
  9262  				ID:              Int64(1),
  9263  				URL:             String("u"),
  9264  				AvatarURL:       String("a"),
  9265  				GravatarID:      String("g"),
  9266  				Name:            String("n"),
  9267  				Company:         String("c"),
  9268  				Blog:            String("b"),
  9269  				Location:        String("l"),
  9270  				Email:           String("e"),
  9271  				Hireable:        Bool(true),
  9272  				Bio:             String("b"),
  9273  				TwitterUsername: String("t"),
  9274  				PublicRepos:     Int(1),
  9275  				Followers:       Int(1),
  9276  				Following:       Int(1),
  9277  				CreatedAt:       &Timestamp{referenceTime},
  9278  				SuspendedAt:     &Timestamp{referenceTime},
  9279  			},
  9280  			AccessTokensURL:     String("atu"),
  9281  			RepositoriesURL:     String("ru"),
  9282  			HTMLURL:             String("hu"),
  9283  			TargetType:          String("tt"),
  9284  			SingleFileName:      String("sfn"),
  9285  			RepositorySelection: String("rs"),
  9286  			Events:              []string{"e"},
  9287  			SingleFilePaths:     []string{"s"},
  9288  			Permissions: &InstallationPermissions{
  9289  				Actions:                       String("a"),
  9290  				Administration:                String("ad"),
  9291  				Checks:                        String("c"),
  9292  				Contents:                      String("co"),
  9293  				ContentReferences:             String("cr"),
  9294  				Deployments:                   String("d"),
  9295  				Environments:                  String("e"),
  9296  				Issues:                        String("i"),
  9297  				Metadata:                      String("md"),
  9298  				Members:                       String("m"),
  9299  				OrganizationAdministration:    String("oa"),
  9300  				OrganizationHooks:             String("oh"),
  9301  				OrganizationPlan:              String("op"),
  9302  				OrganizationPreReceiveHooks:   String("opr"),
  9303  				OrganizationProjects:          String("op"),
  9304  				OrganizationSecrets:           String("os"),
  9305  				OrganizationSelfHostedRunners: String("osh"),
  9306  				OrganizationUserBlocking:      String("oub"),
  9307  				Packages:                      String("pkg"),
  9308  				Pages:                         String("pg"),
  9309  				PullRequests:                  String("pr"),
  9310  				RepositoryHooks:               String("rh"),
  9311  				RepositoryProjects:            String("rp"),
  9312  				RepositoryPreReceiveHooks:     String("rprh"),
  9313  				Secrets:                       String("s"),
  9314  				SecretScanningAlerts:          String("ssa"),
  9315  				SecurityEvents:                String("se"),
  9316  				SingleFile:                    String("sf"),
  9317  				Statuses:                      String("s"),
  9318  				TeamDiscussions:               String("td"),
  9319  				VulnerabilityAlerts:           String("va"),
  9320  				Workflows:                     String("w"),
  9321  			},
  9322  			CreatedAt:              &Timestamp{referenceTime},
  9323  			UpdatedAt:              &Timestamp{referenceTime},
  9324  			HasMultipleSingleFiles: Bool(false),
  9325  			SuspendedBy: &User{
  9326  				Login:           String("l"),
  9327  				ID:              Int64(1),
  9328  				URL:             String("u"),
  9329  				AvatarURL:       String("a"),
  9330  				GravatarID:      String("g"),
  9331  				Name:            String("n"),
  9332  				Company:         String("c"),
  9333  				Blog:            String("b"),
  9334  				Location:        String("l"),
  9335  				Email:           String("e"),
  9336  				Hireable:        Bool(true),
  9337  				Bio:             String("b"),
  9338  				TwitterUsername: String("t"),
  9339  				PublicRepos:     Int(1),
  9340  				Followers:       Int(1),
  9341  				Following:       Int(1),
  9342  				CreatedAt:       &Timestamp{referenceTime},
  9343  				SuspendedAt:     &Timestamp{referenceTime},
  9344  			},
  9345  			SuspendedAt: &Timestamp{referenceTime},
  9346  		},
  9347  	}
  9348  
  9349  	want := `{
  9350  		"pages": [
  9351  			{
  9352  				"page_name": "pn",
  9353  				"title": "t",
  9354  				"summary": "s",
  9355  				"action": "a",
  9356  				"sha": "sha",
  9357  				"html_url": "hu"
  9358  			}
  9359  		],
  9360  		"repository": {
  9361  			"id": 1,
  9362  			"name": "n",
  9363  			"url": "s"
  9364  		},
  9365  		"sender": {
  9366  			"login": "l",
  9367  			"id": 1,
  9368  			"node_id": "n",
  9369  			"avatar_url": "a",
  9370  			"url": "u",
  9371  			"events_url": "e",
  9372  			"repos_url": "r"
  9373  		},
  9374  		"installation": {
  9375  			"id": 1,
  9376  			"node_id": "nid",
  9377  			"app_id": 1,
  9378  			"app_slug": "as",
  9379  			"target_id": 1,
  9380  			"account": {
  9381  				"login": "l",
  9382  				"id": 1,
  9383  				"avatar_url": "a",
  9384  				"gravatar_id": "g",
  9385  				"name": "n",
  9386  				"company": "c",
  9387  				"blog": "b",
  9388  				"location": "l",
  9389  				"email": "e",
  9390  				"hireable": true,
  9391  				"bio": "b",
  9392  				"twitter_username": "t",
  9393  				"public_repos": 1,
  9394  				"followers": 1,
  9395  				"following": 1,
  9396  				"created_at": ` + referenceTimeStr + `,
  9397  				"suspended_at": ` + referenceTimeStr + `,
  9398  				"url": "u"
  9399  			},
  9400  			"access_tokens_url": "atu",
  9401  			"repositories_url": "ru",
  9402  			"html_url": "hu",
  9403  			"target_type": "tt",
  9404  			"single_file_name": "sfn",
  9405  			"repository_selection": "rs",
  9406  			"events": [
  9407  				"e"
  9408  			],
  9409  			"single_file_paths": [
  9410  				"s"
  9411  			],
  9412  			"permissions": {
  9413  				"actions": "a",
  9414  				"administration": "ad",
  9415  				"checks": "c",
  9416  				"contents": "co",
  9417  				"content_references": "cr",
  9418  				"deployments": "d",
  9419  				"environments": "e",
  9420  				"issues": "i",
  9421  				"metadata": "md",
  9422  				"members": "m",
  9423  				"organization_administration": "oa",
  9424  				"organization_hooks": "oh",
  9425  				"organization_plan": "op",
  9426  				"organization_pre_receive_hooks": "opr",
  9427  				"organization_projects": "op",
  9428  				"organization_secrets": "os",
  9429  				"organization_self_hosted_runners": "osh",
  9430  				"organization_user_blocking": "oub",
  9431  				"packages": "pkg",
  9432  				"pages": "pg",
  9433  				"pull_requests": "pr",
  9434  				"repository_hooks": "rh",
  9435  				"repository_projects": "rp",
  9436  				"repository_pre_receive_hooks": "rprh",
  9437  				"secrets": "s",
  9438  				"secret_scanning_alerts": "ssa",
  9439  				"security_events": "se",
  9440  				"single_file": "sf",
  9441  				"statuses": "s",
  9442  				"team_discussions": "td",
  9443  				"vulnerability_alerts": "va",
  9444  				"workflows": "w"
  9445  			},
  9446  			"created_at": ` + referenceTimeStr + `,
  9447  			"updated_at": ` + referenceTimeStr + `,
  9448  			"has_multiple_single_files": false,
  9449  			"suspended_by": {
  9450  				"login": "l",
  9451  				"id": 1,
  9452  				"avatar_url": "a",
  9453  				"gravatar_id": "g",
  9454  				"name": "n",
  9455  				"company": "c",
  9456  				"blog": "b",
  9457  				"location": "l",
  9458  				"email": "e",
  9459  				"hireable": true,
  9460  				"bio": "b",
  9461  				"twitter_username": "t",
  9462  				"public_repos": 1,
  9463  				"followers": 1,
  9464  				"following": 1,
  9465  				"created_at": ` + referenceTimeStr + `,
  9466  				"suspended_at": ` + referenceTimeStr + `,
  9467  				"url": "u"
  9468  			},
  9469  			"suspended_at": ` + referenceTimeStr + `
  9470  		}
  9471  	}`
  9472  
  9473  	testJSONMarshal(t, u, want)
  9474  }
  9475  
  9476  func TestWorkflowRunEvent_Marshal(t *testing.T) {
  9477  	testJSONMarshal(t, &WorkflowRunEvent{}, "{}")
  9478  
  9479  	u := &WorkflowRunEvent{
  9480  		Action: String("a"),
  9481  		Workflow: &Workflow{
  9482  			ID:        Int64(1),
  9483  			NodeID:    String("nid"),
  9484  			Name:      String("n"),
  9485  			Path:      String("p"),
  9486  			State:     String("s"),
  9487  			CreatedAt: &Timestamp{referenceTime},
  9488  			UpdatedAt: &Timestamp{referenceTime},
  9489  			URL:       String("u"),
  9490  			HTMLURL:   String("h"),
  9491  			BadgeURL:  String("b"),
  9492  		},
  9493  		WorkflowRun: &WorkflowRun{
  9494  			ID:         Int64(1),
  9495  			Name:       String("n"),
  9496  			NodeID:     String("nid"),
  9497  			HeadBranch: String("hb"),
  9498  			HeadSHA:    String("hs"),
  9499  			RunNumber:  Int(1),
  9500  			RunAttempt: Int(1),
  9501  			Event:      String("e"),
  9502  			Status:     String("s"),
  9503  			Conclusion: String("c"),
  9504  			WorkflowID: Int64(1),
  9505  			URL:        String("u"),
  9506  			HTMLURL:    String("h"),
  9507  			PullRequests: []*PullRequest{
  9508  				{
  9509  					URL:    String("u"),
  9510  					ID:     Int64(1),
  9511  					Number: Int(1),
  9512  					Head: &PullRequestBranch{
  9513  						Ref: String("r"),
  9514  						SHA: String("s"),
  9515  						Repo: &Repository{
  9516  							ID:   Int64(1),
  9517  							URL:  String("s"),
  9518  							Name: String("n"),
  9519  						},
  9520  					},
  9521  					Base: &PullRequestBranch{
  9522  						Ref: String("r"),
  9523  						SHA: String("s"),
  9524  						Repo: &Repository{
  9525  							ID:   Int64(1),
  9526  							URL:  String("u"),
  9527  							Name: String("n"),
  9528  						},
  9529  					},
  9530  				},
  9531  			},
  9532  			CreatedAt:          &Timestamp{referenceTime},
  9533  			UpdatedAt:          &Timestamp{referenceTime},
  9534  			RunStartedAt:       &Timestamp{referenceTime},
  9535  			JobsURL:            String("j"),
  9536  			LogsURL:            String("l"),
  9537  			CheckSuiteURL:      String("c"),
  9538  			ArtifactsURL:       String("a"),
  9539  			CancelURL:          String("c"),
  9540  			RerunURL:           String("r"),
  9541  			PreviousAttemptURL: String("p"),
  9542  			HeadCommit: &HeadCommit{
  9543  				Message: String("m"),
  9544  				Author: &CommitAuthor{
  9545  					Name:  String("n"),
  9546  					Email: String("e"),
  9547  					Login: String("l"),
  9548  				},
  9549  				URL:       String("u"),
  9550  				Distinct:  Bool(false),
  9551  				SHA:       String("s"),
  9552  				ID:        String("i"),
  9553  				TreeID:    String("tid"),
  9554  				Timestamp: &Timestamp{referenceTime},
  9555  				Committer: &CommitAuthor{
  9556  					Name:  String("n"),
  9557  					Email: String("e"),
  9558  					Login: String("l"),
  9559  				},
  9560  			},
  9561  			WorkflowURL: String("w"),
  9562  			Repository: &Repository{
  9563  				ID:   Int64(1),
  9564  				URL:  String("u"),
  9565  				Name: String("n"),
  9566  			},
  9567  			HeadRepository: &Repository{
  9568  				ID:   Int64(1),
  9569  				URL:  String("u"),
  9570  				Name: String("n"),
  9571  			},
  9572  		},
  9573  		Org: &Organization{
  9574  			BillingEmail:                         String("be"),
  9575  			Blog:                                 String("b"),
  9576  			Company:                              String("c"),
  9577  			Email:                                String("e"),
  9578  			TwitterUsername:                      String("tu"),
  9579  			Location:                             String("loc"),
  9580  			Name:                                 String("n"),
  9581  			Description:                          String("d"),
  9582  			IsVerified:                           Bool(true),
  9583  			HasOrganizationProjects:              Bool(true),
  9584  			HasRepositoryProjects:                Bool(true),
  9585  			DefaultRepoPermission:                String("drp"),
  9586  			MembersCanCreateRepos:                Bool(true),
  9587  			MembersCanCreateInternalRepos:        Bool(true),
  9588  			MembersCanCreatePrivateRepos:         Bool(true),
  9589  			MembersCanCreatePublicRepos:          Bool(false),
  9590  			MembersAllowedRepositoryCreationType: String("marct"),
  9591  			MembersCanCreatePages:                Bool(true),
  9592  			MembersCanCreatePublicPages:          Bool(false),
  9593  			MembersCanCreatePrivatePages:         Bool(true),
  9594  		},
  9595  		Repo: &Repository{
  9596  			ID:   Int64(1),
  9597  			URL:  String("s"),
  9598  			Name: String("n"),
  9599  		},
  9600  		Sender: &User{
  9601  			Login:     String("l"),
  9602  			ID:        Int64(1),
  9603  			NodeID:    String("n"),
  9604  			URL:       String("u"),
  9605  			ReposURL:  String("r"),
  9606  			EventsURL: String("e"),
  9607  			AvatarURL: String("a"),
  9608  		},
  9609  	}
  9610  
  9611  	want := `{
  9612  		"action": "a",
  9613  		"workflow": {
  9614  			"id": 1,
  9615  			"node_id": "nid",
  9616  			"name": "n",
  9617  			"path": "p",
  9618  			"state": "s",
  9619  			"created_at": ` + referenceTimeStr + `,
  9620  			"updated_at": ` + referenceTimeStr + `,
  9621  			"url": "u",
  9622  			"html_url": "h",
  9623  			"badge_url": "b"
  9624  		},
  9625  		"workflow_run": {
  9626  			"id": 1,
  9627  			"name": "n",
  9628  			"node_id": "nid",
  9629  			"head_branch": "hb",
  9630  			"head_sha": "hs",
  9631  			"run_number": 1,
  9632  			"run_attempt": 1,
  9633  			"event": "e",
  9634  			"status": "s",
  9635  			"conclusion": "c",
  9636  			"workflow_id": 1,
  9637  			"url": "u",
  9638  			"html_url": "h",
  9639  			"pull_requests": [
  9640  				{
  9641  					"id": 1,
  9642  					"number": 1,
  9643  					"url": "u",
  9644  					"head": {
  9645  						"ref": "r",
  9646  						"sha": "s",
  9647  						"repo": {
  9648  							"id": 1,
  9649  							"name": "n",
  9650  							"url": "s"
  9651  						}
  9652  					},
  9653  					"base": {
  9654  						"ref": "r",
  9655  						"sha": "s",
  9656  						"repo": {
  9657  							"id": 1,
  9658  							"name": "n",
  9659  							"url": "u"
  9660  						}
  9661  					}
  9662  				}
  9663  			],
  9664  			"created_at": ` + referenceTimeStr + `,
  9665  			"updated_at": ` + referenceTimeStr + `,
  9666  			"run_started_at": ` + referenceTimeStr + `,
  9667  			"jobs_url": "j",
  9668  			"logs_url": "l",
  9669  			"check_suite_url": "c",
  9670  			"artifacts_url": "a",
  9671  			"cancel_url": "c",
  9672  			"rerun_url": "r",
  9673  			"previous_attempt_url": "p",
  9674  			"head_commit": {
  9675  				"message": "m",
  9676  				"author": {
  9677  					"name": "n",
  9678  					"email": "e",
  9679  					"username": "l"
  9680  				},
  9681  				"url": "u",
  9682  				"distinct": false,
  9683  				"sha": "s",
  9684  				"id": "i",
  9685  				"tree_id": "tid",
  9686  				"timestamp": ` + referenceTimeStr + `,
  9687  				"committer": {
  9688  					"name": "n",
  9689  					"email": "e",
  9690  					"username": "l"
  9691  				}
  9692  			},
  9693  			"workflow_url": "w",
  9694  			"repository": {
  9695  				"id": 1,
  9696  				"name": "n",
  9697  				"url": "u"
  9698  			},
  9699  			"head_repository": {
  9700  				"id": 1,
  9701  				"name": "n",
  9702  				"url": "u"
  9703  			}
  9704  		},
  9705  		"organization": {
  9706  			"name": "n",
  9707  			"company": "c",
  9708  			"blog": "b",
  9709  			"location": "loc",
  9710  			"email": "e",
  9711  			"twitter_username": "tu",
  9712  			"description": "d",
  9713  			"billing_email": "be",
  9714  			"is_verified": true,
  9715  			"has_organization_projects": true,
  9716  			"has_repository_projects": true,
  9717  			"default_repository_permission": "drp",
  9718  			"members_can_create_repositories": true,
  9719  			"members_can_create_public_repositories": false,
  9720  			"members_can_create_private_repositories": true,
  9721  			"members_can_create_internal_repositories": true,
  9722  			"members_allowed_repository_creation_type": "marct",
  9723  			"members_can_create_pages": true,
  9724  			"members_can_create_public_pages": false,
  9725  			"members_can_create_private_pages": true
  9726  		},
  9727  		"repository": {
  9728  			"id": 1,
  9729  			"name": "n",
  9730  			"url": "s"
  9731  		},
  9732  		"sender": {
  9733  			"login": "l",
  9734  			"id": 1,
  9735  			"node_id": "n",
  9736  			"avatar_url": "a",
  9737  			"url": "u",
  9738  			"events_url": "e",
  9739  			"repos_url": "r"
  9740  		}
  9741  	}`
  9742  
  9743  	testJSONMarshal(t, u, want)
  9744  }
  9745  
  9746  func TestWorkflowDispatchEvent_Marshal(t *testing.T) {
  9747  	testJSONMarshal(t, &WorkflowDispatchEvent{}, "{}")
  9748  
  9749  	i := make(map[string]interface{})
  9750  	i["key"] = "value"
  9751  
  9752  	jsonMsg, _ := json.Marshal(i)
  9753  	u := &WorkflowDispatchEvent{
  9754  		Inputs:   jsonMsg,
  9755  		Ref:      String("r"),
  9756  		Workflow: String("w"),
  9757  		Repo: &Repository{
  9758  			ID:   Int64(1),
  9759  			URL:  String("s"),
  9760  			Name: String("n"),
  9761  		},
  9762  		Org: &Organization{
  9763  			BillingEmail:                         String("be"),
  9764  			Blog:                                 String("b"),
  9765  			Company:                              String("c"),
  9766  			Email:                                String("e"),
  9767  			TwitterUsername:                      String("tu"),
  9768  			Location:                             String("loc"),
  9769  			Name:                                 String("n"),
  9770  			Description:                          String("d"),
  9771  			IsVerified:                           Bool(true),
  9772  			HasOrganizationProjects:              Bool(true),
  9773  			HasRepositoryProjects:                Bool(true),
  9774  			DefaultRepoPermission:                String("drp"),
  9775  			MembersCanCreateRepos:                Bool(true),
  9776  			MembersCanCreateInternalRepos:        Bool(true),
  9777  			MembersCanCreatePrivateRepos:         Bool(true),
  9778  			MembersCanCreatePublicRepos:          Bool(false),
  9779  			MembersAllowedRepositoryCreationType: String("marct"),
  9780  			MembersCanCreatePages:                Bool(true),
  9781  			MembersCanCreatePublicPages:          Bool(false),
  9782  			MembersCanCreatePrivatePages:         Bool(true),
  9783  		},
  9784  		Sender: &User{
  9785  			Login:     String("l"),
  9786  			ID:        Int64(1),
  9787  			NodeID:    String("n"),
  9788  			URL:       String("u"),
  9789  			ReposURL:  String("r"),
  9790  			EventsURL: String("e"),
  9791  			AvatarURL: String("a"),
  9792  		},
  9793  	}
  9794  
  9795  	want := `{
  9796  		"inputs": {
  9797  			"key": "value"
  9798  		},
  9799  		"ref": "r",
  9800  		"workflow": "w",
  9801  		"repository": {
  9802  			"id": 1,
  9803  			"name": "n",
  9804  			"url": "s"
  9805  		},
  9806  		"organization": {
  9807  			"name": "n",
  9808  			"company": "c",
  9809  			"blog": "b",
  9810  			"location": "loc",
  9811  			"email": "e",
  9812  			"twitter_username": "tu",
  9813  			"description": "d",
  9814  			"billing_email": "be",
  9815  			"is_verified": true,
  9816  			"has_organization_projects": true,
  9817  			"has_repository_projects": true,
  9818  			"default_repository_permission": "drp",
  9819  			"members_can_create_repositories": true,
  9820  			"members_can_create_public_repositories": false,
  9821  			"members_can_create_private_repositories": true,
  9822  			"members_can_create_internal_repositories": true,
  9823  			"members_allowed_repository_creation_type": "marct",
  9824  			"members_can_create_pages": true,
  9825  			"members_can_create_public_pages": false,
  9826  			"members_can_create_private_pages": true
  9827  		},
  9828  		"sender": {
  9829  			"login": "l",
  9830  			"id": 1,
  9831  			"node_id": "n",
  9832  			"avatar_url": "a",
  9833  			"url": "u",
  9834  			"events_url": "e",
  9835  			"repos_url": "r"
  9836  		}
  9837  	}`
  9838  
  9839  	testJSONMarshal(t, u, want)
  9840  }
  9841  
  9842  func TestWatchEvent_Marshal(t *testing.T) {
  9843  	testJSONMarshal(t, &WatchEvent{}, "{}")
  9844  
  9845  	u := &WatchEvent{
  9846  		Action: String("a"),
  9847  		Repo: &Repository{
  9848  			ID:   Int64(1),
  9849  			URL:  String("s"),
  9850  			Name: String("n"),
  9851  		},
  9852  		Sender: &User{
  9853  			Login:     String("l"),
  9854  			ID:        Int64(1),
  9855  			NodeID:    String("n"),
  9856  			URL:       String("u"),
  9857  			ReposURL:  String("r"),
  9858  			EventsURL: String("e"),
  9859  			AvatarURL: String("a"),
  9860  		},
  9861  		Installation: &Installation{
  9862  			ID:       Int64(1),
  9863  			NodeID:   String("nid"),
  9864  			AppID:    Int64(1),
  9865  			AppSlug:  String("as"),
  9866  			TargetID: Int64(1),
  9867  			Account: &User{
  9868  				Login:           String("l"),
  9869  				ID:              Int64(1),
  9870  				URL:             String("u"),
  9871  				AvatarURL:       String("a"),
  9872  				GravatarID:      String("g"),
  9873  				Name:            String("n"),
  9874  				Company:         String("c"),
  9875  				Blog:            String("b"),
  9876  				Location:        String("l"),
  9877  				Email:           String("e"),
  9878  				Hireable:        Bool(true),
  9879  				Bio:             String("b"),
  9880  				TwitterUsername: String("t"),
  9881  				PublicRepos:     Int(1),
  9882  				Followers:       Int(1),
  9883  				Following:       Int(1),
  9884  				CreatedAt:       &Timestamp{referenceTime},
  9885  				SuspendedAt:     &Timestamp{referenceTime},
  9886  			},
  9887  			AccessTokensURL:     String("atu"),
  9888  			RepositoriesURL:     String("ru"),
  9889  			HTMLURL:             String("hu"),
  9890  			TargetType:          String("tt"),
  9891  			SingleFileName:      String("sfn"),
  9892  			RepositorySelection: String("rs"),
  9893  			Events:              []string{"e"},
  9894  			SingleFilePaths:     []string{"s"},
  9895  			Permissions: &InstallationPermissions{
  9896  				Actions:                       String("a"),
  9897  				Administration:                String("ad"),
  9898  				Checks:                        String("c"),
  9899  				Contents:                      String("co"),
  9900  				ContentReferences:             String("cr"),
  9901  				Deployments:                   String("d"),
  9902  				Environments:                  String("e"),
  9903  				Issues:                        String("i"),
  9904  				Metadata:                      String("md"),
  9905  				Members:                       String("m"),
  9906  				OrganizationAdministration:    String("oa"),
  9907  				OrganizationHooks:             String("oh"),
  9908  				OrganizationPlan:              String("op"),
  9909  				OrganizationPreReceiveHooks:   String("opr"),
  9910  				OrganizationProjects:          String("op"),
  9911  				OrganizationSecrets:           String("os"),
  9912  				OrganizationSelfHostedRunners: String("osh"),
  9913  				OrganizationUserBlocking:      String("oub"),
  9914  				Packages:                      String("pkg"),
  9915  				Pages:                         String("pg"),
  9916  				PullRequests:                  String("pr"),
  9917  				RepositoryHooks:               String("rh"),
  9918  				RepositoryProjects:            String("rp"),
  9919  				RepositoryPreReceiveHooks:     String("rprh"),
  9920  				Secrets:                       String("s"),
  9921  				SecretScanningAlerts:          String("ssa"),
  9922  				SecurityEvents:                String("se"),
  9923  				SingleFile:                    String("sf"),
  9924  				Statuses:                      String("s"),
  9925  				TeamDiscussions:               String("td"),
  9926  				VulnerabilityAlerts:           String("va"),
  9927  				Workflows:                     String("w"),
  9928  			},
  9929  			CreatedAt:              &Timestamp{referenceTime},
  9930  			UpdatedAt:              &Timestamp{referenceTime},
  9931  			HasMultipleSingleFiles: Bool(false),
  9932  			SuspendedBy: &User{
  9933  				Login:           String("l"),
  9934  				ID:              Int64(1),
  9935  				URL:             String("u"),
  9936  				AvatarURL:       String("a"),
  9937  				GravatarID:      String("g"),
  9938  				Name:            String("n"),
  9939  				Company:         String("c"),
  9940  				Blog:            String("b"),
  9941  				Location:        String("l"),
  9942  				Email:           String("e"),
  9943  				Hireable:        Bool(true),
  9944  				Bio:             String("b"),
  9945  				TwitterUsername: String("t"),
  9946  				PublicRepos:     Int(1),
  9947  				Followers:       Int(1),
  9948  				Following:       Int(1),
  9949  				CreatedAt:       &Timestamp{referenceTime},
  9950  				SuspendedAt:     &Timestamp{referenceTime},
  9951  			},
  9952  			SuspendedAt: &Timestamp{referenceTime},
  9953  		},
  9954  	}
  9955  
  9956  	want := `{
  9957  		"action": "a",
  9958  		"repository": {
  9959  			"id": 1,
  9960  			"name": "n",
  9961  			"url": "s"
  9962  		},
  9963  		"sender": {
  9964  			"login": "l",
  9965  			"id": 1,
  9966  			"node_id": "n",
  9967  			"avatar_url": "a",
  9968  			"url": "u",
  9969  			"events_url": "e",
  9970  			"repos_url": "r"
  9971  		},
  9972  		"installation": {
  9973  			"id": 1,
  9974  			"node_id": "nid",
  9975  			"app_id": 1,
  9976  			"app_slug": "as",
  9977  			"target_id": 1,
  9978  			"account": {
  9979  				"login": "l",
  9980  				"id": 1,
  9981  				"avatar_url": "a",
  9982  				"gravatar_id": "g",
  9983  				"name": "n",
  9984  				"company": "c",
  9985  				"blog": "b",
  9986  				"location": "l",
  9987  				"email": "e",
  9988  				"hireable": true,
  9989  				"bio": "b",
  9990  				"twitter_username": "t",
  9991  				"public_repos": 1,
  9992  				"followers": 1,
  9993  				"following": 1,
  9994  				"created_at": ` + referenceTimeStr + `,
  9995  				"suspended_at": ` + referenceTimeStr + `,
  9996  				"url": "u"
  9997  			},
  9998  			"access_tokens_url": "atu",
  9999  			"repositories_url": "ru",
 10000  			"html_url": "hu",
 10001  			"target_type": "tt",
 10002  			"single_file_name": "sfn",
 10003  			"repository_selection": "rs",
 10004  			"events": [
 10005  				"e"
 10006  			],
 10007  			"single_file_paths": [
 10008  				"s"
 10009  			],
 10010  			"permissions": {
 10011  				"actions": "a",
 10012  				"administration": "ad",
 10013  				"checks": "c",
 10014  				"contents": "co",
 10015  				"content_references": "cr",
 10016  				"deployments": "d",
 10017  				"environments": "e",
 10018  				"issues": "i",
 10019  				"metadata": "md",
 10020  				"members": "m",
 10021  				"organization_administration": "oa",
 10022  				"organization_hooks": "oh",
 10023  				"organization_plan": "op",
 10024  				"organization_pre_receive_hooks": "opr",
 10025  				"organization_projects": "op",
 10026  				"organization_secrets": "os",
 10027  				"organization_self_hosted_runners": "osh",
 10028  				"organization_user_blocking": "oub",
 10029  				"packages": "pkg",
 10030  				"pages": "pg",
 10031  				"pull_requests": "pr",
 10032  				"repository_hooks": "rh",
 10033  				"repository_projects": "rp",
 10034  				"repository_pre_receive_hooks": "rprh",
 10035  				"secrets": "s",
 10036  				"secret_scanning_alerts": "ssa",
 10037  				"security_events": "se",
 10038  				"single_file": "sf",
 10039  				"statuses": "s",
 10040  				"team_discussions": "td",
 10041  				"vulnerability_alerts": "va",
 10042  				"workflows": "w"
 10043  			},
 10044  			"created_at": ` + referenceTimeStr + `,
 10045  			"updated_at": ` + referenceTimeStr + `,
 10046  			"has_multiple_single_files": false,
 10047  			"suspended_by": {
 10048  				"login": "l",
 10049  				"id": 1,
 10050  				"avatar_url": "a",
 10051  				"gravatar_id": "g",
 10052  				"name": "n",
 10053  				"company": "c",
 10054  				"blog": "b",
 10055  				"location": "l",
 10056  				"email": "e",
 10057  				"hireable": true,
 10058  				"bio": "b",
 10059  				"twitter_username": "t",
 10060  				"public_repos": 1,
 10061  				"followers": 1,
 10062  				"following": 1,
 10063  				"created_at": ` + referenceTimeStr + `,
 10064  				"suspended_at": ` + referenceTimeStr + `,
 10065  				"url": "u"
 10066  			},
 10067  			"suspended_at": ` + referenceTimeStr + `
 10068  		}
 10069  	}`
 10070  
 10071  	testJSONMarshal(t, u, want)
 10072  }
 10073  
 10074  func TestUserEvent_Marshal(t *testing.T) {
 10075  	testJSONMarshal(t, &UserEvent{}, "{}")
 10076  
 10077  	u := &UserEvent{
 10078  		User: &User{
 10079  			Login:     String("l"),
 10080  			ID:        Int64(1),
 10081  			NodeID:    String("n"),
 10082  			URL:       String("u"),
 10083  			ReposURL:  String("r"),
 10084  			EventsURL: String("e"),
 10085  			AvatarURL: String("a"),
 10086  		},
 10087  		// The action performed. Possible values are: "created" or "deleted".
 10088  		Action: String("a"),
 10089  		Enterprise: &Enterprise{
 10090  			ID:          Int(1),
 10091  			Slug:        String("s"),
 10092  			Name:        String("n"),
 10093  			NodeID:      String("nid"),
 10094  			AvatarURL:   String("au"),
 10095  			Description: String("d"),
 10096  			WebsiteURL:  String("wu"),
 10097  			HTMLURL:     String("hu"),
 10098  			CreatedAt:   &Timestamp{referenceTime},
 10099  			UpdatedAt:   &Timestamp{referenceTime},
 10100  		},
 10101  		Sender: &User{
 10102  			Login:     String("l"),
 10103  			ID:        Int64(1),
 10104  			NodeID:    String("n"),
 10105  			URL:       String("u"),
 10106  			ReposURL:  String("r"),
 10107  			EventsURL: String("e"),
 10108  			AvatarURL: String("a"),
 10109  		},
 10110  	}
 10111  
 10112  	want := `{
 10113  		"user": {
 10114  			"login": "l",
 10115  			"id": 1,
 10116  			"node_id": "n",
 10117  			"avatar_url": "a",
 10118  			"url": "u",
 10119  			"events_url": "e",
 10120  			"repos_url": "r"
 10121  		},
 10122  		"action": "a",
 10123  		"enterprise": {
 10124  			"id": 1,
 10125  			"slug": "s",
 10126  			"name": "n",
 10127  			"node_id": "nid",
 10128  			"avatar_url": "au",
 10129  			"description": "d",
 10130  			"website_url": "wu",
 10131  			"html_url": "hu",
 10132  			"created_at": ` + referenceTimeStr + `,
 10133  			"updated_at": ` + referenceTimeStr + `
 10134  		},
 10135  		"sender": {
 10136  			"login": "l",
 10137  			"id": 1,
 10138  			"node_id": "n",
 10139  			"avatar_url": "a",
 10140  			"url": "u",
 10141  			"events_url": "e",
 10142  			"repos_url": "r"
 10143  		}
 10144  	}`
 10145  
 10146  	testJSONMarshal(t, u, want)
 10147  }
 10148  
 10149  func TestCheckRunEvent_Marshal(t *testing.T) {
 10150  	testJSONMarshal(t, &CheckRunEvent{}, "{}")
 10151  
 10152  	r := &CheckRunEvent{
 10153  		CheckRun: &CheckRun{
 10154  			ID:          Int64(1),
 10155  			NodeID:      String("n"),
 10156  			HeadSHA:     String("h"),
 10157  			ExternalID:  String("1"),
 10158  			URL:         String("u"),
 10159  			HTMLURL:     String("u"),
 10160  			DetailsURL:  String("u"),
 10161  			Status:      String("s"),
 10162  			Conclusion:  String("c"),
 10163  			StartedAt:   &Timestamp{referenceTime},
 10164  			CompletedAt: &Timestamp{referenceTime},
 10165  			Output: &CheckRunOutput{
 10166  				Annotations: []*CheckRunAnnotation{
 10167  					{
 10168  						AnnotationLevel: String("a"),
 10169  						EndLine:         Int(1),
 10170  						Message:         String("m"),
 10171  						Path:            String("p"),
 10172  						RawDetails:      String("r"),
 10173  						StartLine:       Int(1),
 10174  						Title:           String("t"),
 10175  					},
 10176  				},
 10177  				AnnotationsCount: Int(1),
 10178  				AnnotationsURL:   String("a"),
 10179  				Images: []*CheckRunImage{
 10180  					{
 10181  						Alt:      String("a"),
 10182  						ImageURL: String("i"),
 10183  						Caption:  String("c"),
 10184  					},
 10185  				},
 10186  				Title:   String("t"),
 10187  				Summary: String("s"),
 10188  				Text:    String("t"),
 10189  			},
 10190  			Name: String("n"),
 10191  			CheckSuite: &CheckSuite{
 10192  				ID: Int64(1),
 10193  			},
 10194  			App: &App{
 10195  				ID:     Int64(1),
 10196  				NodeID: String("n"),
 10197  				Owner: &User{
 10198  					Login:     String("l"),
 10199  					ID:        Int64(1),
 10200  					NodeID:    String("n"),
 10201  					URL:       String("u"),
 10202  					ReposURL:  String("r"),
 10203  					EventsURL: String("e"),
 10204  					AvatarURL: String("a"),
 10205  				},
 10206  				Name:        String("n"),
 10207  				Description: String("d"),
 10208  				HTMLURL:     String("h"),
 10209  				ExternalURL: String("u"),
 10210  				CreatedAt:   &Timestamp{referenceTime},
 10211  				UpdatedAt:   &Timestamp{referenceTime},
 10212  			},
 10213  			PullRequests: []*PullRequest{
 10214  				{
 10215  					URL:    String("u"),
 10216  					ID:     Int64(1),
 10217  					Number: Int(1),
 10218  					Head: &PullRequestBranch{
 10219  						Ref: String("r"),
 10220  						SHA: String("s"),
 10221  						Repo: &Repository{
 10222  							ID:   Int64(1),
 10223  							URL:  String("s"),
 10224  							Name: String("n"),
 10225  						},
 10226  					},
 10227  					Base: &PullRequestBranch{
 10228  						Ref: String("r"),
 10229  						SHA: String("s"),
 10230  						Repo: &Repository{
 10231  							ID:   Int64(1),
 10232  							URL:  String("u"),
 10233  							Name: String("n"),
 10234  						},
 10235  					},
 10236  				},
 10237  			},
 10238  		},
 10239  		Action: String("a"),
 10240  		Repo: &Repository{
 10241  			ID:   Int64(1),
 10242  			URL:  String("s"),
 10243  			Name: String("n"),
 10244  		},
 10245  		Org: &Organization{
 10246  			BillingEmail:                         String("be"),
 10247  			Blog:                                 String("b"),
 10248  			Company:                              String("c"),
 10249  			Email:                                String("e"),
 10250  			TwitterUsername:                      String("tu"),
 10251  			Location:                             String("loc"),
 10252  			Name:                                 String("n"),
 10253  			Description:                          String("d"),
 10254  			IsVerified:                           Bool(true),
 10255  			HasOrganizationProjects:              Bool(true),
 10256  			HasRepositoryProjects:                Bool(true),
 10257  			DefaultRepoPermission:                String("drp"),
 10258  			MembersCanCreateRepos:                Bool(true),
 10259  			MembersCanCreateInternalRepos:        Bool(true),
 10260  			MembersCanCreatePrivateRepos:         Bool(true),
 10261  			MembersCanCreatePublicRepos:          Bool(false),
 10262  			MembersAllowedRepositoryCreationType: String("marct"),
 10263  			MembersCanCreatePages:                Bool(true),
 10264  			MembersCanCreatePublicPages:          Bool(false),
 10265  			MembersCanCreatePrivatePages:         Bool(true),
 10266  		},
 10267  		Sender: &User{
 10268  			Login:     String("l"),
 10269  			ID:        Int64(1),
 10270  			NodeID:    String("n"),
 10271  			URL:       String("u"),
 10272  			ReposURL:  String("r"),
 10273  			EventsURL: String("e"),
 10274  			AvatarURL: String("a"),
 10275  		},
 10276  		Installation: &Installation{
 10277  			ID:       Int64(1),
 10278  			NodeID:   String("nid"),
 10279  			AppID:    Int64(1),
 10280  			AppSlug:  String("as"),
 10281  			TargetID: Int64(1),
 10282  			Account: &User{
 10283  				Login:           String("l"),
 10284  				ID:              Int64(1),
 10285  				URL:             String("u"),
 10286  				AvatarURL:       String("a"),
 10287  				GravatarID:      String("g"),
 10288  				Name:            String("n"),
 10289  				Company:         String("c"),
 10290  				Blog:            String("b"),
 10291  				Location:        String("l"),
 10292  				Email:           String("e"),
 10293  				Hireable:        Bool(true),
 10294  				Bio:             String("b"),
 10295  				TwitterUsername: String("t"),
 10296  				PublicRepos:     Int(1),
 10297  				Followers:       Int(1),
 10298  				Following:       Int(1),
 10299  				CreatedAt:       &Timestamp{referenceTime},
 10300  				SuspendedAt:     &Timestamp{referenceTime},
 10301  			},
 10302  			AccessTokensURL:     String("atu"),
 10303  			RepositoriesURL:     String("ru"),
 10304  			HTMLURL:             String("hu"),
 10305  			TargetType:          String("tt"),
 10306  			SingleFileName:      String("sfn"),
 10307  			RepositorySelection: String("rs"),
 10308  			Events:              []string{"e"},
 10309  			SingleFilePaths:     []string{"s"},
 10310  			Permissions: &InstallationPermissions{
 10311  				Actions:                       String("a"),
 10312  				Administration:                String("ad"),
 10313  				Checks:                        String("c"),
 10314  				Contents:                      String("co"),
 10315  				ContentReferences:             String("cr"),
 10316  				Deployments:                   String("d"),
 10317  				Environments:                  String("e"),
 10318  				Issues:                        String("i"),
 10319  				Metadata:                      String("md"),
 10320  				Members:                       String("m"),
 10321  				OrganizationAdministration:    String("oa"),
 10322  				OrganizationHooks:             String("oh"),
 10323  				OrganizationPlan:              String("op"),
 10324  				OrganizationPreReceiveHooks:   String("opr"),
 10325  				OrganizationProjects:          String("op"),
 10326  				OrganizationSecrets:           String("os"),
 10327  				OrganizationSelfHostedRunners: String("osh"),
 10328  				OrganizationUserBlocking:      String("oub"),
 10329  				Packages:                      String("pkg"),
 10330  				Pages:                         String("pg"),
 10331  				PullRequests:                  String("pr"),
 10332  				RepositoryHooks:               String("rh"),
 10333  				RepositoryProjects:            String("rp"),
 10334  				RepositoryPreReceiveHooks:     String("rprh"),
 10335  				Secrets:                       String("s"),
 10336  				SecretScanningAlerts:          String("ssa"),
 10337  				SecurityEvents:                String("se"),
 10338  				SingleFile:                    String("sf"),
 10339  				Statuses:                      String("s"),
 10340  				TeamDiscussions:               String("td"),
 10341  				VulnerabilityAlerts:           String("va"),
 10342  				Workflows:                     String("w"),
 10343  			},
 10344  			CreatedAt:              &Timestamp{referenceTime},
 10345  			UpdatedAt:              &Timestamp{referenceTime},
 10346  			HasMultipleSingleFiles: Bool(false),
 10347  			SuspendedBy: &User{
 10348  				Login:           String("l"),
 10349  				ID:              Int64(1),
 10350  				URL:             String("u"),
 10351  				AvatarURL:       String("a"),
 10352  				GravatarID:      String("g"),
 10353  				Name:            String("n"),
 10354  				Company:         String("c"),
 10355  				Blog:            String("b"),
 10356  				Location:        String("l"),
 10357  				Email:           String("e"),
 10358  				Hireable:        Bool(true),
 10359  				Bio:             String("b"),
 10360  				TwitterUsername: String("t"),
 10361  				PublicRepos:     Int(1),
 10362  				Followers:       Int(1),
 10363  				Following:       Int(1),
 10364  				CreatedAt:       &Timestamp{referenceTime},
 10365  				SuspendedAt:     &Timestamp{referenceTime},
 10366  			},
 10367  			SuspendedAt: &Timestamp{referenceTime},
 10368  		},
 10369  		RequestedAction: &RequestedAction{
 10370  			Identifier: "i",
 10371  		},
 10372  	}
 10373  
 10374  	want := `{
 10375  		"check_run": {
 10376  			"id": 1,
 10377  			"node_id": "n",
 10378  			"head_sha": "h",
 10379  			"external_id": "1",
 10380  			"url": "u",
 10381  			"html_url": "u",
 10382  			"details_url": "u",
 10383  			"status": "s",
 10384  			"conclusion": "c",
 10385  			"started_at": ` + referenceTimeStr + `,
 10386  			"completed_at": ` + referenceTimeStr + `,
 10387  			"output": {
 10388  				"title": "t",
 10389  				"summary": "s",
 10390  				"text": "t",
 10391  				"annotations_count": 1,
 10392  				"annotations_url": "a",
 10393  				"annotations": [
 10394  					{
 10395  						"path": "p",
 10396  						"start_line": 1,
 10397  						"end_line": 1,
 10398  						"annotation_level": "a",
 10399  						"message": "m",
 10400  						"title": "t",
 10401  						"raw_details": "r"
 10402  					}
 10403  				],
 10404  				"images": [
 10405  					{
 10406  						"alt": "a",
 10407  						"image_url": "i",
 10408  						"caption": "c"
 10409  					}
 10410  				]
 10411  			},
 10412  			"name": "n",
 10413  			"check_suite": {
 10414  				"id": 1
 10415  			},
 10416  			"app": {
 10417  				"id": 1,
 10418  				"node_id": "n",
 10419  				"owner": {
 10420  					"login": "l",
 10421  					"id": 1,
 10422  					"node_id": "n",
 10423  					"avatar_url": "a",
 10424  					"url": "u",
 10425  					"events_url": "e",
 10426  					"repos_url": "r"
 10427  				},
 10428  				"name": "n",
 10429  				"description": "d",
 10430  				"external_url": "u",
 10431  				"html_url": "h",
 10432  				"created_at": ` + referenceTimeStr + `,
 10433  				"updated_at": ` + referenceTimeStr + `
 10434  			},
 10435  			"pull_requests": [
 10436  				{
 10437  					"id": 1,
 10438  					"number": 1,
 10439  					"url": "u",
 10440  					"head": {
 10441  						"ref": "r",
 10442  						"sha": "s",
 10443  						"repo": {
 10444  							"id": 1,
 10445  							"name": "n",
 10446  							"url": "s"
 10447  						}
 10448  					},
 10449  					"base": {
 10450  						"ref": "r",
 10451  						"sha": "s",
 10452  						"repo": {
 10453  							"id": 1,
 10454  							"name": "n",
 10455  							"url": "u"
 10456  						}
 10457  					}
 10458  				}
 10459  			]
 10460  		},
 10461  		"action": "a",
 10462  		"repository": {
 10463  			"id": 1,
 10464  			"name": "n",
 10465  			"url": "s"
 10466  		},
 10467  		"organization": {
 10468  			"name": "n",
 10469  			"company": "c",
 10470  			"blog": "b",
 10471  			"location": "loc",
 10472  			"email": "e",
 10473  			"twitter_username": "tu",
 10474  			"description": "d",
 10475  			"billing_email": "be",
 10476  			"is_verified": true,
 10477  			"has_organization_projects": true,
 10478  			"has_repository_projects": true,
 10479  			"default_repository_permission": "drp",
 10480  			"members_can_create_repositories": true,
 10481  			"members_can_create_public_repositories": false,
 10482  			"members_can_create_private_repositories": true,
 10483  			"members_can_create_internal_repositories": true,
 10484  			"members_allowed_repository_creation_type": "marct",
 10485  			"members_can_create_pages": true,
 10486  			"members_can_create_public_pages": false,
 10487  			"members_can_create_private_pages": true
 10488  		},
 10489  		"sender": {
 10490  			"login": "l",
 10491  			"id": 1,
 10492  			"node_id": "n",
 10493  			"avatar_url": "a",
 10494  			"url": "u",
 10495  			"events_url": "e",
 10496  			"repos_url": "r"
 10497  		},
 10498  		"installation": {
 10499  			"id": 1,
 10500  			"node_id": "nid",
 10501  			"app_id": 1,
 10502  			"app_slug": "as",
 10503  			"target_id": 1,
 10504  			"account": {
 10505  				"login": "l",
 10506  				"id": 1,
 10507  				"avatar_url": "a",
 10508  				"gravatar_id": "g",
 10509  				"name": "n",
 10510  				"company": "c",
 10511  				"blog": "b",
 10512  				"location": "l",
 10513  				"email": "e",
 10514  				"hireable": true,
 10515  				"bio": "b",
 10516  				"twitter_username": "t",
 10517  				"public_repos": 1,
 10518  				"followers": 1,
 10519  				"following": 1,
 10520  				"created_at": ` + referenceTimeStr + `,
 10521  				"suspended_at": ` + referenceTimeStr + `,
 10522  				"url": "u"
 10523  			},
 10524  			"access_tokens_url": "atu",
 10525  			"repositories_url": "ru",
 10526  			"html_url": "hu",
 10527  			"target_type": "tt",
 10528  			"single_file_name": "sfn",
 10529  			"repository_selection": "rs",
 10530  			"events": [
 10531  				"e"
 10532  			],
 10533  			"single_file_paths": [
 10534  				"s"
 10535  			],
 10536  			"permissions": {
 10537  				"actions": "a",
 10538  				"administration": "ad",
 10539  				"checks": "c",
 10540  				"contents": "co",
 10541  				"content_references": "cr",
 10542  				"deployments": "d",
 10543  				"environments": "e",
 10544  				"issues": "i",
 10545  				"metadata": "md",
 10546  				"members": "m",
 10547  				"organization_administration": "oa",
 10548  				"organization_hooks": "oh",
 10549  				"organization_plan": "op",
 10550  				"organization_pre_receive_hooks": "opr",
 10551  				"organization_projects": "op",
 10552  				"organization_secrets": "os",
 10553  				"organization_self_hosted_runners": "osh",
 10554  				"organization_user_blocking": "oub",
 10555  				"packages": "pkg",
 10556  				"pages": "pg",
 10557  				"pull_requests": "pr",
 10558  				"repository_hooks": "rh",
 10559  				"repository_projects": "rp",
 10560  				"repository_pre_receive_hooks": "rprh",
 10561  				"secrets": "s",
 10562  				"secret_scanning_alerts": "ssa",
 10563  				"security_events": "se",
 10564  				"single_file": "sf",
 10565  				"statuses": "s",
 10566  				"team_discussions": "td",
 10567  				"vulnerability_alerts": "va",
 10568  				"workflows": "w"
 10569  			},
 10570  			"created_at": ` + referenceTimeStr + `,
 10571  			"updated_at": ` + referenceTimeStr + `,
 10572  			"has_multiple_single_files": false,
 10573  			"suspended_by": {
 10574  				"login": "l",
 10575  				"id": 1,
 10576  				"avatar_url": "a",
 10577  				"gravatar_id": "g",
 10578  				"name": "n",
 10579  				"company": "c",
 10580  				"blog": "b",
 10581  				"location": "l",
 10582  				"email": "e",
 10583  				"hireable": true,
 10584  				"bio": "b",
 10585  				"twitter_username": "t",
 10586  				"public_repos": 1,
 10587  				"followers": 1,
 10588  				"following": 1,
 10589  				"created_at": ` + referenceTimeStr + `,
 10590  				"suspended_at": ` + referenceTimeStr + `,
 10591  				"url": "u"
 10592  			},
 10593  			"suspended_at": ` + referenceTimeStr + `
 10594  		},
 10595  		"requested_action": {
 10596  			"identifier": "i"
 10597  		}
 10598  	}`
 10599  
 10600  	testJSONMarshal(t, r, want)
 10601  }
 10602  
 10603  func TestCheckSuiteEvent_Marshal(t *testing.T) {
 10604  	testJSONMarshal(t, &CheckSuiteEvent{}, "{}")
 10605  
 10606  	r := &CheckSuiteEvent{
 10607  		CheckSuite: &CheckSuite{
 10608  			ID:         Int64(1),
 10609  			NodeID:     String("n"),
 10610  			HeadBranch: String("h"),
 10611  			HeadSHA:    String("h"),
 10612  			URL:        String("u"),
 10613  			BeforeSHA:  String("b"),
 10614  			AfterSHA:   String("a"),
 10615  			Status:     String("s"),
 10616  			Conclusion: String("c"),
 10617  			App: &App{
 10618  				ID:     Int64(1),
 10619  				NodeID: String("n"),
 10620  				Owner: &User{
 10621  					Login:     String("l"),
 10622  					ID:        Int64(1),
 10623  					NodeID:    String("n"),
 10624  					URL:       String("u"),
 10625  					ReposURL:  String("r"),
 10626  					EventsURL: String("e"),
 10627  					AvatarURL: String("a"),
 10628  				},
 10629  				Name:        String("n"),
 10630  				Description: String("d"),
 10631  				HTMLURL:     String("h"),
 10632  				ExternalURL: String("u"),
 10633  				CreatedAt:   &Timestamp{referenceTime},
 10634  				UpdatedAt:   &Timestamp{referenceTime},
 10635  			},
 10636  			Repository: &Repository{
 10637  				ID: Int64(1),
 10638  			},
 10639  			PullRequests: []*PullRequest{
 10640  				{
 10641  					URL:    String("u"),
 10642  					ID:     Int64(1),
 10643  					Number: Int(1),
 10644  					Head: &PullRequestBranch{
 10645  						Ref: String("r"),
 10646  						SHA: String("s"),
 10647  						Repo: &Repository{
 10648  							ID:   Int64(1),
 10649  							URL:  String("s"),
 10650  							Name: String("n"),
 10651  						},
 10652  					},
 10653  					Base: &PullRequestBranch{
 10654  						Ref: String("r"),
 10655  						SHA: String("s"),
 10656  						Repo: &Repository{
 10657  							ID:   Int64(1),
 10658  							URL:  String("u"),
 10659  							Name: String("n"),
 10660  						},
 10661  					},
 10662  				},
 10663  			},
 10664  			HeadCommit: &Commit{
 10665  				SHA: String("s"),
 10666  			},
 10667  		},
 10668  		Action: String("a"),
 10669  		Repo: &Repository{
 10670  			ID:   Int64(1),
 10671  			URL:  String("s"),
 10672  			Name: String("n"),
 10673  		},
 10674  		Org: &Organization{
 10675  			BillingEmail:                         String("be"),
 10676  			Blog:                                 String("b"),
 10677  			Company:                              String("c"),
 10678  			Email:                                String("e"),
 10679  			TwitterUsername:                      String("tu"),
 10680  			Location:                             String("loc"),
 10681  			Name:                                 String("n"),
 10682  			Description:                          String("d"),
 10683  			IsVerified:                           Bool(true),
 10684  			HasOrganizationProjects:              Bool(true),
 10685  			HasRepositoryProjects:                Bool(true),
 10686  			DefaultRepoPermission:                String("drp"),
 10687  			MembersCanCreateRepos:                Bool(true),
 10688  			MembersCanCreateInternalRepos:        Bool(true),
 10689  			MembersCanCreatePrivateRepos:         Bool(true),
 10690  			MembersCanCreatePublicRepos:          Bool(false),
 10691  			MembersAllowedRepositoryCreationType: String("marct"),
 10692  			MembersCanCreatePages:                Bool(true),
 10693  			MembersCanCreatePublicPages:          Bool(false),
 10694  			MembersCanCreatePrivatePages:         Bool(true),
 10695  		},
 10696  		Sender: &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  		Installation: &Installation{
 10706  			ID:       Int64(1),
 10707  			NodeID:   String("nid"),
 10708  			AppID:    Int64(1),
 10709  			AppSlug:  String("as"),
 10710  			TargetID: Int64(1),
 10711  			Account: &User{
 10712  				Login:           String("l"),
 10713  				ID:              Int64(1),
 10714  				URL:             String("u"),
 10715  				AvatarURL:       String("a"),
 10716  				GravatarID:      String("g"),
 10717  				Name:            String("n"),
 10718  				Company:         String("c"),
 10719  				Blog:            String("b"),
 10720  				Location:        String("l"),
 10721  				Email:           String("e"),
 10722  				Hireable:        Bool(true),
 10723  				Bio:             String("b"),
 10724  				TwitterUsername: String("t"),
 10725  				PublicRepos:     Int(1),
 10726  				Followers:       Int(1),
 10727  				Following:       Int(1),
 10728  				CreatedAt:       &Timestamp{referenceTime},
 10729  				SuspendedAt:     &Timestamp{referenceTime},
 10730  			},
 10731  			AccessTokensURL:     String("atu"),
 10732  			RepositoriesURL:     String("ru"),
 10733  			HTMLURL:             String("hu"),
 10734  			TargetType:          String("tt"),
 10735  			SingleFileName:      String("sfn"),
 10736  			RepositorySelection: String("rs"),
 10737  			Events:              []string{"e"},
 10738  			SingleFilePaths:     []string{"s"},
 10739  			Permissions: &InstallationPermissions{
 10740  				Actions:                       String("a"),
 10741  				Administration:                String("ad"),
 10742  				Checks:                        String("c"),
 10743  				Contents:                      String("co"),
 10744  				ContentReferences:             String("cr"),
 10745  				Deployments:                   String("d"),
 10746  				Environments:                  String("e"),
 10747  				Issues:                        String("i"),
 10748  				Metadata:                      String("md"),
 10749  				Members:                       String("m"),
 10750  				OrganizationAdministration:    String("oa"),
 10751  				OrganizationHooks:             String("oh"),
 10752  				OrganizationPlan:              String("op"),
 10753  				OrganizationPreReceiveHooks:   String("opr"),
 10754  				OrganizationProjects:          String("op"),
 10755  				OrganizationSecrets:           String("os"),
 10756  				OrganizationSelfHostedRunners: String("osh"),
 10757  				OrganizationUserBlocking:      String("oub"),
 10758  				Packages:                      String("pkg"),
 10759  				Pages:                         String("pg"),
 10760  				PullRequests:                  String("pr"),
 10761  				RepositoryHooks:               String("rh"),
 10762  				RepositoryProjects:            String("rp"),
 10763  				RepositoryPreReceiveHooks:     String("rprh"),
 10764  				Secrets:                       String("s"),
 10765  				SecretScanningAlerts:          String("ssa"),
 10766  				SecurityEvents:                String("se"),
 10767  				SingleFile:                    String("sf"),
 10768  				Statuses:                      String("s"),
 10769  				TeamDiscussions:               String("td"),
 10770  				VulnerabilityAlerts:           String("va"),
 10771  				Workflows:                     String("w"),
 10772  			},
 10773  			CreatedAt:              &Timestamp{referenceTime},
 10774  			UpdatedAt:              &Timestamp{referenceTime},
 10775  			HasMultipleSingleFiles: Bool(false),
 10776  			SuspendedBy: &User{
 10777  				Login:           String("l"),
 10778  				ID:              Int64(1),
 10779  				URL:             String("u"),
 10780  				AvatarURL:       String("a"),
 10781  				GravatarID:      String("g"),
 10782  				Name:            String("n"),
 10783  				Company:         String("c"),
 10784  				Blog:            String("b"),
 10785  				Location:        String("l"),
 10786  				Email:           String("e"),
 10787  				Hireable:        Bool(true),
 10788  				Bio:             String("b"),
 10789  				TwitterUsername: String("t"),
 10790  				PublicRepos:     Int(1),
 10791  				Followers:       Int(1),
 10792  				Following:       Int(1),
 10793  				CreatedAt:       &Timestamp{referenceTime},
 10794  				SuspendedAt:     &Timestamp{referenceTime},
 10795  			},
 10796  			SuspendedAt: &Timestamp{referenceTime},
 10797  		},
 10798  	}
 10799  
 10800  	want := `{
 10801  		"check_suite": {
 10802  			"id": 1,
 10803  			"node_id": "n",
 10804  			"head_branch": "h",
 10805  			"head_sha": "h",
 10806  			"url": "u",
 10807  			"before": "b",
 10808  			"after": "a",
 10809  			"status": "s",
 10810  			"conclusion": "c",
 10811  			"app": {
 10812  				"id": 1,
 10813  				"node_id": "n",
 10814  				"owner": {
 10815  					"login": "l",
 10816  					"id": 1,
 10817  					"node_id": "n",
 10818  					"avatar_url": "a",
 10819  					"url": "u",
 10820  					"events_url": "e",
 10821  					"repos_url": "r"
 10822  				},
 10823  				"name": "n",
 10824  				"description": "d",
 10825  				"external_url": "u",
 10826  				"html_url": "h",
 10827  				"created_at": ` + referenceTimeStr + `,
 10828  				"updated_at": ` + referenceTimeStr + `
 10829  			},
 10830  			"repository": {
 10831  				"id": 1
 10832  			},
 10833  			"pull_requests": [
 10834  			{
 10835  				"id": 1,
 10836  				"number": 1,
 10837  				"url": "u",
 10838  				"head": {
 10839  					"ref": "r",
 10840  					"sha": "s",
 10841  					"repo": {
 10842  						"id": 1,
 10843  						"name": "n",
 10844  						"url": "s"
 10845  					}
 10846  				},
 10847  				"base": {
 10848  					"ref": "r",
 10849  					"sha": "s",
 10850  					"repo": {
 10851  						"id": 1,
 10852  						"name": "n",
 10853  						"url": "u"
 10854  					}
 10855  				}
 10856  			}
 10857  		],
 10858  		"head_commit": {
 10859  			"sha": "s"
 10860  		}
 10861  		},
 10862  		"action": "a",
 10863  		"repository": {
 10864  			"id": 1,
 10865  			"name": "n",
 10866  			"url": "s"
 10867  		},
 10868  		"organization": {
 10869  			"name": "n",
 10870  			"company": "c",
 10871  			"blog": "b",
 10872  			"location": "loc",
 10873  			"email": "e",
 10874  			"twitter_username": "tu",
 10875  			"description": "d",
 10876  			"billing_email": "be",
 10877  			"is_verified": true,
 10878  			"has_organization_projects": true,
 10879  			"has_repository_projects": true,
 10880  			"default_repository_permission": "drp",
 10881  			"members_can_create_repositories": true,
 10882  			"members_can_create_public_repositories": false,
 10883  			"members_can_create_private_repositories": true,
 10884  			"members_can_create_internal_repositories": true,
 10885  			"members_allowed_repository_creation_type": "marct",
 10886  			"members_can_create_pages": true,
 10887  			"members_can_create_public_pages": false,
 10888  			"members_can_create_private_pages": true
 10889  		},
 10890  		"sender": {
 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  		"installation": {
 10900  			"id": 1,
 10901  			"node_id": "nid",
 10902  			"app_id": 1,
 10903  			"app_slug": "as",
 10904  			"target_id": 1,
 10905  			"account": {
 10906  				"login": "l",
 10907  				"id": 1,
 10908  				"avatar_url": "a",
 10909  				"gravatar_id": "g",
 10910  				"name": "n",
 10911  				"company": "c",
 10912  				"blog": "b",
 10913  				"location": "l",
 10914  				"email": "e",
 10915  				"hireable": true,
 10916  				"bio": "b",
 10917  				"twitter_username": "t",
 10918  				"public_repos": 1,
 10919  				"followers": 1,
 10920  				"following": 1,
 10921  				"created_at": ` + referenceTimeStr + `,
 10922  				"suspended_at": ` + referenceTimeStr + `,
 10923  				"url": "u"
 10924  			},
 10925  			"access_tokens_url": "atu",
 10926  			"repositories_url": "ru",
 10927  			"html_url": "hu",
 10928  			"target_type": "tt",
 10929  			"single_file_name": "sfn",
 10930  			"repository_selection": "rs",
 10931  			"events": [
 10932  				"e"
 10933  			],
 10934  			"single_file_paths": [
 10935  				"s"
 10936  			],
 10937  			"permissions": {
 10938  				"actions": "a",
 10939  				"administration": "ad",
 10940  				"checks": "c",
 10941  				"contents": "co",
 10942  				"content_references": "cr",
 10943  				"deployments": "d",
 10944  				"environments": "e",
 10945  				"issues": "i",
 10946  				"metadata": "md",
 10947  				"members": "m",
 10948  				"organization_administration": "oa",
 10949  				"organization_hooks": "oh",
 10950  				"organization_plan": "op",
 10951  				"organization_pre_receive_hooks": "opr",
 10952  				"organization_projects": "op",
 10953  				"organization_secrets": "os",
 10954  				"organization_self_hosted_runners": "osh",
 10955  				"organization_user_blocking": "oub",
 10956  				"packages": "pkg",
 10957  				"pages": "pg",
 10958  				"pull_requests": "pr",
 10959  				"repository_hooks": "rh",
 10960  				"repository_projects": "rp",
 10961  				"repository_pre_receive_hooks": "rprh",
 10962  				"secrets": "s",
 10963  				"secret_scanning_alerts": "ssa",
 10964  				"security_events": "se",
 10965  				"single_file": "sf",
 10966  				"statuses": "s",
 10967  				"team_discussions": "td",
 10968  				"vulnerability_alerts": "va",
 10969  				"workflows": "w"
 10970  			},
 10971  			"created_at": ` + referenceTimeStr + `,
 10972  			"updated_at": ` + referenceTimeStr + `,
 10973  			"has_multiple_single_files": false,
 10974  			"suspended_by": {
 10975  				"login": "l",
 10976  				"id": 1,
 10977  				"avatar_url": "a",
 10978  				"gravatar_id": "g",
 10979  				"name": "n",
 10980  				"company": "c",
 10981  				"blog": "b",
 10982  				"location": "l",
 10983  				"email": "e",
 10984  				"hireable": true,
 10985  				"bio": "b",
 10986  				"twitter_username": "t",
 10987  				"public_repos": 1,
 10988  				"followers": 1,
 10989  				"following": 1,
 10990  				"created_at": ` + referenceTimeStr + `,
 10991  				"suspended_at": ` + referenceTimeStr + `,
 10992  				"url": "u"
 10993  			},
 10994  			"suspended_at": ` + referenceTimeStr + `
 10995  		}
 10996  	}`
 10997  
 10998  	testJSONMarshal(t, r, want)
 10999  }
 11000  
 11001  func TestDeployKeyEvent_Marshal(t *testing.T) {
 11002  	testJSONMarshal(t, &DeployKeyEvent{}, "{}")
 11003  
 11004  	u := &DeployKeyEvent{
 11005  		Action: String("a"),
 11006  		Key: &Key{
 11007  			ID:        Int64(1),
 11008  			Key:       String("k"),
 11009  			URL:       String("k"),
 11010  			Title:     String("k"),
 11011  			ReadOnly:  Bool(false),
 11012  			Verified:  Bool(false),
 11013  			CreatedAt: &Timestamp{referenceTime},
 11014  		},
 11015  		Repo: &Repository{
 11016  			ID:   Int64(1),
 11017  			URL:  String("s"),
 11018  			Name: String("n"),
 11019  		},
 11020  		Organization: &Organization{
 11021  			BillingEmail:                         String("be"),
 11022  			Blog:                                 String("b"),
 11023  			Company:                              String("c"),
 11024  			Email:                                String("e"),
 11025  			TwitterUsername:                      String("tu"),
 11026  			Location:                             String("loc"),
 11027  			Name:                                 String("n"),
 11028  			Description:                          String("d"),
 11029  			IsVerified:                           Bool(true),
 11030  			HasOrganizationProjects:              Bool(true),
 11031  			HasRepositoryProjects:                Bool(true),
 11032  			DefaultRepoPermission:                String("drp"),
 11033  			MembersCanCreateRepos:                Bool(true),
 11034  			MembersCanCreateInternalRepos:        Bool(true),
 11035  			MembersCanCreatePrivateRepos:         Bool(true),
 11036  			MembersCanCreatePublicRepos:          Bool(false),
 11037  			MembersAllowedRepositoryCreationType: String("marct"),
 11038  			MembersCanCreatePages:                Bool(true),
 11039  			MembersCanCreatePublicPages:          Bool(false),
 11040  			MembersCanCreatePrivatePages:         Bool(true),
 11041  		},
 11042  		Sender: &User{
 11043  			Login:     String("l"),
 11044  			ID:        Int64(1),
 11045  			NodeID:    String("n"),
 11046  			AvatarURL: String("a"),
 11047  			URL:       String("u"),
 11048  			EventsURL: String("e"),
 11049  			ReposURL:  String("r"),
 11050  		},
 11051  	}
 11052  
 11053  	want := `{
 11054  		"action": "a",
 11055  		"key": {
 11056  			"id": 1,
 11057  			"key": "k",
 11058  			"url": "k",
 11059  			"title": "k",
 11060  			"read_only": false,
 11061  			"verified": false,
 11062  			"created_at": ` + referenceTimeStr + `
 11063  		},
 11064  		"repository": {
 11065  			"id": 1,
 11066  			"name": "n",
 11067  			"url": "s"
 11068  		},
 11069  		"organization": {
 11070  			"name": "n",
 11071  			"company": "c",
 11072  			"blog": "b",
 11073  			"location": "loc",
 11074  			"email": "e",
 11075  			"twitter_username": "tu",
 11076  			"description": "d",
 11077  			"billing_email": "be",
 11078  			"is_verified": true,
 11079  			"has_organization_projects": true,
 11080  			"has_repository_projects": true,
 11081  			"default_repository_permission": "drp",
 11082  			"members_can_create_repositories": true,
 11083  			"members_can_create_public_repositories": false,
 11084  			"members_can_create_private_repositories": true,
 11085  			"members_can_create_internal_repositories": true,
 11086  			"members_allowed_repository_creation_type": "marct",
 11087  			"members_can_create_pages": true,
 11088  			"members_can_create_public_pages": false,
 11089  			"members_can_create_private_pages": true
 11090  		},
 11091  		"sender": {
 11092  			"login": "l",
 11093  			"id": 1,
 11094  			"node_id": "n",
 11095  			"avatar_url": "a",
 11096  			"url": "u",
 11097  			"events_url": "e",
 11098  			"repos_url": "r"
 11099  		}
 11100  	}`
 11101  
 11102  	testJSONMarshal(t, u, want)
 11103  }
 11104  
 11105  func TestMetaEvent_Marshal(t *testing.T) {
 11106  	testJSONMarshal(t, &MetaEvent{}, "{}")
 11107  
 11108  	v := make(map[string]interface{})
 11109  	v["a"] = "b"
 11110  
 11111  	u := &MetaEvent{
 11112  		Action: String("a"),
 11113  		HookID: Int64(1),
 11114  		Hook: &Hook{
 11115  			CreatedAt:    &Timestamp{referenceTime},
 11116  			UpdatedAt:    &Timestamp{referenceTime},
 11117  			URL:          String("u"),
 11118  			ID:           Int64(1),
 11119  			Type:         String("t"),
 11120  			Name:         String("n"),
 11121  			TestURL:      String("tu"),
 11122  			PingURL:      String("pu"),
 11123  			LastResponse: v,
 11124  			Config:       v,
 11125  			Events:       []string{"a"},
 11126  			Active:       Bool(true),
 11127  		},
 11128  	}
 11129  
 11130  	want := `{
 11131  		"action": "a",
 11132  		"hook_id": 1,
 11133  		"hook": {
 11134  			"created_at": ` + referenceTimeStr + `,
 11135  			"updated_at": ` + referenceTimeStr + `,
 11136  			"url": "u",
 11137  			"id": 1,
 11138  			"type": "t",
 11139  			"name": "n",
 11140  			"test_url": "tu",
 11141  			"ping_url": "pu",
 11142  			"last_response": {
 11143  				"a": "b"
 11144  			},
 11145  			"config": {
 11146  				"a": "b"
 11147  			},
 11148  			"events": [
 11149  				"a"
 11150  			],
 11151  			"active": true
 11152  		}
 11153  	}`
 11154  
 11155  	testJSONMarshal(t, u, want)
 11156  }
 11157  
 11158  func TestRequestedAction_Marshal(t *testing.T) {
 11159  	testJSONMarshal(t, &RequestedAction{}, "{}")
 11160  
 11161  	r := &RequestedAction{
 11162  		Identifier: "i",
 11163  	}
 11164  
 11165  	want := `{
 11166  		"identifier": "i"
 11167  	}`
 11168  
 11169  	testJSONMarshal(t, r, want)
 11170  }
 11171  
 11172  func TestCreateEvent_Marshal(t *testing.T) {
 11173  	testJSONMarshal(t, &CreateEvent{}, "{}")
 11174  
 11175  	r := &CreateEvent{
 11176  		Ref:          String("r"),
 11177  		RefType:      String("rt"),
 11178  		MasterBranch: String("mb"),
 11179  		Description:  String("d"),
 11180  		PusherType:   String("pt"),
 11181  		Repo: &Repository{
 11182  			ID:   Int64(1),
 11183  			URL:  String("s"),
 11184  			Name: String("n"),
 11185  		},
 11186  		Sender: &User{
 11187  			Login:     String("l"),
 11188  			ID:        Int64(1),
 11189  			NodeID:    String("n"),
 11190  			URL:       String("u"),
 11191  			ReposURL:  String("r"),
 11192  			EventsURL: String("e"),
 11193  			AvatarURL: String("a"),
 11194  		},
 11195  		Installation: &Installation{
 11196  			ID:       Int64(1),
 11197  			NodeID:   String("nid"),
 11198  			AppID:    Int64(1),
 11199  			AppSlug:  String("as"),
 11200  			TargetID: Int64(1),
 11201  			Account: &User{
 11202  				Login:           String("l"),
 11203  				ID:              Int64(1),
 11204  				URL:             String("u"),
 11205  				AvatarURL:       String("a"),
 11206  				GravatarID:      String("g"),
 11207  				Name:            String("n"),
 11208  				Company:         String("c"),
 11209  				Blog:            String("b"),
 11210  				Location:        String("l"),
 11211  				Email:           String("e"),
 11212  				Hireable:        Bool(true),
 11213  				Bio:             String("b"),
 11214  				TwitterUsername: String("t"),
 11215  				PublicRepos:     Int(1),
 11216  				Followers:       Int(1),
 11217  				Following:       Int(1),
 11218  				CreatedAt:       &Timestamp{referenceTime},
 11219  				SuspendedAt:     &Timestamp{referenceTime},
 11220  			},
 11221  			AccessTokensURL:     String("atu"),
 11222  			RepositoriesURL:     String("ru"),
 11223  			HTMLURL:             String("hu"),
 11224  			TargetType:          String("tt"),
 11225  			SingleFileName:      String("sfn"),
 11226  			RepositorySelection: String("rs"),
 11227  			Events:              []string{"e"},
 11228  			SingleFilePaths:     []string{"s"},
 11229  			Permissions: &InstallationPermissions{
 11230  				Actions:                       String("a"),
 11231  				Administration:                String("ad"),
 11232  				Checks:                        String("c"),
 11233  				Contents:                      String("co"),
 11234  				ContentReferences:             String("cr"),
 11235  				Deployments:                   String("d"),
 11236  				Environments:                  String("e"),
 11237  				Issues:                        String("i"),
 11238  				Metadata:                      String("md"),
 11239  				Members:                       String("m"),
 11240  				OrganizationAdministration:    String("oa"),
 11241  				OrganizationHooks:             String("oh"),
 11242  				OrganizationPlan:              String("op"),
 11243  				OrganizationPreReceiveHooks:   String("opr"),
 11244  				OrganizationProjects:          String("op"),
 11245  				OrganizationSecrets:           String("os"),
 11246  				OrganizationSelfHostedRunners: String("osh"),
 11247  				OrganizationUserBlocking:      String("oub"),
 11248  				Packages:                      String("pkg"),
 11249  				Pages:                         String("pg"),
 11250  				PullRequests:                  String("pr"),
 11251  				RepositoryHooks:               String("rh"),
 11252  				RepositoryProjects:            String("rp"),
 11253  				RepositoryPreReceiveHooks:     String("rprh"),
 11254  				Secrets:                       String("s"),
 11255  				SecretScanningAlerts:          String("ssa"),
 11256  				SecurityEvents:                String("se"),
 11257  				SingleFile:                    String("sf"),
 11258  				Statuses:                      String("s"),
 11259  				TeamDiscussions:               String("td"),
 11260  				VulnerabilityAlerts:           String("va"),
 11261  				Workflows:                     String("w"),
 11262  			},
 11263  			CreatedAt:              &Timestamp{referenceTime},
 11264  			UpdatedAt:              &Timestamp{referenceTime},
 11265  			HasMultipleSingleFiles: Bool(false),
 11266  			SuspendedBy: &User{
 11267  				Login:           String("l"),
 11268  				ID:              Int64(1),
 11269  				URL:             String("u"),
 11270  				AvatarURL:       String("a"),
 11271  				GravatarID:      String("g"),
 11272  				Name:            String("n"),
 11273  				Company:         String("c"),
 11274  				Blog:            String("b"),
 11275  				Location:        String("l"),
 11276  				Email:           String("e"),
 11277  				Hireable:        Bool(true),
 11278  				Bio:             String("b"),
 11279  				TwitterUsername: String("t"),
 11280  				PublicRepos:     Int(1),
 11281  				Followers:       Int(1),
 11282  				Following:       Int(1),
 11283  				CreatedAt:       &Timestamp{referenceTime},
 11284  				SuspendedAt:     &Timestamp{referenceTime},
 11285  			},
 11286  			SuspendedAt: &Timestamp{referenceTime},
 11287  		},
 11288  	}
 11289  
 11290  	want := `{
 11291  		"ref": "r",
 11292  		"ref_type": "rt",
 11293  		"master_branch": "mb",
 11294  		"description": "d",
 11295  		"pusher_type": "pt",
 11296  		"repository": {
 11297  			"id": 1,
 11298  			"name": "n",
 11299  			"url": "s"
 11300  		},
 11301  		"sender": {
 11302  			"login": "l",
 11303  			"id": 1,
 11304  			"node_id": "n",
 11305  			"avatar_url": "a",
 11306  			"url": "u",
 11307  			"events_url": "e",
 11308  			"repos_url": "r"
 11309  		},
 11310  		"installation": {
 11311  			"id": 1,
 11312  			"node_id": "nid",
 11313  			"app_id": 1,
 11314  			"app_slug": "as",
 11315  			"target_id": 1,
 11316  			"account": {
 11317  				"login": "l",
 11318  				"id": 1,
 11319  				"avatar_url": "a",
 11320  				"gravatar_id": "g",
 11321  				"name": "n",
 11322  				"company": "c",
 11323  				"blog": "b",
 11324  				"location": "l",
 11325  				"email": "e",
 11326  				"hireable": true,
 11327  				"bio": "b",
 11328  				"twitter_username": "t",
 11329  				"public_repos": 1,
 11330  				"followers": 1,
 11331  				"following": 1,
 11332  				"created_at": ` + referenceTimeStr + `,
 11333  				"suspended_at": ` + referenceTimeStr + `,
 11334  				"url": "u"
 11335  			},
 11336  			"access_tokens_url": "atu",
 11337  			"repositories_url": "ru",
 11338  			"html_url": "hu",
 11339  			"target_type": "tt",
 11340  			"single_file_name": "sfn",
 11341  			"repository_selection": "rs",
 11342  			"events": [
 11343  				"e"
 11344  			],
 11345  			"single_file_paths": [
 11346  				"s"
 11347  			],
 11348  			"permissions": {
 11349  				"actions": "a",
 11350  				"administration": "ad",
 11351  				"checks": "c",
 11352  				"contents": "co",
 11353  				"content_references": "cr",
 11354  				"deployments": "d",
 11355  				"environments": "e",
 11356  				"issues": "i",
 11357  				"metadata": "md",
 11358  				"members": "m",
 11359  				"organization_administration": "oa",
 11360  				"organization_hooks": "oh",
 11361  				"organization_plan": "op",
 11362  				"organization_pre_receive_hooks": "opr",
 11363  				"organization_projects": "op",
 11364  				"organization_secrets": "os",
 11365  				"organization_self_hosted_runners": "osh",
 11366  				"organization_user_blocking": "oub",
 11367  				"packages": "pkg",
 11368  				"pages": "pg",
 11369  				"pull_requests": "pr",
 11370  				"repository_hooks": "rh",
 11371  				"repository_projects": "rp",
 11372  				"repository_pre_receive_hooks": "rprh",
 11373  				"secrets": "s",
 11374  				"secret_scanning_alerts": "ssa",
 11375  				"security_events": "se",
 11376  				"single_file": "sf",
 11377  				"statuses": "s",
 11378  				"team_discussions": "td",
 11379  				"vulnerability_alerts": "va",
 11380  				"workflows": "w"
 11381  			},
 11382  			"created_at": ` + referenceTimeStr + `,
 11383  			"updated_at": ` + referenceTimeStr + `,
 11384  			"has_multiple_single_files": false,
 11385  			"suspended_by": {
 11386  				"login": "l",
 11387  				"id": 1,
 11388  				"avatar_url": "a",
 11389  				"gravatar_id": "g",
 11390  				"name": "n",
 11391  				"company": "c",
 11392  				"blog": "b",
 11393  				"location": "l",
 11394  				"email": "e",
 11395  				"hireable": true,
 11396  				"bio": "b",
 11397  				"twitter_username": "t",
 11398  				"public_repos": 1,
 11399  				"followers": 1,
 11400  				"following": 1,
 11401  				"created_at": ` + referenceTimeStr + `,
 11402  				"suspended_at": ` + referenceTimeStr + `,
 11403  				"url": "u"
 11404  			},
 11405  			"suspended_at": ` + referenceTimeStr + `
 11406  		}
 11407  	}`
 11408  
 11409  	testJSONMarshal(t, r, want)
 11410  }
 11411  
 11412  func TestDeleteEvent_Marshal(t *testing.T) {
 11413  	testJSONMarshal(t, &DeleteEvent{}, "{}")
 11414  
 11415  	r := &DeleteEvent{
 11416  		Ref:        String("r"),
 11417  		RefType:    String("rt"),
 11418  		PusherType: String("pt"),
 11419  		Repo: &Repository{
 11420  			ID:   Int64(1),
 11421  			URL:  String("s"),
 11422  			Name: String("n"),
 11423  		},
 11424  		Sender: &User{
 11425  			Login:     String("l"),
 11426  			ID:        Int64(1),
 11427  			NodeID:    String("n"),
 11428  			URL:       String("u"),
 11429  			ReposURL:  String("r"),
 11430  			EventsURL: String("e"),
 11431  			AvatarURL: String("a"),
 11432  		},
 11433  		Installation: &Installation{
 11434  			ID:       Int64(1),
 11435  			NodeID:   String("nid"),
 11436  			AppID:    Int64(1),
 11437  			AppSlug:  String("as"),
 11438  			TargetID: Int64(1),
 11439  			Account: &User{
 11440  				Login:           String("l"),
 11441  				ID:              Int64(1),
 11442  				URL:             String("u"),
 11443  				AvatarURL:       String("a"),
 11444  				GravatarID:      String("g"),
 11445  				Name:            String("n"),
 11446  				Company:         String("c"),
 11447  				Blog:            String("b"),
 11448  				Location:        String("l"),
 11449  				Email:           String("e"),
 11450  				Hireable:        Bool(true),
 11451  				Bio:             String("b"),
 11452  				TwitterUsername: String("t"),
 11453  				PublicRepos:     Int(1),
 11454  				Followers:       Int(1),
 11455  				Following:       Int(1),
 11456  				CreatedAt:       &Timestamp{referenceTime},
 11457  				SuspendedAt:     &Timestamp{referenceTime},
 11458  			},
 11459  			AccessTokensURL:     String("atu"),
 11460  			RepositoriesURL:     String("ru"),
 11461  			HTMLURL:             String("hu"),
 11462  			TargetType:          String("tt"),
 11463  			SingleFileName:      String("sfn"),
 11464  			RepositorySelection: String("rs"),
 11465  			Events:              []string{"e"},
 11466  			SingleFilePaths:     []string{"s"},
 11467  			Permissions: &InstallationPermissions{
 11468  				Actions:                       String("a"),
 11469  				Administration:                String("ad"),
 11470  				Checks:                        String("c"),
 11471  				Contents:                      String("co"),
 11472  				ContentReferences:             String("cr"),
 11473  				Deployments:                   String("d"),
 11474  				Environments:                  String("e"),
 11475  				Issues:                        String("i"),
 11476  				Metadata:                      String("md"),
 11477  				Members:                       String("m"),
 11478  				OrganizationAdministration:    String("oa"),
 11479  				OrganizationHooks:             String("oh"),
 11480  				OrganizationPlan:              String("op"),
 11481  				OrganizationPreReceiveHooks:   String("opr"),
 11482  				OrganizationProjects:          String("op"),
 11483  				OrganizationSecrets:           String("os"),
 11484  				OrganizationSelfHostedRunners: String("osh"),
 11485  				OrganizationUserBlocking:      String("oub"),
 11486  				Packages:                      String("pkg"),
 11487  				Pages:                         String("pg"),
 11488  				PullRequests:                  String("pr"),
 11489  				RepositoryHooks:               String("rh"),
 11490  				RepositoryProjects:            String("rp"),
 11491  				RepositoryPreReceiveHooks:     String("rprh"),
 11492  				Secrets:                       String("s"),
 11493  				SecretScanningAlerts:          String("ssa"),
 11494  				SecurityEvents:                String("se"),
 11495  				SingleFile:                    String("sf"),
 11496  				Statuses:                      String("s"),
 11497  				TeamDiscussions:               String("td"),
 11498  				VulnerabilityAlerts:           String("va"),
 11499  				Workflows:                     String("w"),
 11500  			},
 11501  			CreatedAt:              &Timestamp{referenceTime},
 11502  			UpdatedAt:              &Timestamp{referenceTime},
 11503  			HasMultipleSingleFiles: Bool(false),
 11504  			SuspendedBy: &User{
 11505  				Login:           String("l"),
 11506  				ID:              Int64(1),
 11507  				URL:             String("u"),
 11508  				AvatarURL:       String("a"),
 11509  				GravatarID:      String("g"),
 11510  				Name:            String("n"),
 11511  				Company:         String("c"),
 11512  				Blog:            String("b"),
 11513  				Location:        String("l"),
 11514  				Email:           String("e"),
 11515  				Hireable:        Bool(true),
 11516  				Bio:             String("b"),
 11517  				TwitterUsername: String("t"),
 11518  				PublicRepos:     Int(1),
 11519  				Followers:       Int(1),
 11520  				Following:       Int(1),
 11521  				CreatedAt:       &Timestamp{referenceTime},
 11522  				SuspendedAt:     &Timestamp{referenceTime},
 11523  			},
 11524  			SuspendedAt: &Timestamp{referenceTime},
 11525  		},
 11526  	}
 11527  
 11528  	want := `{
 11529  		"ref": "r",
 11530  		"ref_type": "rt",
 11531  		"pusher_type": "pt",
 11532  		"repository": {
 11533  			"id": 1,
 11534  			"name": "n",
 11535  			"url": "s"
 11536  		},
 11537  		"sender": {
 11538  			"login": "l",
 11539  			"id": 1,
 11540  			"node_id": "n",
 11541  			"avatar_url": "a",
 11542  			"url": "u",
 11543  			"events_url": "e",
 11544  			"repos_url": "r"
 11545  		},
 11546  		"installation": {
 11547  			"id": 1,
 11548  			"node_id": "nid",
 11549  			"app_id": 1,
 11550  			"app_slug": "as",
 11551  			"target_id": 1,
 11552  			"account": {
 11553  				"login": "l",
 11554  				"id": 1,
 11555  				"avatar_url": "a",
 11556  				"gravatar_id": "g",
 11557  				"name": "n",
 11558  				"company": "c",
 11559  				"blog": "b",
 11560  				"location": "l",
 11561  				"email": "e",
 11562  				"hireable": true,
 11563  				"bio": "b",
 11564  				"twitter_username": "t",
 11565  				"public_repos": 1,
 11566  				"followers": 1,
 11567  				"following": 1,
 11568  				"created_at": ` + referenceTimeStr + `,
 11569  				"suspended_at": ` + referenceTimeStr + `,
 11570  				"url": "u"
 11571  			},
 11572  			"access_tokens_url": "atu",
 11573  			"repositories_url": "ru",
 11574  			"html_url": "hu",
 11575  			"target_type": "tt",
 11576  			"single_file_name": "sfn",
 11577  			"repository_selection": "rs",
 11578  			"events": [
 11579  				"e"
 11580  			],
 11581  			"single_file_paths": [
 11582  				"s"
 11583  			],
 11584  			"permissions": {
 11585  				"actions": "a",
 11586  				"administration": "ad",
 11587  				"checks": "c",
 11588  				"contents": "co",
 11589  				"content_references": "cr",
 11590  				"deployments": "d",
 11591  				"environments": "e",
 11592  				"issues": "i",
 11593  				"metadata": "md",
 11594  				"members": "m",
 11595  				"organization_administration": "oa",
 11596  				"organization_hooks": "oh",
 11597  				"organization_plan": "op",
 11598  				"organization_pre_receive_hooks": "opr",
 11599  				"organization_projects": "op",
 11600  				"organization_secrets": "os",
 11601  				"organization_self_hosted_runners": "osh",
 11602  				"organization_user_blocking": "oub",
 11603  				"packages": "pkg",
 11604  				"pages": "pg",
 11605  				"pull_requests": "pr",
 11606  				"repository_hooks": "rh",
 11607  				"repository_projects": "rp",
 11608  				"repository_pre_receive_hooks": "rprh",
 11609  				"secrets": "s",
 11610  				"secret_scanning_alerts": "ssa",
 11611  				"security_events": "se",
 11612  				"single_file": "sf",
 11613  				"statuses": "s",
 11614  				"team_discussions": "td",
 11615  				"vulnerability_alerts": "va",
 11616  				"workflows": "w"
 11617  			},
 11618  			"created_at": ` + referenceTimeStr + `,
 11619  			"updated_at": ` + referenceTimeStr + `,
 11620  			"has_multiple_single_files": false,
 11621  			"suspended_by": {
 11622  				"login": "l",
 11623  				"id": 1,
 11624  				"avatar_url": "a",
 11625  				"gravatar_id": "g",
 11626  				"name": "n",
 11627  				"company": "c",
 11628  				"blog": "b",
 11629  				"location": "l",
 11630  				"email": "e",
 11631  				"hireable": true,
 11632  				"bio": "b",
 11633  				"twitter_username": "t",
 11634  				"public_repos": 1,
 11635  				"followers": 1,
 11636  				"following": 1,
 11637  				"created_at": ` + referenceTimeStr + `,
 11638  				"suspended_at": ` + referenceTimeStr + `,
 11639  				"url": "u"
 11640  			},
 11641  			"suspended_at": ` + referenceTimeStr + `
 11642  		}
 11643  	}`
 11644  
 11645  	testJSONMarshal(t, r, want)
 11646  }
 11647  
 11648  func TestForkEvent_Marshal(t *testing.T) {
 11649  	testJSONMarshal(t, &ForkEvent{}, "{}")
 11650  
 11651  	u := &ForkEvent{
 11652  		Forkee: &Repository{
 11653  			ID:   Int64(1),
 11654  			URL:  String("s"),
 11655  			Name: String("n"),
 11656  		},
 11657  		Repo: &Repository{
 11658  			ID:   Int64(1),
 11659  			URL:  String("s"),
 11660  			Name: String("n"),
 11661  		},
 11662  		Sender: &User{
 11663  			Login:     String("l"),
 11664  			ID:        Int64(1),
 11665  			NodeID:    String("n"),
 11666  			URL:       String("u"),
 11667  			ReposURL:  String("r"),
 11668  			EventsURL: String("e"),
 11669  			AvatarURL: String("a"),
 11670  		},
 11671  		Installation: &Installation{
 11672  			ID:       Int64(1),
 11673  			NodeID:   String("nid"),
 11674  			AppID:    Int64(1),
 11675  			AppSlug:  String("as"),
 11676  			TargetID: Int64(1),
 11677  			Account: &User{
 11678  				Login:           String("l"),
 11679  				ID:              Int64(1),
 11680  				URL:             String("u"),
 11681  				AvatarURL:       String("a"),
 11682  				GravatarID:      String("g"),
 11683  				Name:            String("n"),
 11684  				Company:         String("c"),
 11685  				Blog:            String("b"),
 11686  				Location:        String("l"),
 11687  				Email:           String("e"),
 11688  				Hireable:        Bool(true),
 11689  				Bio:             String("b"),
 11690  				TwitterUsername: String("t"),
 11691  				PublicRepos:     Int(1),
 11692  				Followers:       Int(1),
 11693  				Following:       Int(1),
 11694  				CreatedAt:       &Timestamp{referenceTime},
 11695  				SuspendedAt:     &Timestamp{referenceTime},
 11696  			},
 11697  			AccessTokensURL:     String("atu"),
 11698  			RepositoriesURL:     String("ru"),
 11699  			HTMLURL:             String("hu"),
 11700  			TargetType:          String("tt"),
 11701  			SingleFileName:      String("sfn"),
 11702  			RepositorySelection: String("rs"),
 11703  			Events:              []string{"e"},
 11704  			SingleFilePaths:     []string{"s"},
 11705  			Permissions: &InstallationPermissions{
 11706  				Actions:                       String("a"),
 11707  				Administration:                String("ad"),
 11708  				Checks:                        String("c"),
 11709  				Contents:                      String("co"),
 11710  				ContentReferences:             String("cr"),
 11711  				Deployments:                   String("d"),
 11712  				Environments:                  String("e"),
 11713  				Issues:                        String("i"),
 11714  				Metadata:                      String("md"),
 11715  				Members:                       String("m"),
 11716  				OrganizationAdministration:    String("oa"),
 11717  				OrganizationHooks:             String("oh"),
 11718  				OrganizationPlan:              String("op"),
 11719  				OrganizationPreReceiveHooks:   String("opr"),
 11720  				OrganizationProjects:          String("op"),
 11721  				OrganizationSecrets:           String("os"),
 11722  				OrganizationSelfHostedRunners: String("osh"),
 11723  				OrganizationUserBlocking:      String("oub"),
 11724  				Packages:                      String("pkg"),
 11725  				Pages:                         String("pg"),
 11726  				PullRequests:                  String("pr"),
 11727  				RepositoryHooks:               String("rh"),
 11728  				RepositoryProjects:            String("rp"),
 11729  				RepositoryPreReceiveHooks:     String("rprh"),
 11730  				Secrets:                       String("s"),
 11731  				SecretScanningAlerts:          String("ssa"),
 11732  				SecurityEvents:                String("se"),
 11733  				SingleFile:                    String("sf"),
 11734  				Statuses:                      String("s"),
 11735  				TeamDiscussions:               String("td"),
 11736  				VulnerabilityAlerts:           String("va"),
 11737  				Workflows:                     String("w"),
 11738  			},
 11739  			CreatedAt:              &Timestamp{referenceTime},
 11740  			UpdatedAt:              &Timestamp{referenceTime},
 11741  			HasMultipleSingleFiles: Bool(false),
 11742  			SuspendedBy: &User{
 11743  				Login:           String("l"),
 11744  				ID:              Int64(1),
 11745  				URL:             String("u"),
 11746  				AvatarURL:       String("a"),
 11747  				GravatarID:      String("g"),
 11748  				Name:            String("n"),
 11749  				Company:         String("c"),
 11750  				Blog:            String("b"),
 11751  				Location:        String("l"),
 11752  				Email:           String("e"),
 11753  				Hireable:        Bool(true),
 11754  				Bio:             String("b"),
 11755  				TwitterUsername: String("t"),
 11756  				PublicRepos:     Int(1),
 11757  				Followers:       Int(1),
 11758  				Following:       Int(1),
 11759  				CreatedAt:       &Timestamp{referenceTime},
 11760  				SuspendedAt:     &Timestamp{referenceTime},
 11761  			},
 11762  			SuspendedAt: &Timestamp{referenceTime},
 11763  		},
 11764  	}
 11765  
 11766  	want := `{
 11767  		"forkee": {
 11768  			"id": 1,
 11769  			"name": "n",
 11770  			"url": "s"
 11771  		},
 11772  		"repository": {
 11773  			"id": 1,
 11774  			"name": "n",
 11775  			"url": "s"
 11776  		},
 11777  		"sender": {
 11778  			"login": "l",
 11779  			"id": 1,
 11780  			"node_id": "n",
 11781  			"avatar_url": "a",
 11782  			"url": "u",
 11783  			"events_url": "e",
 11784  			"repos_url": "r"
 11785  		},
 11786  		"installation": {
 11787  			"id": 1,
 11788  			"node_id": "nid",
 11789  			"app_id": 1,
 11790  			"app_slug": "as",
 11791  			"target_id": 1,
 11792  			"account": {
 11793  				"login": "l",
 11794  				"id": 1,
 11795  				"avatar_url": "a",
 11796  				"gravatar_id": "g",
 11797  				"name": "n",
 11798  				"company": "c",
 11799  				"blog": "b",
 11800  				"location": "l",
 11801  				"email": "e",
 11802  				"hireable": true,
 11803  				"bio": "b",
 11804  				"twitter_username": "t",
 11805  				"public_repos": 1,
 11806  				"followers": 1,
 11807  				"following": 1,
 11808  				"created_at": ` + referenceTimeStr + `,
 11809  				"suspended_at": ` + referenceTimeStr + `,
 11810  				"url": "u"
 11811  			},
 11812  			"access_tokens_url": "atu",
 11813  			"repositories_url": "ru",
 11814  			"html_url": "hu",
 11815  			"target_type": "tt",
 11816  			"single_file_name": "sfn",
 11817  			"repository_selection": "rs",
 11818  			"events": [
 11819  				"e"
 11820  			],
 11821  			"single_file_paths": [
 11822  				"s"
 11823  			],
 11824  			"permissions": {
 11825  				"actions": "a",
 11826  				"administration": "ad",
 11827  				"checks": "c",
 11828  				"contents": "co",
 11829  				"content_references": "cr",
 11830  				"deployments": "d",
 11831  				"environments": "e",
 11832  				"issues": "i",
 11833  				"metadata": "md",
 11834  				"members": "m",
 11835  				"organization_administration": "oa",
 11836  				"organization_hooks": "oh",
 11837  				"organization_plan": "op",
 11838  				"organization_pre_receive_hooks": "opr",
 11839  				"organization_projects": "op",
 11840  				"organization_secrets": "os",
 11841  				"organization_self_hosted_runners": "osh",
 11842  				"organization_user_blocking": "oub",
 11843  				"packages": "pkg",
 11844  				"pages": "pg",
 11845  				"pull_requests": "pr",
 11846  				"repository_hooks": "rh",
 11847  				"repository_projects": "rp",
 11848  				"repository_pre_receive_hooks": "rprh",
 11849  				"secrets": "s",
 11850  				"secret_scanning_alerts": "ssa",
 11851  				"security_events": "se",
 11852  				"single_file": "sf",
 11853  				"statuses": "s",
 11854  				"team_discussions": "td",
 11855  				"vulnerability_alerts": "va",
 11856  				"workflows": "w"
 11857  			},
 11858  			"created_at": ` + referenceTimeStr + `,
 11859  			"updated_at": ` + referenceTimeStr + `,
 11860  			"has_multiple_single_files": false,
 11861  			"suspended_by": {
 11862  				"login": "l",
 11863  				"id": 1,
 11864  				"avatar_url": "a",
 11865  				"gravatar_id": "g",
 11866  				"name": "n",
 11867  				"company": "c",
 11868  				"blog": "b",
 11869  				"location": "l",
 11870  				"email": "e",
 11871  				"hireable": true,
 11872  				"bio": "b",
 11873  				"twitter_username": "t",
 11874  				"public_repos": 1,
 11875  				"followers": 1,
 11876  				"following": 1,
 11877  				"created_at": ` + referenceTimeStr + `,
 11878  				"suspended_at": ` + referenceTimeStr + `,
 11879  				"url": "u"
 11880  			},
 11881  			"suspended_at": ` + referenceTimeStr + `
 11882  		}
 11883  	}`
 11884  
 11885  	testJSONMarshal(t, u, want)
 11886  }
 11887  
 11888  func TestGitHubAppAuthorizationEvent_Marshal(t *testing.T) {
 11889  	testJSONMarshal(t, &GitHubAppAuthorizationEvent{}, "{}")
 11890  
 11891  	u := &GitHubAppAuthorizationEvent{
 11892  		Action: String("a"),
 11893  		Sender: &User{
 11894  			Login:     String("l"),
 11895  			ID:        Int64(1),
 11896  			NodeID:    String("n"),
 11897  			URL:       String("u"),
 11898  			ReposURL:  String("r"),
 11899  			EventsURL: String("e"),
 11900  			AvatarURL: String("a"),
 11901  		},
 11902  	}
 11903  
 11904  	want := `{
 11905  		"action": "a",
 11906  		"sender": {
 11907  			"login": "l",
 11908  			"id": 1,
 11909  			"node_id": "n",
 11910  			"avatar_url": "a",
 11911  			"url": "u",
 11912  			"events_url": "e",
 11913  			"repos_url": "r"
 11914  		}
 11915  	}`
 11916  
 11917  	testJSONMarshal(t, u, want)
 11918  }
 11919  
 11920  func TestInstallationEvent_Marshal(t *testing.T) {
 11921  	testJSONMarshal(t, &InstallationEvent{}, "{}")
 11922  
 11923  	u := &InstallationEvent{
 11924  		Action: String("a"),
 11925  		Repositories: []*Repository{
 11926  			{
 11927  				ID:   Int64(1),
 11928  				URL:  String("u"),
 11929  				Name: String("n"),
 11930  			},
 11931  		},
 11932  		Sender: &User{
 11933  			Login:     String("l"),
 11934  			ID:        Int64(1),
 11935  			NodeID:    String("n"),
 11936  			URL:       String("u"),
 11937  			ReposURL:  String("r"),
 11938  			EventsURL: String("e"),
 11939  			AvatarURL: String("a"),
 11940  		},
 11941  		Installation: &Installation{
 11942  			ID:       Int64(1),
 11943  			NodeID:   String("nid"),
 11944  			AppID:    Int64(1),
 11945  			AppSlug:  String("as"),
 11946  			TargetID: Int64(1),
 11947  			Account: &User{
 11948  				Login:           String("l"),
 11949  				ID:              Int64(1),
 11950  				URL:             String("u"),
 11951  				AvatarURL:       String("a"),
 11952  				GravatarID:      String("g"),
 11953  				Name:            String("n"),
 11954  				Company:         String("c"),
 11955  				Blog:            String("b"),
 11956  				Location:        String("l"),
 11957  				Email:           String("e"),
 11958  				Hireable:        Bool(true),
 11959  				Bio:             String("b"),
 11960  				TwitterUsername: String("t"),
 11961  				PublicRepos:     Int(1),
 11962  				Followers:       Int(1),
 11963  				Following:       Int(1),
 11964  				CreatedAt:       &Timestamp{referenceTime},
 11965  				SuspendedAt:     &Timestamp{referenceTime},
 11966  			},
 11967  			AccessTokensURL:     String("atu"),
 11968  			RepositoriesURL:     String("ru"),
 11969  			HTMLURL:             String("hu"),
 11970  			TargetType:          String("tt"),
 11971  			SingleFileName:      String("sfn"),
 11972  			RepositorySelection: String("rs"),
 11973  			Events:              []string{"e"},
 11974  			SingleFilePaths:     []string{"s"},
 11975  			Permissions: &InstallationPermissions{
 11976  				Actions:                       String("a"),
 11977  				Administration:                String("ad"),
 11978  				Checks:                        String("c"),
 11979  				Contents:                      String("co"),
 11980  				ContentReferences:             String("cr"),
 11981  				Deployments:                   String("d"),
 11982  				Environments:                  String("e"),
 11983  				Issues:                        String("i"),
 11984  				Metadata:                      String("md"),
 11985  				Members:                       String("m"),
 11986  				OrganizationAdministration:    String("oa"),
 11987  				OrganizationHooks:             String("oh"),
 11988  				OrganizationPlan:              String("op"),
 11989  				OrganizationPreReceiveHooks:   String("opr"),
 11990  				OrganizationProjects:          String("op"),
 11991  				OrganizationSecrets:           String("os"),
 11992  				OrganizationSelfHostedRunners: String("osh"),
 11993  				OrganizationUserBlocking:      String("oub"),
 11994  				Packages:                      String("pkg"),
 11995  				Pages:                         String("pg"),
 11996  				PullRequests:                  String("pr"),
 11997  				RepositoryHooks:               String("rh"),
 11998  				RepositoryProjects:            String("rp"),
 11999  				RepositoryPreReceiveHooks:     String("rprh"),
 12000  				Secrets:                       String("s"),
 12001  				SecretScanningAlerts:          String("ssa"),
 12002  				SecurityEvents:                String("se"),
 12003  				SingleFile:                    String("sf"),
 12004  				Statuses:                      String("s"),
 12005  				TeamDiscussions:               String("td"),
 12006  				VulnerabilityAlerts:           String("va"),
 12007  				Workflows:                     String("w"),
 12008  			},
 12009  			CreatedAt:              &Timestamp{referenceTime},
 12010  			UpdatedAt:              &Timestamp{referenceTime},
 12011  			HasMultipleSingleFiles: Bool(false),
 12012  			SuspendedBy: &User{
 12013  				Login:           String("l"),
 12014  				ID:              Int64(1),
 12015  				URL:             String("u"),
 12016  				AvatarURL:       String("a"),
 12017  				GravatarID:      String("g"),
 12018  				Name:            String("n"),
 12019  				Company:         String("c"),
 12020  				Blog:            String("b"),
 12021  				Location:        String("l"),
 12022  				Email:           String("e"),
 12023  				Hireable:        Bool(true),
 12024  				Bio:             String("b"),
 12025  				TwitterUsername: String("t"),
 12026  				PublicRepos:     Int(1),
 12027  				Followers:       Int(1),
 12028  				Following:       Int(1),
 12029  				CreatedAt:       &Timestamp{referenceTime},
 12030  				SuspendedAt:     &Timestamp{referenceTime},
 12031  			},
 12032  			SuspendedAt: &Timestamp{referenceTime},
 12033  		},
 12034  	}
 12035  
 12036  	want := `{
 12037  		"action": "a",
 12038  		"repositories": [
 12039  			{
 12040  				"id":1,
 12041  				"name":"n",
 12042  				"url":"u"
 12043  			}
 12044  		],
 12045  		"sender": {
 12046  			"login": "l",
 12047  			"id": 1,
 12048  			"node_id": "n",
 12049  			"avatar_url": "a",
 12050  			"url": "u",
 12051  			"events_url": "e",
 12052  			"repos_url": "r"
 12053  		},
 12054  		"installation": {
 12055  			"id": 1,
 12056  			"node_id": "nid",
 12057  			"app_id": 1,
 12058  			"app_slug": "as",
 12059  			"target_id": 1,
 12060  			"account": {
 12061  				"login": "l",
 12062  				"id": 1,
 12063  				"avatar_url": "a",
 12064  				"gravatar_id": "g",
 12065  				"name": "n",
 12066  				"company": "c",
 12067  				"blog": "b",
 12068  				"location": "l",
 12069  				"email": "e",
 12070  				"hireable": true,
 12071  				"bio": "b",
 12072  				"twitter_username": "t",
 12073  				"public_repos": 1,
 12074  				"followers": 1,
 12075  				"following": 1,
 12076  				"created_at": ` + referenceTimeStr + `,
 12077  				"suspended_at": ` + referenceTimeStr + `,
 12078  				"url": "u"
 12079  			},
 12080  			"access_tokens_url": "atu",
 12081  			"repositories_url": "ru",
 12082  			"html_url": "hu",
 12083  			"target_type": "tt",
 12084  			"single_file_name": "sfn",
 12085  			"repository_selection": "rs",
 12086  			"events": [
 12087  				"e"
 12088  			],
 12089  			"single_file_paths": [
 12090  				"s"
 12091  			],
 12092  			"permissions": {
 12093  				"actions": "a",
 12094  				"administration": "ad",
 12095  				"checks": "c",
 12096  				"contents": "co",
 12097  				"content_references": "cr",
 12098  				"deployments": "d",
 12099  				"environments": "e",
 12100  				"issues": "i",
 12101  				"metadata": "md",
 12102  				"members": "m",
 12103  				"organization_administration": "oa",
 12104  				"organization_hooks": "oh",
 12105  				"organization_plan": "op",
 12106  				"organization_pre_receive_hooks": "opr",
 12107  				"organization_projects": "op",
 12108  				"organization_secrets": "os",
 12109  				"organization_self_hosted_runners": "osh",
 12110  				"organization_user_blocking": "oub",
 12111  				"packages": "pkg",
 12112  				"pages": "pg",
 12113  				"pull_requests": "pr",
 12114  				"repository_hooks": "rh",
 12115  				"repository_projects": "rp",
 12116  				"repository_pre_receive_hooks": "rprh",
 12117  				"secrets": "s",
 12118  				"secret_scanning_alerts": "ssa",
 12119  				"security_events": "se",
 12120  				"single_file": "sf",
 12121  				"statuses": "s",
 12122  				"team_discussions": "td",
 12123  				"vulnerability_alerts": "va",
 12124  				"workflows": "w"
 12125  			},
 12126  			"created_at": ` + referenceTimeStr + `,
 12127  			"updated_at": ` + referenceTimeStr + `,
 12128  			"has_multiple_single_files": false,
 12129  			"suspended_by": {
 12130  				"login": "l",
 12131  				"id": 1,
 12132  				"avatar_url": "a",
 12133  				"gravatar_id": "g",
 12134  				"name": "n",
 12135  				"company": "c",
 12136  				"blog": "b",
 12137  				"location": "l",
 12138  				"email": "e",
 12139  				"hireable": true,
 12140  				"bio": "b",
 12141  				"twitter_username": "t",
 12142  				"public_repos": 1,
 12143  				"followers": 1,
 12144  				"following": 1,
 12145  				"created_at": ` + referenceTimeStr + `,
 12146  				"suspended_at": ` + referenceTimeStr + `,
 12147  				"url": "u"
 12148  			},
 12149  			"suspended_at": ` + referenceTimeStr + `
 12150  		}
 12151  	}`
 12152  
 12153  	testJSONMarshal(t, u, want)
 12154  }
 12155  
 12156  func TestHeadCommit_Marshal(t *testing.T) {
 12157  	testJSONMarshal(t, &HeadCommit{}, "{}")
 12158  
 12159  	u := &HeadCommit{
 12160  		Message: String("m"),
 12161  		Author: &CommitAuthor{
 12162  			Date:  &Timestamp{referenceTime},
 12163  			Name:  String("n"),
 12164  			Email: String("e"),
 12165  			Login: String("u"),
 12166  		},
 12167  		URL:       String("u"),
 12168  		Distinct:  Bool(true),
 12169  		SHA:       String("s"),
 12170  		ID:        String("id"),
 12171  		TreeID:    String("tid"),
 12172  		Timestamp: &Timestamp{referenceTime},
 12173  		Committer: &CommitAuthor{
 12174  			Date:  &Timestamp{referenceTime},
 12175  			Name:  String("n"),
 12176  			Email: String("e"),
 12177  			Login: String("u"),
 12178  		},
 12179  		Added:    []string{"a"},
 12180  		Removed:  []string{"r"},
 12181  		Modified: []string{"m"},
 12182  	}
 12183  
 12184  	want := `{
 12185  		"message": "m",
 12186  		"author": {
 12187  			"date": ` + referenceTimeStr + `,
 12188  			"name": "n",
 12189  			"email": "e",
 12190  			"username": "u"
 12191  		},
 12192  		"url": "u",
 12193  		"distinct": true,
 12194  		"sha": "s",
 12195  		"id": "id",
 12196  		"tree_id": "tid",
 12197  		"timestamp": ` + referenceTimeStr + `,
 12198  		"committer": {
 12199  			"date": ` + referenceTimeStr + `,
 12200  			"name": "n",
 12201  			"email": "e",
 12202  			"username": "u"
 12203  		},
 12204  		"added": [
 12205  			"a"
 12206  		],
 12207  		"removed":  [
 12208  			"r"
 12209  		],
 12210  		"modified":  [
 12211  			"m"
 12212  		]
 12213  	}`
 12214  
 12215  	testJSONMarshal(t, u, want)
 12216  }
 12217  
 12218  func TestPushEventRepository_Marshal(t *testing.T) {
 12219  	testJSONMarshal(t, &PushEventRepository{}, "{}")
 12220  
 12221  	u := &PushEventRepository{
 12222  		ID:       Int64(1),
 12223  		NodeID:   String("nid"),
 12224  		Name:     String("n"),
 12225  		FullName: String("fn"),
 12226  		Owner: &User{
 12227  			Login:       String("l"),
 12228  			ID:          Int64(1),
 12229  			AvatarURL:   String("a"),
 12230  			GravatarID:  String("g"),
 12231  			Name:        String("n"),
 12232  			Company:     String("c"),
 12233  			Blog:        String("b"),
 12234  			Location:    String("l"),
 12235  			Email:       String("e"),
 12236  			Hireable:    Bool(true),
 12237  			PublicRepos: Int(1),
 12238  			Followers:   Int(1),
 12239  			Following:   Int(1),
 12240  			CreatedAt:   &Timestamp{referenceTime},
 12241  			URL:         String("u"),
 12242  		},
 12243  		Private:         Bool(true),
 12244  		Description:     String("d"),
 12245  		Fork:            Bool(true),
 12246  		CreatedAt:       &Timestamp{referenceTime},
 12247  		PushedAt:        &Timestamp{referenceTime},
 12248  		UpdatedAt:       &Timestamp{referenceTime},
 12249  		Homepage:        String("h"),
 12250  		PullsURL:        String("p"),
 12251  		Size:            Int(1),
 12252  		StargazersCount: Int(1),
 12253  		WatchersCount:   Int(1),
 12254  		Language:        String("l"),
 12255  		HasIssues:       Bool(true),
 12256  		HasDownloads:    Bool(true),
 12257  		HasWiki:         Bool(true),
 12258  		HasPages:        Bool(true),
 12259  		ForksCount:      Int(1),
 12260  		Archived:        Bool(true),
 12261  		Disabled:        Bool(true),
 12262  		OpenIssuesCount: Int(1),
 12263  		DefaultBranch:   String("d"),
 12264  		MasterBranch:    String("m"),
 12265  		Organization:    String("o"),
 12266  		URL:             String("u"),
 12267  		ArchiveURL:      String("a"),
 12268  		HTMLURL:         String("h"),
 12269  		StatusesURL:     String("s"),
 12270  		GitURL:          String("g"),
 12271  		SSHURL:          String("s"),
 12272  		CloneURL:        String("c"),
 12273  		SVNURL:          String("s"),
 12274  	}
 12275  
 12276  	want := `{
 12277  		"id": 1,
 12278  		"node_id": "nid",
 12279  		"name": "n",
 12280  		"full_name": "fn",
 12281  		"owner": {
 12282  			"login": "l",
 12283  			"id": 1,
 12284  			"avatar_url": "a",
 12285  			"gravatar_id": "g",
 12286  			"name": "n",
 12287  			"company": "c",
 12288  			"blog": "b",
 12289  			"location": "l",
 12290  			"email": "e",
 12291  			"hireable": true,
 12292  			"public_repos": 1,
 12293  			"followers": 1,
 12294  			"following": 1,
 12295  			"created_at": ` + referenceTimeStr + `,
 12296  			"url": "u"
 12297  		},
 12298  		"private": true,
 12299  		"description": "d",
 12300  		"fork": true,
 12301  		"created_at": ` + referenceTimeStr + `,
 12302  		"pushed_at": ` + referenceTimeStr + `,
 12303  		"updated_at": ` + referenceTimeStr + `,
 12304  		"homepage": "h",
 12305  		"pulls_url": "p",
 12306  		"size": 1,
 12307  		"stargazers_count": 1,
 12308  		"watchers_count": 1,
 12309  		"language": "l",
 12310  		"has_issues": true,
 12311  		"has_downloads": true,
 12312  		"has_wiki": true,
 12313  		"has_pages": true,
 12314  		"forks_count": 1,
 12315  		"archived": true,
 12316  		"disabled": true,
 12317  		"open_issues_count": 1,
 12318  		"default_branch": "d",
 12319  		"master_branch": "m",
 12320  		"organization": "o",
 12321  		"url": "u",
 12322  		"archive_url": "a",
 12323  		"html_url": "h",
 12324  		"statuses_url": "s",
 12325  		"git_url": "g",
 12326  		"ssh_url": "s",
 12327  		"clone_url": "c",
 12328  		"svn_url": "s"
 12329  	}`
 12330  
 12331  	testJSONMarshal(t, u, want)
 12332  }
 12333  
 12334  func TestPushEventRepoOwner_Marshal(t *testing.T) {
 12335  	testJSONMarshal(t, &PushEventRepoOwner{}, "{}")
 12336  
 12337  	u := &PushEventRepoOwner{
 12338  		Name:  String("n"),
 12339  		Email: String("e"),
 12340  	}
 12341  
 12342  	want := `{
 12343  		"name": "n",
 12344  		"email": "e"
 12345  	}`
 12346  
 12347  	testJSONMarshal(t, u, want)
 12348  }
 12349  
 12350  func TestProjectEvent_Marshal(t *testing.T) {
 12351  	testJSONMarshal(t, &ProjectEvent{}, "{}")
 12352  
 12353  	u := &ProjectEvent{
 12354  		Project: &Project{ID: Int64(1)},
 12355  		Action:  String("a"),
 12356  		Changes: &ProjectChange{
 12357  			Name: &ProjectName{From: String("NameFrom")},
 12358  			Body: &ProjectBody{From: String("BodyFrom")},
 12359  		},
 12360  		Repo: &Repository{
 12361  			ID:   Int64(1),
 12362  			URL:  String("s"),
 12363  			Name: String("n"),
 12364  		},
 12365  		Org: &Organization{
 12366  			BillingEmail:                         String("be"),
 12367  			Blog:                                 String("b"),
 12368  			Company:                              String("c"),
 12369  			Email:                                String("e"),
 12370  			TwitterUsername:                      String("tu"),
 12371  			Location:                             String("loc"),
 12372  			Name:                                 String("n"),
 12373  			Description:                          String("d"),
 12374  			IsVerified:                           Bool(true),
 12375  			HasOrganizationProjects:              Bool(true),
 12376  			HasRepositoryProjects:                Bool(true),
 12377  			DefaultRepoPermission:                String("drp"),
 12378  			MembersCanCreateRepos:                Bool(true),
 12379  			MembersCanCreateInternalRepos:        Bool(true),
 12380  			MembersCanCreatePrivateRepos:         Bool(true),
 12381  			MembersCanCreatePublicRepos:          Bool(false),
 12382  			MembersAllowedRepositoryCreationType: String("marct"),
 12383  			MembersCanCreatePages:                Bool(true),
 12384  			MembersCanCreatePublicPages:          Bool(false),
 12385  			MembersCanCreatePrivatePages:         Bool(true),
 12386  		},
 12387  		Sender: &User{
 12388  			Login:     String("l"),
 12389  			ID:        Int64(1),
 12390  			NodeID:    String("n"),
 12391  			URL:       String("u"),
 12392  			ReposURL:  String("r"),
 12393  			EventsURL: String("e"),
 12394  			AvatarURL: String("a"),
 12395  		},
 12396  		Installation: &Installation{
 12397  			ID:       Int64(1),
 12398  			NodeID:   String("nid"),
 12399  			AppID:    Int64(1),
 12400  			AppSlug:  String("as"),
 12401  			TargetID: Int64(1),
 12402  			Account: &User{
 12403  				Login:           String("l"),
 12404  				ID:              Int64(1),
 12405  				URL:             String("u"),
 12406  				AvatarURL:       String("a"),
 12407  				GravatarID:      String("g"),
 12408  				Name:            String("n"),
 12409  				Company:         String("c"),
 12410  				Blog:            String("b"),
 12411  				Location:        String("l"),
 12412  				Email:           String("e"),
 12413  				Hireable:        Bool(true),
 12414  				Bio:             String("b"),
 12415  				TwitterUsername: String("t"),
 12416  				PublicRepos:     Int(1),
 12417  				Followers:       Int(1),
 12418  				Following:       Int(1),
 12419  				CreatedAt:       &Timestamp{referenceTime},
 12420  				SuspendedAt:     &Timestamp{referenceTime},
 12421  			},
 12422  			AccessTokensURL:     String("atu"),
 12423  			RepositoriesURL:     String("ru"),
 12424  			HTMLURL:             String("hu"),
 12425  			TargetType:          String("tt"),
 12426  			SingleFileName:      String("sfn"),
 12427  			RepositorySelection: String("rs"),
 12428  			Events:              []string{"e"},
 12429  			SingleFilePaths:     []string{"s"},
 12430  			Permissions: &InstallationPermissions{
 12431  				Actions:                       String("a"),
 12432  				Administration:                String("ad"),
 12433  				Checks:                        String("c"),
 12434  				Contents:                      String("co"),
 12435  				ContentReferences:             String("cr"),
 12436  				Deployments:                   String("d"),
 12437  				Environments:                  String("e"),
 12438  				Issues:                        String("i"),
 12439  				Metadata:                      String("md"),
 12440  				Members:                       String("m"),
 12441  				OrganizationAdministration:    String("oa"),
 12442  				OrganizationHooks:             String("oh"),
 12443  				OrganizationPlan:              String("op"),
 12444  				OrganizationPreReceiveHooks:   String("opr"),
 12445  				OrganizationProjects:          String("op"),
 12446  				OrganizationSecrets:           String("os"),
 12447  				OrganizationSelfHostedRunners: String("osh"),
 12448  				OrganizationUserBlocking:      String("oub"),
 12449  				Packages:                      String("pkg"),
 12450  				Pages:                         String("pg"),
 12451  				PullRequests:                  String("pr"),
 12452  				RepositoryHooks:               String("rh"),
 12453  				RepositoryProjects:            String("rp"),
 12454  				RepositoryPreReceiveHooks:     String("rprh"),
 12455  				Secrets:                       String("s"),
 12456  				SecretScanningAlerts:          String("ssa"),
 12457  				SecurityEvents:                String("se"),
 12458  				SingleFile:                    String("sf"),
 12459  				Statuses:                      String("s"),
 12460  				TeamDiscussions:               String("td"),
 12461  				VulnerabilityAlerts:           String("va"),
 12462  				Workflows:                     String("w"),
 12463  			},
 12464  			CreatedAt:              &Timestamp{referenceTime},
 12465  			UpdatedAt:              &Timestamp{referenceTime},
 12466  			HasMultipleSingleFiles: Bool(false),
 12467  			SuspendedBy: &User{
 12468  				Login:           String("l"),
 12469  				ID:              Int64(1),
 12470  				URL:             String("u"),
 12471  				AvatarURL:       String("a"),
 12472  				GravatarID:      String("g"),
 12473  				Name:            String("n"),
 12474  				Company:         String("c"),
 12475  				Blog:            String("b"),
 12476  				Location:        String("l"),
 12477  				Email:           String("e"),
 12478  				Hireable:        Bool(true),
 12479  				Bio:             String("b"),
 12480  				TwitterUsername: String("t"),
 12481  				PublicRepos:     Int(1),
 12482  				Followers:       Int(1),
 12483  				Following:       Int(1),
 12484  				CreatedAt:       &Timestamp{referenceTime},
 12485  				SuspendedAt:     &Timestamp{referenceTime},
 12486  			},
 12487  			SuspendedAt: &Timestamp{referenceTime},
 12488  		},
 12489  	}
 12490  
 12491  	want := `{
 12492  		"action": "a",
 12493  		"changes": {
 12494  			"name": {
 12495  				"from": "NameFrom"
 12496  			},
 12497  			"body": {
 12498  				"from": "BodyFrom"
 12499  			}
 12500  		},
 12501  		"project": {
 12502  			"id": 1
 12503  		},
 12504  		"repository": {
 12505  			"id": 1,
 12506  			"name": "n",
 12507  			"url": "s"
 12508  		},
 12509  		"organization": {
 12510  			"name": "n",
 12511  			"company": "c",
 12512  			"blog": "b",
 12513  			"location": "loc",
 12514  			"email": "e",
 12515  			"twitter_username": "tu",
 12516  			"description": "d",
 12517  			"billing_email": "be",
 12518  			"is_verified": true,
 12519  			"has_organization_projects": true,
 12520  			"has_repository_projects": true,
 12521  			"default_repository_permission": "drp",
 12522  			"members_can_create_repositories": true,
 12523  			"members_can_create_public_repositories": false,
 12524  			"members_can_create_private_repositories": true,
 12525  			"members_can_create_internal_repositories": true,
 12526  			"members_allowed_repository_creation_type": "marct",
 12527  			"members_can_create_pages": true,
 12528  			"members_can_create_public_pages": false,
 12529  			"members_can_create_private_pages": true
 12530  		},
 12531  		"sender": {
 12532  			"login": "l",
 12533  			"id": 1,
 12534  			"node_id": "n",
 12535  			"avatar_url": "a",
 12536  			"url": "u",
 12537  			"events_url": "e",
 12538  			"repos_url": "r"
 12539  		},
 12540  		"installation": {
 12541  			"id": 1,
 12542  			"node_id": "nid",
 12543  			"app_id": 1,
 12544  			"app_slug": "as",
 12545  			"target_id": 1,
 12546  			"account": {
 12547  				"login": "l",
 12548  				"id": 1,
 12549  				"avatar_url": "a",
 12550  				"gravatar_id": "g",
 12551  				"name": "n",
 12552  				"company": "c",
 12553  				"blog": "b",
 12554  				"location": "l",
 12555  				"email": "e",
 12556  				"hireable": true,
 12557  				"bio": "b",
 12558  				"twitter_username": "t",
 12559  				"public_repos": 1,
 12560  				"followers": 1,
 12561  				"following": 1,
 12562  				"created_at": ` + referenceTimeStr + `,
 12563  				"suspended_at": ` + referenceTimeStr + `,
 12564  				"url": "u"
 12565  			},
 12566  			"access_tokens_url": "atu",
 12567  			"repositories_url": "ru",
 12568  			"html_url": "hu",
 12569  			"target_type": "tt",
 12570  			"single_file_name": "sfn",
 12571  			"repository_selection": "rs",
 12572  			"events": [
 12573  				"e"
 12574  			],
 12575  			"single_file_paths": [
 12576  				"s"
 12577  			],
 12578  			"permissions": {
 12579  				"actions": "a",
 12580  				"administration": "ad",
 12581  				"checks": "c",
 12582  				"contents": "co",
 12583  				"content_references": "cr",
 12584  				"deployments": "d",
 12585  				"environments": "e",
 12586  				"issues": "i",
 12587  				"metadata": "md",
 12588  				"members": "m",
 12589  				"organization_administration": "oa",
 12590  				"organization_hooks": "oh",
 12591  				"organization_plan": "op",
 12592  				"organization_pre_receive_hooks": "opr",
 12593  				"organization_projects": "op",
 12594  				"organization_secrets": "os",
 12595  				"organization_self_hosted_runners": "osh",
 12596  				"organization_user_blocking": "oub",
 12597  				"packages": "pkg",
 12598  				"pages": "pg",
 12599  				"pull_requests": "pr",
 12600  				"repository_hooks": "rh",
 12601  				"repository_projects": "rp",
 12602  				"repository_pre_receive_hooks": "rprh",
 12603  				"secrets": "s",
 12604  				"secret_scanning_alerts": "ssa",
 12605  				"security_events": "se",
 12606  				"single_file": "sf",
 12607  				"statuses": "s",
 12608  				"team_discussions": "td",
 12609  				"vulnerability_alerts": "va",
 12610  				"workflows": "w"
 12611  			},
 12612  			"created_at": ` + referenceTimeStr + `,
 12613  			"updated_at": ` + referenceTimeStr + `,
 12614  			"has_multiple_single_files": false,
 12615  			"suspended_by": {
 12616  				"login": "l",
 12617  				"id": 1,
 12618  				"avatar_url": "a",
 12619  				"gravatar_id": "g",
 12620  				"name": "n",
 12621  				"company": "c",
 12622  				"blog": "b",
 12623  				"location": "l",
 12624  				"email": "e",
 12625  				"hireable": true,
 12626  				"bio": "b",
 12627  				"twitter_username": "t",
 12628  				"public_repos": 1,
 12629  				"followers": 1,
 12630  				"following": 1,
 12631  				"created_at": ` + referenceTimeStr + `,
 12632  				"suspended_at": ` + referenceTimeStr + `,
 12633  				"url": "u"
 12634  			},
 12635  			"suspended_at": ` + referenceTimeStr + `
 12636  		}
 12637  	}`
 12638  
 12639  	testJSONMarshal(t, u, want)
 12640  }
 12641  
 12642  func TestProjectCardEvent_Marshal(t *testing.T) {
 12643  	testJSONMarshal(t, &ProjectCardEvent{}, "{}")
 12644  
 12645  	u := &ProjectCardEvent{
 12646  		Action: String("a"),
 12647  		Changes: &ProjectCardChange{
 12648  			Note: &ProjectCardNote{From: String("NoteFrom")},
 12649  		},
 12650  		AfterID:     Int64(1),
 12651  		ProjectCard: &ProjectCard{ID: Int64(1)},
 12652  		Repo: &Repository{
 12653  			ID:   Int64(1),
 12654  			URL:  String("s"),
 12655  			Name: String("n"),
 12656  		},
 12657  		Org: &Organization{
 12658  			BillingEmail:                         String("be"),
 12659  			Blog:                                 String("b"),
 12660  			Company:                              String("c"),
 12661  			Email:                                String("e"),
 12662  			TwitterUsername:                      String("tu"),
 12663  			Location:                             String("loc"),
 12664  			Name:                                 String("n"),
 12665  			Description:                          String("d"),
 12666  			IsVerified:                           Bool(true),
 12667  			HasOrganizationProjects:              Bool(true),
 12668  			HasRepositoryProjects:                Bool(true),
 12669  			DefaultRepoPermission:                String("drp"),
 12670  			MembersCanCreateRepos:                Bool(true),
 12671  			MembersCanCreateInternalRepos:        Bool(true),
 12672  			MembersCanCreatePrivateRepos:         Bool(true),
 12673  			MembersCanCreatePublicRepos:          Bool(false),
 12674  			MembersAllowedRepositoryCreationType: String("marct"),
 12675  			MembersCanCreatePages:                Bool(true),
 12676  			MembersCanCreatePublicPages:          Bool(false),
 12677  			MembersCanCreatePrivatePages:         Bool(true),
 12678  		},
 12679  		Sender: &User{
 12680  			Login:     String("l"),
 12681  			ID:        Int64(1),
 12682  			NodeID:    String("n"),
 12683  			URL:       String("u"),
 12684  			ReposURL:  String("r"),
 12685  			EventsURL: String("e"),
 12686  			AvatarURL: String("a"),
 12687  		},
 12688  		Installation: &Installation{
 12689  			ID:       Int64(1),
 12690  			NodeID:   String("nid"),
 12691  			AppID:    Int64(1),
 12692  			AppSlug:  String("as"),
 12693  			TargetID: Int64(1),
 12694  			Account: &User{
 12695  				Login:           String("l"),
 12696  				ID:              Int64(1),
 12697  				URL:             String("u"),
 12698  				AvatarURL:       String("a"),
 12699  				GravatarID:      String("g"),
 12700  				Name:            String("n"),
 12701  				Company:         String("c"),
 12702  				Blog:            String("b"),
 12703  				Location:        String("l"),
 12704  				Email:           String("e"),
 12705  				Hireable:        Bool(true),
 12706  				Bio:             String("b"),
 12707  				TwitterUsername: String("t"),
 12708  				PublicRepos:     Int(1),
 12709  				Followers:       Int(1),
 12710  				Following:       Int(1),
 12711  				CreatedAt:       &Timestamp{referenceTime},
 12712  				SuspendedAt:     &Timestamp{referenceTime},
 12713  			},
 12714  			AccessTokensURL:     String("atu"),
 12715  			RepositoriesURL:     String("ru"),
 12716  			HTMLURL:             String("hu"),
 12717  			TargetType:          String("tt"),
 12718  			SingleFileName:      String("sfn"),
 12719  			RepositorySelection: String("rs"),
 12720  			Events:              []string{"e"},
 12721  			SingleFilePaths:     []string{"s"},
 12722  			Permissions: &InstallationPermissions{
 12723  				Actions:                       String("a"),
 12724  				Administration:                String("ad"),
 12725  				Checks:                        String("c"),
 12726  				Contents:                      String("co"),
 12727  				ContentReferences:             String("cr"),
 12728  				Deployments:                   String("d"),
 12729  				Environments:                  String("e"),
 12730  				Issues:                        String("i"),
 12731  				Metadata:                      String("md"),
 12732  				Members:                       String("m"),
 12733  				OrganizationAdministration:    String("oa"),
 12734  				OrganizationHooks:             String("oh"),
 12735  				OrganizationPlan:              String("op"),
 12736  				OrganizationPreReceiveHooks:   String("opr"),
 12737  				OrganizationProjects:          String("op"),
 12738  				OrganizationSecrets:           String("os"),
 12739  				OrganizationSelfHostedRunners: String("osh"),
 12740  				OrganizationUserBlocking:      String("oub"),
 12741  				Packages:                      String("pkg"),
 12742  				Pages:                         String("pg"),
 12743  				PullRequests:                  String("pr"),
 12744  				RepositoryHooks:               String("rh"),
 12745  				RepositoryProjects:            String("rp"),
 12746  				RepositoryPreReceiveHooks:     String("rprh"),
 12747  				Secrets:                       String("s"),
 12748  				SecretScanningAlerts:          String("ssa"),
 12749  				SecurityEvents:                String("se"),
 12750  				SingleFile:                    String("sf"),
 12751  				Statuses:                      String("s"),
 12752  				TeamDiscussions:               String("td"),
 12753  				VulnerabilityAlerts:           String("va"),
 12754  				Workflows:                     String("w"),
 12755  			},
 12756  			CreatedAt:              &Timestamp{referenceTime},
 12757  			UpdatedAt:              &Timestamp{referenceTime},
 12758  			HasMultipleSingleFiles: Bool(false),
 12759  			SuspendedBy: &User{
 12760  				Login:           String("l"),
 12761  				ID:              Int64(1),
 12762  				URL:             String("u"),
 12763  				AvatarURL:       String("a"),
 12764  				GravatarID:      String("g"),
 12765  				Name:            String("n"),
 12766  				Company:         String("c"),
 12767  				Blog:            String("b"),
 12768  				Location:        String("l"),
 12769  				Email:           String("e"),
 12770  				Hireable:        Bool(true),
 12771  				Bio:             String("b"),
 12772  				TwitterUsername: String("t"),
 12773  				PublicRepos:     Int(1),
 12774  				Followers:       Int(1),
 12775  				Following:       Int(1),
 12776  				CreatedAt:       &Timestamp{referenceTime},
 12777  				SuspendedAt:     &Timestamp{referenceTime},
 12778  			},
 12779  			SuspendedAt: &Timestamp{referenceTime},
 12780  		},
 12781  	}
 12782  
 12783  	want := `{
 12784  		"action": "a",
 12785  		"changes": {
 12786  			"note": {
 12787  				"from": "NoteFrom"
 12788  			}
 12789  		},
 12790  		"after_id": 1,
 12791  		"project_card": {
 12792  			"id": 1
 12793  		},
 12794  		"repository": {
 12795  			"id": 1,
 12796  			"name": "n",
 12797  			"url": "s"
 12798  		},
 12799  		"organization": {
 12800  			"name": "n",
 12801  			"company": "c",
 12802  			"blog": "b",
 12803  			"location": "loc",
 12804  			"email": "e",
 12805  			"twitter_username": "tu",
 12806  			"description": "d",
 12807  			"billing_email": "be",
 12808  			"is_verified": true,
 12809  			"has_organization_projects": true,
 12810  			"has_repository_projects": true,
 12811  			"default_repository_permission": "drp",
 12812  			"members_can_create_repositories": true,
 12813  			"members_can_create_public_repositories": false,
 12814  			"members_can_create_private_repositories": true,
 12815  			"members_can_create_internal_repositories": true,
 12816  			"members_allowed_repository_creation_type": "marct",
 12817  			"members_can_create_pages": true,
 12818  			"members_can_create_public_pages": false,
 12819  			"members_can_create_private_pages": true
 12820  		},
 12821  		"sender": {
 12822  			"login": "l",
 12823  			"id": 1,
 12824  			"node_id": "n",
 12825  			"avatar_url": "a",
 12826  			"url": "u",
 12827  			"events_url": "e",
 12828  			"repos_url": "r"
 12829  		},
 12830  		"installation": {
 12831  			"id": 1,
 12832  			"node_id": "nid",
 12833  			"app_id": 1,
 12834  			"app_slug": "as",
 12835  			"target_id": 1,
 12836  			"account": {
 12837  				"login": "l",
 12838  				"id": 1,
 12839  				"avatar_url": "a",
 12840  				"gravatar_id": "g",
 12841  				"name": "n",
 12842  				"company": "c",
 12843  				"blog": "b",
 12844  				"location": "l",
 12845  				"email": "e",
 12846  				"hireable": true,
 12847  				"bio": "b",
 12848  				"twitter_username": "t",
 12849  				"public_repos": 1,
 12850  				"followers": 1,
 12851  				"following": 1,
 12852  				"created_at": ` + referenceTimeStr + `,
 12853  				"suspended_at": ` + referenceTimeStr + `,
 12854  				"url": "u"
 12855  			},
 12856  			"access_tokens_url": "atu",
 12857  			"repositories_url": "ru",
 12858  			"html_url": "hu",
 12859  			"target_type": "tt",
 12860  			"single_file_name": "sfn",
 12861  			"repository_selection": "rs",
 12862  			"events": [
 12863  				"e"
 12864  			],
 12865  			"single_file_paths": [
 12866  				"s"
 12867  			],
 12868  			"permissions": {
 12869  				"actions": "a",
 12870  				"administration": "ad",
 12871  				"checks": "c",
 12872  				"contents": "co",
 12873  				"content_references": "cr",
 12874  				"deployments": "d",
 12875  				"environments": "e",
 12876  				"issues": "i",
 12877  				"metadata": "md",
 12878  				"members": "m",
 12879  				"organization_administration": "oa",
 12880  				"organization_hooks": "oh",
 12881  				"organization_plan": "op",
 12882  				"organization_pre_receive_hooks": "opr",
 12883  				"organization_projects": "op",
 12884  				"organization_secrets": "os",
 12885  				"organization_self_hosted_runners": "osh",
 12886  				"organization_user_blocking": "oub",
 12887  				"packages": "pkg",
 12888  				"pages": "pg",
 12889  				"pull_requests": "pr",
 12890  				"repository_hooks": "rh",
 12891  				"repository_projects": "rp",
 12892  				"repository_pre_receive_hooks": "rprh",
 12893  				"secrets": "s",
 12894  				"secret_scanning_alerts": "ssa",
 12895  				"security_events": "se",
 12896  				"single_file": "sf",
 12897  				"statuses": "s",
 12898  				"team_discussions": "td",
 12899  				"vulnerability_alerts": "va",
 12900  				"workflows": "w"
 12901  			},
 12902  			"created_at": ` + referenceTimeStr + `,
 12903  			"updated_at": ` + referenceTimeStr + `,
 12904  			"has_multiple_single_files": false,
 12905  			"suspended_by": {
 12906  				"login": "l",
 12907  				"id": 1,
 12908  				"avatar_url": "a",
 12909  				"gravatar_id": "g",
 12910  				"name": "n",
 12911  				"company": "c",
 12912  				"blog": "b",
 12913  				"location": "l",
 12914  				"email": "e",
 12915  				"hireable": true,
 12916  				"bio": "b",
 12917  				"twitter_username": "t",
 12918  				"public_repos": 1,
 12919  				"followers": 1,
 12920  				"following": 1,
 12921  				"created_at": ` + referenceTimeStr + `,
 12922  				"suspended_at": ` + referenceTimeStr + `,
 12923  				"url": "u"
 12924  			},
 12925  			"suspended_at": ` + referenceTimeStr + `
 12926  		}
 12927  	}`
 12928  
 12929  	testJSONMarshal(t, u, want)
 12930  }
 12931  
 12932  func TestProjectColumnEvent_Marshal(t *testing.T) {
 12933  	testJSONMarshal(t, &ProjectColumnEvent{}, "{}")
 12934  
 12935  	u := &ProjectColumnEvent{
 12936  		Action: String("a"),
 12937  		Changes: &ProjectColumnChange{
 12938  			Name: &ProjectColumnName{From: String("NameFrom")},
 12939  		},
 12940  		AfterID:       Int64(1),
 12941  		ProjectColumn: &ProjectColumn{ID: Int64(1)},
 12942  		Repo: &Repository{
 12943  			ID:   Int64(1),
 12944  			URL:  String("s"),
 12945  			Name: String("n"),
 12946  		},
 12947  		Org: &Organization{
 12948  			BillingEmail:                         String("be"),
 12949  			Blog:                                 String("b"),
 12950  			Company:                              String("c"),
 12951  			Email:                                String("e"),
 12952  			TwitterUsername:                      String("tu"),
 12953  			Location:                             String("loc"),
 12954  			Name:                                 String("n"),
 12955  			Description:                          String("d"),
 12956  			IsVerified:                           Bool(true),
 12957  			HasOrganizationProjects:              Bool(true),
 12958  			HasRepositoryProjects:                Bool(true),
 12959  			DefaultRepoPermission:                String("drp"),
 12960  			MembersCanCreateRepos:                Bool(true),
 12961  			MembersCanCreateInternalRepos:        Bool(true),
 12962  			MembersCanCreatePrivateRepos:         Bool(true),
 12963  			MembersCanCreatePublicRepos:          Bool(false),
 12964  			MembersAllowedRepositoryCreationType: String("marct"),
 12965  			MembersCanCreatePages:                Bool(true),
 12966  			MembersCanCreatePublicPages:          Bool(false),
 12967  			MembersCanCreatePrivatePages:         Bool(true),
 12968  		},
 12969  		Sender: &User{
 12970  			Login:     String("l"),
 12971  			ID:        Int64(1),
 12972  			NodeID:    String("n"),
 12973  			URL:       String("u"),
 12974  			ReposURL:  String("r"),
 12975  			EventsURL: String("e"),
 12976  			AvatarURL: String("a"),
 12977  		},
 12978  		Installation: &Installation{
 12979  			ID:       Int64(1),
 12980  			NodeID:   String("nid"),
 12981  			AppID:    Int64(1),
 12982  			AppSlug:  String("as"),
 12983  			TargetID: Int64(1),
 12984  			Account: &User{
 12985  				Login:           String("l"),
 12986  				ID:              Int64(1),
 12987  				URL:             String("u"),
 12988  				AvatarURL:       String("a"),
 12989  				GravatarID:      String("g"),
 12990  				Name:            String("n"),
 12991  				Company:         String("c"),
 12992  				Blog:            String("b"),
 12993  				Location:        String("l"),
 12994  				Email:           String("e"),
 12995  				Hireable:        Bool(true),
 12996  				Bio:             String("b"),
 12997  				TwitterUsername: String("t"),
 12998  				PublicRepos:     Int(1),
 12999  				Followers:       Int(1),
 13000  				Following:       Int(1),
 13001  				CreatedAt:       &Timestamp{referenceTime},
 13002  				SuspendedAt:     &Timestamp{referenceTime},
 13003  			},
 13004  			AccessTokensURL:     String("atu"),
 13005  			RepositoriesURL:     String("ru"),
 13006  			HTMLURL:             String("hu"),
 13007  			TargetType:          String("tt"),
 13008  			SingleFileName:      String("sfn"),
 13009  			RepositorySelection: String("rs"),
 13010  			Events:              []string{"e"},
 13011  			SingleFilePaths:     []string{"s"},
 13012  			Permissions: &InstallationPermissions{
 13013  				Actions:                       String("a"),
 13014  				Administration:                String("ad"),
 13015  				Checks:                        String("c"),
 13016  				Contents:                      String("co"),
 13017  				ContentReferences:             String("cr"),
 13018  				Deployments:                   String("d"),
 13019  				Environments:                  String("e"),
 13020  				Issues:                        String("i"),
 13021  				Metadata:                      String("md"),
 13022  				Members:                       String("m"),
 13023  				OrganizationAdministration:    String("oa"),
 13024  				OrganizationHooks:             String("oh"),
 13025  				OrganizationPlan:              String("op"),
 13026  				OrganizationPreReceiveHooks:   String("opr"),
 13027  				OrganizationProjects:          String("op"),
 13028  				OrganizationSecrets:           String("os"),
 13029  				OrganizationSelfHostedRunners: String("osh"),
 13030  				OrganizationUserBlocking:      String("oub"),
 13031  				Packages:                      String("pkg"),
 13032  				Pages:                         String("pg"),
 13033  				PullRequests:                  String("pr"),
 13034  				RepositoryHooks:               String("rh"),
 13035  				RepositoryProjects:            String("rp"),
 13036  				RepositoryPreReceiveHooks:     String("rprh"),
 13037  				Secrets:                       String("s"),
 13038  				SecretScanningAlerts:          String("ssa"),
 13039  				SecurityEvents:                String("se"),
 13040  				SingleFile:                    String("sf"),
 13041  				Statuses:                      String("s"),
 13042  				TeamDiscussions:               String("td"),
 13043  				VulnerabilityAlerts:           String("va"),
 13044  				Workflows:                     String("w"),
 13045  			},
 13046  			CreatedAt:              &Timestamp{referenceTime},
 13047  			UpdatedAt:              &Timestamp{referenceTime},
 13048  			HasMultipleSingleFiles: Bool(false),
 13049  			SuspendedBy: &User{
 13050  				Login:           String("l"),
 13051  				ID:              Int64(1),
 13052  				URL:             String("u"),
 13053  				AvatarURL:       String("a"),
 13054  				GravatarID:      String("g"),
 13055  				Name:            String("n"),
 13056  				Company:         String("c"),
 13057  				Blog:            String("b"),
 13058  				Location:        String("l"),
 13059  				Email:           String("e"),
 13060  				Hireable:        Bool(true),
 13061  				Bio:             String("b"),
 13062  				TwitterUsername: String("t"),
 13063  				PublicRepos:     Int(1),
 13064  				Followers:       Int(1),
 13065  				Following:       Int(1),
 13066  				CreatedAt:       &Timestamp{referenceTime},
 13067  				SuspendedAt:     &Timestamp{referenceTime},
 13068  			},
 13069  			SuspendedAt: &Timestamp{referenceTime},
 13070  		},
 13071  	}
 13072  
 13073  	want := `{
 13074  		"action": "a",
 13075  		"changes": {
 13076  			"name": {
 13077  				"from": "NameFrom"
 13078  			}
 13079  		},
 13080  		"after_id": 1,
 13081  		"project_column": {
 13082  			"id": 1
 13083  		},
 13084  		"repository": {
 13085  			"id": 1,
 13086  			"name": "n",
 13087  			"url": "s"
 13088  		},
 13089  		"organization": {
 13090  			"name": "n",
 13091  			"company": "c",
 13092  			"blog": "b",
 13093  			"location": "loc",
 13094  			"email": "e",
 13095  			"twitter_username": "tu",
 13096  			"description": "d",
 13097  			"billing_email": "be",
 13098  			"is_verified": true,
 13099  			"has_organization_projects": true,
 13100  			"has_repository_projects": true,
 13101  			"default_repository_permission": "drp",
 13102  			"members_can_create_repositories": true,
 13103  			"members_can_create_public_repositories": false,
 13104  			"members_can_create_private_repositories": true,
 13105  			"members_can_create_internal_repositories": true,
 13106  			"members_allowed_repository_creation_type": "marct",
 13107  			"members_can_create_pages": true,
 13108  			"members_can_create_public_pages": false,
 13109  			"members_can_create_private_pages": true
 13110  		},
 13111  		"sender": {
 13112  			"login": "l",
 13113  			"id": 1,
 13114  			"node_id": "n",
 13115  			"avatar_url": "a",
 13116  			"url": "u",
 13117  			"events_url": "e",
 13118  			"repos_url": "r"
 13119  		},
 13120  		"installation": {
 13121  			"id": 1,
 13122  			"node_id": "nid",
 13123  			"app_id": 1,
 13124  			"app_slug": "as",
 13125  			"target_id": 1,
 13126  			"account": {
 13127  				"login": "l",
 13128  				"id": 1,
 13129  				"avatar_url": "a",
 13130  				"gravatar_id": "g",
 13131  				"name": "n",
 13132  				"company": "c",
 13133  				"blog": "b",
 13134  				"location": "l",
 13135  				"email": "e",
 13136  				"hireable": true,
 13137  				"bio": "b",
 13138  				"twitter_username": "t",
 13139  				"public_repos": 1,
 13140  				"followers": 1,
 13141  				"following": 1,
 13142  				"created_at": ` + referenceTimeStr + `,
 13143  				"suspended_at": ` + referenceTimeStr + `,
 13144  				"url": "u"
 13145  			},
 13146  			"access_tokens_url": "atu",
 13147  			"repositories_url": "ru",
 13148  			"html_url": "hu",
 13149  			"target_type": "tt",
 13150  			"single_file_name": "sfn",
 13151  			"repository_selection": "rs",
 13152  			"events": [
 13153  				"e"
 13154  			],
 13155  			"single_file_paths": [
 13156  				"s"
 13157  			],
 13158  			"permissions": {
 13159  				"actions": "a",
 13160  				"administration": "ad",
 13161  				"checks": "c",
 13162  				"contents": "co",
 13163  				"content_references": "cr",
 13164  				"deployments": "d",
 13165  				"environments": "e",
 13166  				"issues": "i",
 13167  				"metadata": "md",
 13168  				"members": "m",
 13169  				"organization_administration": "oa",
 13170  				"organization_hooks": "oh",
 13171  				"organization_plan": "op",
 13172  				"organization_pre_receive_hooks": "opr",
 13173  				"organization_projects": "op",
 13174  				"organization_secrets": "os",
 13175  				"organization_self_hosted_runners": "osh",
 13176  				"organization_user_blocking": "oub",
 13177  				"packages": "pkg",
 13178  				"pages": "pg",
 13179  				"pull_requests": "pr",
 13180  				"repository_hooks": "rh",
 13181  				"repository_projects": "rp",
 13182  				"repository_pre_receive_hooks": "rprh",
 13183  				"secrets": "s",
 13184  				"secret_scanning_alerts": "ssa",
 13185  				"security_events": "se",
 13186  				"single_file": "sf",
 13187  				"statuses": "s",
 13188  				"team_discussions": "td",
 13189  				"vulnerability_alerts": "va",
 13190  				"workflows": "w"
 13191  			},
 13192  			"created_at": ` + referenceTimeStr + `,
 13193  			"updated_at": ` + referenceTimeStr + `,
 13194  			"has_multiple_single_files": false,
 13195  			"suspended_by": {
 13196  				"login": "l",
 13197  				"id": 1,
 13198  				"avatar_url": "a",
 13199  				"gravatar_id": "g",
 13200  				"name": "n",
 13201  				"company": "c",
 13202  				"blog": "b",
 13203  				"location": "l",
 13204  				"email": "e",
 13205  				"hireable": true,
 13206  				"bio": "b",
 13207  				"twitter_username": "t",
 13208  				"public_repos": 1,
 13209  				"followers": 1,
 13210  				"following": 1,
 13211  				"created_at": ` + referenceTimeStr + `,
 13212  				"suspended_at": ` + referenceTimeStr + `,
 13213  				"url": "u"
 13214  			},
 13215  			"suspended_at": ` + referenceTimeStr + `
 13216  		}
 13217  	}`
 13218  
 13219  	testJSONMarshal(t, u, want)
 13220  }
 13221  
 13222  func TestPullRequestEvent_Marshal(t *testing.T) {
 13223  	testJSONMarshal(t, &PullRequestEvent{}, "{}")
 13224  
 13225  	u := &PullRequestEvent{
 13226  		Action: String("a"),
 13227  		Assignee: &User{
 13228  			Login:     String("l"),
 13229  			ID:        Int64(1),
 13230  			NodeID:    String("n"),
 13231  			URL:       String("u"),
 13232  			ReposURL:  String("r"),
 13233  			EventsURL: String("e"),
 13234  			AvatarURL: String("a"),
 13235  		},
 13236  		Number:      Int(1),
 13237  		PullRequest: &PullRequest{ID: Int64(1)},
 13238  		Changes: &EditChange{
 13239  			Title: &EditTitle{
 13240  				From: String("TitleFrom"),
 13241  			},
 13242  			Body: &EditBody{
 13243  				From: String("BodyFrom"),
 13244  			},
 13245  			Base: &EditBase{
 13246  				Ref: &EditRef{
 13247  					From: String("BaseRefFrom"),
 13248  				},
 13249  				SHA: &EditSHA{
 13250  					From: String("BaseSHAFrom"),
 13251  				},
 13252  			},
 13253  		},
 13254  		RequestedReviewer: &User{
 13255  			Login:     String("l"),
 13256  			ID:        Int64(1),
 13257  			NodeID:    String("n"),
 13258  			URL:       String("u"),
 13259  			ReposURL:  String("r"),
 13260  			EventsURL: String("e"),
 13261  			AvatarURL: String("a"),
 13262  		},
 13263  		RequestedTeam: &Team{ID: Int64(1)},
 13264  		Label:         &Label{ID: Int64(1)},
 13265  		Before:        String("before"),
 13266  		After:         String("after"),
 13267  		Repo: &Repository{
 13268  			ID:   Int64(1),
 13269  			URL:  String("s"),
 13270  			Name: String("n"),
 13271  		},
 13272  		Organization: &Organization{
 13273  			BillingEmail:                         String("be"),
 13274  			Blog:                                 String("b"),
 13275  			Company:                              String("c"),
 13276  			Email:                                String("e"),
 13277  			TwitterUsername:                      String("tu"),
 13278  			Location:                             String("loc"),
 13279  			Name:                                 String("n"),
 13280  			Description:                          String("d"),
 13281  			IsVerified:                           Bool(true),
 13282  			HasOrganizationProjects:              Bool(true),
 13283  			HasRepositoryProjects:                Bool(true),
 13284  			DefaultRepoPermission:                String("drp"),
 13285  			MembersCanCreateRepos:                Bool(true),
 13286  			MembersCanCreateInternalRepos:        Bool(true),
 13287  			MembersCanCreatePrivateRepos:         Bool(true),
 13288  			MembersCanCreatePublicRepos:          Bool(false),
 13289  			MembersAllowedRepositoryCreationType: String("marct"),
 13290  			MembersCanCreatePages:                Bool(true),
 13291  			MembersCanCreatePublicPages:          Bool(false),
 13292  			MembersCanCreatePrivatePages:         Bool(true),
 13293  		},
 13294  		Sender: &User{
 13295  			Login:     String("l"),
 13296  			ID:        Int64(1),
 13297  			NodeID:    String("n"),
 13298  			URL:       String("u"),
 13299  			ReposURL:  String("r"),
 13300  			EventsURL: String("e"),
 13301  			AvatarURL: String("a"),
 13302  		},
 13303  		Installation: &Installation{
 13304  			ID:       Int64(1),
 13305  			NodeID:   String("nid"),
 13306  			AppID:    Int64(1),
 13307  			AppSlug:  String("as"),
 13308  			TargetID: Int64(1),
 13309  			Account: &User{
 13310  				Login:           String("l"),
 13311  				ID:              Int64(1),
 13312  				URL:             String("u"),
 13313  				AvatarURL:       String("a"),
 13314  				GravatarID:      String("g"),
 13315  				Name:            String("n"),
 13316  				Company:         String("c"),
 13317  				Blog:            String("b"),
 13318  				Location:        String("l"),
 13319  				Email:           String("e"),
 13320  				Hireable:        Bool(true),
 13321  				Bio:             String("b"),
 13322  				TwitterUsername: String("t"),
 13323  				PublicRepos:     Int(1),
 13324  				Followers:       Int(1),
 13325  				Following:       Int(1),
 13326  				CreatedAt:       &Timestamp{referenceTime},
 13327  				SuspendedAt:     &Timestamp{referenceTime},
 13328  			},
 13329  			AccessTokensURL:     String("atu"),
 13330  			RepositoriesURL:     String("ru"),
 13331  			HTMLURL:             String("hu"),
 13332  			TargetType:          String("tt"),
 13333  			SingleFileName:      String("sfn"),
 13334  			RepositorySelection: String("rs"),
 13335  			Events:              []string{"e"},
 13336  			SingleFilePaths:     []string{"s"},
 13337  			Permissions: &InstallationPermissions{
 13338  				Actions:                       String("a"),
 13339  				Administration:                String("ad"),
 13340  				Checks:                        String("c"),
 13341  				Contents:                      String("co"),
 13342  				ContentReferences:             String("cr"),
 13343  				Deployments:                   String("d"),
 13344  				Environments:                  String("e"),
 13345  				Issues:                        String("i"),
 13346  				Metadata:                      String("md"),
 13347  				Members:                       String("m"),
 13348  				OrganizationAdministration:    String("oa"),
 13349  				OrganizationHooks:             String("oh"),
 13350  				OrganizationPlan:              String("op"),
 13351  				OrganizationPreReceiveHooks:   String("opr"),
 13352  				OrganizationProjects:          String("op"),
 13353  				OrganizationSecrets:           String("os"),
 13354  				OrganizationSelfHostedRunners: String("osh"),
 13355  				OrganizationUserBlocking:      String("oub"),
 13356  				Packages:                      String("pkg"),
 13357  				Pages:                         String("pg"),
 13358  				PullRequests:                  String("pr"),
 13359  				RepositoryHooks:               String("rh"),
 13360  				RepositoryProjects:            String("rp"),
 13361  				RepositoryPreReceiveHooks:     String("rprh"),
 13362  				Secrets:                       String("s"),
 13363  				SecretScanningAlerts:          String("ssa"),
 13364  				SecurityEvents:                String("se"),
 13365  				SingleFile:                    String("sf"),
 13366  				Statuses:                      String("s"),
 13367  				TeamDiscussions:               String("td"),
 13368  				VulnerabilityAlerts:           String("va"),
 13369  				Workflows:                     String("w"),
 13370  			},
 13371  			CreatedAt:              &Timestamp{referenceTime},
 13372  			UpdatedAt:              &Timestamp{referenceTime},
 13373  			HasMultipleSingleFiles: Bool(false),
 13374  			SuspendedBy: &User{
 13375  				Login:           String("l"),
 13376  				ID:              Int64(1),
 13377  				URL:             String("u"),
 13378  				AvatarURL:       String("a"),
 13379  				GravatarID:      String("g"),
 13380  				Name:            String("n"),
 13381  				Company:         String("c"),
 13382  				Blog:            String("b"),
 13383  				Location:        String("l"),
 13384  				Email:           String("e"),
 13385  				Hireable:        Bool(true),
 13386  				Bio:             String("b"),
 13387  				TwitterUsername: String("t"),
 13388  				PublicRepos:     Int(1),
 13389  				Followers:       Int(1),
 13390  				Following:       Int(1),
 13391  				CreatedAt:       &Timestamp{referenceTime},
 13392  				SuspendedAt:     &Timestamp{referenceTime},
 13393  			},
 13394  			SuspendedAt: &Timestamp{referenceTime},
 13395  		},
 13396  	}
 13397  
 13398  	want := `{
 13399  		"action": "a",
 13400  		"assignee": {
 13401  			"login": "l",
 13402  			"id": 1,
 13403  			"node_id": "n",
 13404  			"avatar_url": "a",
 13405  			"url": "u",
 13406  			"events_url": "e",
 13407  			"repos_url": "r"
 13408  		},
 13409  		"number": 1,
 13410  		"pull_request": {
 13411  			"id": 1
 13412  		},
 13413  		"changes": {
 13414  			"title": {
 13415  				"from": "TitleFrom"
 13416  			},
 13417  			"body": {
 13418  				"from": "BodyFrom"
 13419  			},
 13420  			"base": {
 13421  				"ref": {
 13422  					"from": "BaseRefFrom"
 13423  				},
 13424  				"sha": {
 13425  					"from": "BaseSHAFrom"
 13426  				}
 13427  			}
 13428  		},
 13429  		"requested_reviewer": {
 13430  			"login": "l",
 13431  			"id": 1,
 13432  			"node_id": "n",
 13433  			"avatar_url": "a",
 13434  			"url": "u",
 13435  			"events_url": "e",
 13436  			"repos_url": "r"
 13437  		},
 13438  		"requested_team": {
 13439  			"id": 1
 13440  		},
 13441  		"repository": {
 13442  			"id": 1,
 13443  			"name": "n",
 13444  			"url": "s"
 13445  		},
 13446  		"sender": {
 13447  			"login": "l",
 13448  			"id": 1,
 13449  			"node_id": "n",
 13450  			"avatar_url": "a",
 13451  			"url": "u",
 13452  			"events_url": "e",
 13453  			"repos_url": "r"
 13454  		},
 13455  		"installation": {
 13456  			"id": 1,
 13457  			"node_id": "nid",
 13458  			"app_id": 1,
 13459  			"app_slug": "as",
 13460  			"target_id": 1,
 13461  			"account": {
 13462  				"login": "l",
 13463  				"id": 1,
 13464  				"avatar_url": "a",
 13465  				"gravatar_id": "g",
 13466  				"name": "n",
 13467  				"company": "c",
 13468  				"blog": "b",
 13469  				"location": "l",
 13470  				"email": "e",
 13471  				"hireable": true,
 13472  				"bio": "b",
 13473  				"twitter_username": "t",
 13474  				"public_repos": 1,
 13475  				"followers": 1,
 13476  				"following": 1,
 13477  				"created_at": ` + referenceTimeStr + `,
 13478  				"suspended_at": ` + referenceTimeStr + `,
 13479  				"url": "u"
 13480  			},
 13481  			"access_tokens_url": "atu",
 13482  			"repositories_url": "ru",
 13483  			"html_url": "hu",
 13484  			"target_type": "tt",
 13485  			"single_file_name": "sfn",
 13486  			"repository_selection": "rs",
 13487  			"events": [
 13488  				"e"
 13489  			],
 13490  			"single_file_paths": [
 13491  				"s"
 13492  			],
 13493  			"permissions": {
 13494  				"actions": "a",
 13495  				"administration": "ad",
 13496  				"checks": "c",
 13497  				"contents": "co",
 13498  				"content_references": "cr",
 13499  				"deployments": "d",
 13500  				"environments": "e",
 13501  				"issues": "i",
 13502  				"metadata": "md",
 13503  				"members": "m",
 13504  				"organization_administration": "oa",
 13505  				"organization_hooks": "oh",
 13506  				"organization_plan": "op",
 13507  				"organization_pre_receive_hooks": "opr",
 13508  				"organization_projects": "op",
 13509  				"organization_secrets": "os",
 13510  				"organization_self_hosted_runners": "osh",
 13511  				"organization_user_blocking": "oub",
 13512  				"packages": "pkg",
 13513  				"pages": "pg",
 13514  				"pull_requests": "pr",
 13515  				"repository_hooks": "rh",
 13516  				"repository_projects": "rp",
 13517  				"repository_pre_receive_hooks": "rprh",
 13518  				"secrets": "s",
 13519  				"secret_scanning_alerts": "ssa",
 13520  				"security_events": "se",
 13521  				"single_file": "sf",
 13522  				"statuses": "s",
 13523  				"team_discussions": "td",
 13524  				"vulnerability_alerts": "va",
 13525  				"workflows": "w"
 13526  			},
 13527  			"created_at": ` + referenceTimeStr + `,
 13528  			"updated_at": ` + referenceTimeStr + `,
 13529  			"has_multiple_single_files": false,
 13530  			"suspended_by": {
 13531  				"login": "l",
 13532  				"id": 1,
 13533  				"avatar_url": "a",
 13534  				"gravatar_id": "g",
 13535  				"name": "n",
 13536  				"company": "c",
 13537  				"blog": "b",
 13538  				"location": "l",
 13539  				"email": "e",
 13540  				"hireable": true,
 13541  				"bio": "b",
 13542  				"twitter_username": "t",
 13543  				"public_repos": 1,
 13544  				"followers": 1,
 13545  				"following": 1,
 13546  				"created_at": ` + referenceTimeStr + `,
 13547  				"suspended_at": ` + referenceTimeStr + `,
 13548  				"url": "u"
 13549  			},
 13550  			"suspended_at": ` + referenceTimeStr + `
 13551  		},
 13552  		"label": {
 13553  			"id": 1
 13554  		},
 13555  		"organization": {
 13556  			"name": "n",
 13557  			"company": "c",
 13558  			"blog": "b",
 13559  			"location": "loc",
 13560  			"email": "e",
 13561  			"twitter_username": "tu",
 13562  			"description": "d",
 13563  			"billing_email": "be",
 13564  			"is_verified": true,
 13565  			"has_organization_projects": true,
 13566  			"has_repository_projects": true,
 13567  			"default_repository_permission": "drp",
 13568  			"members_can_create_repositories": true,
 13569  			"members_can_create_public_repositories": false,
 13570  			"members_can_create_private_repositories": true,
 13571  			"members_can_create_internal_repositories": true,
 13572  			"members_allowed_repository_creation_type": "marct",
 13573  			"members_can_create_pages": true,
 13574  			"members_can_create_public_pages": false,
 13575  			"members_can_create_private_pages": true
 13576  		},
 13577  		"before": "before",
 13578  		"after": "after"
 13579  	}`
 13580  
 13581  	testJSONMarshal(t, u, want)
 13582  }
 13583  
 13584  func TestPullRequestReviewCommentEvent_Marshal(t *testing.T) {
 13585  	testJSONMarshal(t, &PullRequestReviewCommentEvent{}, "{}")
 13586  
 13587  	u := &PullRequestReviewCommentEvent{
 13588  		Action:      String("a"),
 13589  		PullRequest: &PullRequest{ID: Int64(1)},
 13590  		Comment:     &PullRequestComment{ID: Int64(1)},
 13591  		Changes: &EditChange{
 13592  			Title: &EditTitle{
 13593  				From: String("TitleFrom"),
 13594  			},
 13595  			Body: &EditBody{
 13596  				From: String("BodyFrom"),
 13597  			},
 13598  			Base: &EditBase{
 13599  				Ref: &EditRef{
 13600  					From: String("BaseRefFrom"),
 13601  				},
 13602  				SHA: &EditSHA{
 13603  					From: String("BaseSHAFrom"),
 13604  				},
 13605  			},
 13606  		},
 13607  		Repo: &Repository{
 13608  			ID:   Int64(1),
 13609  			URL:  String("s"),
 13610  			Name: String("n"),
 13611  		},
 13612  		Sender: &User{
 13613  			Login:     String("l"),
 13614  			ID:        Int64(1),
 13615  			NodeID:    String("n"),
 13616  			URL:       String("u"),
 13617  			ReposURL:  String("r"),
 13618  			EventsURL: String("e"),
 13619  			AvatarURL: String("a"),
 13620  		},
 13621  		Installation: &Installation{
 13622  			ID:       Int64(1),
 13623  			NodeID:   String("nid"),
 13624  			AppID:    Int64(1),
 13625  			AppSlug:  String("as"),
 13626  			TargetID: Int64(1),
 13627  			Account: &User{
 13628  				Login:           String("l"),
 13629  				ID:              Int64(1),
 13630  				URL:             String("u"),
 13631  				AvatarURL:       String("a"),
 13632  				GravatarID:      String("g"),
 13633  				Name:            String("n"),
 13634  				Company:         String("c"),
 13635  				Blog:            String("b"),
 13636  				Location:        String("l"),
 13637  				Email:           String("e"),
 13638  				Hireable:        Bool(true),
 13639  				Bio:             String("b"),
 13640  				TwitterUsername: String("t"),
 13641  				PublicRepos:     Int(1),
 13642  				Followers:       Int(1),
 13643  				Following:       Int(1),
 13644  				CreatedAt:       &Timestamp{referenceTime},
 13645  				SuspendedAt:     &Timestamp{referenceTime},
 13646  			},
 13647  			AccessTokensURL:     String("atu"),
 13648  			RepositoriesURL:     String("ru"),
 13649  			HTMLURL:             String("hu"),
 13650  			TargetType:          String("tt"),
 13651  			SingleFileName:      String("sfn"),
 13652  			RepositorySelection: String("rs"),
 13653  			Events:              []string{"e"},
 13654  			SingleFilePaths:     []string{"s"},
 13655  			Permissions: &InstallationPermissions{
 13656  				Actions:                       String("a"),
 13657  				Administration:                String("ad"),
 13658  				Checks:                        String("c"),
 13659  				Contents:                      String("co"),
 13660  				ContentReferences:             String("cr"),
 13661  				Deployments:                   String("d"),
 13662  				Environments:                  String("e"),
 13663  				Issues:                        String("i"),
 13664  				Metadata:                      String("md"),
 13665  				Members:                       String("m"),
 13666  				OrganizationAdministration:    String("oa"),
 13667  				OrganizationHooks:             String("oh"),
 13668  				OrganizationPlan:              String("op"),
 13669  				OrganizationPreReceiveHooks:   String("opr"),
 13670  				OrganizationProjects:          String("op"),
 13671  				OrganizationSecrets:           String("os"),
 13672  				OrganizationSelfHostedRunners: String("osh"),
 13673  				OrganizationUserBlocking:      String("oub"),
 13674  				Packages:                      String("pkg"),
 13675  				Pages:                         String("pg"),
 13676  				PullRequests:                  String("pr"),
 13677  				RepositoryHooks:               String("rh"),
 13678  				RepositoryProjects:            String("rp"),
 13679  				RepositoryPreReceiveHooks:     String("rprh"),
 13680  				Secrets:                       String("s"),
 13681  				SecretScanningAlerts:          String("ssa"),
 13682  				SecurityEvents:                String("se"),
 13683  				SingleFile:                    String("sf"),
 13684  				Statuses:                      String("s"),
 13685  				TeamDiscussions:               String("td"),
 13686  				VulnerabilityAlerts:           String("va"),
 13687  				Workflows:                     String("w"),
 13688  			},
 13689  			CreatedAt:              &Timestamp{referenceTime},
 13690  			UpdatedAt:              &Timestamp{referenceTime},
 13691  			HasMultipleSingleFiles: Bool(false),
 13692  			SuspendedBy: &User{
 13693  				Login:           String("l"),
 13694  				ID:              Int64(1),
 13695  				URL:             String("u"),
 13696  				AvatarURL:       String("a"),
 13697  				GravatarID:      String("g"),
 13698  				Name:            String("n"),
 13699  				Company:         String("c"),
 13700  				Blog:            String("b"),
 13701  				Location:        String("l"),
 13702  				Email:           String("e"),
 13703  				Hireable:        Bool(true),
 13704  				Bio:             String("b"),
 13705  				TwitterUsername: String("t"),
 13706  				PublicRepos:     Int(1),
 13707  				Followers:       Int(1),
 13708  				Following:       Int(1),
 13709  				CreatedAt:       &Timestamp{referenceTime},
 13710  				SuspendedAt:     &Timestamp{referenceTime},
 13711  			},
 13712  			SuspendedAt: &Timestamp{referenceTime},
 13713  		},
 13714  	}
 13715  
 13716  	want := `{
 13717  		"action": "a",
 13718  		"pull_request": {
 13719  			"id": 1
 13720  		},
 13721  		"comment": {
 13722  			"id": 1
 13723  		},
 13724  		"changes": {
 13725  			"title": {
 13726  				"from": "TitleFrom"
 13727  			},
 13728  			"body": {
 13729  				"from": "BodyFrom"
 13730  			},
 13731  			"base": {
 13732  				"ref": {
 13733  					"from": "BaseRefFrom"
 13734  				},
 13735  				"sha": {
 13736  					"from": "BaseSHAFrom"
 13737  				}
 13738  			}
 13739  		},
 13740  		"repository": {
 13741  			"id": 1,
 13742  			"name": "n",
 13743  			"url": "s"
 13744  		},
 13745  		"sender": {
 13746  			"login": "l",
 13747  			"id": 1,
 13748  			"node_id": "n",
 13749  			"avatar_url": "a",
 13750  			"url": "u",
 13751  			"events_url": "e",
 13752  			"repos_url": "r"
 13753  		},
 13754  		"installation": {
 13755  			"id": 1,
 13756  			"node_id": "nid",
 13757  			"app_id": 1,
 13758  			"app_slug": "as",
 13759  			"target_id": 1,
 13760  			"account": {
 13761  				"login": "l",
 13762  				"id": 1,
 13763  				"avatar_url": "a",
 13764  				"gravatar_id": "g",
 13765  				"name": "n",
 13766  				"company": "c",
 13767  				"blog": "b",
 13768  				"location": "l",
 13769  				"email": "e",
 13770  				"hireable": true,
 13771  				"bio": "b",
 13772  				"twitter_username": "t",
 13773  				"public_repos": 1,
 13774  				"followers": 1,
 13775  				"following": 1,
 13776  				"created_at": ` + referenceTimeStr + `,
 13777  				"suspended_at": ` + referenceTimeStr + `,
 13778  				"url": "u"
 13779  			},
 13780  			"access_tokens_url": "atu",
 13781  			"repositories_url": "ru",
 13782  			"html_url": "hu",
 13783  			"target_type": "tt",
 13784  			"single_file_name": "sfn",
 13785  			"repository_selection": "rs",
 13786  			"events": [
 13787  				"e"
 13788  			],
 13789  			"single_file_paths": [
 13790  				"s"
 13791  			],
 13792  			"permissions": {
 13793  				"actions": "a",
 13794  				"administration": "ad",
 13795  				"checks": "c",
 13796  				"contents": "co",
 13797  				"content_references": "cr",
 13798  				"deployments": "d",
 13799  				"environments": "e",
 13800  				"issues": "i",
 13801  				"metadata": "md",
 13802  				"members": "m",
 13803  				"organization_administration": "oa",
 13804  				"organization_hooks": "oh",
 13805  				"organization_plan": "op",
 13806  				"organization_pre_receive_hooks": "opr",
 13807  				"organization_projects": "op",
 13808  				"organization_secrets": "os",
 13809  				"organization_self_hosted_runners": "osh",
 13810  				"organization_user_blocking": "oub",
 13811  				"packages": "pkg",
 13812  				"pages": "pg",
 13813  				"pull_requests": "pr",
 13814  				"repository_hooks": "rh",
 13815  				"repository_projects": "rp",
 13816  				"repository_pre_receive_hooks": "rprh",
 13817  				"secrets": "s",
 13818  				"secret_scanning_alerts": "ssa",
 13819  				"security_events": "se",
 13820  				"single_file": "sf",
 13821  				"statuses": "s",
 13822  				"team_discussions": "td",
 13823  				"vulnerability_alerts": "va",
 13824  				"workflows": "w"
 13825  			},
 13826  			"created_at": ` + referenceTimeStr + `,
 13827  			"updated_at": ` + referenceTimeStr + `,
 13828  			"has_multiple_single_files": false,
 13829  			"suspended_by": {
 13830  				"login": "l",
 13831  				"id": 1,
 13832  				"avatar_url": "a",
 13833  				"gravatar_id": "g",
 13834  				"name": "n",
 13835  				"company": "c",
 13836  				"blog": "b",
 13837  				"location": "l",
 13838  				"email": "e",
 13839  				"hireable": true,
 13840  				"bio": "b",
 13841  				"twitter_username": "t",
 13842  				"public_repos": 1,
 13843  				"followers": 1,
 13844  				"following": 1,
 13845  				"created_at": ` + referenceTimeStr + `,
 13846  				"suspended_at": ` + referenceTimeStr + `,
 13847  				"url": "u"
 13848  			},
 13849  			"suspended_at": ` + referenceTimeStr + `
 13850  		}
 13851  	}`
 13852  
 13853  	testJSONMarshal(t, u, want)
 13854  }
 13855  
 13856  func TestPullRequestReviewThreadEvent_Marshal(t *testing.T) {
 13857  	testJSONMarshal(t, &PullRequestReviewThreadEvent{}, "{}")
 13858  
 13859  	u := &PullRequestReviewThreadEvent{
 13860  		Action:      String("a"),
 13861  		PullRequest: &PullRequest{ID: Int64(1)},
 13862  		Thread: &PullRequestThread{
 13863  			Comments: []*PullRequestComment{{ID: Int64(1)}, {ID: Int64(2)}},
 13864  		},
 13865  		Repo: &Repository{
 13866  			ID:   Int64(1),
 13867  			URL:  String("s"),
 13868  			Name: String("n"),
 13869  		},
 13870  		Sender: &User{
 13871  			Login:     String("l"),
 13872  			ID:        Int64(1),
 13873  			NodeID:    String("n"),
 13874  			URL:       String("u"),
 13875  			ReposURL:  String("r"),
 13876  			EventsURL: String("e"),
 13877  			AvatarURL: String("a"),
 13878  		},
 13879  		Installation: &Installation{
 13880  			ID:       Int64(1),
 13881  			NodeID:   String("nid"),
 13882  			AppID:    Int64(1),
 13883  			AppSlug:  String("as"),
 13884  			TargetID: Int64(1),
 13885  			Account: &User{
 13886  				Login:           String("l"),
 13887  				ID:              Int64(1),
 13888  				URL:             String("u"),
 13889  				AvatarURL:       String("a"),
 13890  				GravatarID:      String("g"),
 13891  				Name:            String("n"),
 13892  				Company:         String("c"),
 13893  				Blog:            String("b"),
 13894  				Location:        String("l"),
 13895  				Email:           String("e"),
 13896  				Hireable:        Bool(true),
 13897  				Bio:             String("b"),
 13898  				TwitterUsername: String("t"),
 13899  				PublicRepos:     Int(1),
 13900  				Followers:       Int(1),
 13901  				Following:       Int(1),
 13902  				CreatedAt:       &Timestamp{referenceTime},
 13903  				SuspendedAt:     &Timestamp{referenceTime},
 13904  			},
 13905  			AccessTokensURL:     String("atu"),
 13906  			RepositoriesURL:     String("ru"),
 13907  			HTMLURL:             String("hu"),
 13908  			TargetType:          String("tt"),
 13909  			SingleFileName:      String("sfn"),
 13910  			RepositorySelection: String("rs"),
 13911  			Events:              []string{"e"},
 13912  			SingleFilePaths:     []string{"s"},
 13913  			Permissions: &InstallationPermissions{
 13914  				Actions:                       String("a"),
 13915  				Administration:                String("ad"),
 13916  				Checks:                        String("c"),
 13917  				Contents:                      String("co"),
 13918  				ContentReferences:             String("cr"),
 13919  				Deployments:                   String("d"),
 13920  				Environments:                  String("e"),
 13921  				Issues:                        String("i"),
 13922  				Metadata:                      String("md"),
 13923  				Members:                       String("m"),
 13924  				OrganizationAdministration:    String("oa"),
 13925  				OrganizationHooks:             String("oh"),
 13926  				OrganizationPlan:              String("op"),
 13927  				OrganizationPreReceiveHooks:   String("opr"),
 13928  				OrganizationProjects:          String("op"),
 13929  				OrganizationSecrets:           String("os"),
 13930  				OrganizationSelfHostedRunners: String("osh"),
 13931  				OrganizationUserBlocking:      String("oub"),
 13932  				Packages:                      String("pkg"),
 13933  				Pages:                         String("pg"),
 13934  				PullRequests:                  String("pr"),
 13935  				RepositoryHooks:               String("rh"),
 13936  				RepositoryProjects:            String("rp"),
 13937  				RepositoryPreReceiveHooks:     String("rprh"),
 13938  				Secrets:                       String("s"),
 13939  				SecretScanningAlerts:          String("ssa"),
 13940  				SecurityEvents:                String("se"),
 13941  				SingleFile:                    String("sf"),
 13942  				Statuses:                      String("s"),
 13943  				TeamDiscussions:               String("td"),
 13944  				VulnerabilityAlerts:           String("va"),
 13945  				Workflows:                     String("w"),
 13946  			},
 13947  			CreatedAt:              &Timestamp{referenceTime},
 13948  			UpdatedAt:              &Timestamp{referenceTime},
 13949  			HasMultipleSingleFiles: Bool(false),
 13950  			SuspendedBy: &User{
 13951  				Login:           String("l"),
 13952  				ID:              Int64(1),
 13953  				URL:             String("u"),
 13954  				AvatarURL:       String("a"),
 13955  				GravatarID:      String("g"),
 13956  				Name:            String("n"),
 13957  				Company:         String("c"),
 13958  				Blog:            String("b"),
 13959  				Location:        String("l"),
 13960  				Email:           String("e"),
 13961  				Hireable:        Bool(true),
 13962  				Bio:             String("b"),
 13963  				TwitterUsername: String("t"),
 13964  				PublicRepos:     Int(1),
 13965  				Followers:       Int(1),
 13966  				Following:       Int(1),
 13967  				CreatedAt:       &Timestamp{referenceTime},
 13968  				SuspendedAt:     &Timestamp{referenceTime},
 13969  			},
 13970  			SuspendedAt: &Timestamp{referenceTime},
 13971  		},
 13972  	}
 13973  
 13974  	want := `{
 13975  		"action": "a",
 13976  		"pull_request": {
 13977  			"id": 1
 13978  		},
 13979  		"thread": {
 13980  			"comments": [
 13981  				{
 13982  					"id": 1
 13983  				},
 13984  				{
 13985  					"id": 2
 13986  				}
 13987  			]
 13988  		},
 13989  		"repository": {
 13990  			"id": 1,
 13991  			"name": "n",
 13992  			"url": "s"
 13993  		},
 13994  		"sender": {
 13995  			"login": "l",
 13996  			"id": 1,
 13997  			"node_id": "n",
 13998  			"avatar_url": "a",
 13999  			"url": "u",
 14000  			"events_url": "e",
 14001  			"repos_url": "r"
 14002  		},
 14003  		"installation": {
 14004  			"id": 1,
 14005  			"node_id": "nid",
 14006  			"app_id": 1,
 14007  			"app_slug": "as",
 14008  			"target_id": 1,
 14009  			"account": {
 14010  				"login": "l",
 14011  				"id": 1,
 14012  				"avatar_url": "a",
 14013  				"gravatar_id": "g",
 14014  				"name": "n",
 14015  				"company": "c",
 14016  				"blog": "b",
 14017  				"location": "l",
 14018  				"email": "e",
 14019  				"hireable": true,
 14020  				"bio": "b",
 14021  				"twitter_username": "t",
 14022  				"public_repos": 1,
 14023  				"followers": 1,
 14024  				"following": 1,
 14025  				"created_at": ` + referenceTimeStr + `,
 14026  				"suspended_at": ` + referenceTimeStr + `,
 14027  				"url": "u"
 14028  			},
 14029  			"access_tokens_url": "atu",
 14030  			"repositories_url": "ru",
 14031  			"html_url": "hu",
 14032  			"target_type": "tt",
 14033  			"single_file_name": "sfn",
 14034  			"repository_selection": "rs",
 14035  			"events": [
 14036  				"e"
 14037  			],
 14038  			"single_file_paths": [
 14039  				"s"
 14040  			],
 14041  			"permissions": {
 14042  				"actions": "a",
 14043  				"administration": "ad",
 14044  				"checks": "c",
 14045  				"contents": "co",
 14046  				"content_references": "cr",
 14047  				"deployments": "d",
 14048  				"environments": "e",
 14049  				"issues": "i",
 14050  				"metadata": "md",
 14051  				"members": "m",
 14052  				"organization_administration": "oa",
 14053  				"organization_hooks": "oh",
 14054  				"organization_plan": "op",
 14055  				"organization_pre_receive_hooks": "opr",
 14056  				"organization_projects": "op",
 14057  				"organization_secrets": "os",
 14058  				"organization_self_hosted_runners": "osh",
 14059  				"organization_user_blocking": "oub",
 14060  				"packages": "pkg",
 14061  				"pages": "pg",
 14062  				"pull_requests": "pr",
 14063  				"repository_hooks": "rh",
 14064  				"repository_projects": "rp",
 14065  				"repository_pre_receive_hooks": "rprh",
 14066  				"secrets": "s",
 14067  				"secret_scanning_alerts": "ssa",
 14068  				"security_events": "se",
 14069  				"single_file": "sf",
 14070  				"statuses": "s",
 14071  				"team_discussions": "td",
 14072  				"vulnerability_alerts": "va",
 14073  				"workflows": "w"
 14074  			},
 14075  			"created_at": ` + referenceTimeStr + `,
 14076  			"updated_at": ` + referenceTimeStr + `,
 14077  			"has_multiple_single_files": false,
 14078  			"suspended_by": {
 14079  				"login": "l",
 14080  				"id": 1,
 14081  				"avatar_url": "a",
 14082  				"gravatar_id": "g",
 14083  				"name": "n",
 14084  				"company": "c",
 14085  				"blog": "b",
 14086  				"location": "l",
 14087  				"email": "e",
 14088  				"hireable": true,
 14089  				"bio": "b",
 14090  				"twitter_username": "t",
 14091  				"public_repos": 1,
 14092  				"followers": 1,
 14093  				"following": 1,
 14094  				"created_at": ` + referenceTimeStr + `,
 14095  				"suspended_at": ` + referenceTimeStr + `,
 14096  				"url": "u"
 14097  			},
 14098  			"suspended_at": ` + referenceTimeStr + `
 14099  		}
 14100  	}`
 14101  
 14102  	testJSONMarshal(t, u, want)
 14103  }
 14104  
 14105  func TestPullRequestTargetEvent_Marshal(t *testing.T) {
 14106  	testJSONMarshal(t, &PullRequestTargetEvent{}, "{}")
 14107  
 14108  	u := &PullRequestTargetEvent{
 14109  		Action: String("a"),
 14110  		Assignee: &User{
 14111  			Login:     String("l"),
 14112  			ID:        Int64(1),
 14113  			NodeID:    String("n"),
 14114  			URL:       String("u"),
 14115  			ReposURL:  String("r"),
 14116  			EventsURL: String("e"),
 14117  			AvatarURL: String("a"),
 14118  		},
 14119  		Number:      Int(1),
 14120  		PullRequest: &PullRequest{ID: Int64(1)},
 14121  		Changes: &EditChange{
 14122  			Title: &EditTitle{
 14123  				From: String("TitleFrom"),
 14124  			},
 14125  			Body: &EditBody{
 14126  				From: String("BodyFrom"),
 14127  			},
 14128  			Base: &EditBase{
 14129  				Ref: &EditRef{
 14130  					From: String("BaseRefFrom"),
 14131  				},
 14132  				SHA: &EditSHA{
 14133  					From: String("BaseSHAFrom"),
 14134  				},
 14135  			},
 14136  		},
 14137  		RequestedReviewer: &User{
 14138  			Login:     String("l"),
 14139  			ID:        Int64(1),
 14140  			NodeID:    String("n"),
 14141  			URL:       String("u"),
 14142  			ReposURL:  String("r"),
 14143  			EventsURL: String("e"),
 14144  			AvatarURL: String("a"),
 14145  		},
 14146  		RequestedTeam: &Team{ID: Int64(1)},
 14147  		Label:         &Label{ID: Int64(1)},
 14148  		Before:        String("before"),
 14149  		After:         String("after"),
 14150  		Repo: &Repository{
 14151  			ID:   Int64(1),
 14152  			URL:  String("s"),
 14153  			Name: String("n"),
 14154  		},
 14155  		Organization: &Organization{
 14156  			BillingEmail:                         String("be"),
 14157  			Blog:                                 String("b"),
 14158  			Company:                              String("c"),
 14159  			Email:                                String("e"),
 14160  			TwitterUsername:                      String("tu"),
 14161  			Location:                             String("loc"),
 14162  			Name:                                 String("n"),
 14163  			Description:                          String("d"),
 14164  			IsVerified:                           Bool(true),
 14165  			HasOrganizationProjects:              Bool(true),
 14166  			HasRepositoryProjects:                Bool(true),
 14167  			DefaultRepoPermission:                String("drp"),
 14168  			MembersCanCreateRepos:                Bool(true),
 14169  			MembersCanCreateInternalRepos:        Bool(true),
 14170  			MembersCanCreatePrivateRepos:         Bool(true),
 14171  			MembersCanCreatePublicRepos:          Bool(false),
 14172  			MembersAllowedRepositoryCreationType: String("marct"),
 14173  			MembersCanCreatePages:                Bool(true),
 14174  			MembersCanCreatePublicPages:          Bool(false),
 14175  			MembersCanCreatePrivatePages:         Bool(true),
 14176  		},
 14177  		Sender: &User{
 14178  			Login:     String("l"),
 14179  			ID:        Int64(1),
 14180  			NodeID:    String("n"),
 14181  			URL:       String("u"),
 14182  			ReposURL:  String("r"),
 14183  			EventsURL: String("e"),
 14184  			AvatarURL: String("a"),
 14185  		},
 14186  		Installation: &Installation{
 14187  			ID:       Int64(1),
 14188  			NodeID:   String("nid"),
 14189  			AppID:    Int64(1),
 14190  			AppSlug:  String("as"),
 14191  			TargetID: Int64(1),
 14192  			Account: &User{
 14193  				Login:           String("l"),
 14194  				ID:              Int64(1),
 14195  				URL:             String("u"),
 14196  				AvatarURL:       String("a"),
 14197  				GravatarID:      String("g"),
 14198  				Name:            String("n"),
 14199  				Company:         String("c"),
 14200  				Blog:            String("b"),
 14201  				Location:        String("l"),
 14202  				Email:           String("e"),
 14203  				Hireable:        Bool(true),
 14204  				Bio:             String("b"),
 14205  				TwitterUsername: String("t"),
 14206  				PublicRepos:     Int(1),
 14207  				Followers:       Int(1),
 14208  				Following:       Int(1),
 14209  				CreatedAt:       &Timestamp{referenceTime},
 14210  				SuspendedAt:     &Timestamp{referenceTime},
 14211  			},
 14212  			AccessTokensURL:     String("atu"),
 14213  			RepositoriesURL:     String("ru"),
 14214  			HTMLURL:             String("hu"),
 14215  			TargetType:          String("tt"),
 14216  			SingleFileName:      String("sfn"),
 14217  			RepositorySelection: String("rs"),
 14218  			Events:              []string{"e"},
 14219  			SingleFilePaths:     []string{"s"},
 14220  			Permissions: &InstallationPermissions{
 14221  				Actions:                       String("a"),
 14222  				Administration:                String("ad"),
 14223  				Checks:                        String("c"),
 14224  				Contents:                      String("co"),
 14225  				ContentReferences:             String("cr"),
 14226  				Deployments:                   String("d"),
 14227  				Environments:                  String("e"),
 14228  				Issues:                        String("i"),
 14229  				Metadata:                      String("md"),
 14230  				Members:                       String("m"),
 14231  				OrganizationAdministration:    String("oa"),
 14232  				OrganizationHooks:             String("oh"),
 14233  				OrganizationPlan:              String("op"),
 14234  				OrganizationPreReceiveHooks:   String("opr"),
 14235  				OrganizationProjects:          String("op"),
 14236  				OrganizationSecrets:           String("os"),
 14237  				OrganizationSelfHostedRunners: String("osh"),
 14238  				OrganizationUserBlocking:      String("oub"),
 14239  				Packages:                      String("pkg"),
 14240  				Pages:                         String("pg"),
 14241  				PullRequests:                  String("pr"),
 14242  				RepositoryHooks:               String("rh"),
 14243  				RepositoryProjects:            String("rp"),
 14244  				RepositoryPreReceiveHooks:     String("rprh"),
 14245  				Secrets:                       String("s"),
 14246  				SecretScanningAlerts:          String("ssa"),
 14247  				SecurityEvents:                String("se"),
 14248  				SingleFile:                    String("sf"),
 14249  				Statuses:                      String("s"),
 14250  				TeamDiscussions:               String("td"),
 14251  				VulnerabilityAlerts:           String("va"),
 14252  				Workflows:                     String("w"),
 14253  			},
 14254  			CreatedAt:              &Timestamp{referenceTime},
 14255  			UpdatedAt:              &Timestamp{referenceTime},
 14256  			HasMultipleSingleFiles: Bool(false),
 14257  			SuspendedBy: &User{
 14258  				Login:           String("l"),
 14259  				ID:              Int64(1),
 14260  				URL:             String("u"),
 14261  				AvatarURL:       String("a"),
 14262  				GravatarID:      String("g"),
 14263  				Name:            String("n"),
 14264  				Company:         String("c"),
 14265  				Blog:            String("b"),
 14266  				Location:        String("l"),
 14267  				Email:           String("e"),
 14268  				Hireable:        Bool(true),
 14269  				Bio:             String("b"),
 14270  				TwitterUsername: String("t"),
 14271  				PublicRepos:     Int(1),
 14272  				Followers:       Int(1),
 14273  				Following:       Int(1),
 14274  				CreatedAt:       &Timestamp{referenceTime},
 14275  				SuspendedAt:     &Timestamp{referenceTime},
 14276  			},
 14277  			SuspendedAt: &Timestamp{referenceTime},
 14278  		},
 14279  	}
 14280  
 14281  	want := `{
 14282  		"action": "a",
 14283  		"assignee": {
 14284  			"login": "l",
 14285  			"id": 1,
 14286  			"node_id": "n",
 14287  			"avatar_url": "a",
 14288  			"url": "u",
 14289  			"events_url": "e",
 14290  			"repos_url": "r"
 14291  		},
 14292  		"number": 1,
 14293  		"pull_request": {
 14294  			"id": 1
 14295  		},
 14296  		"changes": {
 14297  			"title": {
 14298  				"from": "TitleFrom"
 14299  			},
 14300  			"body": {
 14301  				"from": "BodyFrom"
 14302  			},
 14303  			"base": {
 14304  				"ref": {
 14305  					"from": "BaseRefFrom"
 14306  				},
 14307  				"sha": {
 14308  					"from": "BaseSHAFrom"
 14309  				}
 14310  			}
 14311  		},
 14312  		"requested_reviewer": {
 14313  			"login": "l",
 14314  			"id": 1,
 14315  			"node_id": "n",
 14316  			"avatar_url": "a",
 14317  			"url": "u",
 14318  			"events_url": "e",
 14319  			"repos_url": "r"
 14320  		},
 14321  		"requested_team": {
 14322  			"id": 1
 14323  		},
 14324  		"repository": {
 14325  			"id": 1,
 14326  			"name": "n",
 14327  			"url": "s"
 14328  		},
 14329  		"sender": {
 14330  			"login": "l",
 14331  			"id": 1,
 14332  			"node_id": "n",
 14333  			"avatar_url": "a",
 14334  			"url": "u",
 14335  			"events_url": "e",
 14336  			"repos_url": "r"
 14337  		},
 14338  		"installation": {
 14339  			"id": 1,
 14340  			"node_id": "nid",
 14341  			"app_id": 1,
 14342  			"app_slug": "as",
 14343  			"target_id": 1,
 14344  			"account": {
 14345  				"login": "l",
 14346  				"id": 1,
 14347  				"avatar_url": "a",
 14348  				"gravatar_id": "g",
 14349  				"name": "n",
 14350  				"company": "c",
 14351  				"blog": "b",
 14352  				"location": "l",
 14353  				"email": "e",
 14354  				"hireable": true,
 14355  				"bio": "b",
 14356  				"twitter_username": "t",
 14357  				"public_repos": 1,
 14358  				"followers": 1,
 14359  				"following": 1,
 14360  				"created_at": ` + referenceTimeStr + `,
 14361  				"suspended_at": ` + referenceTimeStr + `,
 14362  				"url": "u"
 14363  			},
 14364  			"access_tokens_url": "atu",
 14365  			"repositories_url": "ru",
 14366  			"html_url": "hu",
 14367  			"target_type": "tt",
 14368  			"single_file_name": "sfn",
 14369  			"repository_selection": "rs",
 14370  			"events": [
 14371  				"e"
 14372  			],
 14373  			"single_file_paths": [
 14374  				"s"
 14375  			],
 14376  			"permissions": {
 14377  				"actions": "a",
 14378  				"administration": "ad",
 14379  				"checks": "c",
 14380  				"contents": "co",
 14381  				"content_references": "cr",
 14382  				"deployments": "d",
 14383  				"environments": "e",
 14384  				"issues": "i",
 14385  				"metadata": "md",
 14386  				"members": "m",
 14387  				"organization_administration": "oa",
 14388  				"organization_hooks": "oh",
 14389  				"organization_plan": "op",
 14390  				"organization_pre_receive_hooks": "opr",
 14391  				"organization_projects": "op",
 14392  				"organization_secrets": "os",
 14393  				"organization_self_hosted_runners": "osh",
 14394  				"organization_user_blocking": "oub",
 14395  				"packages": "pkg",
 14396  				"pages": "pg",
 14397  				"pull_requests": "pr",
 14398  				"repository_hooks": "rh",
 14399  				"repository_projects": "rp",
 14400  				"repository_pre_receive_hooks": "rprh",
 14401  				"secrets": "s",
 14402  				"secret_scanning_alerts": "ssa",
 14403  				"security_events": "se",
 14404  				"single_file": "sf",
 14405  				"statuses": "s",
 14406  				"team_discussions": "td",
 14407  				"vulnerability_alerts": "va",
 14408  				"workflows": "w"
 14409  			},
 14410  			"created_at": ` + referenceTimeStr + `,
 14411  			"updated_at": ` + referenceTimeStr + `,
 14412  			"has_multiple_single_files": false,
 14413  			"suspended_by": {
 14414  				"login": "l",
 14415  				"id": 1,
 14416  				"avatar_url": "a",
 14417  				"gravatar_id": "g",
 14418  				"name": "n",
 14419  				"company": "c",
 14420  				"blog": "b",
 14421  				"location": "l",
 14422  				"email": "e",
 14423  				"hireable": true,
 14424  				"bio": "b",
 14425  				"twitter_username": "t",
 14426  				"public_repos": 1,
 14427  				"followers": 1,
 14428  				"following": 1,
 14429  				"created_at": ` + referenceTimeStr + `,
 14430  				"suspended_at": ` + referenceTimeStr + `,
 14431  				"url": "u"
 14432  			},
 14433  			"suspended_at": ` + referenceTimeStr + `
 14434  		},
 14435  		"label": {
 14436  			"id": 1
 14437  		},
 14438  		"organization": {
 14439  			"name": "n",
 14440  			"company": "c",
 14441  			"blog": "b",
 14442  			"location": "loc",
 14443  			"email": "e",
 14444  			"twitter_username": "tu",
 14445  			"description": "d",
 14446  			"billing_email": "be",
 14447  			"is_verified": true,
 14448  			"has_organization_projects": true,
 14449  			"has_repository_projects": true,
 14450  			"default_repository_permission": "drp",
 14451  			"members_can_create_repositories": true,
 14452  			"members_can_create_public_repositories": false,
 14453  			"members_can_create_private_repositories": true,
 14454  			"members_can_create_internal_repositories": true,
 14455  			"members_allowed_repository_creation_type": "marct",
 14456  			"members_can_create_pages": true,
 14457  			"members_can_create_public_pages": false,
 14458  			"members_can_create_private_pages": true
 14459  		},
 14460  		"before": "before",
 14461  		"after": "after"
 14462  	}`
 14463  
 14464  	testJSONMarshal(t, u, want)
 14465  }
 14466  
 14467  func TestRepositoryVulnerabilityAlertEvent_Marshal(t *testing.T) {
 14468  	testJSONMarshal(t, &RepositoryVulnerabilityAlertEvent{}, "{}")
 14469  
 14470  	u := &RepositoryVulnerabilityAlertEvent{
 14471  		Action: String("a"),
 14472  		Alert: &RepositoryVulnerabilityAlert{
 14473  			ID:                  Int64(1),
 14474  			AffectedRange:       String("ar"),
 14475  			AffectedPackageName: String("apn"),
 14476  			ExternalReference:   String("er"),
 14477  			ExternalIdentifier:  String("ei"),
 14478  			FixedIn:             String("fi"),
 14479  			Dismisser: &User{
 14480  				Login:     String("l"),
 14481  				ID:        Int64(1),
 14482  				NodeID:    String("n"),
 14483  				URL:       String("u"),
 14484  				ReposURL:  String("r"),
 14485  				EventsURL: String("e"),
 14486  				AvatarURL: String("a"),
 14487  			},
 14488  			DismissReason: String("dr"),
 14489  			DismissedAt:   &Timestamp{referenceTime},
 14490  		},
 14491  		Repository: &Repository{
 14492  			ID:   Int64(1),
 14493  			URL:  String("s"),
 14494  			Name: String("n"),
 14495  		},
 14496  	}
 14497  
 14498  	want := `{
 14499  		"action": "a",
 14500  		"alert": {
 14501  			"id": 1,
 14502  			"affected_range": "ar",
 14503  			"affected_package_name": "apn",
 14504  			"external_reference": "er",
 14505  			"external_identifier": "ei",
 14506  			"fixed_in": "fi",
 14507  			"dismisser": {
 14508  				"login": "l",
 14509  				"id": 1,
 14510  				"node_id": "n",
 14511  				"avatar_url": "a",
 14512  				"url": "u",
 14513  				"events_url": "e",
 14514  				"repos_url": "r"
 14515  			},
 14516  			"dismiss_reason": "dr",
 14517  			"dismissed_at": ` + referenceTimeStr + `
 14518  		},
 14519  		"repository": {
 14520  			"id": 1,
 14521  			"name": "n",
 14522  			"url": "s"
 14523  		}
 14524  	}`
 14525  
 14526  	testJSONMarshal(t, u, want)
 14527  }
 14528  
 14529  func TestSecretScanningAlertEvent_Marshal(t *testing.T) {
 14530  	testJSONMarshal(t, &SecretScanningAlertEvent{}, "{}")
 14531  
 14532  	u := &SecretScanningAlertEvent{
 14533  		Action: String("a"),
 14534  		Alert: &SecretScanningAlert{
 14535  			Number:     Int(1),
 14536  			SecretType: String("t"),
 14537  			Resolution: String("r"),
 14538  			ResolvedBy: &User{
 14539  				Login:     String("l"),
 14540  				ID:        Int64(1),
 14541  				NodeID:    String("n"),
 14542  				URL:       String("u"),
 14543  				ReposURL:  String("r"),
 14544  				EventsURL: String("e"),
 14545  				AvatarURL: String("a"),
 14546  			},
 14547  			ResolvedAt: &Timestamp{referenceTime},
 14548  		},
 14549  		Repo: &Repository{
 14550  			ID:   Int64(1),
 14551  			URL:  String("s"),
 14552  			Name: String("n"),
 14553  		},
 14554  		Organization: &Organization{
 14555  			BillingEmail:                         String("be"),
 14556  			Blog:                                 String("b"),
 14557  			Company:                              String("c"),
 14558  			Email:                                String("e"),
 14559  			TwitterUsername:                      String("tu"),
 14560  			Location:                             String("loc"),
 14561  			Name:                                 String("n"),
 14562  			Description:                          String("d"),
 14563  			IsVerified:                           Bool(true),
 14564  			HasOrganizationProjects:              Bool(true),
 14565  			HasRepositoryProjects:                Bool(true),
 14566  			DefaultRepoPermission:                String("drp"),
 14567  			MembersCanCreateRepos:                Bool(true),
 14568  			MembersCanCreateInternalRepos:        Bool(true),
 14569  			MembersCanCreatePrivateRepos:         Bool(true),
 14570  			MembersCanCreatePublicRepos:          Bool(false),
 14571  			MembersAllowedRepositoryCreationType: String("marct"),
 14572  			MembersCanCreatePages:                Bool(true),
 14573  			MembersCanCreatePublicPages:          Bool(false),
 14574  			MembersCanCreatePrivatePages:         Bool(true),
 14575  		},
 14576  		Enterprise: &Enterprise{
 14577  			ID:          Int(1),
 14578  			Slug:        String("s"),
 14579  			Name:        String("n"),
 14580  			NodeID:      String("nid"),
 14581  			AvatarURL:   String("au"),
 14582  			Description: String("d"),
 14583  			WebsiteURL:  String("wu"),
 14584  			HTMLURL:     String("hu"),
 14585  			CreatedAt:   &Timestamp{referenceTime},
 14586  			UpdatedAt:   &Timestamp{referenceTime},
 14587  		},
 14588  		Sender: &User{
 14589  			Login:     String("l"),
 14590  			ID:        Int64(1),
 14591  			NodeID:    String("n"),
 14592  			URL:       String("u"),
 14593  			ReposURL:  String("r"),
 14594  			EventsURL: String("e"),
 14595  			AvatarURL: String("a"),
 14596  		},
 14597  		Installation: &Installation{
 14598  			ID:       Int64(1),
 14599  			NodeID:   String("nid"),
 14600  			AppID:    Int64(1),
 14601  			AppSlug:  String("as"),
 14602  			TargetID: Int64(1),
 14603  			Account: &User{
 14604  				Login:           String("l"),
 14605  				ID:              Int64(1),
 14606  				URL:             String("u"),
 14607  				AvatarURL:       String("a"),
 14608  				GravatarID:      String("g"),
 14609  				Name:            String("n"),
 14610  				Company:         String("c"),
 14611  				Blog:            String("b"),
 14612  				Location:        String("l"),
 14613  				Email:           String("e"),
 14614  				Hireable:        Bool(true),
 14615  				Bio:             String("b"),
 14616  				TwitterUsername: String("t"),
 14617  				PublicRepos:     Int(1),
 14618  				Followers:       Int(1),
 14619  				Following:       Int(1),
 14620  				CreatedAt:       &Timestamp{referenceTime},
 14621  				SuspendedAt:     &Timestamp{referenceTime},
 14622  			},
 14623  			AccessTokensURL:     String("atu"),
 14624  			RepositoriesURL:     String("ru"),
 14625  			HTMLURL:             String("hu"),
 14626  			TargetType:          String("tt"),
 14627  			SingleFileName:      String("sfn"),
 14628  			RepositorySelection: String("rs"),
 14629  			Events:              []string{"e"},
 14630  			SingleFilePaths:     []string{"s"},
 14631  			Permissions: &InstallationPermissions{
 14632  				Actions:                       String("a"),
 14633  				Administration:                String("ad"),
 14634  				Checks:                        String("c"),
 14635  				Contents:                      String("co"),
 14636  				ContentReferences:             String("cr"),
 14637  				Deployments:                   String("d"),
 14638  				Environments:                  String("e"),
 14639  				Issues:                        String("i"),
 14640  				Metadata:                      String("md"),
 14641  				Members:                       String("m"),
 14642  				OrganizationAdministration:    String("oa"),
 14643  				OrganizationHooks:             String("oh"),
 14644  				OrganizationPlan:              String("op"),
 14645  				OrganizationPreReceiveHooks:   String("opr"),
 14646  				OrganizationProjects:          String("op"),
 14647  				OrganizationSecrets:           String("os"),
 14648  				OrganizationSelfHostedRunners: String("osh"),
 14649  				OrganizationUserBlocking:      String("oub"),
 14650  				Packages:                      String("pkg"),
 14651  				Pages:                         String("pg"),
 14652  				PullRequests:                  String("pr"),
 14653  				RepositoryHooks:               String("rh"),
 14654  				RepositoryProjects:            String("rp"),
 14655  				RepositoryPreReceiveHooks:     String("rprh"),
 14656  				Secrets:                       String("s"),
 14657  				SecretScanningAlerts:          String("ssa"),
 14658  				SecurityEvents:                String("se"),
 14659  				SingleFile:                    String("sf"),
 14660  				Statuses:                      String("s"),
 14661  				TeamDiscussions:               String("td"),
 14662  				VulnerabilityAlerts:           String("va"),
 14663  				Workflows:                     String("w"),
 14664  			},
 14665  			CreatedAt:              &Timestamp{referenceTime},
 14666  			UpdatedAt:              &Timestamp{referenceTime},
 14667  			HasMultipleSingleFiles: Bool(false),
 14668  			SuspendedBy: &User{
 14669  				Login:           String("l"),
 14670  				ID:              Int64(1),
 14671  				URL:             String("u"),
 14672  				AvatarURL:       String("a"),
 14673  				GravatarID:      String("g"),
 14674  				Name:            String("n"),
 14675  				Company:         String("c"),
 14676  				Blog:            String("b"),
 14677  				Location:        String("l"),
 14678  				Email:           String("e"),
 14679  				Hireable:        Bool(true),
 14680  				Bio:             String("b"),
 14681  				TwitterUsername: String("t"),
 14682  				PublicRepos:     Int(1),
 14683  				Followers:       Int(1),
 14684  				Following:       Int(1),
 14685  				CreatedAt:       &Timestamp{referenceTime},
 14686  				SuspendedAt:     &Timestamp{referenceTime},
 14687  			},
 14688  			SuspendedAt: &Timestamp{referenceTime},
 14689  		},
 14690  	}
 14691  
 14692  	want := `{
 14693  		"action": "a",
 14694  		"alert": {
 14695  			"number": 1,
 14696  			"secret_type": "t",
 14697  			"resolution": "r",
 14698  			"resolved_by": {
 14699  				"login": "l",
 14700  				"id": 1,
 14701  				"node_id": "n",
 14702  				"avatar_url": "a",
 14703  				"url": "u",
 14704  				"events_url": "e",
 14705  				"repos_url": "r"
 14706  			},
 14707  			"resolved_at": ` + referenceTimeStr + `
 14708  		},
 14709  		"repository": {
 14710  			"id": 1,
 14711  			"name": "n",
 14712  			"url": "s"
 14713  		},
 14714          "organization": {
 14715  			"name": "n",
 14716  			"company": "c",
 14717  			"blog": "b",
 14718  			"location": "loc",
 14719  			"email": "e",
 14720  			"twitter_username": "tu",
 14721  			"description": "d",
 14722  			"billing_email": "be",
 14723  			"is_verified": true,
 14724  			"has_organization_projects": true,
 14725  			"has_repository_projects": true,
 14726  			"default_repository_permission": "drp",
 14727  			"members_can_create_repositories": true,
 14728  			"members_can_create_public_repositories": false,
 14729  			"members_can_create_private_repositories": true,
 14730  			"members_can_create_internal_repositories": true,
 14731  			"members_allowed_repository_creation_type": "marct",
 14732  			"members_can_create_pages": true,
 14733  			"members_can_create_public_pages": false,
 14734  			"members_can_create_private_pages": true
 14735  		},
 14736          "enterprise": {
 14737  			"id": 1,
 14738  			"slug": "s",
 14739  			"name": "n",
 14740  			"node_id": "nid",
 14741  			"avatar_url": "au",
 14742  			"description": "d",
 14743  			"website_url": "wu",
 14744  			"html_url": "hu",
 14745  			"created_at": ` + referenceTimeStr + `,
 14746  			"updated_at": ` + referenceTimeStr + `
 14747  		},
 14748  		"sender": {
 14749  			"login": "l",
 14750  			"id": 1,
 14751  			"node_id": "n",
 14752  			"avatar_url": "a",
 14753  			"url": "u",
 14754  			"events_url": "e",
 14755  			"repos_url": "r"
 14756  		},
 14757          "installation": {
 14758  			"id": 1,
 14759  			"node_id": "nid",
 14760  			"app_id": 1,
 14761  			"app_slug": "as",
 14762  			"target_id": 1,
 14763  			"account": {
 14764  				"login": "l",
 14765  				"id": 1,
 14766  				"avatar_url": "a",
 14767  				"gravatar_id": "g",
 14768  				"name": "n",
 14769  				"company": "c",
 14770  				"blog": "b",
 14771  				"location": "l",
 14772  				"email": "e",
 14773  				"hireable": true,
 14774  				"bio": "b",
 14775  				"twitter_username": "t",
 14776  				"public_repos": 1,
 14777  				"followers": 1,
 14778  				"following": 1,
 14779  				"created_at": ` + referenceTimeStr + `,
 14780  				"suspended_at": ` + referenceTimeStr + `,
 14781  				"url": "u"
 14782  			},
 14783  			"access_tokens_url": "atu",
 14784  			"repositories_url": "ru",
 14785  			"html_url": "hu",
 14786  			"target_type": "tt",
 14787  			"single_file_name": "sfn",
 14788  			"repository_selection": "rs",
 14789  			"events": [
 14790  				"e"
 14791  			],
 14792  			"single_file_paths": [
 14793  				"s"
 14794  			],
 14795  			"permissions": {
 14796  				"actions": "a",
 14797  				"administration": "ad",
 14798  				"checks": "c",
 14799  				"contents": "co",
 14800  				"content_references": "cr",
 14801  				"deployments": "d",
 14802  				"environments": "e",
 14803  				"issues": "i",
 14804  				"metadata": "md",
 14805  				"members": "m",
 14806  				"organization_administration": "oa",
 14807  				"organization_hooks": "oh",
 14808  				"organization_plan": "op",
 14809  				"organization_pre_receive_hooks": "opr",
 14810  				"organization_projects": "op",
 14811  				"organization_secrets": "os",
 14812  				"organization_self_hosted_runners": "osh",
 14813  				"organization_user_blocking": "oub",
 14814  				"packages": "pkg",
 14815  				"pages": "pg",
 14816  				"pull_requests": "pr",
 14817  				"repository_hooks": "rh",
 14818  				"repository_projects": "rp",
 14819  				"repository_pre_receive_hooks": "rprh",
 14820  				"secrets": "s",
 14821  				"secret_scanning_alerts": "ssa",
 14822  				"security_events": "se",
 14823  				"single_file": "sf",
 14824  				"statuses": "s",
 14825  				"team_discussions": "td",
 14826  				"vulnerability_alerts": "va",
 14827  				"workflows": "w"
 14828  			},
 14829  			"created_at": ` + referenceTimeStr + `,
 14830  			"updated_at": ` + referenceTimeStr + `,
 14831  			"has_multiple_single_files": false,
 14832  			"suspended_by": {
 14833  				"login": "l",
 14834  				"id": 1,
 14835  				"avatar_url": "a",
 14836  				"gravatar_id": "g",
 14837  				"name": "n",
 14838  				"company": "c",
 14839  				"blog": "b",
 14840  				"location": "l",
 14841  				"email": "e",
 14842  				"hireable": true,
 14843  				"bio": "b",
 14844  				"twitter_username": "t",
 14845  				"public_repos": 1,
 14846  				"followers": 1,
 14847  				"following": 1,
 14848  				"created_at": ` + referenceTimeStr + `,
 14849  				"suspended_at": ` + referenceTimeStr + `,
 14850  				"url": "u"
 14851  			},
 14852  			"suspended_at": ` + referenceTimeStr + `
 14853  		}
 14854  	}`
 14855  
 14856  	testJSONMarshal(t, u, want)
 14857  }
 14858  
 14859  func TestSecurityAdvisoryEvent_Marshal(t *testing.T) {
 14860  	testJSONMarshal(t, &SecurityAdvisoryEvent{}, "{}")
 14861  	u := &SecurityAdvisoryEvent{
 14862  		Action: String("published"),
 14863  		SecurityAdvisory: &SecurityAdvisory{
 14864  			GHSAID:      String("GHSA-rf4j-j272-some"),
 14865  			Summary:     String("Siuuuuuuuuu"),
 14866  			Description: String("desc"),
 14867  			Severity:    String("moderate"),
 14868  			Identifiers: []*AdvisoryIdentifier{
 14869  				{
 14870  					Value: String("GHSA-rf4j-j272-some"),
 14871  					Type:  String("GHSA"),
 14872  				},
 14873  			},
 14874  			References: []*AdvisoryReference{
 14875  				{
 14876  					URL: String("https://some-url"),
 14877  				},
 14878  			},
 14879  			PublishedAt: &Timestamp{referenceTime},
 14880  			UpdatedAt:   &Timestamp{referenceTime},
 14881  			WithdrawnAt: nil,
 14882  			Vulnerabilities: []*AdvisoryVulnerability{
 14883  				{
 14884  					Package: &VulnerabilityPackage{
 14885  						Ecosystem: String("ucl"),
 14886  						Name:      String("penaldo"),
 14887  					},
 14888  					Severity:               String("moderate"),
 14889  					VulnerableVersionRange: String(">= 2.0.0, < 2.0.2"),
 14890  					FirstPatchedVersion: &FirstPatchedVersion{
 14891  						Identifier: String("2.0.2"),
 14892  					},
 14893  				},
 14894  			},
 14895  		},
 14896  	}
 14897  
 14898  	want := `{
 14899  		"action": "published",
 14900  		"security_advisory": {
 14901  		  "ghsa_id": "GHSA-rf4j-j272-some",
 14902  		  "summary": "Siuuuuuuuuu",
 14903  		  "description": "desc",
 14904  		  "severity": "moderate",
 14905  		  "identifiers": [
 14906  			{
 14907  			  "value": "GHSA-rf4j-j272-some",
 14908  			  "type": "GHSA"
 14909  			}
 14910  		  ],
 14911  		  "references": [
 14912  			{
 14913  			  "url": "https://some-url"
 14914  			}
 14915  		  ],
 14916  		  "published_at": ` + referenceTimeStr + `,
 14917  		  "updated_at": ` + referenceTimeStr + `,
 14918  		  "withdrawn_at": null,
 14919  		  "vulnerabilities": [
 14920  			{
 14921  			  "package": {
 14922  				"ecosystem": "ucl",
 14923  				"name": "penaldo"
 14924  			  },
 14925  			  "severity": "moderate",
 14926  			  "vulnerable_version_range": ">= 2.0.0, < 2.0.2",
 14927  			  "first_patched_version": {
 14928  				"identifier": "2.0.2"
 14929  			  }
 14930  			}
 14931  		  ]
 14932  		}
 14933  	  }`
 14934  
 14935  	testJSONMarshal(t, u, want)
 14936  }
 14937  
 14938  func TestCodeScanningAlertEvent_Marshal(t *testing.T) {
 14939  	testJSONMarshal(t, &CodeScanningAlertEvent{}, "{}")
 14940  
 14941  	u := &CodeScanningAlertEvent{
 14942  		Action: String("reopened"),
 14943  		Alert: &Alert{
 14944  			Number: Int(10),
 14945  			Rule: &Rule{
 14946  				ID:              String("Style/FrozenStringLiteralComment"),
 14947  				Severity:        String("note"),
 14948  				Description:     String("desc"),
 14949  				FullDescription: String("full desc"),
 14950  				Tags:            []string{"style"},
 14951  				Help:            String("help"),
 14952  			},
 14953  			Tool: &Tool{
 14954  				Name:    String("Rubocop"),
 14955  				Version: nil,
 14956  			},
 14957  			CreatedAt: &Timestamp{referenceTime},
 14958  			UpdatedAt: &Timestamp{referenceTime},
 14959  			FixedAt:   nil,
 14960  			State:     String("open"),
 14961  			URL:       String("a"),
 14962  			HTMLURL:   String("a"),
 14963  			Instances: []*MostRecentInstance{
 14964  				{
 14965  					Ref:         String("refs/heads/main"),
 14966  					AnalysisKey: String(".github/workflows/workflow.yml:upload"),
 14967  					Environment: String("{}"),
 14968  					State:       String("open"),
 14969  				},
 14970  			},
 14971  			DismissedBy:     nil,
 14972  			DismissedAt:     nil,
 14973  			DismissedReason: nil,
 14974  		},
 14975  		Ref:       String("refs/heads/main"),
 14976  		CommitOID: String("d6e4c75c141dbacecc279b721b8bsomeSHA"),
 14977  		Repo: &Repository{
 14978  			ID:     Int64(1234234535),
 14979  			NodeID: String("MDEwOlJlcG9zaXRvcnkxODY4NT=="),
 14980  			Owner: &User{
 14981  				Login:             String("Codertocat"),
 14982  				ID:                Int64(21031067),
 14983  				NodeID:            String("MDQ6VXNlcjIxMDMxMDY3"),
 14984  				AvatarURL:         String("a"),
 14985  				GravatarID:        String(""),
 14986  				URL:               String("a"),
 14987  				HTMLURL:           String("a"),
 14988  				Type:              String("User"),
 14989  				SiteAdmin:         Bool(false),
 14990  				FollowersURL:      String("a"),
 14991  				FollowingURL:      String("a"),
 14992  				EventsURL:         String("a"),
 14993  				GistsURL:          String("a"),
 14994  				OrganizationsURL:  String("a"),
 14995  				ReceivedEventsURL: String("a"),
 14996  				ReposURL:          String("a"),
 14997  				StarredURL:        String("a"),
 14998  				SubscriptionsURL:  String("a"),
 14999  			},
 15000  			HTMLURL:          String("a"),
 15001  			Name:             String("Hello-World"),
 15002  			FullName:         String("Codertocat/Hello-World"),
 15003  			Description:      nil,
 15004  			Fork:             Bool(false),
 15005  			Homepage:         nil,
 15006  			DefaultBranch:    String("main"),
 15007  			CreatedAt:        &Timestamp{referenceTime},
 15008  			PushedAt:         &Timestamp{referenceTime},
 15009  			UpdatedAt:        &Timestamp{referenceTime},
 15010  			CloneURL:         String("a"),
 15011  			GitURL:           String("a"),
 15012  			MirrorURL:        nil,
 15013  			SSHURL:           String("a"),
 15014  			SVNURL:           String("a"),
 15015  			Language:         nil,
 15016  			ForksCount:       Int(0),
 15017  			OpenIssuesCount:  Int(2),
 15018  			OpenIssues:       Int(2),
 15019  			StargazersCount:  Int(0),
 15020  			WatchersCount:    Int(0),
 15021  			Watchers:         Int(0),
 15022  			Size:             Int(0),
 15023  			Archived:         Bool(false),
 15024  			Disabled:         Bool(false),
 15025  			License:          nil,
 15026  			Private:          Bool(false),
 15027  			HasIssues:        Bool(true),
 15028  			HasWiki:          Bool(true),
 15029  			HasPages:         Bool(true),
 15030  			HasProjects:      Bool(true),
 15031  			HasDownloads:     Bool(true),
 15032  			URL:              String("a"),
 15033  			ArchiveURL:       String("a"),
 15034  			AssigneesURL:     String("a"),
 15035  			BlobsURL:         String("a"),
 15036  			BranchesURL:      String("a"),
 15037  			CollaboratorsURL: String("a"),
 15038  			CommentsURL:      String("a"),
 15039  			CommitsURL:       String("a"),
 15040  			CompareURL:       String("a"),
 15041  			ContentsURL:      String("a"),
 15042  			ContributorsURL:  String("a"),
 15043  			DeploymentsURL:   String("a"),
 15044  			DownloadsURL:     String("a"),
 15045  			EventsURL:        String("a"),
 15046  			ForksURL:         String("a"),
 15047  			GitCommitsURL:    String("a"),
 15048  			GitRefsURL:       String("a"),
 15049  			GitTagsURL:       String("a"),
 15050  			HooksURL:         String("a"),
 15051  			IssueCommentURL:  String("a"),
 15052  			IssueEventsURL:   String("a"),
 15053  			IssuesURL:        String("a"),
 15054  			KeysURL:          String("a"),
 15055  			LabelsURL:        String("a"),
 15056  			LanguagesURL:     String("a"),
 15057  			MergesURL:        String("a"),
 15058  			MilestonesURL:    String("a"),
 15059  			NotificationsURL: String("a"),
 15060  			PullsURL:         String("a"),
 15061  			ReleasesURL:      String("a"),
 15062  			StargazersURL:    String("a"),
 15063  			StatusesURL:      String("a"),
 15064  			SubscribersURL:   String("a"),
 15065  			SubscriptionURL:  String("a"),
 15066  			TagsURL:          String("a"),
 15067  			TreesURL:         String("a"),
 15068  			TeamsURL:         String("a"),
 15069  		},
 15070  		Org: &Organization{
 15071  			Login:            String("Octocoders"),
 15072  			ID:               Int64(6),
 15073  			NodeID:           String("MDEyOk9yZ2FuaXphdGlvbjY="),
 15074  			AvatarURL:        String("a"),
 15075  			Description:      String(""),
 15076  			URL:              String("a"),
 15077  			EventsURL:        String("a"),
 15078  			HooksURL:         String("a"),
 15079  			IssuesURL:        String("a"),
 15080  			MembersURL:       String("a"),
 15081  			PublicMembersURL: String("a"),
 15082  			ReposURL:         String("a"),
 15083  		},
 15084  		Sender: &User{
 15085  			Login:             String("github"),
 15086  			ID:                Int64(9919),
 15087  			NodeID:            String("MDEyOk9yZ2FuaXphdGlvbjk5MTk="),
 15088  			AvatarURL:         String("a"),
 15089  			HTMLURL:           String("a"),
 15090  			GravatarID:        String(""),
 15091  			Type:              String("Organization"),
 15092  			SiteAdmin:         Bool(false),
 15093  			URL:               String("a"),
 15094  			EventsURL:         String("a"),
 15095  			FollowingURL:      String("a"),
 15096  			FollowersURL:      String("a"),
 15097  			GistsURL:          String("a"),
 15098  			OrganizationsURL:  String("a"),
 15099  			ReceivedEventsURL: String("a"),
 15100  			ReposURL:          String("a"),
 15101  			StarredURL:        String("a"),
 15102  			SubscriptionsURL:  String("a"),
 15103  		},
 15104  	}
 15105  
 15106  	want := `{
 15107  		"action": "reopened",
 15108  		"alert": {
 15109  		  "number": 10,
 15110  		  "created_at": ` + referenceTimeStr + `,
 15111  		  "updated_at": ` + referenceTimeStr + `,
 15112  		  "url": "a",
 15113  		  "html_url": "a",
 15114  		  "instances": [
 15115  			{
 15116  			  "ref": "refs/heads/main",
 15117  			  "analysis_key": ".github/workflows/workflow.yml:upload",
 15118  			  "environment": "{}",
 15119  			  "state": "open"
 15120  			}
 15121  		  ],
 15122  		  "state": "open",
 15123  		  "fixed_at": null,
 15124  		  "dismissed_by": null,
 15125  		  "dismissed_at": null,
 15126  		  "dismissed_reason": null,
 15127  		  "rule": {
 15128  			"id": "Style/FrozenStringLiteralComment",
 15129  			"severity": "note",
 15130  			"description": "desc",
 15131  			"full_description": "full desc",
 15132  			"tags": [
 15133  			  "style"
 15134  			],
 15135  			"help": "help"
 15136  		  },
 15137  		  "tool": {
 15138  			"name": "Rubocop",
 15139  			"version": null
 15140  		  }
 15141  		},
 15142  		"ref": "refs/heads/main",
 15143  		"commit_oid": "d6e4c75c141dbacecc279b721b8bsomeSHA",
 15144  		"repository": {
 15145  		  "id": 1234234535,
 15146  		  "node_id": "MDEwOlJlcG9zaXRvcnkxODY4NT==",
 15147  		  "name": "Hello-World",
 15148  		  "full_name": "Codertocat/Hello-World",
 15149  		  "private": false,
 15150  		  "owner": {
 15151  			"login": "Codertocat",
 15152  			"id": 21031067,
 15153  			"node_id": "MDQ6VXNlcjIxMDMxMDY3",
 15154  			"avatar_url": "a",
 15155  			"gravatar_id": "",
 15156  			"url": "a",
 15157  			"html_url": "a",
 15158  			"followers_url": "a",
 15159  			"following_url": "a",
 15160  			"gists_url": "a",
 15161  			"starred_url": "a",
 15162  			"subscriptions_url": "a",
 15163  			"organizations_url": "a",
 15164  			"repos_url": "a",
 15165  			"events_url": "a",
 15166  			"received_events_url": "a",
 15167  			"type": "User",
 15168  			"site_admin": false
 15169  		  },
 15170  		  "html_url": "a",
 15171  		  "description": null,
 15172  		  "fork": false,
 15173  		  "url": "a",
 15174  		  "forks_url": "a",
 15175  		  "keys_url": "a",
 15176  		  "collaborators_url": "a",
 15177  		  "teams_url": "a",
 15178  		  "hooks_url": "a",
 15179  		  "issue_events_url": "a",
 15180  		  "events_url": "a",
 15181  		  "assignees_url": "a",
 15182  		  "branches_url": "a",
 15183  		  "tags_url": "a",
 15184  		  "blobs_url": "a",
 15185  		  "git_tags_url": "a",
 15186  		  "git_refs_url": "a",
 15187  		  "trees_url": "a",
 15188  		  "statuses_url": "a",
 15189  		  "languages_url": "a",
 15190  		  "stargazers_url": "a",
 15191  		  "contributors_url": "a",
 15192  		  "subscribers_url": "a",
 15193  		  "subscription_url": "a",
 15194  		  "commits_url": "a",
 15195  		  "git_commits_url": "a",
 15196  		  "comments_url": "a",
 15197  		  "issue_comment_url": "a",
 15198  		  "contents_url": "a",
 15199  		  "compare_url": "a",
 15200  		  "merges_url": "a",
 15201  		  "archive_url": "a",
 15202  		  "downloads_url": "a",
 15203  		  "issues_url": "a",
 15204  		  "pulls_url": "a",
 15205  		  "milestones_url": "a",
 15206  		  "notifications_url": "a",
 15207  		  "labels_url": "a",
 15208  		  "releases_url": "a",
 15209  		  "deployments_url": "a",
 15210  		  "created_at": ` + referenceTimeStr + `,
 15211  		  "updated_at": ` + referenceTimeStr + `,
 15212  		  "pushed_at": ` + referenceTimeStr + `,
 15213  		  "git_url": "a",
 15214  		  "ssh_url": "a",
 15215  		  "clone_url": "a",
 15216  		  "svn_url": "a",
 15217  		  "homepage": null,
 15218  		  "size": 0,
 15219  		  "stargazers_count": 0,
 15220  		  "watchers_count": 0,
 15221  		  "language": null,
 15222  		  "has_issues": true,
 15223  		  "has_projects": true,
 15224  		  "has_downloads": true,
 15225  		  "has_wiki": true,
 15226  		  "has_pages": true,
 15227  		  "forks_count": 0,
 15228  		  "mirror_url": null,
 15229  		  "archived": false,
 15230  		  "disabled": false,
 15231  		  "open_issues_count": 2,
 15232  		  "license": null,
 15233  		  "forks": 0,
 15234  		  "open_issues": 2,
 15235  		  "watchers": 0,
 15236  		  "default_branch": "main"
 15237  		},
 15238  		"organization": {
 15239  		  "login": "Octocoders",
 15240  		  "id": 6,
 15241  		  "node_id": "MDEyOk9yZ2FuaXphdGlvbjY=",
 15242  		  "url": "a",
 15243  		  "repos_url": "a",
 15244  		  "events_url": "a",
 15245  		  "hooks_url": "a",
 15246  		  "issues_url": "a",
 15247  		  "members_url": "a",
 15248  		  "public_members_url": "a",
 15249  		  "avatar_url": "a",
 15250  		  "description": ""
 15251  		},
 15252  		"sender": {
 15253  		  "login": "github",
 15254  		  "id": 9919,
 15255  		  "node_id": "MDEyOk9yZ2FuaXphdGlvbjk5MTk=",
 15256  		  "avatar_url": "a",
 15257  		  "gravatar_id": "",
 15258  		  "url": "a",
 15259  		  "html_url": "a",
 15260  		  "followers_url": "a",
 15261  		  "following_url": "a",
 15262  		  "gists_url": "a",
 15263  		  "starred_url": "a",
 15264  		  "subscriptions_url": "a",
 15265  		  "organizations_url": "a",
 15266  		  "repos_url": "a",
 15267  		  "events_url": "a",
 15268  		  "received_events_url": "a",
 15269  		  "type": "Organization",
 15270  		  "site_admin": false
 15271  		}
 15272  	  }`
 15273  
 15274  	testJSONMarshal(t, u, want)
 15275  }