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

     1  // Copyright 2020 The go-github AUTHORS. All rights reserved.
     2  //
     3  // Use of this source code is governed by a BSD-style
     4  // license that can be found in the LICENSE file.
     5  
     6  package github
     7  
     8  import (
     9  	"encoding/json"
    10  	"testing"
    11  )
    12  
    13  func TestEditChange_Marshal_TitleChange(t *testing.T) {
    14  	testJSONMarshal(t, &EditChange{}, "{}")
    15  
    16  	u := &EditChange{
    17  		Title: &EditTitle{
    18  			From: String("TitleFrom"),
    19  		},
    20  		Body: nil,
    21  		Base: nil,
    22  	}
    23  
    24  	want := `{
    25  		"title": {
    26  			"from": "TitleFrom"
    27  		  }
    28  	}`
    29  
    30  	testJSONMarshal(t, u, want)
    31  }
    32  
    33  func TestEditChange_Marshal_BodyChange(t *testing.T) {
    34  	testJSONMarshal(t, &EditChange{}, "{}")
    35  
    36  	u := &EditChange{
    37  		Title: nil,
    38  		Body: &EditBody{
    39  			From: String("BodyFrom"),
    40  		},
    41  		Base: nil,
    42  	}
    43  
    44  	want := `{
    45  		"body": {
    46  			"from": "BodyFrom"
    47  		  }
    48  	}`
    49  
    50  	testJSONMarshal(t, u, want)
    51  }
    52  
    53  func TestEditChange_Marshal_BaseChange(t *testing.T) {
    54  	testJSONMarshal(t, &EditChange{}, "{}")
    55  
    56  	Base := EditBase{
    57  		Ref: &EditRef{
    58  			From: String("BaseRefFrom"),
    59  		},
    60  		SHA: &EditSHA{
    61  			From: String("BaseSHAFrom"),
    62  		},
    63  	}
    64  
    65  	u := &EditChange{
    66  		Title: nil,
    67  		Body:  nil,
    68  		Base:  &Base,
    69  	}
    70  
    71  	want := `{
    72  		"base": {
    73  			"ref": {
    74  				"from": "BaseRefFrom"
    75  			},
    76  			"sha": {
    77  				"from": "BaseSHAFrom"
    78  			}
    79  		}
    80  	}`
    81  
    82  	testJSONMarshal(t, u, want)
    83  }
    84  
    85  func TestEditChange_Marshal_Repo(t *testing.T) {
    86  	testJSONMarshal(t, &EditChange{}, "{}")
    87  
    88  	u := &EditChange{
    89  		Repo: &EditRepo{
    90  			Name: &RepoName{
    91  				From: String("old-repo-name"),
    92  			},
    93  		},
    94  	}
    95  
    96  	want := `{
    97  		"repository": {
    98  			"name": {
    99  				"from": "old-repo-name"
   100  			}
   101  		}
   102  	}`
   103  
   104  	testJSONMarshal(t, u, want)
   105  }
   106  
   107  func 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: &referenceTime,
  4859  			UpdatedAt: &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 TestDiscussionEvent_Marshal(t *testing.T) {
  5744  	testJSONMarshal(t, &DiscussionEvent{}, "{}")
  5745  
  5746  	u := &DiscussionEvent{
  5747  		Discussion: &Discussion{
  5748  			RepositoryURL: String("rurl"),
  5749  			DiscussionCategory: &DiscussionCategory{
  5750  				ID:           Int64(1),
  5751  				NodeID:       String("nid"),
  5752  				RepositoryID: Int64(1),
  5753  				Emoji:        String("emoji"),
  5754  				Name:         String("name"),
  5755  				Description:  String("description"),
  5756  				CreatedAt:    &Timestamp{referenceTime},
  5757  				UpdatedAt:    &Timestamp{referenceTime},
  5758  				Slug:         String("slug"),
  5759  				IsAnswerable: Bool(false),
  5760  			},
  5761  			HTMLURL: String("hurl"),
  5762  			ID:      Int64(1),
  5763  			NodeID:  String("nurl"),
  5764  			Number:  Int(1),
  5765  			Title:   String("title"),
  5766  			User: &User{
  5767  				Login:     String("l"),
  5768  				ID:        Int64(1),
  5769  				NodeID:    String("n"),
  5770  				URL:       String("u"),
  5771  				ReposURL:  String("r"),
  5772  				EventsURL: String("e"),
  5773  				AvatarURL: String("a"),
  5774  			},
  5775  			State:             String("st"),
  5776  			Locked:            Bool(false),
  5777  			Comments:          Int(1),
  5778  			CreatedAt:         &Timestamp{referenceTime},
  5779  			UpdatedAt:         &Timestamp{referenceTime},
  5780  			AuthorAssociation: String("aa"),
  5781  			Body:              String("bo"),
  5782  		},
  5783  		Repo: &Repository{
  5784  			ID:   Int64(1),
  5785  			URL:  String("s"),
  5786  			Name: String("n"),
  5787  		},
  5788  		Org: &Organization{
  5789  			BillingEmail:                         String("be"),
  5790  			Blog:                                 String("b"),
  5791  			Company:                              String("c"),
  5792  			Email:                                String("e"),
  5793  			TwitterUsername:                      String("tu"),
  5794  			Location:                             String("loc"),
  5795  			Name:                                 String("n"),
  5796  			Description:                          String("d"),
  5797  			IsVerified:                           Bool(true),
  5798  			HasOrganizationProjects:              Bool(true),
  5799  			HasRepositoryProjects:                Bool(true),
  5800  			DefaultRepoPermission:                String("drp"),
  5801  			MembersCanCreateRepos:                Bool(true),
  5802  			MembersCanCreateInternalRepos:        Bool(true),
  5803  			MembersCanCreatePrivateRepos:         Bool(true),
  5804  			MembersCanCreatePublicRepos:          Bool(false),
  5805  			MembersAllowedRepositoryCreationType: String("marct"),
  5806  			MembersCanCreatePages:                Bool(true),
  5807  			MembersCanCreatePublicPages:          Bool(false),
  5808  			MembersCanCreatePrivatePages:         Bool(true),
  5809  		},
  5810  		Sender: &User{
  5811  			Login:     String("l"),
  5812  			ID:        Int64(1),
  5813  			NodeID:    String("n"),
  5814  			URL:       String("u"),
  5815  			ReposURL:  String("r"),
  5816  			EventsURL: String("e"),
  5817  			AvatarURL: String("a"),
  5818  		},
  5819  		Installation: &Installation{
  5820  			ID:       Int64(1),
  5821  			NodeID:   String("nid"),
  5822  			AppID:    Int64(1),
  5823  			AppSlug:  String("as"),
  5824  			TargetID: Int64(1),
  5825  			Account: &User{
  5826  				Login:           String("l"),
  5827  				ID:              Int64(1),
  5828  				URL:             String("u"),
  5829  				AvatarURL:       String("a"),
  5830  				GravatarID:      String("g"),
  5831  				Name:            String("n"),
  5832  				Company:         String("c"),
  5833  				Blog:            String("b"),
  5834  				Location:        String("l"),
  5835  				Email:           String("e"),
  5836  				Hireable:        Bool(true),
  5837  				Bio:             String("b"),
  5838  				TwitterUsername: String("t"),
  5839  				PublicRepos:     Int(1),
  5840  				Followers:       Int(1),
  5841  				Following:       Int(1),
  5842  				CreatedAt:       &Timestamp{referenceTime},
  5843  				SuspendedAt:     &Timestamp{referenceTime},
  5844  			},
  5845  			AccessTokensURL:     String("atu"),
  5846  			RepositoriesURL:     String("ru"),
  5847  			HTMLURL:             String("hu"),
  5848  			TargetType:          String("tt"),
  5849  			SingleFileName:      String("sfn"),
  5850  			RepositorySelection: String("rs"),
  5851  			Events:              []string{"e"},
  5852  			SingleFilePaths:     []string{"s"},
  5853  			Permissions: &InstallationPermissions{
  5854  				Actions:                       String("a"),
  5855  				Administration:                String("ad"),
  5856  				Checks:                        String("c"),
  5857  				Contents:                      String("co"),
  5858  				ContentReferences:             String("cr"),
  5859  				Deployments:                   String("d"),
  5860  				Environments:                  String("e"),
  5861  				Issues:                        String("i"),
  5862  				Metadata:                      String("md"),
  5863  				Members:                       String("m"),
  5864  				OrganizationAdministration:    String("oa"),
  5865  				OrganizationHooks:             String("oh"),
  5866  				OrganizationPlan:              String("op"),
  5867  				OrganizationPreReceiveHooks:   String("opr"),
  5868  				OrganizationProjects:          String("op"),
  5869  				OrganizationSecrets:           String("os"),
  5870  				OrganizationSelfHostedRunners: String("osh"),
  5871  				OrganizationUserBlocking:      String("oub"),
  5872  				Packages:                      String("pkg"),
  5873  				Pages:                         String("pg"),
  5874  				PullRequests:                  String("pr"),
  5875  				RepositoryHooks:               String("rh"),
  5876  				RepositoryProjects:            String("rp"),
  5877  				RepositoryPreReceiveHooks:     String("rprh"),
  5878  				Secrets:                       String("s"),
  5879  				SecretScanningAlerts:          String("ssa"),
  5880  				SecurityEvents:                String("se"),
  5881  				SingleFile:                    String("sf"),
  5882  				Statuses:                      String("s"),
  5883  				TeamDiscussions:               String("td"),
  5884  				VulnerabilityAlerts:           String("va"),
  5885  				Workflows:                     String("w"),
  5886  			},
  5887  			CreatedAt:              &Timestamp{referenceTime},
  5888  			UpdatedAt:              &Timestamp{referenceTime},
  5889  			HasMultipleSingleFiles: Bool(false),
  5890  			SuspendedBy: &User{
  5891  				Login:           String("l"),
  5892  				ID:              Int64(1),
  5893  				URL:             String("u"),
  5894  				AvatarURL:       String("a"),
  5895  				GravatarID:      String("g"),
  5896  				Name:            String("n"),
  5897  				Company:         String("c"),
  5898  				Blog:            String("b"),
  5899  				Location:        String("l"),
  5900  				Email:           String("e"),
  5901  				Hireable:        Bool(true),
  5902  				Bio:             String("b"),
  5903  				TwitterUsername: String("t"),
  5904  				PublicRepos:     Int(1),
  5905  				Followers:       Int(1),
  5906  				Following:       Int(1),
  5907  				CreatedAt:       &Timestamp{referenceTime},
  5908  				SuspendedAt:     &Timestamp{referenceTime},
  5909  			},
  5910  			SuspendedAt: &Timestamp{referenceTime},
  5911  		},
  5912  	}
  5913  
  5914  	want := `{
  5915  		"discussion": {
  5916  			"repository_url": "rurl",
  5917  			"category": {
  5918  				"id": 1,
  5919  				"node_id": "nid",
  5920  				"repository_id": 1,
  5921  				"emoji": "emoji",
  5922  				"name": "name",
  5923  				"description": "description",
  5924  				"created_at": ` + referenceTimeStr + `,
  5925  				"updated_at": ` + referenceTimeStr + `,
  5926  				"slug": "slug",
  5927  				"is_answerable": false
  5928  			},
  5929  			"html_url": "hurl",
  5930  			"id": 1,
  5931  			"node_id": "nurl",
  5932  			"number": 1,
  5933  			"title": "title",
  5934  			"user": {
  5935  				"login": "l",
  5936  				"id": 1,
  5937  				"node_id": "n",
  5938  				"avatar_url": "a",
  5939  				"url": "u",
  5940  				"events_url": "e",
  5941  				"repos_url": "r"
  5942  			},
  5943  			"state": "st",
  5944  			"locked": false,
  5945  			"comments": 1,
  5946  			"created_at": ` + referenceTimeStr + `,
  5947  			"updated_at": ` + referenceTimeStr + `,
  5948  			"author_association": "aa",
  5949  			"body": "bo"
  5950  		},
  5951  		"repository": {
  5952  			"id": 1,
  5953  			"name": "n",
  5954  			"url": "s"
  5955  		},
  5956  		"organization": {
  5957  			"name": "n",
  5958  			"company": "c",
  5959  			"blog": "b",
  5960  			"location": "loc",
  5961  			"email": "e",
  5962  			"twitter_username": "tu",
  5963  			"description": "d",
  5964  			"billing_email": "be",
  5965  			"is_verified": true,
  5966  			"has_organization_projects": true,
  5967  			"has_repository_projects": true,
  5968  			"default_repository_permission": "drp",
  5969  			"members_can_create_repositories": true,
  5970  			"members_can_create_public_repositories": false,
  5971  			"members_can_create_private_repositories": true,
  5972  			"members_can_create_internal_repositories": true,
  5973  			"members_allowed_repository_creation_type": "marct",
  5974  			"members_can_create_pages": true,
  5975  			"members_can_create_public_pages": false,
  5976  			"members_can_create_private_pages": true
  5977  		},
  5978  		"sender": {
  5979  			"login": "l",
  5980  			"id": 1,
  5981  			"node_id": "n",
  5982  			"avatar_url": "a",
  5983  			"url": "u",
  5984  			"events_url": "e",
  5985  			"repos_url": "r"
  5986  		},
  5987  		"installation": {
  5988  			"id": 1,
  5989  			"node_id": "nid",
  5990  			"app_id": 1,
  5991  			"app_slug": "as",
  5992  			"target_id": 1,
  5993  			"account": {
  5994  				"login": "l",
  5995  				"id": 1,
  5996  				"avatar_url": "a",
  5997  				"gravatar_id": "g",
  5998  				"name": "n",
  5999  				"company": "c",
  6000  				"blog": "b",
  6001  				"location": "l",
  6002  				"email": "e",
  6003  				"hireable": true,
  6004  				"bio": "b",
  6005  				"twitter_username": "t",
  6006  				"public_repos": 1,
  6007  				"followers": 1,
  6008  				"following": 1,
  6009  				"created_at": ` + referenceTimeStr + `,
  6010  				"suspended_at": ` + referenceTimeStr + `,
  6011  				"url": "u"
  6012  			},
  6013  			"access_tokens_url": "atu",
  6014  			"repositories_url": "ru",
  6015  			"html_url": "hu",
  6016  			"target_type": "tt",
  6017  			"single_file_name": "sfn",
  6018  			"repository_selection": "rs",
  6019  			"events": [
  6020  				"e"
  6021  			],
  6022  			"single_file_paths": [
  6023  				"s"
  6024  			],
  6025  			"permissions": {
  6026  				"actions": "a",
  6027  				"administration": "ad",
  6028  				"checks": "c",
  6029  				"contents": "co",
  6030  				"content_references": "cr",
  6031  				"deployments": "d",
  6032  				"environments": "e",
  6033  				"issues": "i",
  6034  				"metadata": "md",
  6035  				"members": "m",
  6036  				"organization_administration": "oa",
  6037  				"organization_hooks": "oh",
  6038  				"organization_plan": "op",
  6039  				"organization_pre_receive_hooks": "opr",
  6040  				"organization_projects": "op",
  6041  				"organization_secrets": "os",
  6042  				"organization_self_hosted_runners": "osh",
  6043  				"organization_user_blocking": "oub",
  6044  				"packages": "pkg",
  6045  				"pages": "pg",
  6046  				"pull_requests": "pr",
  6047  				"repository_hooks": "rh",
  6048  				"repository_projects": "rp",
  6049  				"repository_pre_receive_hooks": "rprh",
  6050  				"secrets": "s",
  6051  				"secret_scanning_alerts": "ssa",
  6052  				"security_events": "se",
  6053  				"single_file": "sf",
  6054  				"statuses": "s",
  6055  				"team_discussions": "td",
  6056  				"vulnerability_alerts": "va",
  6057  				"workflows": "w"
  6058  			},
  6059  			"created_at": ` + referenceTimeStr + `,
  6060  			"updated_at": ` + referenceTimeStr + `,
  6061  			"has_multiple_single_files": false,
  6062  			"suspended_by": {
  6063  				"login": "l",
  6064  				"id": 1,
  6065  				"avatar_url": "a",
  6066  				"gravatar_id": "g",
  6067  				"name": "n",
  6068  				"company": "c",
  6069  				"blog": "b",
  6070  				"location": "l",
  6071  				"email": "e",
  6072  				"hireable": true,
  6073  				"bio": "b",
  6074  				"twitter_username": "t",
  6075  				"public_repos": 1,
  6076  				"followers": 1,
  6077  				"following": 1,
  6078  				"created_at": ` + referenceTimeStr + `,
  6079  				"suspended_at": ` + referenceTimeStr + `,
  6080  				"url": "u"
  6081  			},
  6082  			"suspended_at": ` + referenceTimeStr + `
  6083  		}
  6084  	}`
  6085  
  6086  	testJSONMarshal(t, u, want)
  6087  }
  6088  
  6089  func TestPackageEvent_Marshal(t *testing.T) {
  6090  	testJSONMarshal(t, &PackageEvent{}, "{}")
  6091  
  6092  	u := &PackageEvent{
  6093  		Action: String("a"),
  6094  		Package: &Package{
  6095  			ID:          Int64(1),
  6096  			Name:        String("n"),
  6097  			PackageType: String("pt"),
  6098  			HTMLURL:     String("hurl"),
  6099  			CreatedAt:   &Timestamp{referenceTime},
  6100  			UpdatedAt:   &Timestamp{referenceTime},
  6101  			Owner: &User{
  6102  				Login:     String("l"),
  6103  				ID:        Int64(1),
  6104  				NodeID:    String("n"),
  6105  				URL:       String("u"),
  6106  				ReposURL:  String("r"),
  6107  				EventsURL: String("e"),
  6108  				AvatarURL: String("a"),
  6109  			},
  6110  			PackageVersion: &PackageVersion{ID: Int64(1)},
  6111  			Registry:       &PackageRegistry{Name: String("n")},
  6112  		},
  6113  		Repo: &Repository{
  6114  			ID:   Int64(1),
  6115  			URL:  String("s"),
  6116  			Name: String("n"),
  6117  		},
  6118  		Org: &Organization{
  6119  			BillingEmail:                         String("be"),
  6120  			Blog:                                 String("b"),
  6121  			Company:                              String("c"),
  6122  			Email:                                String("e"),
  6123  			TwitterUsername:                      String("tu"),
  6124  			Location:                             String("loc"),
  6125  			Name:                                 String("n"),
  6126  			Description:                          String("d"),
  6127  			IsVerified:                           Bool(true),
  6128  			HasOrganizationProjects:              Bool(true),
  6129  			HasRepositoryProjects:                Bool(true),
  6130  			DefaultRepoPermission:                String("drp"),
  6131  			MembersCanCreateRepos:                Bool(true),
  6132  			MembersCanCreateInternalRepos:        Bool(true),
  6133  			MembersCanCreatePrivateRepos:         Bool(true),
  6134  			MembersCanCreatePublicRepos:          Bool(false),
  6135  			MembersAllowedRepositoryCreationType: String("marct"),
  6136  			MembersCanCreatePages:                Bool(true),
  6137  			MembersCanCreatePublicPages:          Bool(false),
  6138  			MembersCanCreatePrivatePages:         Bool(true),
  6139  		},
  6140  		Sender: &User{
  6141  			Login:     String("l"),
  6142  			ID:        Int64(1),
  6143  			NodeID:    String("n"),
  6144  			URL:       String("u"),
  6145  			ReposURL:  String("r"),
  6146  			EventsURL: String("e"),
  6147  			AvatarURL: String("a"),
  6148  		},
  6149  	}
  6150  
  6151  	want := `{
  6152  		"action": "a",
  6153  		"package": {
  6154  			"id": 1,
  6155  			"name": "n",
  6156  			"package_type": "pt",
  6157  			"html_url": "hurl",
  6158  			"created_at": ` + referenceTimeStr + `,
  6159  			"updated_at": ` + referenceTimeStr + `,
  6160  			"owner": {
  6161  				"login": "l",
  6162  				"id": 1,
  6163  				"node_id": "n",
  6164  				"avatar_url": "a",
  6165  				"url": "u",
  6166  				"events_url": "e",
  6167  				"repos_url": "r"
  6168  			},
  6169  			"package_version": {
  6170  				"id": 1
  6171  			},
  6172  			"registry": {
  6173  				"name": "n"
  6174  			}
  6175  		},
  6176  		"repository": {
  6177  			"id": 1,
  6178  			"name": "n",
  6179  			"url": "s"
  6180  		},
  6181  		"organization": {
  6182  			"name": "n",
  6183  			"company": "c",
  6184  			"blog": "b",
  6185  			"location": "loc",
  6186  			"email": "e",
  6187  			"twitter_username": "tu",
  6188  			"description": "d",
  6189  			"billing_email": "be",
  6190  			"is_verified": true,
  6191  			"has_organization_projects": true,
  6192  			"has_repository_projects": true,
  6193  			"default_repository_permission": "drp",
  6194  			"members_can_create_repositories": true,
  6195  			"members_can_create_public_repositories": false,
  6196  			"members_can_create_private_repositories": true,
  6197  			"members_can_create_internal_repositories": true,
  6198  			"members_allowed_repository_creation_type": "marct",
  6199  			"members_can_create_pages": true,
  6200  			"members_can_create_public_pages": false,
  6201  			"members_can_create_private_pages": true
  6202  		},
  6203  		"sender": {
  6204  			"login": "l",
  6205  			"id": 1,
  6206  			"node_id": "n",
  6207  			"avatar_url": "a",
  6208  			"url": "u",
  6209  			"events_url": "e",
  6210  			"repos_url": "r"
  6211  		}
  6212  	}`
  6213  
  6214  	testJSONMarshal(t, u, want)
  6215  }
  6216  
  6217  func TestPingEvent_Marshal(t *testing.T) {
  6218  	testJSONMarshal(t, &PingEvent{}, "{}")
  6219  
  6220  	l := make(map[string]interface{})
  6221  	l["key"] = "value"
  6222  
  6223  	u := &PingEvent{
  6224  		Zen:    String("z"),
  6225  		HookID: Int64(1),
  6226  		Hook: &Hook{
  6227  			CreatedAt:    &referenceTime,
  6228  			UpdatedAt:    &referenceTime,
  6229  			URL:          String("url"),
  6230  			ID:           Int64(1),
  6231  			Type:         String("t"),
  6232  			Name:         String("n"),
  6233  			TestURL:      String("tu"),
  6234  			PingURL:      String("pu"),
  6235  			LastResponse: l,
  6236  			Config:       l,
  6237  			Events:       []string{"a"},
  6238  			Active:       Bool(true),
  6239  		},
  6240  		Installation: &Installation{
  6241  			ID:       Int64(1),
  6242  			NodeID:   String("nid"),
  6243  			AppID:    Int64(1),
  6244  			AppSlug:  String("as"),
  6245  			TargetID: Int64(1),
  6246  			Account: &User{
  6247  				Login:           String("l"),
  6248  				ID:              Int64(1),
  6249  				URL:             String("u"),
  6250  				AvatarURL:       String("a"),
  6251  				GravatarID:      String("g"),
  6252  				Name:            String("n"),
  6253  				Company:         String("c"),
  6254  				Blog:            String("b"),
  6255  				Location:        String("l"),
  6256  				Email:           String("e"),
  6257  				Hireable:        Bool(true),
  6258  				Bio:             String("b"),
  6259  				TwitterUsername: String("t"),
  6260  				PublicRepos:     Int(1),
  6261  				Followers:       Int(1),
  6262  				Following:       Int(1),
  6263  				CreatedAt:       &Timestamp{referenceTime},
  6264  				SuspendedAt:     &Timestamp{referenceTime},
  6265  			},
  6266  			AccessTokensURL:     String("atu"),
  6267  			RepositoriesURL:     String("ru"),
  6268  			HTMLURL:             String("hu"),
  6269  			TargetType:          String("tt"),
  6270  			SingleFileName:      String("sfn"),
  6271  			RepositorySelection: String("rs"),
  6272  			Events:              []string{"e"},
  6273  			SingleFilePaths:     []string{"s"},
  6274  			Permissions: &InstallationPermissions{
  6275  				Actions:                       String("a"),
  6276  				Administration:                String("ad"),
  6277  				Checks:                        String("c"),
  6278  				Contents:                      String("co"),
  6279  				ContentReferences:             String("cr"),
  6280  				Deployments:                   String("d"),
  6281  				Environments:                  String("e"),
  6282  				Issues:                        String("i"),
  6283  				Metadata:                      String("md"),
  6284  				Members:                       String("m"),
  6285  				OrganizationAdministration:    String("oa"),
  6286  				OrganizationHooks:             String("oh"),
  6287  				OrganizationPlan:              String("op"),
  6288  				OrganizationPreReceiveHooks:   String("opr"),
  6289  				OrganizationProjects:          String("op"),
  6290  				OrganizationSecrets:           String("os"),
  6291  				OrganizationSelfHostedRunners: String("osh"),
  6292  				OrganizationUserBlocking:      String("oub"),
  6293  				Packages:                      String("pkg"),
  6294  				Pages:                         String("pg"),
  6295  				PullRequests:                  String("pr"),
  6296  				RepositoryHooks:               String("rh"),
  6297  				RepositoryProjects:            String("rp"),
  6298  				RepositoryPreReceiveHooks:     String("rprh"),
  6299  				Secrets:                       String("s"),
  6300  				SecretScanningAlerts:          String("ssa"),
  6301  				SecurityEvents:                String("se"),
  6302  				SingleFile:                    String("sf"),
  6303  				Statuses:                      String("s"),
  6304  				TeamDiscussions:               String("td"),
  6305  				VulnerabilityAlerts:           String("va"),
  6306  				Workflows:                     String("w"),
  6307  			},
  6308  			CreatedAt:              &Timestamp{referenceTime},
  6309  			UpdatedAt:              &Timestamp{referenceTime},
  6310  			HasMultipleSingleFiles: Bool(false),
  6311  			SuspendedBy: &User{
  6312  				Login:           String("l"),
  6313  				ID:              Int64(1),
  6314  				URL:             String("u"),
  6315  				AvatarURL:       String("a"),
  6316  				GravatarID:      String("g"),
  6317  				Name:            String("n"),
  6318  				Company:         String("c"),
  6319  				Blog:            String("b"),
  6320  				Location:        String("l"),
  6321  				Email:           String("e"),
  6322  				Hireable:        Bool(true),
  6323  				Bio:             String("b"),
  6324  				TwitterUsername: String("t"),
  6325  				PublicRepos:     Int(1),
  6326  				Followers:       Int(1),
  6327  				Following:       Int(1),
  6328  				CreatedAt:       &Timestamp{referenceTime},
  6329  				SuspendedAt:     &Timestamp{referenceTime},
  6330  			},
  6331  			SuspendedAt: &Timestamp{referenceTime},
  6332  		},
  6333  	}
  6334  
  6335  	want := `{
  6336  		"zen": "z",
  6337  		"hook_id": 1,
  6338  		"hook": {
  6339  			"created_at": ` + referenceTimeStr + `,
  6340  			"updated_at": ` + referenceTimeStr + `,
  6341  			"url": "url",
  6342  			"id": 1,
  6343  			"type": "t",
  6344  			"name": "n",
  6345  			"test_url": "tu",
  6346  			"ping_url": "pu",
  6347  			"last_response": {
  6348  				"key": "value"
  6349  			},
  6350  			"config": {
  6351  				"key": "value"
  6352  			},
  6353  			"events": [
  6354  				"a"
  6355  			],
  6356  			"active": true
  6357  		},
  6358  		"installation": {
  6359  			"id": 1,
  6360  			"node_id": "nid",
  6361  			"app_id": 1,
  6362  			"app_slug": "as",
  6363  			"target_id": 1,
  6364  			"account": {
  6365  				"login": "l",
  6366  				"id": 1,
  6367  				"avatar_url": "a",
  6368  				"gravatar_id": "g",
  6369  				"name": "n",
  6370  				"company": "c",
  6371  				"blog": "b",
  6372  				"location": "l",
  6373  				"email": "e",
  6374  				"hireable": true,
  6375  				"bio": "b",
  6376  				"twitter_username": "t",
  6377  				"public_repos": 1,
  6378  				"followers": 1,
  6379  				"following": 1,
  6380  				"created_at": ` + referenceTimeStr + `,
  6381  				"suspended_at": ` + referenceTimeStr + `,
  6382  				"url": "u"
  6383  			},
  6384  			"access_tokens_url": "atu",
  6385  			"repositories_url": "ru",
  6386  			"html_url": "hu",
  6387  			"target_type": "tt",
  6388  			"single_file_name": "sfn",
  6389  			"repository_selection": "rs",
  6390  			"events": [
  6391  				"e"
  6392  			],
  6393  			"single_file_paths": [
  6394  				"s"
  6395  			],
  6396  			"permissions": {
  6397  				"actions": "a",
  6398  				"administration": "ad",
  6399  				"checks": "c",
  6400  				"contents": "co",
  6401  				"content_references": "cr",
  6402  				"deployments": "d",
  6403  				"environments": "e",
  6404  				"issues": "i",
  6405  				"metadata": "md",
  6406  				"members": "m",
  6407  				"organization_administration": "oa",
  6408  				"organization_hooks": "oh",
  6409  				"organization_plan": "op",
  6410  				"organization_pre_receive_hooks": "opr",
  6411  				"organization_projects": "op",
  6412  				"organization_secrets": "os",
  6413  				"organization_self_hosted_runners": "osh",
  6414  				"organization_user_blocking": "oub",
  6415  				"packages": "pkg",
  6416  				"pages": "pg",
  6417  				"pull_requests": "pr",
  6418  				"repository_hooks": "rh",
  6419  				"repository_projects": "rp",
  6420  				"repository_pre_receive_hooks": "rprh",
  6421  				"secrets": "s",
  6422  				"secret_scanning_alerts": "ssa",
  6423  				"security_events": "se",
  6424  				"single_file": "sf",
  6425  				"statuses": "s",
  6426  				"team_discussions": "td",
  6427  				"vulnerability_alerts": "va",
  6428  				"workflows": "w"
  6429  			},
  6430  			"created_at": ` + referenceTimeStr + `,
  6431  			"updated_at": ` + referenceTimeStr + `,
  6432  			"has_multiple_single_files": false,
  6433  			"suspended_by": {
  6434  				"login": "l",
  6435  				"id": 1,
  6436  				"avatar_url": "a",
  6437  				"gravatar_id": "g",
  6438  				"name": "n",
  6439  				"company": "c",
  6440  				"blog": "b",
  6441  				"location": "l",
  6442  				"email": "e",
  6443  				"hireable": true,
  6444  				"bio": "b",
  6445  				"twitter_username": "t",
  6446  				"public_repos": 1,
  6447  				"followers": 1,
  6448  				"following": 1,
  6449  				"created_at": ` + referenceTimeStr + `,
  6450  				"suspended_at": ` + referenceTimeStr + `,
  6451  				"url": "u"
  6452  			},
  6453  			"suspended_at": ` + referenceTimeStr + `
  6454  		}
  6455  	}`
  6456  
  6457  	testJSONMarshal(t, u, want)
  6458  }
  6459  
  6460  func TestRepositoryDispatchEvent_Marshal(t *testing.T) {
  6461  	testJSONMarshal(t, &RepositoryDispatchEvent{}, "{}")
  6462  
  6463  	l := make(map[string]interface{})
  6464  	l["key"] = "value"
  6465  
  6466  	jsonMsg, _ := json.Marshal(&l)
  6467  
  6468  	u := &RepositoryDispatchEvent{
  6469  		Action:        String("a"),
  6470  		Branch:        String("b"),
  6471  		ClientPayload: jsonMsg,
  6472  		Repo: &Repository{
  6473  
  6474  			ID:   Int64(1),
  6475  			URL:  String("s"),
  6476  			Name: String("n"),
  6477  		},
  6478  		Org: &Organization{
  6479  			BillingEmail:                         String("be"),
  6480  			Blog:                                 String("b"),
  6481  			Company:                              String("c"),
  6482  			Email:                                String("e"),
  6483  			TwitterUsername:                      String("tu"),
  6484  			Location:                             String("loc"),
  6485  			Name:                                 String("n"),
  6486  			Description:                          String("d"),
  6487  			IsVerified:                           Bool(true),
  6488  			HasOrganizationProjects:              Bool(true),
  6489  			HasRepositoryProjects:                Bool(true),
  6490  			DefaultRepoPermission:                String("drp"),
  6491  			MembersCanCreateRepos:                Bool(true),
  6492  			MembersCanCreateInternalRepos:        Bool(true),
  6493  			MembersCanCreatePrivateRepos:         Bool(true),
  6494  			MembersCanCreatePublicRepos:          Bool(false),
  6495  			MembersAllowedRepositoryCreationType: String("marct"),
  6496  			MembersCanCreatePages:                Bool(true),
  6497  			MembersCanCreatePublicPages:          Bool(false),
  6498  			MembersCanCreatePrivatePages:         Bool(true),
  6499  		},
  6500  		Sender: &User{
  6501  			Login:     String("l"),
  6502  			ID:        Int64(1),
  6503  			NodeID:    String("n"),
  6504  			URL:       String("u"),
  6505  			ReposURL:  String("r"),
  6506  			EventsURL: String("e"),
  6507  			AvatarURL: String("a"),
  6508  		},
  6509  		Installation: &Installation{
  6510  			ID:       Int64(1),
  6511  			NodeID:   String("nid"),
  6512  			AppID:    Int64(1),
  6513  			AppSlug:  String("as"),
  6514  			TargetID: Int64(1),
  6515  			Account: &User{
  6516  				Login:           String("l"),
  6517  				ID:              Int64(1),
  6518  				URL:             String("u"),
  6519  				AvatarURL:       String("a"),
  6520  				GravatarID:      String("g"),
  6521  				Name:            String("n"),
  6522  				Company:         String("c"),
  6523  				Blog:            String("b"),
  6524  				Location:        String("l"),
  6525  				Email:           String("e"),
  6526  				Hireable:        Bool(true),
  6527  				Bio:             String("b"),
  6528  				TwitterUsername: String("t"),
  6529  				PublicRepos:     Int(1),
  6530  				Followers:       Int(1),
  6531  				Following:       Int(1),
  6532  				CreatedAt:       &Timestamp{referenceTime},
  6533  				SuspendedAt:     &Timestamp{referenceTime},
  6534  			},
  6535  			AccessTokensURL:     String("atu"),
  6536  			RepositoriesURL:     String("ru"),
  6537  			HTMLURL:             String("hu"),
  6538  			TargetType:          String("tt"),
  6539  			SingleFileName:      String("sfn"),
  6540  			RepositorySelection: String("rs"),
  6541  			Events:              []string{"e"},
  6542  			SingleFilePaths:     []string{"s"},
  6543  			Permissions: &InstallationPermissions{
  6544  				Actions:                       String("a"),
  6545  				Administration:                String("ad"),
  6546  				Checks:                        String("c"),
  6547  				Contents:                      String("co"),
  6548  				ContentReferences:             String("cr"),
  6549  				Deployments:                   String("d"),
  6550  				Environments:                  String("e"),
  6551  				Issues:                        String("i"),
  6552  				Metadata:                      String("md"),
  6553  				Members:                       String("m"),
  6554  				OrganizationAdministration:    String("oa"),
  6555  				OrganizationHooks:             String("oh"),
  6556  				OrganizationPlan:              String("op"),
  6557  				OrganizationPreReceiveHooks:   String("opr"),
  6558  				OrganizationProjects:          String("op"),
  6559  				OrganizationSecrets:           String("os"),
  6560  				OrganizationSelfHostedRunners: String("osh"),
  6561  				OrganizationUserBlocking:      String("oub"),
  6562  				Packages:                      String("pkg"),
  6563  				Pages:                         String("pg"),
  6564  				PullRequests:                  String("pr"),
  6565  				RepositoryHooks:               String("rh"),
  6566  				RepositoryProjects:            String("rp"),
  6567  				RepositoryPreReceiveHooks:     String("rprh"),
  6568  				Secrets:                       String("s"),
  6569  				SecretScanningAlerts:          String("ssa"),
  6570  				SecurityEvents:                String("se"),
  6571  				SingleFile:                    String("sf"),
  6572  				Statuses:                      String("s"),
  6573  				TeamDiscussions:               String("td"),
  6574  				VulnerabilityAlerts:           String("va"),
  6575  				Workflows:                     String("w"),
  6576  			},
  6577  			CreatedAt:              &Timestamp{referenceTime},
  6578  			UpdatedAt:              &Timestamp{referenceTime},
  6579  			HasMultipleSingleFiles: Bool(false),
  6580  			SuspendedBy: &User{
  6581  				Login:           String("l"),
  6582  				ID:              Int64(1),
  6583  				URL:             String("u"),
  6584  				AvatarURL:       String("a"),
  6585  				GravatarID:      String("g"),
  6586  				Name:            String("n"),
  6587  				Company:         String("c"),
  6588  				Blog:            String("b"),
  6589  				Location:        String("l"),
  6590  				Email:           String("e"),
  6591  				Hireable:        Bool(true),
  6592  				Bio:             String("b"),
  6593  				TwitterUsername: String("t"),
  6594  				PublicRepos:     Int(1),
  6595  				Followers:       Int(1),
  6596  				Following:       Int(1),
  6597  				CreatedAt:       &Timestamp{referenceTime},
  6598  				SuspendedAt:     &Timestamp{referenceTime},
  6599  			},
  6600  			SuspendedAt: &Timestamp{referenceTime},
  6601  		},
  6602  	}
  6603  
  6604  	want := `{
  6605  		"action": "a",
  6606  		"branch": "b",
  6607  		"client_payload": {
  6608  			"key": "value"
  6609  		},
  6610  		"repository": {
  6611  			"id": 1,
  6612  			"name": "n",
  6613  			"url": "s"
  6614  		},
  6615  		"organization": {
  6616  			"name": "n",
  6617  			"company": "c",
  6618  			"blog": "b",
  6619  			"location": "loc",
  6620  			"email": "e",
  6621  			"twitter_username": "tu",
  6622  			"description": "d",
  6623  			"billing_email": "be",
  6624  			"is_verified": true,
  6625  			"has_organization_projects": true,
  6626  			"has_repository_projects": true,
  6627  			"default_repository_permission": "drp",
  6628  			"members_can_create_repositories": true,
  6629  			"members_can_create_public_repositories": false,
  6630  			"members_can_create_private_repositories": true,
  6631  			"members_can_create_internal_repositories": true,
  6632  			"members_allowed_repository_creation_type": "marct",
  6633  			"members_can_create_pages": true,
  6634  			"members_can_create_public_pages": false,
  6635  			"members_can_create_private_pages": true
  6636  		},
  6637  		"sender": {
  6638  			"login": "l",
  6639  			"id": 1,
  6640  			"node_id": "n",
  6641  			"avatar_url": "a",
  6642  			"url": "u",
  6643  			"events_url": "e",
  6644  			"repos_url": "r"
  6645  		},
  6646  		"installation": {
  6647  			"id": 1,
  6648  			"node_id": "nid",
  6649  			"app_id": 1,
  6650  			"app_slug": "as",
  6651  			"target_id": 1,
  6652  			"account": {
  6653  				"login": "l",
  6654  				"id": 1,
  6655  				"avatar_url": "a",
  6656  				"gravatar_id": "g",
  6657  				"name": "n",
  6658  				"company": "c",
  6659  				"blog": "b",
  6660  				"location": "l",
  6661  				"email": "e",
  6662  				"hireable": true,
  6663  				"bio": "b",
  6664  				"twitter_username": "t",
  6665  				"public_repos": 1,
  6666  				"followers": 1,
  6667  				"following": 1,
  6668  				"created_at": ` + referenceTimeStr + `,
  6669  				"suspended_at": ` + referenceTimeStr + `,
  6670  				"url": "u"
  6671  			},
  6672  			"access_tokens_url": "atu",
  6673  			"repositories_url": "ru",
  6674  			"html_url": "hu",
  6675  			"target_type": "tt",
  6676  			"single_file_name": "sfn",
  6677  			"repository_selection": "rs",
  6678  			"events": [
  6679  				"e"
  6680  			],
  6681  			"single_file_paths": [
  6682  				"s"
  6683  			],
  6684  			"permissions": {
  6685  				"actions": "a",
  6686  				"administration": "ad",
  6687  				"checks": "c",
  6688  				"contents": "co",
  6689  				"content_references": "cr",
  6690  				"deployments": "d",
  6691  				"environments": "e",
  6692  				"issues": "i",
  6693  				"metadata": "md",
  6694  				"members": "m",
  6695  				"organization_administration": "oa",
  6696  				"organization_hooks": "oh",
  6697  				"organization_plan": "op",
  6698  				"organization_pre_receive_hooks": "opr",
  6699  				"organization_projects": "op",
  6700  				"organization_secrets": "os",
  6701  				"organization_self_hosted_runners": "osh",
  6702  				"organization_user_blocking": "oub",
  6703  				"packages": "pkg",
  6704  				"pages": "pg",
  6705  				"pull_requests": "pr",
  6706  				"repository_hooks": "rh",
  6707  				"repository_projects": "rp",
  6708  				"repository_pre_receive_hooks": "rprh",
  6709  				"secrets": "s",
  6710  				"secret_scanning_alerts": "ssa",
  6711  				"security_events": "se",
  6712  				"single_file": "sf",
  6713  				"statuses": "s",
  6714  				"team_discussions": "td",
  6715  				"vulnerability_alerts": "va",
  6716  				"workflows": "w"
  6717  			},
  6718  			"created_at": ` + referenceTimeStr + `,
  6719  			"updated_at": ` + referenceTimeStr + `,
  6720  			"has_multiple_single_files": false,
  6721  			"suspended_by": {
  6722  				"login": "l",
  6723  				"id": 1,
  6724  				"avatar_url": "a",
  6725  				"gravatar_id": "g",
  6726  				"name": "n",
  6727  				"company": "c",
  6728  				"blog": "b",
  6729  				"location": "l",
  6730  				"email": "e",
  6731  				"hireable": true,
  6732  				"bio": "b",
  6733  				"twitter_username": "t",
  6734  				"public_repos": 1,
  6735  				"followers": 1,
  6736  				"following": 1,
  6737  				"created_at": ` + referenceTimeStr + `,
  6738  				"suspended_at": ` + referenceTimeStr + `,
  6739  				"url": "u"
  6740  			},
  6741  			"suspended_at": ` + referenceTimeStr + `
  6742  		}
  6743  	}`
  6744  
  6745  	testJSONMarshal(t, u, want)
  6746  }
  6747  
  6748  func TestRepositoryEvent_Marshal(t *testing.T) {
  6749  	testJSONMarshal(t, &RepositoryEvent{}, "{}")
  6750  
  6751  	u := &RepositoryEvent{
  6752  		Action: String("a"),
  6753  		Repo: &Repository{
  6754  			ID:   Int64(1),
  6755  			URL:  String("s"),
  6756  			Name: String("n"),
  6757  		},
  6758  		Org: &Organization{
  6759  			BillingEmail:                         String("be"),
  6760  			Blog:                                 String("b"),
  6761  			Company:                              String("c"),
  6762  			Email:                                String("e"),
  6763  			TwitterUsername:                      String("tu"),
  6764  			Location:                             String("loc"),
  6765  			Name:                                 String("n"),
  6766  			Description:                          String("d"),
  6767  			IsVerified:                           Bool(true),
  6768  			HasOrganizationProjects:              Bool(true),
  6769  			HasRepositoryProjects:                Bool(true),
  6770  			DefaultRepoPermission:                String("drp"),
  6771  			MembersCanCreateRepos:                Bool(true),
  6772  			MembersCanCreateInternalRepos:        Bool(true),
  6773  			MembersCanCreatePrivateRepos:         Bool(true),
  6774  			MembersCanCreatePublicRepos:          Bool(false),
  6775  			MembersAllowedRepositoryCreationType: String("marct"),
  6776  			MembersCanCreatePages:                Bool(true),
  6777  			MembersCanCreatePublicPages:          Bool(false),
  6778  			MembersCanCreatePrivatePages:         Bool(true),
  6779  		},
  6780  		Sender: &User{
  6781  			Login:     String("l"),
  6782  			ID:        Int64(1),
  6783  			NodeID:    String("n"),
  6784  			URL:       String("u"),
  6785  			ReposURL:  String("r"),
  6786  			EventsURL: String("e"),
  6787  			AvatarURL: String("a"),
  6788  		},
  6789  		Installation: &Installation{
  6790  			ID:       Int64(1),
  6791  			NodeID:   String("nid"),
  6792  			AppID:    Int64(1),
  6793  			AppSlug:  String("as"),
  6794  			TargetID: Int64(1),
  6795  			Account: &User{
  6796  				Login:           String("l"),
  6797  				ID:              Int64(1),
  6798  				URL:             String("u"),
  6799  				AvatarURL:       String("a"),
  6800  				GravatarID:      String("g"),
  6801  				Name:            String("n"),
  6802  				Company:         String("c"),
  6803  				Blog:            String("b"),
  6804  				Location:        String("l"),
  6805  				Email:           String("e"),
  6806  				Hireable:        Bool(true),
  6807  				Bio:             String("b"),
  6808  				TwitterUsername: String("t"),
  6809  				PublicRepos:     Int(1),
  6810  				Followers:       Int(1),
  6811  				Following:       Int(1),
  6812  				CreatedAt:       &Timestamp{referenceTime},
  6813  				SuspendedAt:     &Timestamp{referenceTime},
  6814  			},
  6815  			AccessTokensURL:     String("atu"),
  6816  			RepositoriesURL:     String("ru"),
  6817  			HTMLURL:             String("hu"),
  6818  			TargetType:          String("tt"),
  6819  			SingleFileName:      String("sfn"),
  6820  			RepositorySelection: String("rs"),
  6821  			Events:              []string{"e"},
  6822  			SingleFilePaths:     []string{"s"},
  6823  			Permissions: &InstallationPermissions{
  6824  				Actions:                       String("a"),
  6825  				Administration:                String("ad"),
  6826  				Checks:                        String("c"),
  6827  				Contents:                      String("co"),
  6828  				ContentReferences:             String("cr"),
  6829  				Deployments:                   String("d"),
  6830  				Environments:                  String("e"),
  6831  				Issues:                        String("i"),
  6832  				Metadata:                      String("md"),
  6833  				Members:                       String("m"),
  6834  				OrganizationAdministration:    String("oa"),
  6835  				OrganizationHooks:             String("oh"),
  6836  				OrganizationPlan:              String("op"),
  6837  				OrganizationPreReceiveHooks:   String("opr"),
  6838  				OrganizationProjects:          String("op"),
  6839  				OrganizationSecrets:           String("os"),
  6840  				OrganizationSelfHostedRunners: String("osh"),
  6841  				OrganizationUserBlocking:      String("oub"),
  6842  				Packages:                      String("pkg"),
  6843  				Pages:                         String("pg"),
  6844  				PullRequests:                  String("pr"),
  6845  				RepositoryHooks:               String("rh"),
  6846  				RepositoryProjects:            String("rp"),
  6847  				RepositoryPreReceiveHooks:     String("rprh"),
  6848  				Secrets:                       String("s"),
  6849  				SecretScanningAlerts:          String("ssa"),
  6850  				SecurityEvents:                String("se"),
  6851  				SingleFile:                    String("sf"),
  6852  				Statuses:                      String("s"),
  6853  				TeamDiscussions:               String("td"),
  6854  				VulnerabilityAlerts:           String("va"),
  6855  				Workflows:                     String("w"),
  6856  			},
  6857  			CreatedAt:              &Timestamp{referenceTime},
  6858  			UpdatedAt:              &Timestamp{referenceTime},
  6859  			HasMultipleSingleFiles: Bool(false),
  6860  			SuspendedBy: &User{
  6861  				Login:           String("l"),
  6862  				ID:              Int64(1),
  6863  				URL:             String("u"),
  6864  				AvatarURL:       String("a"),
  6865  				GravatarID:      String("g"),
  6866  				Name:            String("n"),
  6867  				Company:         String("c"),
  6868  				Blog:            String("b"),
  6869  				Location:        String("l"),
  6870  				Email:           String("e"),
  6871  				Hireable:        Bool(true),
  6872  				Bio:             String("b"),
  6873  				TwitterUsername: String("t"),
  6874  				PublicRepos:     Int(1),
  6875  				Followers:       Int(1),
  6876  				Following:       Int(1),
  6877  				CreatedAt:       &Timestamp{referenceTime},
  6878  				SuspendedAt:     &Timestamp{referenceTime},
  6879  			},
  6880  			SuspendedAt: &Timestamp{referenceTime},
  6881  		},
  6882  	}
  6883  
  6884  	want := `{
  6885  		"action": "a",
  6886  		"repository": {
  6887  			"id": 1,
  6888  			"name": "n",
  6889  			"url": "s"
  6890  		},
  6891  		"organization": {
  6892  			"name": "n",
  6893  			"company": "c",
  6894  			"blog": "b",
  6895  			"location": "loc",
  6896  			"email": "e",
  6897  			"twitter_username": "tu",
  6898  			"description": "d",
  6899  			"billing_email": "be",
  6900  			"is_verified": true,
  6901  			"has_organization_projects": true,
  6902  			"has_repository_projects": true,
  6903  			"default_repository_permission": "drp",
  6904  			"members_can_create_repositories": true,
  6905  			"members_can_create_public_repositories": false,
  6906  			"members_can_create_private_repositories": true,
  6907  			"members_can_create_internal_repositories": true,
  6908  			"members_allowed_repository_creation_type": "marct",
  6909  			"members_can_create_pages": true,
  6910  			"members_can_create_public_pages": false,
  6911  			"members_can_create_private_pages": true
  6912  		},
  6913  		"sender": {
  6914  			"login": "l",
  6915  			"id": 1,
  6916  			"node_id": "n",
  6917  			"avatar_url": "a",
  6918  			"url": "u",
  6919  			"events_url": "e",
  6920  			"repos_url": "r"
  6921  		},
  6922  		"installation": {
  6923  			"id": 1,
  6924  			"node_id": "nid",
  6925  			"app_id": 1,
  6926  			"app_slug": "as",
  6927  			"target_id": 1,
  6928  			"account": {
  6929  				"login": "l",
  6930  				"id": 1,
  6931  				"avatar_url": "a",
  6932  				"gravatar_id": "g",
  6933  				"name": "n",
  6934  				"company": "c",
  6935  				"blog": "b",
  6936  				"location": "l",
  6937  				"email": "e",
  6938  				"hireable": true,
  6939  				"bio": "b",
  6940  				"twitter_username": "t",
  6941  				"public_repos": 1,
  6942  				"followers": 1,
  6943  				"following": 1,
  6944  				"created_at": ` + referenceTimeStr + `,
  6945  				"suspended_at": ` + referenceTimeStr + `,
  6946  				"url": "u"
  6947  			},
  6948  			"access_tokens_url": "atu",
  6949  			"repositories_url": "ru",
  6950  			"html_url": "hu",
  6951  			"target_type": "tt",
  6952  			"single_file_name": "sfn",
  6953  			"repository_selection": "rs",
  6954  			"events": [
  6955  				"e"
  6956  			],
  6957  			"single_file_paths": [
  6958  				"s"
  6959  			],
  6960  			"permissions": {
  6961  				"actions": "a",
  6962  				"administration": "ad",
  6963  				"checks": "c",
  6964  				"contents": "co",
  6965  				"content_references": "cr",
  6966  				"deployments": "d",
  6967  				"environments": "e",
  6968  				"issues": "i",
  6969  				"metadata": "md",
  6970  				"members": "m",
  6971  				"organization_administration": "oa",
  6972  				"organization_hooks": "oh",
  6973  				"organization_plan": "op",
  6974  				"organization_pre_receive_hooks": "opr",
  6975  				"organization_projects": "op",
  6976  				"organization_secrets": "os",
  6977  				"organization_self_hosted_runners": "osh",
  6978  				"organization_user_blocking": "oub",
  6979  				"packages": "pkg",
  6980  				"pages": "pg",
  6981  				"pull_requests": "pr",
  6982  				"repository_hooks": "rh",
  6983  				"repository_projects": "rp",
  6984  				"repository_pre_receive_hooks": "rprh",
  6985  				"secrets": "s",
  6986  				"secret_scanning_alerts": "ssa",
  6987  				"security_events": "se",
  6988  				"single_file": "sf",
  6989  				"statuses": "s",
  6990  				"team_discussions": "td",
  6991  				"vulnerability_alerts": "va",
  6992  				"workflows": "w"
  6993  			},
  6994  			"created_at": ` + referenceTimeStr + `,
  6995  			"updated_at": ` + referenceTimeStr + `,
  6996  			"has_multiple_single_files": false,
  6997  			"suspended_by": {
  6998  				"login": "l",
  6999  				"id": 1,
  7000  				"avatar_url": "a",
  7001  				"gravatar_id": "g",
  7002  				"name": "n",
  7003  				"company": "c",
  7004  				"blog": "b",
  7005  				"location": "l",
  7006  				"email": "e",
  7007  				"hireable": true,
  7008  				"bio": "b",
  7009  				"twitter_username": "t",
  7010  				"public_repos": 1,
  7011  				"followers": 1,
  7012  				"following": 1,
  7013  				"created_at": ` + referenceTimeStr + `,
  7014  				"suspended_at": ` + referenceTimeStr + `,
  7015  				"url": "u"
  7016  			},
  7017  			"suspended_at": ` + referenceTimeStr + `
  7018  		}
  7019  	}`
  7020  
  7021  	testJSONMarshal(t, u, want)
  7022  }
  7023  
  7024  func TestReleaseEvent_Marshal(t *testing.T) {
  7025  	testJSONMarshal(t, &ReleaseEvent{}, "{}")
  7026  
  7027  	u := &ReleaseEvent{
  7028  		Action: String("a"),
  7029  		Release: &RepositoryRelease{
  7030  			Name:                   String("n"),
  7031  			DiscussionCategoryName: String("dcn"),
  7032  			ID:                     Int64(2),
  7033  			CreatedAt:              &Timestamp{referenceTime},
  7034  			PublishedAt:            &Timestamp{referenceTime},
  7035  			URL:                    String("url"),
  7036  			HTMLURL:                String("htmlurl"),
  7037  			AssetsURL:              String("assetsurl"),
  7038  			Assets:                 []*ReleaseAsset{{ID: Int64(1)}},
  7039  			UploadURL:              String("uploadurl"),
  7040  			ZipballURL:             String("zipballurl"),
  7041  			TarballURL:             String("tarballurl"),
  7042  			Author:                 &User{Name: String("octocat")},
  7043  			NodeID:                 String("nid"),
  7044  		},
  7045  		Repo: &Repository{
  7046  			ID:   Int64(1),
  7047  			URL:  String("s"),
  7048  			Name: String("n"),
  7049  		},
  7050  		Sender: &User{
  7051  			Login:     String("l"),
  7052  			ID:        Int64(1),
  7053  			NodeID:    String("n"),
  7054  			URL:       String("u"),
  7055  			ReposURL:  String("r"),
  7056  			EventsURL: String("e"),
  7057  			AvatarURL: String("a"),
  7058  		},
  7059  		Installation: &Installation{
  7060  			ID:       Int64(1),
  7061  			NodeID:   String("nid"),
  7062  			AppID:    Int64(1),
  7063  			AppSlug:  String("as"),
  7064  			TargetID: Int64(1),
  7065  			Account: &User{
  7066  				Login:           String("l"),
  7067  				ID:              Int64(1),
  7068  				URL:             String("u"),
  7069  				AvatarURL:       String("a"),
  7070  				GravatarID:      String("g"),
  7071  				Name:            String("n"),
  7072  				Company:         String("c"),
  7073  				Blog:            String("b"),
  7074  				Location:        String("l"),
  7075  				Email:           String("e"),
  7076  				Hireable:        Bool(true),
  7077  				Bio:             String("b"),
  7078  				TwitterUsername: String("t"),
  7079  				PublicRepos:     Int(1),
  7080  				Followers:       Int(1),
  7081  				Following:       Int(1),
  7082  				CreatedAt:       &Timestamp{referenceTime},
  7083  				SuspendedAt:     &Timestamp{referenceTime},
  7084  			},
  7085  			AccessTokensURL:     String("atu"),
  7086  			RepositoriesURL:     String("ru"),
  7087  			HTMLURL:             String("hu"),
  7088  			TargetType:          String("tt"),
  7089  			SingleFileName:      String("sfn"),
  7090  			RepositorySelection: String("rs"),
  7091  			Events:              []string{"e"},
  7092  			SingleFilePaths:     []string{"s"},
  7093  			Permissions: &InstallationPermissions{
  7094  				Actions:                       String("a"),
  7095  				Administration:                String("ad"),
  7096  				Checks:                        String("c"),
  7097  				Contents:                      String("co"),
  7098  				ContentReferences:             String("cr"),
  7099  				Deployments:                   String("d"),
  7100  				Environments:                  String("e"),
  7101  				Issues:                        String("i"),
  7102  				Metadata:                      String("md"),
  7103  				Members:                       String("m"),
  7104  				OrganizationAdministration:    String("oa"),
  7105  				OrganizationHooks:             String("oh"),
  7106  				OrganizationPlan:              String("op"),
  7107  				OrganizationPreReceiveHooks:   String("opr"),
  7108  				OrganizationProjects:          String("op"),
  7109  				OrganizationSecrets:           String("os"),
  7110  				OrganizationSelfHostedRunners: String("osh"),
  7111  				OrganizationUserBlocking:      String("oub"),
  7112  				Packages:                      String("pkg"),
  7113  				Pages:                         String("pg"),
  7114  				PullRequests:                  String("pr"),
  7115  				RepositoryHooks:               String("rh"),
  7116  				RepositoryProjects:            String("rp"),
  7117  				RepositoryPreReceiveHooks:     String("rprh"),
  7118  				Secrets:                       String("s"),
  7119  				SecretScanningAlerts:          String("ssa"),
  7120  				SecurityEvents:                String("se"),
  7121  				SingleFile:                    String("sf"),
  7122  				Statuses:                      String("s"),
  7123  				TeamDiscussions:               String("td"),
  7124  				VulnerabilityAlerts:           String("va"),
  7125  				Workflows:                     String("w"),
  7126  			},
  7127  			CreatedAt:              &Timestamp{referenceTime},
  7128  			UpdatedAt:              &Timestamp{referenceTime},
  7129  			HasMultipleSingleFiles: Bool(false),
  7130  			SuspendedBy: &User{
  7131  				Login:           String("l"),
  7132  				ID:              Int64(1),
  7133  				URL:             String("u"),
  7134  				AvatarURL:       String("a"),
  7135  				GravatarID:      String("g"),
  7136  				Name:            String("n"),
  7137  				Company:         String("c"),
  7138  				Blog:            String("b"),
  7139  				Location:        String("l"),
  7140  				Email:           String("e"),
  7141  				Hireable:        Bool(true),
  7142  				Bio:             String("b"),
  7143  				TwitterUsername: String("t"),
  7144  				PublicRepos:     Int(1),
  7145  				Followers:       Int(1),
  7146  				Following:       Int(1),
  7147  				CreatedAt:       &Timestamp{referenceTime},
  7148  				SuspendedAt:     &Timestamp{referenceTime},
  7149  			},
  7150  			SuspendedAt: &Timestamp{referenceTime},
  7151  		},
  7152  	}
  7153  
  7154  	want := `{
  7155  		"action": "a",
  7156  		"release": {
  7157  			"name": "n",
  7158  			"discussion_category_name": "dcn",
  7159  			"id": 2,
  7160  			"created_at": ` + referenceTimeStr + `,
  7161  			"published_at": ` + referenceTimeStr + `,
  7162  			"url": "url",
  7163  			"html_url": "htmlurl",
  7164  			"assets_url": "assetsurl",
  7165  			"assets": [
  7166  				{
  7167  					"id": 1
  7168  				}
  7169  			],
  7170  			"upload_url": "uploadurl",
  7171  			"zipball_url": "zipballurl",
  7172  			"tarball_url": "tarballurl",
  7173  			"author": {
  7174  				"name": "octocat"
  7175  			},
  7176  			"node_id": "nid"
  7177  		},
  7178  		"repository": {
  7179  			"id": 1,
  7180  			"name": "n",
  7181  			"url": "s"
  7182  		},
  7183  		"sender": {
  7184  			"login": "l",
  7185  			"id": 1,
  7186  			"node_id": "n",
  7187  			"avatar_url": "a",
  7188  			"url": "u",
  7189  			"events_url": "e",
  7190  			"repos_url": "r"
  7191  		},
  7192  		"installation": {
  7193  			"id": 1,
  7194  			"node_id": "nid",
  7195  			"app_id": 1,
  7196  			"app_slug": "as",
  7197  			"target_id": 1,
  7198  			"account": {
  7199  				"login": "l",
  7200  				"id": 1,
  7201  				"avatar_url": "a",
  7202  				"gravatar_id": "g",
  7203  				"name": "n",
  7204  				"company": "c",
  7205  				"blog": "b",
  7206  				"location": "l",
  7207  				"email": "e",
  7208  				"hireable": true,
  7209  				"bio": "b",
  7210  				"twitter_username": "t",
  7211  				"public_repos": 1,
  7212  				"followers": 1,
  7213  				"following": 1,
  7214  				"created_at": ` + referenceTimeStr + `,
  7215  				"suspended_at": ` + referenceTimeStr + `,
  7216  				"url": "u"
  7217  			},
  7218  			"access_tokens_url": "atu",
  7219  			"repositories_url": "ru",
  7220  			"html_url": "hu",
  7221  			"target_type": "tt",
  7222  			"single_file_name": "sfn",
  7223  			"repository_selection": "rs",
  7224  			"events": [
  7225  				"e"
  7226  			],
  7227  			"single_file_paths": [
  7228  				"s"
  7229  			],
  7230  			"permissions": {
  7231  				"actions": "a",
  7232  				"administration": "ad",
  7233  				"checks": "c",
  7234  				"contents": "co",
  7235  				"content_references": "cr",
  7236  				"deployments": "d",
  7237  				"environments": "e",
  7238  				"issues": "i",
  7239  				"metadata": "md",
  7240  				"members": "m",
  7241  				"organization_administration": "oa",
  7242  				"organization_hooks": "oh",
  7243  				"organization_plan": "op",
  7244  				"organization_pre_receive_hooks": "opr",
  7245  				"organization_projects": "op",
  7246  				"organization_secrets": "os",
  7247  				"organization_self_hosted_runners": "osh",
  7248  				"organization_user_blocking": "oub",
  7249  				"packages": "pkg",
  7250  				"pages": "pg",
  7251  				"pull_requests": "pr",
  7252  				"repository_hooks": "rh",
  7253  				"repository_projects": "rp",
  7254  				"repository_pre_receive_hooks": "rprh",
  7255  				"secrets": "s",
  7256  				"secret_scanning_alerts": "ssa",
  7257  				"security_events": "se",
  7258  				"single_file": "sf",
  7259  				"statuses": "s",
  7260  				"team_discussions": "td",
  7261  				"vulnerability_alerts": "va",
  7262  				"workflows": "w"
  7263  			},
  7264  			"created_at": ` + referenceTimeStr + `,
  7265  			"updated_at": ` + referenceTimeStr + `,
  7266  			"has_multiple_single_files": false,
  7267  			"suspended_by": {
  7268  				"login": "l",
  7269  				"id": 1,
  7270  				"avatar_url": "a",
  7271  				"gravatar_id": "g",
  7272  				"name": "n",
  7273  				"company": "c",
  7274  				"blog": "b",
  7275  				"location": "l",
  7276  				"email": "e",
  7277  				"hireable": true,
  7278  				"bio": "b",
  7279  				"twitter_username": "t",
  7280  				"public_repos": 1,
  7281  				"followers": 1,
  7282  				"following": 1,
  7283  				"created_at": ` + referenceTimeStr + `,
  7284  				"suspended_at": ` + referenceTimeStr + `,
  7285  				"url": "u"
  7286  			},
  7287  			"suspended_at": ` + referenceTimeStr + `
  7288  		}
  7289  	}`
  7290  
  7291  	testJSONMarshal(t, u, want)
  7292  }
  7293  
  7294  func TestContentReferenceEvent_Marshal(t *testing.T) {
  7295  	testJSONMarshal(t, &ContentReferenceEvent{}, "{}")
  7296  
  7297  	u := &ContentReferenceEvent{
  7298  		Action: String("a"),
  7299  		ContentReference: &ContentReference{
  7300  			ID:        Int64(1),
  7301  			NodeID:    String("nid"),
  7302  			Reference: String("ref"),
  7303  		},
  7304  		Repo: &Repository{
  7305  			ID:   Int64(1),
  7306  			URL:  String("s"),
  7307  			Name: String("n"),
  7308  		},
  7309  		Sender: &User{
  7310  			Login:     String("l"),
  7311  			ID:        Int64(1),
  7312  			NodeID:    String("n"),
  7313  			URL:       String("u"),
  7314  			ReposURL:  String("r"),
  7315  			EventsURL: String("e"),
  7316  			AvatarURL: String("a"),
  7317  		},
  7318  		Installation: &Installation{
  7319  			ID:       Int64(1),
  7320  			NodeID:   String("nid"),
  7321  			AppID:    Int64(1),
  7322  			AppSlug:  String("as"),
  7323  			TargetID: Int64(1),
  7324  			Account: &User{
  7325  				Login:           String("l"),
  7326  				ID:              Int64(1),
  7327  				URL:             String("u"),
  7328  				AvatarURL:       String("a"),
  7329  				GravatarID:      String("g"),
  7330  				Name:            String("n"),
  7331  				Company:         String("c"),
  7332  				Blog:            String("b"),
  7333  				Location:        String("l"),
  7334  				Email:           String("e"),
  7335  				Hireable:        Bool(true),
  7336  				Bio:             String("b"),
  7337  				TwitterUsername: String("t"),
  7338  				PublicRepos:     Int(1),
  7339  				Followers:       Int(1),
  7340  				Following:       Int(1),
  7341  				CreatedAt:       &Timestamp{referenceTime},
  7342  				SuspendedAt:     &Timestamp{referenceTime},
  7343  			},
  7344  			AccessTokensURL:     String("atu"),
  7345  			RepositoriesURL:     String("ru"),
  7346  			HTMLURL:             String("hu"),
  7347  			TargetType:          String("tt"),
  7348  			SingleFileName:      String("sfn"),
  7349  			RepositorySelection: String("rs"),
  7350  			Events:              []string{"e"},
  7351  			SingleFilePaths:     []string{"s"},
  7352  			Permissions: &InstallationPermissions{
  7353  				Actions:                       String("a"),
  7354  				Administration:                String("ad"),
  7355  				Checks:                        String("c"),
  7356  				Contents:                      String("co"),
  7357  				ContentReferences:             String("cr"),
  7358  				Deployments:                   String("d"),
  7359  				Environments:                  String("e"),
  7360  				Issues:                        String("i"),
  7361  				Metadata:                      String("md"),
  7362  				Members:                       String("m"),
  7363  				OrganizationAdministration:    String("oa"),
  7364  				OrganizationHooks:             String("oh"),
  7365  				OrganizationPlan:              String("op"),
  7366  				OrganizationPreReceiveHooks:   String("opr"),
  7367  				OrganizationProjects:          String("op"),
  7368  				OrganizationSecrets:           String("os"),
  7369  				OrganizationSelfHostedRunners: String("osh"),
  7370  				OrganizationUserBlocking:      String("oub"),
  7371  				Packages:                      String("pkg"),
  7372  				Pages:                         String("pg"),
  7373  				PullRequests:                  String("pr"),
  7374  				RepositoryHooks:               String("rh"),
  7375  				RepositoryProjects:            String("rp"),
  7376  				RepositoryPreReceiveHooks:     String("rprh"),
  7377  				Secrets:                       String("s"),
  7378  				SecretScanningAlerts:          String("ssa"),
  7379  				SecurityEvents:                String("se"),
  7380  				SingleFile:                    String("sf"),
  7381  				Statuses:                      String("s"),
  7382  				TeamDiscussions:               String("td"),
  7383  				VulnerabilityAlerts:           String("va"),
  7384  				Workflows:                     String("w"),
  7385  			},
  7386  			CreatedAt:              &Timestamp{referenceTime},
  7387  			UpdatedAt:              &Timestamp{referenceTime},
  7388  			HasMultipleSingleFiles: Bool(false),
  7389  			SuspendedBy: &User{
  7390  				Login:           String("l"),
  7391  				ID:              Int64(1),
  7392  				URL:             String("u"),
  7393  				AvatarURL:       String("a"),
  7394  				GravatarID:      String("g"),
  7395  				Name:            String("n"),
  7396  				Company:         String("c"),
  7397  				Blog:            String("b"),
  7398  				Location:        String("l"),
  7399  				Email:           String("e"),
  7400  				Hireable:        Bool(true),
  7401  				Bio:             String("b"),
  7402  				TwitterUsername: String("t"),
  7403  				PublicRepos:     Int(1),
  7404  				Followers:       Int(1),
  7405  				Following:       Int(1),
  7406  				CreatedAt:       &Timestamp{referenceTime},
  7407  				SuspendedAt:     &Timestamp{referenceTime},
  7408  			},
  7409  			SuspendedAt: &Timestamp{referenceTime},
  7410  		},
  7411  	}
  7412  
  7413  	want := `{
  7414  		"action": "a",
  7415  		"content_reference": {
  7416  			"id": 1,
  7417  			"node_id": "nid",
  7418  			"reference": "ref"
  7419  		},
  7420  		"repository": {
  7421  			"id": 1,
  7422  			"name": "n",
  7423  			"url": "s"
  7424  		},
  7425  		"sender": {
  7426  			"login": "l",
  7427  			"id": 1,
  7428  			"node_id": "n",
  7429  			"avatar_url": "a",
  7430  			"url": "u",
  7431  			"events_url": "e",
  7432  			"repos_url": "r"
  7433  		},
  7434  		"installation": {
  7435  			"id": 1,
  7436  			"node_id": "nid",
  7437  			"app_id": 1,
  7438  			"app_slug": "as",
  7439  			"target_id": 1,
  7440  			"account": {
  7441  				"login": "l",
  7442  				"id": 1,
  7443  				"avatar_url": "a",
  7444  				"gravatar_id": "g",
  7445  				"name": "n",
  7446  				"company": "c",
  7447  				"blog": "b",
  7448  				"location": "l",
  7449  				"email": "e",
  7450  				"hireable": true,
  7451  				"bio": "b",
  7452  				"twitter_username": "t",
  7453  				"public_repos": 1,
  7454  				"followers": 1,
  7455  				"following": 1,
  7456  				"created_at": ` + referenceTimeStr + `,
  7457  				"suspended_at": ` + referenceTimeStr + `,
  7458  				"url": "u"
  7459  			},
  7460  			"access_tokens_url": "atu",
  7461  			"repositories_url": "ru",
  7462  			"html_url": "hu",
  7463  			"target_type": "tt",
  7464  			"single_file_name": "sfn",
  7465  			"repository_selection": "rs",
  7466  			"events": [
  7467  				"e"
  7468  			],
  7469  			"single_file_paths": [
  7470  				"s"
  7471  			],
  7472  			"permissions": {
  7473  				"actions": "a",
  7474  				"administration": "ad",
  7475  				"checks": "c",
  7476  				"contents": "co",
  7477  				"content_references": "cr",
  7478  				"deployments": "d",
  7479  				"environments": "e",
  7480  				"issues": "i",
  7481  				"metadata": "md",
  7482  				"members": "m",
  7483  				"organization_administration": "oa",
  7484  				"organization_hooks": "oh",
  7485  				"organization_plan": "op",
  7486  				"organization_pre_receive_hooks": "opr",
  7487  				"organization_projects": "op",
  7488  				"organization_secrets": "os",
  7489  				"organization_self_hosted_runners": "osh",
  7490  				"organization_user_blocking": "oub",
  7491  				"packages": "pkg",
  7492  				"pages": "pg",
  7493  				"pull_requests": "pr",
  7494  				"repository_hooks": "rh",
  7495  				"repository_projects": "rp",
  7496  				"repository_pre_receive_hooks": "rprh",
  7497  				"secrets": "s",
  7498  				"secret_scanning_alerts": "ssa",
  7499  				"security_events": "se",
  7500  				"single_file": "sf",
  7501  				"statuses": "s",
  7502  				"team_discussions": "td",
  7503  				"vulnerability_alerts": "va",
  7504  				"workflows": "w"
  7505  			},
  7506  			"created_at": ` + referenceTimeStr + `,
  7507  			"updated_at": ` + referenceTimeStr + `,
  7508  			"has_multiple_single_files": false,
  7509  			"suspended_by": {
  7510  				"login": "l",
  7511  				"id": 1,
  7512  				"avatar_url": "a",
  7513  				"gravatar_id": "g",
  7514  				"name": "n",
  7515  				"company": "c",
  7516  				"blog": "b",
  7517  				"location": "l",
  7518  				"email": "e",
  7519  				"hireable": true,
  7520  				"bio": "b",
  7521  				"twitter_username": "t",
  7522  				"public_repos": 1,
  7523  				"followers": 1,
  7524  				"following": 1,
  7525  				"created_at": ` + referenceTimeStr + `,
  7526  				"suspended_at": ` + referenceTimeStr + `,
  7527  				"url": "u"
  7528  			},
  7529  			"suspended_at": ` + referenceTimeStr + `
  7530  		}
  7531  	}`
  7532  
  7533  	testJSONMarshal(t, u, want)
  7534  }
  7535  
  7536  func TestMemberEvent_Marshal(t *testing.T) {
  7537  	testJSONMarshal(t, &MemberEvent{}, "{}")
  7538  
  7539  	u := &MemberEvent{
  7540  		Action: String("a"),
  7541  		Member: &User{
  7542  			Login:     String("l"),
  7543  			ID:        Int64(1),
  7544  			NodeID:    String("n"),
  7545  			URL:       String("u"),
  7546  			ReposURL:  String("r"),
  7547  			EventsURL: String("e"),
  7548  			AvatarURL: String("a"),
  7549  		},
  7550  		Repo: &Repository{
  7551  			ID:   Int64(1),
  7552  			URL:  String("s"),
  7553  			Name: String("n"),
  7554  		},
  7555  		Sender: &User{
  7556  			Login:     String("l"),
  7557  			ID:        Int64(1),
  7558  			NodeID:    String("n"),
  7559  			URL:       String("u"),
  7560  			ReposURL:  String("r"),
  7561  			EventsURL: String("e"),
  7562  			AvatarURL: String("a"),
  7563  		},
  7564  		Installation: &Installation{
  7565  			ID:       Int64(1),
  7566  			NodeID:   String("nid"),
  7567  			AppID:    Int64(1),
  7568  			AppSlug:  String("as"),
  7569  			TargetID: Int64(1),
  7570  			Account: &User{
  7571  				Login:           String("l"),
  7572  				ID:              Int64(1),
  7573  				URL:             String("u"),
  7574  				AvatarURL:       String("a"),
  7575  				GravatarID:      String("g"),
  7576  				Name:            String("n"),
  7577  				Company:         String("c"),
  7578  				Blog:            String("b"),
  7579  				Location:        String("l"),
  7580  				Email:           String("e"),
  7581  				Hireable:        Bool(true),
  7582  				Bio:             String("b"),
  7583  				TwitterUsername: String("t"),
  7584  				PublicRepos:     Int(1),
  7585  				Followers:       Int(1),
  7586  				Following:       Int(1),
  7587  				CreatedAt:       &Timestamp{referenceTime},
  7588  				SuspendedAt:     &Timestamp{referenceTime},
  7589  			},
  7590  			AccessTokensURL:     String("atu"),
  7591  			RepositoriesURL:     String("ru"),
  7592  			HTMLURL:             String("hu"),
  7593  			TargetType:          String("tt"),
  7594  			SingleFileName:      String("sfn"),
  7595  			RepositorySelection: String("rs"),
  7596  			Events:              []string{"e"},
  7597  			SingleFilePaths:     []string{"s"},
  7598  			Permissions: &InstallationPermissions{
  7599  				Actions:                       String("a"),
  7600  				Administration:                String("ad"),
  7601  				Checks:                        String("c"),
  7602  				Contents:                      String("co"),
  7603  				ContentReferences:             String("cr"),
  7604  				Deployments:                   String("d"),
  7605  				Environments:                  String("e"),
  7606  				Issues:                        String("i"),
  7607  				Metadata:                      String("md"),
  7608  				Members:                       String("m"),
  7609  				OrganizationAdministration:    String("oa"),
  7610  				OrganizationHooks:             String("oh"),
  7611  				OrganizationPlan:              String("op"),
  7612  				OrganizationPreReceiveHooks:   String("opr"),
  7613  				OrganizationProjects:          String("op"),
  7614  				OrganizationSecrets:           String("os"),
  7615  				OrganizationSelfHostedRunners: String("osh"),
  7616  				OrganizationUserBlocking:      String("oub"),
  7617  				Packages:                      String("pkg"),
  7618  				Pages:                         String("pg"),
  7619  				PullRequests:                  String("pr"),
  7620  				RepositoryHooks:               String("rh"),
  7621  				RepositoryProjects:            String("rp"),
  7622  				RepositoryPreReceiveHooks:     String("rprh"),
  7623  				Secrets:                       String("s"),
  7624  				SecretScanningAlerts:          String("ssa"),
  7625  				SecurityEvents:                String("se"),
  7626  				SingleFile:                    String("sf"),
  7627  				Statuses:                      String("s"),
  7628  				TeamDiscussions:               String("td"),
  7629  				VulnerabilityAlerts:           String("va"),
  7630  				Workflows:                     String("w"),
  7631  			},
  7632  			CreatedAt:              &Timestamp{referenceTime},
  7633  			UpdatedAt:              &Timestamp{referenceTime},
  7634  			HasMultipleSingleFiles: Bool(false),
  7635  			SuspendedBy: &User{
  7636  				Login:           String("l"),
  7637  				ID:              Int64(1),
  7638  				URL:             String("u"),
  7639  				AvatarURL:       String("a"),
  7640  				GravatarID:      String("g"),
  7641  				Name:            String("n"),
  7642  				Company:         String("c"),
  7643  				Blog:            String("b"),
  7644  				Location:        String("l"),
  7645  				Email:           String("e"),
  7646  				Hireable:        Bool(true),
  7647  				Bio:             String("b"),
  7648  				TwitterUsername: String("t"),
  7649  				PublicRepos:     Int(1),
  7650  				Followers:       Int(1),
  7651  				Following:       Int(1),
  7652  				CreatedAt:       &Timestamp{referenceTime},
  7653  				SuspendedAt:     &Timestamp{referenceTime},
  7654  			},
  7655  			SuspendedAt: &Timestamp{referenceTime},
  7656  		},
  7657  	}
  7658  
  7659  	want := `{
  7660  		"action": "a",
  7661  		"member": {
  7662  			"login": "l",
  7663  			"id": 1,
  7664  			"node_id": "n",
  7665  			"avatar_url": "a",
  7666  			"url": "u",
  7667  			"events_url": "e",
  7668  			"repos_url": "r"
  7669  		},
  7670  		"repository": {
  7671  			"id": 1,
  7672  			"name": "n",
  7673  			"url": "s"
  7674  		},
  7675  		"sender": {
  7676  			"login": "l",
  7677  			"id": 1,
  7678  			"node_id": "n",
  7679  			"avatar_url": "a",
  7680  			"url": "u",
  7681  			"events_url": "e",
  7682  			"repos_url": "r"
  7683  		},
  7684  		"installation": {
  7685  			"id": 1,
  7686  			"node_id": "nid",
  7687  			"app_id": 1,
  7688  			"app_slug": "as",
  7689  			"target_id": 1,
  7690  			"account": {
  7691  				"login": "l",
  7692  				"id": 1,
  7693  				"avatar_url": "a",
  7694  				"gravatar_id": "g",
  7695  				"name": "n",
  7696  				"company": "c",
  7697  				"blog": "b",
  7698  				"location": "l",
  7699  				"email": "e",
  7700  				"hireable": true,
  7701  				"bio": "b",
  7702  				"twitter_username": "t",
  7703  				"public_repos": 1,
  7704  				"followers": 1,
  7705  				"following": 1,
  7706  				"created_at": ` + referenceTimeStr + `,
  7707  				"suspended_at": ` + referenceTimeStr + `,
  7708  				"url": "u"
  7709  			},
  7710  			"access_tokens_url": "atu",
  7711  			"repositories_url": "ru",
  7712  			"html_url": "hu",
  7713  			"target_type": "tt",
  7714  			"single_file_name": "sfn",
  7715  			"repository_selection": "rs",
  7716  			"events": [
  7717  				"e"
  7718  			],
  7719  			"single_file_paths": [
  7720  				"s"
  7721  			],
  7722  			"permissions": {
  7723  				"actions": "a",
  7724  				"administration": "ad",
  7725  				"checks": "c",
  7726  				"contents": "co",
  7727  				"content_references": "cr",
  7728  				"deployments": "d",
  7729  				"environments": "e",
  7730  				"issues": "i",
  7731  				"metadata": "md",
  7732  				"members": "m",
  7733  				"organization_administration": "oa",
  7734  				"organization_hooks": "oh",
  7735  				"organization_plan": "op",
  7736  				"organization_pre_receive_hooks": "opr",
  7737  				"organization_projects": "op",
  7738  				"organization_secrets": "os",
  7739  				"organization_self_hosted_runners": "osh",
  7740  				"organization_user_blocking": "oub",
  7741  				"packages": "pkg",
  7742  				"pages": "pg",
  7743  				"pull_requests": "pr",
  7744  				"repository_hooks": "rh",
  7745  				"repository_projects": "rp",
  7746  				"repository_pre_receive_hooks": "rprh",
  7747  				"secrets": "s",
  7748  				"secret_scanning_alerts": "ssa",
  7749  				"security_events": "se",
  7750  				"single_file": "sf",
  7751  				"statuses": "s",
  7752  				"team_discussions": "td",
  7753  				"vulnerability_alerts": "va",
  7754  				"workflows": "w"
  7755  			},
  7756  			"created_at": ` + referenceTimeStr + `,
  7757  			"updated_at": ` + referenceTimeStr + `,
  7758  			"has_multiple_single_files": false,
  7759  			"suspended_by": {
  7760  				"login": "l",
  7761  				"id": 1,
  7762  				"avatar_url": "a",
  7763  				"gravatar_id": "g",
  7764  				"name": "n",
  7765  				"company": "c",
  7766  				"blog": "b",
  7767  				"location": "l",
  7768  				"email": "e",
  7769  				"hireable": true,
  7770  				"bio": "b",
  7771  				"twitter_username": "t",
  7772  				"public_repos": 1,
  7773  				"followers": 1,
  7774  				"following": 1,
  7775  				"created_at": ` + referenceTimeStr + `,
  7776  				"suspended_at": ` + referenceTimeStr + `,
  7777  				"url": "u"
  7778  			},
  7779  			"suspended_at": ` + referenceTimeStr + `
  7780  		}
  7781  	}`
  7782  
  7783  	testJSONMarshal(t, u, want)
  7784  }
  7785  
  7786  func TestMembershipEvent_Marshal(t *testing.T) {
  7787  	testJSONMarshal(t, &MembershipEvent{}, "{}")
  7788  
  7789  	u := &MembershipEvent{
  7790  		Action: String("a"),
  7791  		Scope:  String("s"),
  7792  		Member: &User{
  7793  			Login:     String("l"),
  7794  			ID:        Int64(1),
  7795  			NodeID:    String("n"),
  7796  			URL:       String("u"),
  7797  			ReposURL:  String("r"),
  7798  			EventsURL: String("e"),
  7799  			AvatarURL: String("a"),
  7800  		},
  7801  		Team: &Team{
  7802  			ID:              Int64(1),
  7803  			NodeID:          String("n"),
  7804  			Name:            String("n"),
  7805  			Description:     String("d"),
  7806  			URL:             String("u"),
  7807  			Slug:            String("s"),
  7808  			Permission:      String("p"),
  7809  			Privacy:         String("p"),
  7810  			MembersCount:    Int(1),
  7811  			ReposCount:      Int(1),
  7812  			MembersURL:      String("m"),
  7813  			RepositoriesURL: String("r"),
  7814  			Organization: &Organization{
  7815  				Login:     String("l"),
  7816  				ID:        Int64(1),
  7817  				NodeID:    String("n"),
  7818  				AvatarURL: String("a"),
  7819  				HTMLURL:   String("h"),
  7820  				Name:      String("n"),
  7821  				Company:   String("c"),
  7822  				Blog:      String("b"),
  7823  				Location:  String("l"),
  7824  				Email:     String("e"),
  7825  			},
  7826  			Parent: &Team{
  7827  				ID:           Int64(1),
  7828  				NodeID:       String("n"),
  7829  				Name:         String("n"),
  7830  				Description:  String("d"),
  7831  				URL:          String("u"),
  7832  				Slug:         String("s"),
  7833  				Permission:   String("p"),
  7834  				Privacy:      String("p"),
  7835  				MembersCount: Int(1),
  7836  				ReposCount:   Int(1),
  7837  			},
  7838  			LDAPDN: String("l"),
  7839  		},
  7840  		Org: &Organization{
  7841  			BillingEmail:                         String("be"),
  7842  			Blog:                                 String("b"),
  7843  			Company:                              String("c"),
  7844  			Email:                                String("e"),
  7845  			TwitterUsername:                      String("tu"),
  7846  			Location:                             String("loc"),
  7847  			Name:                                 String("n"),
  7848  			Description:                          String("d"),
  7849  			IsVerified:                           Bool(true),
  7850  			HasOrganizationProjects:              Bool(true),
  7851  			HasRepositoryProjects:                Bool(true),
  7852  			DefaultRepoPermission:                String("drp"),
  7853  			MembersCanCreateRepos:                Bool(true),
  7854  			MembersCanCreateInternalRepos:        Bool(true),
  7855  			MembersCanCreatePrivateRepos:         Bool(true),
  7856  			MembersCanCreatePublicRepos:          Bool(false),
  7857  			MembersAllowedRepositoryCreationType: String("marct"),
  7858  			MembersCanCreatePages:                Bool(true),
  7859  			MembersCanCreatePublicPages:          Bool(false),
  7860  			MembersCanCreatePrivatePages:         Bool(true),
  7861  		},
  7862  		Sender: &User{
  7863  			Login:     String("l"),
  7864  			ID:        Int64(1),
  7865  			NodeID:    String("n"),
  7866  			URL:       String("u"),
  7867  			ReposURL:  String("r"),
  7868  			EventsURL: String("e"),
  7869  			AvatarURL: String("a"),
  7870  		},
  7871  		Installation: &Installation{
  7872  			ID:       Int64(1),
  7873  			NodeID:   String("nid"),
  7874  			AppID:    Int64(1),
  7875  			AppSlug:  String("as"),
  7876  			TargetID: Int64(1),
  7877  			Account: &User{
  7878  				Login:           String("l"),
  7879  				ID:              Int64(1),
  7880  				URL:             String("u"),
  7881  				AvatarURL:       String("a"),
  7882  				GravatarID:      String("g"),
  7883  				Name:            String("n"),
  7884  				Company:         String("c"),
  7885  				Blog:            String("b"),
  7886  				Location:        String("l"),
  7887  				Email:           String("e"),
  7888  				Hireable:        Bool(true),
  7889  				Bio:             String("b"),
  7890  				TwitterUsername: String("t"),
  7891  				PublicRepos:     Int(1),
  7892  				Followers:       Int(1),
  7893  				Following:       Int(1),
  7894  				CreatedAt:       &Timestamp{referenceTime},
  7895  				SuspendedAt:     &Timestamp{referenceTime},
  7896  			},
  7897  			AccessTokensURL:     String("atu"),
  7898  			RepositoriesURL:     String("ru"),
  7899  			HTMLURL:             String("hu"),
  7900  			TargetType:          String("tt"),
  7901  			SingleFileName:      String("sfn"),
  7902  			RepositorySelection: String("rs"),
  7903  			Events:              []string{"e"},
  7904  			SingleFilePaths:     []string{"s"},
  7905  			Permissions: &InstallationPermissions{
  7906  				Actions:                       String("a"),
  7907  				Administration:                String("ad"),
  7908  				Checks:                        String("c"),
  7909  				Contents:                      String("co"),
  7910  				ContentReferences:             String("cr"),
  7911  				Deployments:                   String("d"),
  7912  				Environments:                  String("e"),
  7913  				Issues:                        String("i"),
  7914  				Metadata:                      String("md"),
  7915  				Members:                       String("m"),
  7916  				OrganizationAdministration:    String("oa"),
  7917  				OrganizationHooks:             String("oh"),
  7918  				OrganizationPlan:              String("op"),
  7919  				OrganizationPreReceiveHooks:   String("opr"),
  7920  				OrganizationProjects:          String("op"),
  7921  				OrganizationSecrets:           String("os"),
  7922  				OrganizationSelfHostedRunners: String("osh"),
  7923  				OrganizationUserBlocking:      String("oub"),
  7924  				Packages:                      String("pkg"),
  7925  				Pages:                         String("pg"),
  7926  				PullRequests:                  String("pr"),
  7927  				RepositoryHooks:               String("rh"),
  7928  				RepositoryProjects:            String("rp"),
  7929  				RepositoryPreReceiveHooks:     String("rprh"),
  7930  				Secrets:                       String("s"),
  7931  				SecretScanningAlerts:          String("ssa"),
  7932  				SecurityEvents:                String("se"),
  7933  				SingleFile:                    String("sf"),
  7934  				Statuses:                      String("s"),
  7935  				TeamDiscussions:               String("td"),
  7936  				VulnerabilityAlerts:           String("va"),
  7937  				Workflows:                     String("w"),
  7938  			},
  7939  			CreatedAt:              &Timestamp{referenceTime},
  7940  			UpdatedAt:              &Timestamp{referenceTime},
  7941  			HasMultipleSingleFiles: Bool(false),
  7942  			SuspendedBy: &User{
  7943  				Login:           String("l"),
  7944  				ID:              Int64(1),
  7945  				URL:             String("u"),
  7946  				AvatarURL:       String("a"),
  7947  				GravatarID:      String("g"),
  7948  				Name:            String("n"),
  7949  				Company:         String("c"),
  7950  				Blog:            String("b"),
  7951  				Location:        String("l"),
  7952  				Email:           String("e"),
  7953  				Hireable:        Bool(true),
  7954  				Bio:             String("b"),
  7955  				TwitterUsername: String("t"),
  7956  				PublicRepos:     Int(1),
  7957  				Followers:       Int(1),
  7958  				Following:       Int(1),
  7959  				CreatedAt:       &Timestamp{referenceTime},
  7960  				SuspendedAt:     &Timestamp{referenceTime},
  7961  			},
  7962  			SuspendedAt: &Timestamp{referenceTime},
  7963  		},
  7964  	}
  7965  
  7966  	want := `{
  7967  		"action": "a",
  7968  		"scope": "s",
  7969  		"member": {
  7970  			"login": "l",
  7971  			"id": 1,
  7972  			"node_id": "n",
  7973  			"avatar_url": "a",
  7974  			"url": "u",
  7975  			"events_url": "e",
  7976  			"repos_url": "r"
  7977  		},
  7978  		"team": {
  7979  			"id": 1,
  7980  			"node_id": "n",
  7981  			"name": "n",
  7982  			"description": "d",
  7983  			"url": "u",
  7984  			"slug": "s",
  7985  			"permission": "p",
  7986  			"privacy": "p",
  7987  			"members_count": 1,
  7988  			"repos_count": 1,
  7989  			"organization": {
  7990  				"login": "l",
  7991  				"id": 1,
  7992  				"node_id": "n",
  7993  				"avatar_url": "a",
  7994  				"html_url": "h",
  7995  				"name": "n",
  7996  				"company": "c",
  7997  				"blog": "b",
  7998  				"location": "l",
  7999  				"email": "e"
  8000  			},
  8001  			"members_url": "m",
  8002  			"repositories_url": "r",
  8003  			"parent": {
  8004  				"id": 1,
  8005  				"node_id": "n",
  8006  				"name": "n",
  8007  				"description": "d",
  8008  				"url": "u",
  8009  				"slug": "s",
  8010  				"permission": "p",
  8011  				"privacy": "p",
  8012  				"members_count": 1,
  8013  				"repos_count": 1
  8014  			},
  8015  			"ldap_dn": "l"
  8016  		},
  8017  		"organization": {
  8018  			"name": "n",
  8019  			"company": "c",
  8020  			"blog": "b",
  8021  			"location": "loc",
  8022  			"email": "e",
  8023  			"twitter_username": "tu",
  8024  			"description": "d",
  8025  			"billing_email": "be",
  8026  			"is_verified": true,
  8027  			"has_organization_projects": true,
  8028  			"has_repository_projects": true,
  8029  			"default_repository_permission": "drp",
  8030  			"members_can_create_repositories": true,
  8031  			"members_can_create_public_repositories": false,
  8032  			"members_can_create_private_repositories": true,
  8033  			"members_can_create_internal_repositories": true,
  8034  			"members_allowed_repository_creation_type": "marct",
  8035  			"members_can_create_pages": true,
  8036  			"members_can_create_public_pages": false,
  8037  			"members_can_create_private_pages": true
  8038  		},
  8039  		"sender": {
  8040  			"login": "l",
  8041  			"id": 1,
  8042  			"node_id": "n",
  8043  			"avatar_url": "a",
  8044  			"url": "u",
  8045  			"events_url": "e",
  8046  			"repos_url": "r"
  8047  		},
  8048  		"installation": {
  8049  			"id": 1,
  8050  			"node_id": "nid",
  8051  			"app_id": 1,
  8052  			"app_slug": "as",
  8053  			"target_id": 1,
  8054  			"account": {
  8055  				"login": "l",
  8056  				"id": 1,
  8057  				"avatar_url": "a",
  8058  				"gravatar_id": "g",
  8059  				"name": "n",
  8060  				"company": "c",
  8061  				"blog": "b",
  8062  				"location": "l",
  8063  				"email": "e",
  8064  				"hireable": true,
  8065  				"bio": "b",
  8066  				"twitter_username": "t",
  8067  				"public_repos": 1,
  8068  				"followers": 1,
  8069  				"following": 1,
  8070  				"created_at": ` + referenceTimeStr + `,
  8071  				"suspended_at": ` + referenceTimeStr + `,
  8072  				"url": "u"
  8073  			},
  8074  			"access_tokens_url": "atu",
  8075  			"repositories_url": "ru",
  8076  			"html_url": "hu",
  8077  			"target_type": "tt",
  8078  			"single_file_name": "sfn",
  8079  			"repository_selection": "rs",
  8080  			"events": [
  8081  				"e"
  8082  			],
  8083  			"single_file_paths": [
  8084  				"s"
  8085  			],
  8086  			"permissions": {
  8087  				"actions": "a",
  8088  				"administration": "ad",
  8089  				"checks": "c",
  8090  				"contents": "co",
  8091  				"content_references": "cr",
  8092  				"deployments": "d",
  8093  				"environments": "e",
  8094  				"issues": "i",
  8095  				"metadata": "md",
  8096  				"members": "m",
  8097  				"organization_administration": "oa",
  8098  				"organization_hooks": "oh",
  8099  				"organization_plan": "op",
  8100  				"organization_pre_receive_hooks": "opr",
  8101  				"organization_projects": "op",
  8102  				"organization_secrets": "os",
  8103  				"organization_self_hosted_runners": "osh",
  8104  				"organization_user_blocking": "oub",
  8105  				"packages": "pkg",
  8106  				"pages": "pg",
  8107  				"pull_requests": "pr",
  8108  				"repository_hooks": "rh",
  8109  				"repository_projects": "rp",
  8110  				"repository_pre_receive_hooks": "rprh",
  8111  				"secrets": "s",
  8112  				"secret_scanning_alerts": "ssa",
  8113  				"security_events": "se",
  8114  				"single_file": "sf",
  8115  				"statuses": "s",
  8116  				"team_discussions": "td",
  8117  				"vulnerability_alerts": "va",
  8118  				"workflows": "w"
  8119  			},
  8120  			"created_at": ` + referenceTimeStr + `,
  8121  			"updated_at": ` + referenceTimeStr + `,
  8122  			"has_multiple_single_files": false,
  8123  			"suspended_by": {
  8124  				"login": "l",
  8125  				"id": 1,
  8126  				"avatar_url": "a",
  8127  				"gravatar_id": "g",
  8128  				"name": "n",
  8129  				"company": "c",
  8130  				"blog": "b",
  8131  				"location": "l",
  8132  				"email": "e",
  8133  				"hireable": true,
  8134  				"bio": "b",
  8135  				"twitter_username": "t",
  8136  				"public_repos": 1,
  8137  				"followers": 1,
  8138  				"following": 1,
  8139  				"created_at": ` + referenceTimeStr + `,
  8140  				"suspended_at": ` + referenceTimeStr + `,
  8141  				"url": "u"
  8142  			},
  8143  			"suspended_at": ` + referenceTimeStr + `
  8144  		}
  8145  	}`
  8146  
  8147  	testJSONMarshal(t, u, want)
  8148  }
  8149  
  8150  func TestOrgBlockEvent_Marshal(t *testing.T) {
  8151  	testJSONMarshal(t, &OrgBlockEvent{}, "{}")
  8152  
  8153  	u := &OrgBlockEvent{
  8154  		Action: String("a"),
  8155  		BlockedUser: &User{
  8156  			Login:     String("l"),
  8157  			ID:        Int64(1),
  8158  			NodeID:    String("n"),
  8159  			URL:       String("u"),
  8160  			ReposURL:  String("r"),
  8161  			EventsURL: String("e"),
  8162  			AvatarURL: String("a"),
  8163  		},
  8164  		Organization: &Organization{
  8165  			BillingEmail:                         String("be"),
  8166  			Blog:                                 String("b"),
  8167  			Company:                              String("c"),
  8168  			Email:                                String("e"),
  8169  			TwitterUsername:                      String("tu"),
  8170  			Location:                             String("loc"),
  8171  			Name:                                 String("n"),
  8172  			Description:                          String("d"),
  8173  			IsVerified:                           Bool(true),
  8174  			HasOrganizationProjects:              Bool(true),
  8175  			HasRepositoryProjects:                Bool(true),
  8176  			DefaultRepoPermission:                String("drp"),
  8177  			MembersCanCreateRepos:                Bool(true),
  8178  			MembersCanCreateInternalRepos:        Bool(true),
  8179  			MembersCanCreatePrivateRepos:         Bool(true),
  8180  			MembersCanCreatePublicRepos:          Bool(false),
  8181  			MembersAllowedRepositoryCreationType: String("marct"),
  8182  			MembersCanCreatePages:                Bool(true),
  8183  			MembersCanCreatePublicPages:          Bool(false),
  8184  			MembersCanCreatePrivatePages:         Bool(true),
  8185  		},
  8186  		Sender: &User{
  8187  			Login:     String("l"),
  8188  			ID:        Int64(1),
  8189  			NodeID:    String("n"),
  8190  			URL:       String("u"),
  8191  			ReposURL:  String("r"),
  8192  			EventsURL: String("e"),
  8193  			AvatarURL: String("a"),
  8194  		},
  8195  		Installation: &Installation{
  8196  			ID:       Int64(1),
  8197  			NodeID:   String("nid"),
  8198  			AppID:    Int64(1),
  8199  			AppSlug:  String("as"),
  8200  			TargetID: Int64(1),
  8201  			Account: &User{
  8202  				Login:           String("l"),
  8203  				ID:              Int64(1),
  8204  				URL:             String("u"),
  8205  				AvatarURL:       String("a"),
  8206  				GravatarID:      String("g"),
  8207  				Name:            String("n"),
  8208  				Company:         String("c"),
  8209  				Blog:            String("b"),
  8210  				Location:        String("l"),
  8211  				Email:           String("e"),
  8212  				Hireable:        Bool(true),
  8213  				Bio:             String("b"),
  8214  				TwitterUsername: String("t"),
  8215  				PublicRepos:     Int(1),
  8216  				Followers:       Int(1),
  8217  				Following:       Int(1),
  8218  				CreatedAt:       &Timestamp{referenceTime},
  8219  				SuspendedAt:     &Timestamp{referenceTime},
  8220  			},
  8221  			AccessTokensURL:     String("atu"),
  8222  			RepositoriesURL:     String("ru"),
  8223  			HTMLURL:             String("hu"),
  8224  			TargetType:          String("tt"),
  8225  			SingleFileName:      String("sfn"),
  8226  			RepositorySelection: String("rs"),
  8227  			Events:              []string{"e"},
  8228  			SingleFilePaths:     []string{"s"},
  8229  			Permissions: &InstallationPermissions{
  8230  				Actions:                       String("a"),
  8231  				Administration:                String("ad"),
  8232  				Checks:                        String("c"),
  8233  				Contents:                      String("co"),
  8234  				ContentReferences:             String("cr"),
  8235  				Deployments:                   String("d"),
  8236  				Environments:                  String("e"),
  8237  				Issues:                        String("i"),
  8238  				Metadata:                      String("md"),
  8239  				Members:                       String("m"),
  8240  				OrganizationAdministration:    String("oa"),
  8241  				OrganizationHooks:             String("oh"),
  8242  				OrganizationPlan:              String("op"),
  8243  				OrganizationPreReceiveHooks:   String("opr"),
  8244  				OrganizationProjects:          String("op"),
  8245  				OrganizationSecrets:           String("os"),
  8246  				OrganizationSelfHostedRunners: String("osh"),
  8247  				OrganizationUserBlocking:      String("oub"),
  8248  				Packages:                      String("pkg"),
  8249  				Pages:                         String("pg"),
  8250  				PullRequests:                  String("pr"),
  8251  				RepositoryHooks:               String("rh"),
  8252  				RepositoryProjects:            String("rp"),
  8253  				RepositoryPreReceiveHooks:     String("rprh"),
  8254  				Secrets:                       String("s"),
  8255  				SecretScanningAlerts:          String("ssa"),
  8256  				SecurityEvents:                String("se"),
  8257  				SingleFile:                    String("sf"),
  8258  				Statuses:                      String("s"),
  8259  				TeamDiscussions:               String("td"),
  8260  				VulnerabilityAlerts:           String("va"),
  8261  				Workflows:                     String("w"),
  8262  			},
  8263  			CreatedAt:              &Timestamp{referenceTime},
  8264  			UpdatedAt:              &Timestamp{referenceTime},
  8265  			HasMultipleSingleFiles: Bool(false),
  8266  			SuspendedBy: &User{
  8267  				Login:           String("l"),
  8268  				ID:              Int64(1),
  8269  				URL:             String("u"),
  8270  				AvatarURL:       String("a"),
  8271  				GravatarID:      String("g"),
  8272  				Name:            String("n"),
  8273  				Company:         String("c"),
  8274  				Blog:            String("b"),
  8275  				Location:        String("l"),
  8276  				Email:           String("e"),
  8277  				Hireable:        Bool(true),
  8278  				Bio:             String("b"),
  8279  				TwitterUsername: String("t"),
  8280  				PublicRepos:     Int(1),
  8281  				Followers:       Int(1),
  8282  				Following:       Int(1),
  8283  				CreatedAt:       &Timestamp{referenceTime},
  8284  				SuspendedAt:     &Timestamp{referenceTime},
  8285  			},
  8286  			SuspendedAt: &Timestamp{referenceTime},
  8287  		},
  8288  	}
  8289  
  8290  	want := `{
  8291  		"action": "a",
  8292  		"blocked_user": {
  8293  			"login": "l",
  8294  			"id": 1,
  8295  			"node_id": "n",
  8296  			"avatar_url": "a",
  8297  			"url": "u",
  8298  			"events_url": "e",
  8299  			"repos_url": "r"
  8300  		},
  8301  		"organization": {
  8302  			"name": "n",
  8303  			"company": "c",
  8304  			"blog": "b",
  8305  			"location": "loc",
  8306  			"email": "e",
  8307  			"twitter_username": "tu",
  8308  			"description": "d",
  8309  			"billing_email": "be",
  8310  			"is_verified": true,
  8311  			"has_organization_projects": true,
  8312  			"has_repository_projects": true,
  8313  			"default_repository_permission": "drp",
  8314  			"members_can_create_repositories": true,
  8315  			"members_can_create_public_repositories": false,
  8316  			"members_can_create_private_repositories": true,
  8317  			"members_can_create_internal_repositories": true,
  8318  			"members_allowed_repository_creation_type": "marct",
  8319  			"members_can_create_pages": true,
  8320  			"members_can_create_public_pages": false,
  8321  			"members_can_create_private_pages": true
  8322  		},
  8323  		"sender": {
  8324  			"login": "l",
  8325  			"id": 1,
  8326  			"node_id": "n",
  8327  			"avatar_url": "a",
  8328  			"url": "u",
  8329  			"events_url": "e",
  8330  			"repos_url": "r"
  8331  		},
  8332  		"installation": {
  8333  			"id": 1,
  8334  			"node_id": "nid",
  8335  			"app_id": 1,
  8336  			"app_slug": "as",
  8337  			"target_id": 1,
  8338  			"account": {
  8339  				"login": "l",
  8340  				"id": 1,
  8341  				"avatar_url": "a",
  8342  				"gravatar_id": "g",
  8343  				"name": "n",
  8344  				"company": "c",
  8345  				"blog": "b",
  8346  				"location": "l",
  8347  				"email": "e",
  8348  				"hireable": true,
  8349  				"bio": "b",
  8350  				"twitter_username": "t",
  8351  				"public_repos": 1,
  8352  				"followers": 1,
  8353  				"following": 1,
  8354  				"created_at": ` + referenceTimeStr + `,
  8355  				"suspended_at": ` + referenceTimeStr + `,
  8356  				"url": "u"
  8357  			},
  8358  			"access_tokens_url": "atu",
  8359  			"repositories_url": "ru",
  8360  			"html_url": "hu",
  8361  			"target_type": "tt",
  8362  			"single_file_name": "sfn",
  8363  			"repository_selection": "rs",
  8364  			"events": [
  8365  				"e"
  8366  			],
  8367  			"single_file_paths": [
  8368  				"s"
  8369  			],
  8370  			"permissions": {
  8371  				"actions": "a",
  8372  				"administration": "ad",
  8373  				"checks": "c",
  8374  				"contents": "co",
  8375  				"content_references": "cr",
  8376  				"deployments": "d",
  8377  				"environments": "e",
  8378  				"issues": "i",
  8379  				"metadata": "md",
  8380  				"members": "m",
  8381  				"organization_administration": "oa",
  8382  				"organization_hooks": "oh",
  8383  				"organization_plan": "op",
  8384  				"organization_pre_receive_hooks": "opr",
  8385  				"organization_projects": "op",
  8386  				"organization_secrets": "os",
  8387  				"organization_self_hosted_runners": "osh",
  8388  				"organization_user_blocking": "oub",
  8389  				"packages": "pkg",
  8390  				"pages": "pg",
  8391  				"pull_requests": "pr",
  8392  				"repository_hooks": "rh",
  8393  				"repository_projects": "rp",
  8394  				"repository_pre_receive_hooks": "rprh",
  8395  				"secrets": "s",
  8396  				"secret_scanning_alerts": "ssa",
  8397  				"security_events": "se",
  8398  				"single_file": "sf",
  8399  				"statuses": "s",
  8400  				"team_discussions": "td",
  8401  				"vulnerability_alerts": "va",
  8402  				"workflows": "w"
  8403  			},
  8404  			"created_at": ` + referenceTimeStr + `,
  8405  			"updated_at": ` + referenceTimeStr + `,
  8406  			"has_multiple_single_files": false,
  8407  			"suspended_by": {
  8408  				"login": "l",
  8409  				"id": 1,
  8410  				"avatar_url": "a",
  8411  				"gravatar_id": "g",
  8412  				"name": "n",
  8413  				"company": "c",
  8414  				"blog": "b",
  8415  				"location": "l",
  8416  				"email": "e",
  8417  				"hireable": true,
  8418  				"bio": "b",
  8419  				"twitter_username": "t",
  8420  				"public_repos": 1,
  8421  				"followers": 1,
  8422  				"following": 1,
  8423  				"created_at": ` + referenceTimeStr + `,
  8424  				"suspended_at": ` + referenceTimeStr + `,
  8425  				"url": "u"
  8426  			},
  8427  			"suspended_at": ` + referenceTimeStr + `
  8428  		}
  8429  	}`
  8430  
  8431  	testJSONMarshal(t, u, want)
  8432  }
  8433  
  8434  func TestGollumEvent_Marshal(t *testing.T) {
  8435  	testJSONMarshal(t, &GollumEvent{}, "{}")
  8436  
  8437  	u := &GollumEvent{
  8438  		Pages: []*Page{
  8439  			{
  8440  				PageName: String("pn"),
  8441  				Title:    String("t"),
  8442  				Summary:  String("s"),
  8443  				Action:   String("a"),
  8444  				SHA:      String("sha"),
  8445  				HTMLURL:  String("hu"),
  8446  			},
  8447  		},
  8448  		Repo: &Repository{
  8449  			ID:   Int64(1),
  8450  			URL:  String("s"),
  8451  			Name: String("n"),
  8452  		},
  8453  		Sender: &User{
  8454  			Login:     String("l"),
  8455  			ID:        Int64(1),
  8456  			NodeID:    String("n"),
  8457  			URL:       String("u"),
  8458  			ReposURL:  String("r"),
  8459  			EventsURL: String("e"),
  8460  			AvatarURL: String("a"),
  8461  		},
  8462  		Installation: &Installation{
  8463  			ID:       Int64(1),
  8464  			NodeID:   String("nid"),
  8465  			AppID:    Int64(1),
  8466  			AppSlug:  String("as"),
  8467  			TargetID: Int64(1),
  8468  			Account: &User{
  8469  				Login:           String("l"),
  8470  				ID:              Int64(1),
  8471  				URL:             String("u"),
  8472  				AvatarURL:       String("a"),
  8473  				GravatarID:      String("g"),
  8474  				Name:            String("n"),
  8475  				Company:         String("c"),
  8476  				Blog:            String("b"),
  8477  				Location:        String("l"),
  8478  				Email:           String("e"),
  8479  				Hireable:        Bool(true),
  8480  				Bio:             String("b"),
  8481  				TwitterUsername: String("t"),
  8482  				PublicRepos:     Int(1),
  8483  				Followers:       Int(1),
  8484  				Following:       Int(1),
  8485  				CreatedAt:       &Timestamp{referenceTime},
  8486  				SuspendedAt:     &Timestamp{referenceTime},
  8487  			},
  8488  			AccessTokensURL:     String("atu"),
  8489  			RepositoriesURL:     String("ru"),
  8490  			HTMLURL:             String("hu"),
  8491  			TargetType:          String("tt"),
  8492  			SingleFileName:      String("sfn"),
  8493  			RepositorySelection: String("rs"),
  8494  			Events:              []string{"e"},
  8495  			SingleFilePaths:     []string{"s"},
  8496  			Permissions: &InstallationPermissions{
  8497  				Actions:                       String("a"),
  8498  				Administration:                String("ad"),
  8499  				Checks:                        String("c"),
  8500  				Contents:                      String("co"),
  8501  				ContentReferences:             String("cr"),
  8502  				Deployments:                   String("d"),
  8503  				Environments:                  String("e"),
  8504  				Issues:                        String("i"),
  8505  				Metadata:                      String("md"),
  8506  				Members:                       String("m"),
  8507  				OrganizationAdministration:    String("oa"),
  8508  				OrganizationHooks:             String("oh"),
  8509  				OrganizationPlan:              String("op"),
  8510  				OrganizationPreReceiveHooks:   String("opr"),
  8511  				OrganizationProjects:          String("op"),
  8512  				OrganizationSecrets:           String("os"),
  8513  				OrganizationSelfHostedRunners: String("osh"),
  8514  				OrganizationUserBlocking:      String("oub"),
  8515  				Packages:                      String("pkg"),
  8516  				Pages:                         String("pg"),
  8517  				PullRequests:                  String("pr"),
  8518  				RepositoryHooks:               String("rh"),
  8519  				RepositoryProjects:            String("rp"),
  8520  				RepositoryPreReceiveHooks:     String("rprh"),
  8521  				Secrets:                       String("s"),
  8522  				SecretScanningAlerts:          String("ssa"),
  8523  				SecurityEvents:                String("se"),
  8524  				SingleFile:                    String("sf"),
  8525  				Statuses:                      String("s"),
  8526  				TeamDiscussions:               String("td"),
  8527  				VulnerabilityAlerts:           String("va"),
  8528  				Workflows:                     String("w"),
  8529  			},
  8530  			CreatedAt:              &Timestamp{referenceTime},
  8531  			UpdatedAt:              &Timestamp{referenceTime},
  8532  			HasMultipleSingleFiles: Bool(false),
  8533  			SuspendedBy: &User{
  8534  				Login:           String("l"),
  8535  				ID:              Int64(1),
  8536  				URL:             String("u"),
  8537  				AvatarURL:       String("a"),
  8538  				GravatarID:      String("g"),
  8539  				Name:            String("n"),
  8540  				Company:         String("c"),
  8541  				Blog:            String("b"),
  8542  				Location:        String("l"),
  8543  				Email:           String("e"),
  8544  				Hireable:        Bool(true),
  8545  				Bio:             String("b"),
  8546  				TwitterUsername: String("t"),
  8547  				PublicRepos:     Int(1),
  8548  				Followers:       Int(1),
  8549  				Following:       Int(1),
  8550  				CreatedAt:       &Timestamp{referenceTime},
  8551  				SuspendedAt:     &Timestamp{referenceTime},
  8552  			},
  8553  			SuspendedAt: &Timestamp{referenceTime},
  8554  		},
  8555  	}
  8556  
  8557  	want := `{
  8558  		"pages": [
  8559  			{
  8560  				"page_name": "pn",
  8561  				"title": "t",
  8562  				"summary": "s",
  8563  				"action": "a",
  8564  				"sha": "sha",
  8565  				"html_url": "hu"
  8566  			}
  8567  		],
  8568  		"repository": {
  8569  			"id": 1,
  8570  			"name": "n",
  8571  			"url": "s"
  8572  		},
  8573  		"sender": {
  8574  			"login": "l",
  8575  			"id": 1,
  8576  			"node_id": "n",
  8577  			"avatar_url": "a",
  8578  			"url": "u",
  8579  			"events_url": "e",
  8580  			"repos_url": "r"
  8581  		},
  8582  		"installation": {
  8583  			"id": 1,
  8584  			"node_id": "nid",
  8585  			"app_id": 1,
  8586  			"app_slug": "as",
  8587  			"target_id": 1,
  8588  			"account": {
  8589  				"login": "l",
  8590  				"id": 1,
  8591  				"avatar_url": "a",
  8592  				"gravatar_id": "g",
  8593  				"name": "n",
  8594  				"company": "c",
  8595  				"blog": "b",
  8596  				"location": "l",
  8597  				"email": "e",
  8598  				"hireable": true,
  8599  				"bio": "b",
  8600  				"twitter_username": "t",
  8601  				"public_repos": 1,
  8602  				"followers": 1,
  8603  				"following": 1,
  8604  				"created_at": ` + referenceTimeStr + `,
  8605  				"suspended_at": ` + referenceTimeStr + `,
  8606  				"url": "u"
  8607  			},
  8608  			"access_tokens_url": "atu",
  8609  			"repositories_url": "ru",
  8610  			"html_url": "hu",
  8611  			"target_type": "tt",
  8612  			"single_file_name": "sfn",
  8613  			"repository_selection": "rs",
  8614  			"events": [
  8615  				"e"
  8616  			],
  8617  			"single_file_paths": [
  8618  				"s"
  8619  			],
  8620  			"permissions": {
  8621  				"actions": "a",
  8622  				"administration": "ad",
  8623  				"checks": "c",
  8624  				"contents": "co",
  8625  				"content_references": "cr",
  8626  				"deployments": "d",
  8627  				"environments": "e",
  8628  				"issues": "i",
  8629  				"metadata": "md",
  8630  				"members": "m",
  8631  				"organization_administration": "oa",
  8632  				"organization_hooks": "oh",
  8633  				"organization_plan": "op",
  8634  				"organization_pre_receive_hooks": "opr",
  8635  				"organization_projects": "op",
  8636  				"organization_secrets": "os",
  8637  				"organization_self_hosted_runners": "osh",
  8638  				"organization_user_blocking": "oub",
  8639  				"packages": "pkg",
  8640  				"pages": "pg",
  8641  				"pull_requests": "pr",
  8642  				"repository_hooks": "rh",
  8643  				"repository_projects": "rp",
  8644  				"repository_pre_receive_hooks": "rprh",
  8645  				"secrets": "s",
  8646  				"secret_scanning_alerts": "ssa",
  8647  				"security_events": "se",
  8648  				"single_file": "sf",
  8649  				"statuses": "s",
  8650  				"team_discussions": "td",
  8651  				"vulnerability_alerts": "va",
  8652  				"workflows": "w"
  8653  			},
  8654  			"created_at": ` + referenceTimeStr + `,
  8655  			"updated_at": ` + referenceTimeStr + `,
  8656  			"has_multiple_single_files": false,
  8657  			"suspended_by": {
  8658  				"login": "l",
  8659  				"id": 1,
  8660  				"avatar_url": "a",
  8661  				"gravatar_id": "g",
  8662  				"name": "n",
  8663  				"company": "c",
  8664  				"blog": "b",
  8665  				"location": "l",
  8666  				"email": "e",
  8667  				"hireable": true,
  8668  				"bio": "b",
  8669  				"twitter_username": "t",
  8670  				"public_repos": 1,
  8671  				"followers": 1,
  8672  				"following": 1,
  8673  				"created_at": ` + referenceTimeStr + `,
  8674  				"suspended_at": ` + referenceTimeStr + `,
  8675  				"url": "u"
  8676  			},
  8677  			"suspended_at": ` + referenceTimeStr + `
  8678  		}
  8679  	}`
  8680  
  8681  	testJSONMarshal(t, u, want)
  8682  }
  8683  
  8684  func TestWorkflowRunEvent_Marshal(t *testing.T) {
  8685  	testJSONMarshal(t, &WorkflowRunEvent{}, "{}")
  8686  
  8687  	u := &WorkflowRunEvent{
  8688  		Action: String("a"),
  8689  		Workflow: &Workflow{
  8690  			ID:        Int64(1),
  8691  			NodeID:    String("nid"),
  8692  			Name:      String("n"),
  8693  			Path:      String("p"),
  8694  			State:     String("s"),
  8695  			CreatedAt: &Timestamp{referenceTime},
  8696  			UpdatedAt: &Timestamp{referenceTime},
  8697  			URL:       String("u"),
  8698  			HTMLURL:   String("h"),
  8699  			BadgeURL:  String("b"),
  8700  		},
  8701  		WorkflowRun: &WorkflowRun{
  8702  			ID:         Int64(1),
  8703  			Name:       String("n"),
  8704  			NodeID:     String("nid"),
  8705  			HeadBranch: String("hb"),
  8706  			HeadSHA:    String("hs"),
  8707  			RunNumber:  Int(1),
  8708  			RunAttempt: Int(1),
  8709  			Event:      String("e"),
  8710  			Status:     String("s"),
  8711  			Conclusion: String("c"),
  8712  			WorkflowID: Int64(1),
  8713  			URL:        String("u"),
  8714  			HTMLURL:    String("h"),
  8715  			PullRequests: []*PullRequest{
  8716  				{
  8717  					URL:    String("u"),
  8718  					ID:     Int64(1),
  8719  					Number: Int(1),
  8720  					Head: &PullRequestBranch{
  8721  						Ref: String("r"),
  8722  						SHA: String("s"),
  8723  						Repo: &Repository{
  8724  							ID:   Int64(1),
  8725  							URL:  String("s"),
  8726  							Name: String("n"),
  8727  						},
  8728  					},
  8729  					Base: &PullRequestBranch{
  8730  						Ref: String("r"),
  8731  						SHA: String("s"),
  8732  						Repo: &Repository{
  8733  							ID:   Int64(1),
  8734  							URL:  String("u"),
  8735  							Name: String("n"),
  8736  						},
  8737  					},
  8738  				},
  8739  			},
  8740  			CreatedAt:          &Timestamp{referenceTime},
  8741  			UpdatedAt:          &Timestamp{referenceTime},
  8742  			RunStartedAt:       &Timestamp{referenceTime},
  8743  			JobsURL:            String("j"),
  8744  			LogsURL:            String("l"),
  8745  			CheckSuiteURL:      String("c"),
  8746  			ArtifactsURL:       String("a"),
  8747  			CancelURL:          String("c"),
  8748  			RerunURL:           String("r"),
  8749  			PreviousAttemptURL: String("p"),
  8750  			HeadCommit: &HeadCommit{
  8751  				Message: String("m"),
  8752  				Author: &CommitAuthor{
  8753  					Name:  String("n"),
  8754  					Email: String("e"),
  8755  					Login: String("l"),
  8756  				},
  8757  				URL:       String("u"),
  8758  				Distinct:  Bool(false),
  8759  				SHA:       String("s"),
  8760  				ID:        String("i"),
  8761  				TreeID:    String("tid"),
  8762  				Timestamp: &Timestamp{referenceTime},
  8763  				Committer: &CommitAuthor{
  8764  					Name:  String("n"),
  8765  					Email: String("e"),
  8766  					Login: String("l"),
  8767  				},
  8768  			},
  8769  			WorkflowURL: String("w"),
  8770  			Repository: &Repository{
  8771  				ID:   Int64(1),
  8772  				URL:  String("u"),
  8773  				Name: String("n"),
  8774  			},
  8775  			HeadRepository: &Repository{
  8776  				ID:   Int64(1),
  8777  				URL:  String("u"),
  8778  				Name: String("n"),
  8779  			},
  8780  		},
  8781  		Org: &Organization{
  8782  			BillingEmail:                         String("be"),
  8783  			Blog:                                 String("b"),
  8784  			Company:                              String("c"),
  8785  			Email:                                String("e"),
  8786  			TwitterUsername:                      String("tu"),
  8787  			Location:                             String("loc"),
  8788  			Name:                                 String("n"),
  8789  			Description:                          String("d"),
  8790  			IsVerified:                           Bool(true),
  8791  			HasOrganizationProjects:              Bool(true),
  8792  			HasRepositoryProjects:                Bool(true),
  8793  			DefaultRepoPermission:                String("drp"),
  8794  			MembersCanCreateRepos:                Bool(true),
  8795  			MembersCanCreateInternalRepos:        Bool(true),
  8796  			MembersCanCreatePrivateRepos:         Bool(true),
  8797  			MembersCanCreatePublicRepos:          Bool(false),
  8798  			MembersAllowedRepositoryCreationType: String("marct"),
  8799  			MembersCanCreatePages:                Bool(true),
  8800  			MembersCanCreatePublicPages:          Bool(false),
  8801  			MembersCanCreatePrivatePages:         Bool(true),
  8802  		},
  8803  		Repo: &Repository{
  8804  			ID:   Int64(1),
  8805  			URL:  String("s"),
  8806  			Name: String("n"),
  8807  		},
  8808  		Sender: &User{
  8809  			Login:     String("l"),
  8810  			ID:        Int64(1),
  8811  			NodeID:    String("n"),
  8812  			URL:       String("u"),
  8813  			ReposURL:  String("r"),
  8814  			EventsURL: String("e"),
  8815  			AvatarURL: String("a"),
  8816  		},
  8817  	}
  8818  
  8819  	want := `{
  8820  		"action": "a",
  8821  		"workflow": {
  8822  			"id": 1,
  8823  			"node_id": "nid",
  8824  			"name": "n",
  8825  			"path": "p",
  8826  			"state": "s",
  8827  			"created_at": ` + referenceTimeStr + `,
  8828  			"updated_at": ` + referenceTimeStr + `,
  8829  			"url": "u",
  8830  			"html_url": "h",
  8831  			"badge_url": "b"
  8832  		},
  8833  		"workflow_run": {
  8834  			"id": 1,
  8835  			"name": "n",
  8836  			"node_id": "nid",
  8837  			"head_branch": "hb",
  8838  			"head_sha": "hs",
  8839  			"run_number": 1,
  8840  			"run_attempt": 1,
  8841  			"event": "e",
  8842  			"status": "s",
  8843  			"conclusion": "c",
  8844  			"workflow_id": 1,
  8845  			"url": "u",
  8846  			"html_url": "h",
  8847  			"pull_requests": [
  8848  				{
  8849  					"id": 1,
  8850  					"number": 1,
  8851  					"url": "u",
  8852  					"head": {
  8853  						"ref": "r",
  8854  						"sha": "s",
  8855  						"repo": {
  8856  							"id": 1,
  8857  							"name": "n",
  8858  							"url": "s"
  8859  						}
  8860  					},
  8861  					"base": {
  8862  						"ref": "r",
  8863  						"sha": "s",
  8864  						"repo": {
  8865  							"id": 1,
  8866  							"name": "n",
  8867  							"url": "u"
  8868  						}
  8869  					}
  8870  				}
  8871  			],
  8872  			"created_at": ` + referenceTimeStr + `,
  8873  			"updated_at": ` + referenceTimeStr + `,
  8874  			"run_started_at": ` + referenceTimeStr + `,
  8875  			"jobs_url": "j",
  8876  			"logs_url": "l",
  8877  			"check_suite_url": "c",
  8878  			"artifacts_url": "a",
  8879  			"cancel_url": "c",
  8880  			"rerun_url": "r",
  8881  			"previous_attempt_url": "p",
  8882  			"head_commit": {
  8883  				"message": "m",
  8884  				"author": {
  8885  					"name": "n",
  8886  					"email": "e",
  8887  					"username": "l"
  8888  				},
  8889  				"url": "u",
  8890  				"distinct": false,
  8891  				"sha": "s",
  8892  				"id": "i",
  8893  				"tree_id": "tid",
  8894  				"timestamp": ` + referenceTimeStr + `,
  8895  				"committer": {
  8896  					"name": "n",
  8897  					"email": "e",
  8898  					"username": "l"
  8899  				}
  8900  			},
  8901  			"workflow_url": "w",
  8902  			"repository": {
  8903  				"id": 1,
  8904  				"name": "n",
  8905  				"url": "u"
  8906  			},
  8907  			"head_repository": {
  8908  				"id": 1,
  8909  				"name": "n",
  8910  				"url": "u"
  8911  			}
  8912  		},
  8913  		"organization": {
  8914  			"name": "n",
  8915  			"company": "c",
  8916  			"blog": "b",
  8917  			"location": "loc",
  8918  			"email": "e",
  8919  			"twitter_username": "tu",
  8920  			"description": "d",
  8921  			"billing_email": "be",
  8922  			"is_verified": true,
  8923  			"has_organization_projects": true,
  8924  			"has_repository_projects": true,
  8925  			"default_repository_permission": "drp",
  8926  			"members_can_create_repositories": true,
  8927  			"members_can_create_public_repositories": false,
  8928  			"members_can_create_private_repositories": true,
  8929  			"members_can_create_internal_repositories": true,
  8930  			"members_allowed_repository_creation_type": "marct",
  8931  			"members_can_create_pages": true,
  8932  			"members_can_create_public_pages": false,
  8933  			"members_can_create_private_pages": true
  8934  		},
  8935  		"repository": {
  8936  			"id": 1,
  8937  			"name": "n",
  8938  			"url": "s"
  8939  		},
  8940  		"sender": {
  8941  			"login": "l",
  8942  			"id": 1,
  8943  			"node_id": "n",
  8944  			"avatar_url": "a",
  8945  			"url": "u",
  8946  			"events_url": "e",
  8947  			"repos_url": "r"
  8948  		}
  8949  	}`
  8950  
  8951  	testJSONMarshal(t, u, want)
  8952  }
  8953  
  8954  func TestWorkflowDispatchEvent_Marshal(t *testing.T) {
  8955  	testJSONMarshal(t, &WorkflowDispatchEvent{}, "{}")
  8956  
  8957  	i := make(map[string]interface{})
  8958  	i["key"] = "value"
  8959  
  8960  	jsonMsg, _ := json.Marshal(i)
  8961  	u := &WorkflowDispatchEvent{
  8962  		Inputs:   jsonMsg,
  8963  		Ref:      String("r"),
  8964  		Workflow: String("w"),
  8965  		Repo: &Repository{
  8966  			ID:   Int64(1),
  8967  			URL:  String("s"),
  8968  			Name: String("n"),
  8969  		},
  8970  		Org: &Organization{
  8971  			BillingEmail:                         String("be"),
  8972  			Blog:                                 String("b"),
  8973  			Company:                              String("c"),
  8974  			Email:                                String("e"),
  8975  			TwitterUsername:                      String("tu"),
  8976  			Location:                             String("loc"),
  8977  			Name:                                 String("n"),
  8978  			Description:                          String("d"),
  8979  			IsVerified:                           Bool(true),
  8980  			HasOrganizationProjects:              Bool(true),
  8981  			HasRepositoryProjects:                Bool(true),
  8982  			DefaultRepoPermission:                String("drp"),
  8983  			MembersCanCreateRepos:                Bool(true),
  8984  			MembersCanCreateInternalRepos:        Bool(true),
  8985  			MembersCanCreatePrivateRepos:         Bool(true),
  8986  			MembersCanCreatePublicRepos:          Bool(false),
  8987  			MembersAllowedRepositoryCreationType: String("marct"),
  8988  			MembersCanCreatePages:                Bool(true),
  8989  			MembersCanCreatePublicPages:          Bool(false),
  8990  			MembersCanCreatePrivatePages:         Bool(true),
  8991  		},
  8992  		Sender: &User{
  8993  			Login:     String("l"),
  8994  			ID:        Int64(1),
  8995  			NodeID:    String("n"),
  8996  			URL:       String("u"),
  8997  			ReposURL:  String("r"),
  8998  			EventsURL: String("e"),
  8999  			AvatarURL: String("a"),
  9000  		},
  9001  	}
  9002  
  9003  	want := `{
  9004  		"inputs": {
  9005  			"key": "value"
  9006  		},
  9007  		"ref": "r",
  9008  		"workflow": "w",
  9009  		"repository": {
  9010  			"id": 1,
  9011  			"name": "n",
  9012  			"url": "s"
  9013  		},
  9014  		"organization": {
  9015  			"name": "n",
  9016  			"company": "c",
  9017  			"blog": "b",
  9018  			"location": "loc",
  9019  			"email": "e",
  9020  			"twitter_username": "tu",
  9021  			"description": "d",
  9022  			"billing_email": "be",
  9023  			"is_verified": true,
  9024  			"has_organization_projects": true,
  9025  			"has_repository_projects": true,
  9026  			"default_repository_permission": "drp",
  9027  			"members_can_create_repositories": true,
  9028  			"members_can_create_public_repositories": false,
  9029  			"members_can_create_private_repositories": true,
  9030  			"members_can_create_internal_repositories": true,
  9031  			"members_allowed_repository_creation_type": "marct",
  9032  			"members_can_create_pages": true,
  9033  			"members_can_create_public_pages": false,
  9034  			"members_can_create_private_pages": true
  9035  		},
  9036  		"sender": {
  9037  			"login": "l",
  9038  			"id": 1,
  9039  			"node_id": "n",
  9040  			"avatar_url": "a",
  9041  			"url": "u",
  9042  			"events_url": "e",
  9043  			"repos_url": "r"
  9044  		}
  9045  	}`
  9046  
  9047  	testJSONMarshal(t, u, want)
  9048  }
  9049  
  9050  func TestWatchEvent_Marshal(t *testing.T) {
  9051  	testJSONMarshal(t, &WatchEvent{}, "{}")
  9052  
  9053  	u := &WatchEvent{
  9054  		Action: String("a"),
  9055  		Repo: &Repository{
  9056  			ID:   Int64(1),
  9057  			URL:  String("s"),
  9058  			Name: String("n"),
  9059  		},
  9060  		Sender: &User{
  9061  			Login:     String("l"),
  9062  			ID:        Int64(1),
  9063  			NodeID:    String("n"),
  9064  			URL:       String("u"),
  9065  			ReposURL:  String("r"),
  9066  			EventsURL: String("e"),
  9067  			AvatarURL: String("a"),
  9068  		},
  9069  		Installation: &Installation{
  9070  			ID:       Int64(1),
  9071  			NodeID:   String("nid"),
  9072  			AppID:    Int64(1),
  9073  			AppSlug:  String("as"),
  9074  			TargetID: Int64(1),
  9075  			Account: &User{
  9076  				Login:           String("l"),
  9077  				ID:              Int64(1),
  9078  				URL:             String("u"),
  9079  				AvatarURL:       String("a"),
  9080  				GravatarID:      String("g"),
  9081  				Name:            String("n"),
  9082  				Company:         String("c"),
  9083  				Blog:            String("b"),
  9084  				Location:        String("l"),
  9085  				Email:           String("e"),
  9086  				Hireable:        Bool(true),
  9087  				Bio:             String("b"),
  9088  				TwitterUsername: String("t"),
  9089  				PublicRepos:     Int(1),
  9090  				Followers:       Int(1),
  9091  				Following:       Int(1),
  9092  				CreatedAt:       &Timestamp{referenceTime},
  9093  				SuspendedAt:     &Timestamp{referenceTime},
  9094  			},
  9095  			AccessTokensURL:     String("atu"),
  9096  			RepositoriesURL:     String("ru"),
  9097  			HTMLURL:             String("hu"),
  9098  			TargetType:          String("tt"),
  9099  			SingleFileName:      String("sfn"),
  9100  			RepositorySelection: String("rs"),
  9101  			Events:              []string{"e"},
  9102  			SingleFilePaths:     []string{"s"},
  9103  			Permissions: &InstallationPermissions{
  9104  				Actions:                       String("a"),
  9105  				Administration:                String("ad"),
  9106  				Checks:                        String("c"),
  9107  				Contents:                      String("co"),
  9108  				ContentReferences:             String("cr"),
  9109  				Deployments:                   String("d"),
  9110  				Environments:                  String("e"),
  9111  				Issues:                        String("i"),
  9112  				Metadata:                      String("md"),
  9113  				Members:                       String("m"),
  9114  				OrganizationAdministration:    String("oa"),
  9115  				OrganizationHooks:             String("oh"),
  9116  				OrganizationPlan:              String("op"),
  9117  				OrganizationPreReceiveHooks:   String("opr"),
  9118  				OrganizationProjects:          String("op"),
  9119  				OrganizationSecrets:           String("os"),
  9120  				OrganizationSelfHostedRunners: String("osh"),
  9121  				OrganizationUserBlocking:      String("oub"),
  9122  				Packages:                      String("pkg"),
  9123  				Pages:                         String("pg"),
  9124  				PullRequests:                  String("pr"),
  9125  				RepositoryHooks:               String("rh"),
  9126  				RepositoryProjects:            String("rp"),
  9127  				RepositoryPreReceiveHooks:     String("rprh"),
  9128  				Secrets:                       String("s"),
  9129  				SecretScanningAlerts:          String("ssa"),
  9130  				SecurityEvents:                String("se"),
  9131  				SingleFile:                    String("sf"),
  9132  				Statuses:                      String("s"),
  9133  				TeamDiscussions:               String("td"),
  9134  				VulnerabilityAlerts:           String("va"),
  9135  				Workflows:                     String("w"),
  9136  			},
  9137  			CreatedAt:              &Timestamp{referenceTime},
  9138  			UpdatedAt:              &Timestamp{referenceTime},
  9139  			HasMultipleSingleFiles: Bool(false),
  9140  			SuspendedBy: &User{
  9141  				Login:           String("l"),
  9142  				ID:              Int64(1),
  9143  				URL:             String("u"),
  9144  				AvatarURL:       String("a"),
  9145  				GravatarID:      String("g"),
  9146  				Name:            String("n"),
  9147  				Company:         String("c"),
  9148  				Blog:            String("b"),
  9149  				Location:        String("l"),
  9150  				Email:           String("e"),
  9151  				Hireable:        Bool(true),
  9152  				Bio:             String("b"),
  9153  				TwitterUsername: String("t"),
  9154  				PublicRepos:     Int(1),
  9155  				Followers:       Int(1),
  9156  				Following:       Int(1),
  9157  				CreatedAt:       &Timestamp{referenceTime},
  9158  				SuspendedAt:     &Timestamp{referenceTime},
  9159  			},
  9160  			SuspendedAt: &Timestamp{referenceTime},
  9161  		},
  9162  	}
  9163  
  9164  	want := `{
  9165  		"action": "a",
  9166  		"repository": {
  9167  			"id": 1,
  9168  			"name": "n",
  9169  			"url": "s"
  9170  		},
  9171  		"sender": {
  9172  			"login": "l",
  9173  			"id": 1,
  9174  			"node_id": "n",
  9175  			"avatar_url": "a",
  9176  			"url": "u",
  9177  			"events_url": "e",
  9178  			"repos_url": "r"
  9179  		},
  9180  		"installation": {
  9181  			"id": 1,
  9182  			"node_id": "nid",
  9183  			"app_id": 1,
  9184  			"app_slug": "as",
  9185  			"target_id": 1,
  9186  			"account": {
  9187  				"login": "l",
  9188  				"id": 1,
  9189  				"avatar_url": "a",
  9190  				"gravatar_id": "g",
  9191  				"name": "n",
  9192  				"company": "c",
  9193  				"blog": "b",
  9194  				"location": "l",
  9195  				"email": "e",
  9196  				"hireable": true,
  9197  				"bio": "b",
  9198  				"twitter_username": "t",
  9199  				"public_repos": 1,
  9200  				"followers": 1,
  9201  				"following": 1,
  9202  				"created_at": ` + referenceTimeStr + `,
  9203  				"suspended_at": ` + referenceTimeStr + `,
  9204  				"url": "u"
  9205  			},
  9206  			"access_tokens_url": "atu",
  9207  			"repositories_url": "ru",
  9208  			"html_url": "hu",
  9209  			"target_type": "tt",
  9210  			"single_file_name": "sfn",
  9211  			"repository_selection": "rs",
  9212  			"events": [
  9213  				"e"
  9214  			],
  9215  			"single_file_paths": [
  9216  				"s"
  9217  			],
  9218  			"permissions": {
  9219  				"actions": "a",
  9220  				"administration": "ad",
  9221  				"checks": "c",
  9222  				"contents": "co",
  9223  				"content_references": "cr",
  9224  				"deployments": "d",
  9225  				"environments": "e",
  9226  				"issues": "i",
  9227  				"metadata": "md",
  9228  				"members": "m",
  9229  				"organization_administration": "oa",
  9230  				"organization_hooks": "oh",
  9231  				"organization_plan": "op",
  9232  				"organization_pre_receive_hooks": "opr",
  9233  				"organization_projects": "op",
  9234  				"organization_secrets": "os",
  9235  				"organization_self_hosted_runners": "osh",
  9236  				"organization_user_blocking": "oub",
  9237  				"packages": "pkg",
  9238  				"pages": "pg",
  9239  				"pull_requests": "pr",
  9240  				"repository_hooks": "rh",
  9241  				"repository_projects": "rp",
  9242  				"repository_pre_receive_hooks": "rprh",
  9243  				"secrets": "s",
  9244  				"secret_scanning_alerts": "ssa",
  9245  				"security_events": "se",
  9246  				"single_file": "sf",
  9247  				"statuses": "s",
  9248  				"team_discussions": "td",
  9249  				"vulnerability_alerts": "va",
  9250  				"workflows": "w"
  9251  			},
  9252  			"created_at": ` + referenceTimeStr + `,
  9253  			"updated_at": ` + referenceTimeStr + `,
  9254  			"has_multiple_single_files": false,
  9255  			"suspended_by": {
  9256  				"login": "l",
  9257  				"id": 1,
  9258  				"avatar_url": "a",
  9259  				"gravatar_id": "g",
  9260  				"name": "n",
  9261  				"company": "c",
  9262  				"blog": "b",
  9263  				"location": "l",
  9264  				"email": "e",
  9265  				"hireable": true,
  9266  				"bio": "b",
  9267  				"twitter_username": "t",
  9268  				"public_repos": 1,
  9269  				"followers": 1,
  9270  				"following": 1,
  9271  				"created_at": ` + referenceTimeStr + `,
  9272  				"suspended_at": ` + referenceTimeStr + `,
  9273  				"url": "u"
  9274  			},
  9275  			"suspended_at": ` + referenceTimeStr + `
  9276  		}
  9277  	}`
  9278  
  9279  	testJSONMarshal(t, u, want)
  9280  }
  9281  
  9282  func TestUserEvent_Marshal(t *testing.T) {
  9283  	testJSONMarshal(t, &UserEvent{}, "{}")
  9284  
  9285  	u := &UserEvent{
  9286  		User: &User{
  9287  			Login:     String("l"),
  9288  			ID:        Int64(1),
  9289  			NodeID:    String("n"),
  9290  			URL:       String("u"),
  9291  			ReposURL:  String("r"),
  9292  			EventsURL: String("e"),
  9293  			AvatarURL: String("a"),
  9294  		},
  9295  		// The action performed. Possible values are: "created" or "deleted".
  9296  		Action: String("a"),
  9297  		Enterprise: &Enterprise{
  9298  			ID:          Int(1),
  9299  			Slug:        String("s"),
  9300  			Name:        String("n"),
  9301  			NodeID:      String("nid"),
  9302  			AvatarURL:   String("au"),
  9303  			Description: String("d"),
  9304  			WebsiteURL:  String("wu"),
  9305  			HTMLURL:     String("hu"),
  9306  			CreatedAt:   &Timestamp{referenceTime},
  9307  			UpdatedAt:   &Timestamp{referenceTime},
  9308  		},
  9309  		Sender: &User{
  9310  			Login:     String("l"),
  9311  			ID:        Int64(1),
  9312  			NodeID:    String("n"),
  9313  			URL:       String("u"),
  9314  			ReposURL:  String("r"),
  9315  			EventsURL: String("e"),
  9316  			AvatarURL: String("a"),
  9317  		},
  9318  	}
  9319  
  9320  	want := `{
  9321  		"user": {
  9322  			"login": "l",
  9323  			"id": 1,
  9324  			"node_id": "n",
  9325  			"avatar_url": "a",
  9326  			"url": "u",
  9327  			"events_url": "e",
  9328  			"repos_url": "r"
  9329  		},
  9330  		"action": "a",
  9331  		"enterprise": {
  9332  			"id": 1,
  9333  			"slug": "s",
  9334  			"name": "n",
  9335  			"node_id": "nid",
  9336  			"avatar_url": "au",
  9337  			"description": "d",
  9338  			"website_url": "wu",
  9339  			"html_url": "hu",
  9340  			"created_at": ` + referenceTimeStr + `,
  9341  			"updated_at": ` + referenceTimeStr + `
  9342  		},
  9343  		"sender": {
  9344  			"login": "l",
  9345  			"id": 1,
  9346  			"node_id": "n",
  9347  			"avatar_url": "a",
  9348  			"url": "u",
  9349  			"events_url": "e",
  9350  			"repos_url": "r"
  9351  		}
  9352  	}`
  9353  
  9354  	testJSONMarshal(t, u, want)
  9355  }
  9356  
  9357  func TestCheckRunEvent_Marshal(t *testing.T) {
  9358  	testJSONMarshal(t, &CheckRunEvent{}, "{}")
  9359  
  9360  	r := &CheckRunEvent{
  9361  		CheckRun: &CheckRun{
  9362  			ID:          Int64(1),
  9363  			NodeID:      String("n"),
  9364  			HeadSHA:     String("h"),
  9365  			ExternalID:  String("1"),
  9366  			URL:         String("u"),
  9367  			HTMLURL:     String("u"),
  9368  			DetailsURL:  String("u"),
  9369  			Status:      String("s"),
  9370  			Conclusion:  String("c"),
  9371  			StartedAt:   &Timestamp{referenceTime},
  9372  			CompletedAt: &Timestamp{referenceTime},
  9373  			Output: &CheckRunOutput{
  9374  				Annotations: []*CheckRunAnnotation{
  9375  					{
  9376  						AnnotationLevel: String("a"),
  9377  						EndLine:         Int(1),
  9378  						Message:         String("m"),
  9379  						Path:            String("p"),
  9380  						RawDetails:      String("r"),
  9381  						StartLine:       Int(1),
  9382  						Title:           String("t"),
  9383  					},
  9384  				},
  9385  				AnnotationsCount: Int(1),
  9386  				AnnotationsURL:   String("a"),
  9387  				Images: []*CheckRunImage{
  9388  					{
  9389  						Alt:      String("a"),
  9390  						ImageURL: String("i"),
  9391  						Caption:  String("c"),
  9392  					},
  9393  				},
  9394  				Title:   String("t"),
  9395  				Summary: String("s"),
  9396  				Text:    String("t"),
  9397  			},
  9398  			Name: String("n"),
  9399  			CheckSuite: &CheckSuite{
  9400  				ID: Int64(1),
  9401  			},
  9402  			App: &App{
  9403  				ID:     Int64(1),
  9404  				NodeID: String("n"),
  9405  				Owner: &User{
  9406  					Login:     String("l"),
  9407  					ID:        Int64(1),
  9408  					NodeID:    String("n"),
  9409  					URL:       String("u"),
  9410  					ReposURL:  String("r"),
  9411  					EventsURL: String("e"),
  9412  					AvatarURL: String("a"),
  9413  				},
  9414  				Name:        String("n"),
  9415  				Description: String("d"),
  9416  				HTMLURL:     String("h"),
  9417  				ExternalURL: String("u"),
  9418  				CreatedAt:   &Timestamp{referenceTime},
  9419  				UpdatedAt:   &Timestamp{referenceTime},
  9420  			},
  9421  			PullRequests: []*PullRequest{
  9422  				{
  9423  					URL:    String("u"),
  9424  					ID:     Int64(1),
  9425  					Number: Int(1),
  9426  					Head: &PullRequestBranch{
  9427  						Ref: String("r"),
  9428  						SHA: String("s"),
  9429  						Repo: &Repository{
  9430  							ID:   Int64(1),
  9431  							URL:  String("s"),
  9432  							Name: String("n"),
  9433  						},
  9434  					},
  9435  					Base: &PullRequestBranch{
  9436  						Ref: String("r"),
  9437  						SHA: String("s"),
  9438  						Repo: &Repository{
  9439  							ID:   Int64(1),
  9440  							URL:  String("u"),
  9441  							Name: String("n"),
  9442  						},
  9443  					},
  9444  				},
  9445  			},
  9446  		},
  9447  		Action: String("a"),
  9448  		Repo: &Repository{
  9449  			ID:   Int64(1),
  9450  			URL:  String("s"),
  9451  			Name: String("n"),
  9452  		},
  9453  		Org: &Organization{
  9454  			BillingEmail:                         String("be"),
  9455  			Blog:                                 String("b"),
  9456  			Company:                              String("c"),
  9457  			Email:                                String("e"),
  9458  			TwitterUsername:                      String("tu"),
  9459  			Location:                             String("loc"),
  9460  			Name:                                 String("n"),
  9461  			Description:                          String("d"),
  9462  			IsVerified:                           Bool(true),
  9463  			HasOrganizationProjects:              Bool(true),
  9464  			HasRepositoryProjects:                Bool(true),
  9465  			DefaultRepoPermission:                String("drp"),
  9466  			MembersCanCreateRepos:                Bool(true),
  9467  			MembersCanCreateInternalRepos:        Bool(true),
  9468  			MembersCanCreatePrivateRepos:         Bool(true),
  9469  			MembersCanCreatePublicRepos:          Bool(false),
  9470  			MembersAllowedRepositoryCreationType: String("marct"),
  9471  			MembersCanCreatePages:                Bool(true),
  9472  			MembersCanCreatePublicPages:          Bool(false),
  9473  			MembersCanCreatePrivatePages:         Bool(true),
  9474  		},
  9475  		Sender: &User{
  9476  			Login:     String("l"),
  9477  			ID:        Int64(1),
  9478  			NodeID:    String("n"),
  9479  			URL:       String("u"),
  9480  			ReposURL:  String("r"),
  9481  			EventsURL: String("e"),
  9482  			AvatarURL: String("a"),
  9483  		},
  9484  		Installation: &Installation{
  9485  			ID:       Int64(1),
  9486  			NodeID:   String("nid"),
  9487  			AppID:    Int64(1),
  9488  			AppSlug:  String("as"),
  9489  			TargetID: Int64(1),
  9490  			Account: &User{
  9491  				Login:           String("l"),
  9492  				ID:              Int64(1),
  9493  				URL:             String("u"),
  9494  				AvatarURL:       String("a"),
  9495  				GravatarID:      String("g"),
  9496  				Name:            String("n"),
  9497  				Company:         String("c"),
  9498  				Blog:            String("b"),
  9499  				Location:        String("l"),
  9500  				Email:           String("e"),
  9501  				Hireable:        Bool(true),
  9502  				Bio:             String("b"),
  9503  				TwitterUsername: String("t"),
  9504  				PublicRepos:     Int(1),
  9505  				Followers:       Int(1),
  9506  				Following:       Int(1),
  9507  				CreatedAt:       &Timestamp{referenceTime},
  9508  				SuspendedAt:     &Timestamp{referenceTime},
  9509  			},
  9510  			AccessTokensURL:     String("atu"),
  9511  			RepositoriesURL:     String("ru"),
  9512  			HTMLURL:             String("hu"),
  9513  			TargetType:          String("tt"),
  9514  			SingleFileName:      String("sfn"),
  9515  			RepositorySelection: String("rs"),
  9516  			Events:              []string{"e"},
  9517  			SingleFilePaths:     []string{"s"},
  9518  			Permissions: &InstallationPermissions{
  9519  				Actions:                       String("a"),
  9520  				Administration:                String("ad"),
  9521  				Checks:                        String("c"),
  9522  				Contents:                      String("co"),
  9523  				ContentReferences:             String("cr"),
  9524  				Deployments:                   String("d"),
  9525  				Environments:                  String("e"),
  9526  				Issues:                        String("i"),
  9527  				Metadata:                      String("md"),
  9528  				Members:                       String("m"),
  9529  				OrganizationAdministration:    String("oa"),
  9530  				OrganizationHooks:             String("oh"),
  9531  				OrganizationPlan:              String("op"),
  9532  				OrganizationPreReceiveHooks:   String("opr"),
  9533  				OrganizationProjects:          String("op"),
  9534  				OrganizationSecrets:           String("os"),
  9535  				OrganizationSelfHostedRunners: String("osh"),
  9536  				OrganizationUserBlocking:      String("oub"),
  9537  				Packages:                      String("pkg"),
  9538  				Pages:                         String("pg"),
  9539  				PullRequests:                  String("pr"),
  9540  				RepositoryHooks:               String("rh"),
  9541  				RepositoryProjects:            String("rp"),
  9542  				RepositoryPreReceiveHooks:     String("rprh"),
  9543  				Secrets:                       String("s"),
  9544  				SecretScanningAlerts:          String("ssa"),
  9545  				SecurityEvents:                String("se"),
  9546  				SingleFile:                    String("sf"),
  9547  				Statuses:                      String("s"),
  9548  				TeamDiscussions:               String("td"),
  9549  				VulnerabilityAlerts:           String("va"),
  9550  				Workflows:                     String("w"),
  9551  			},
  9552  			CreatedAt:              &Timestamp{referenceTime},
  9553  			UpdatedAt:              &Timestamp{referenceTime},
  9554  			HasMultipleSingleFiles: Bool(false),
  9555  			SuspendedBy: &User{
  9556  				Login:           String("l"),
  9557  				ID:              Int64(1),
  9558  				URL:             String("u"),
  9559  				AvatarURL:       String("a"),
  9560  				GravatarID:      String("g"),
  9561  				Name:            String("n"),
  9562  				Company:         String("c"),
  9563  				Blog:            String("b"),
  9564  				Location:        String("l"),
  9565  				Email:           String("e"),
  9566  				Hireable:        Bool(true),
  9567  				Bio:             String("b"),
  9568  				TwitterUsername: String("t"),
  9569  				PublicRepos:     Int(1),
  9570  				Followers:       Int(1),
  9571  				Following:       Int(1),
  9572  				CreatedAt:       &Timestamp{referenceTime},
  9573  				SuspendedAt:     &Timestamp{referenceTime},
  9574  			},
  9575  			SuspendedAt: &Timestamp{referenceTime},
  9576  		},
  9577  		RequestedAction: &RequestedAction{
  9578  			Identifier: "i",
  9579  		},
  9580  	}
  9581  
  9582  	want := `{
  9583  		"check_run": {
  9584  			"id": 1,
  9585  			"node_id": "n",
  9586  			"head_sha": "h",
  9587  			"external_id": "1",
  9588  			"url": "u",
  9589  			"html_url": "u",
  9590  			"details_url": "u",
  9591  			"status": "s",
  9592  			"conclusion": "c",
  9593  			"started_at": ` + referenceTimeStr + `,
  9594  			"completed_at": ` + referenceTimeStr + `,
  9595  			"output": {
  9596  				"title": "t",
  9597  				"summary": "s",
  9598  				"text": "t",
  9599  				"annotations_count": 1,
  9600  				"annotations_url": "a",
  9601  				"annotations": [
  9602  					{
  9603  						"path": "p",
  9604  						"start_line": 1,
  9605  						"end_line": 1,
  9606  						"annotation_level": "a",
  9607  						"message": "m",
  9608  						"title": "t",
  9609  						"raw_details": "r"
  9610  					}
  9611  				],
  9612  				"images": [
  9613  					{
  9614  						"alt": "a",
  9615  						"image_url": "i",
  9616  						"caption": "c"
  9617  					}
  9618  				]
  9619  			},
  9620  			"name": "n",
  9621  			"check_suite": {
  9622  				"id": 1
  9623  			},
  9624  			"app": {
  9625  				"id": 1,
  9626  				"node_id": "n",
  9627  				"owner": {
  9628  					"login": "l",
  9629  					"id": 1,
  9630  					"node_id": "n",
  9631  					"avatar_url": "a",
  9632  					"url": "u",
  9633  					"events_url": "e",
  9634  					"repos_url": "r"
  9635  				},
  9636  				"name": "n",
  9637  				"description": "d",
  9638  				"external_url": "u",
  9639  				"html_url": "h",
  9640  				"created_at": ` + referenceTimeStr + `,
  9641  				"updated_at": ` + referenceTimeStr + `
  9642  			},
  9643  			"pull_requests": [
  9644  				{
  9645  					"id": 1,
  9646  					"number": 1,
  9647  					"url": "u",
  9648  					"head": {
  9649  						"ref": "r",
  9650  						"sha": "s",
  9651  						"repo": {
  9652  							"id": 1,
  9653  							"name": "n",
  9654  							"url": "s"
  9655  						}
  9656  					},
  9657  					"base": {
  9658  						"ref": "r",
  9659  						"sha": "s",
  9660  						"repo": {
  9661  							"id": 1,
  9662  							"name": "n",
  9663  							"url": "u"
  9664  						}
  9665  					}
  9666  				}
  9667  			]
  9668  		},
  9669  		"action": "a",
  9670  		"repository": {
  9671  			"id": 1,
  9672  			"name": "n",
  9673  			"url": "s"
  9674  		},
  9675  		"organization": {
  9676  			"name": "n",
  9677  			"company": "c",
  9678  			"blog": "b",
  9679  			"location": "loc",
  9680  			"email": "e",
  9681  			"twitter_username": "tu",
  9682  			"description": "d",
  9683  			"billing_email": "be",
  9684  			"is_verified": true,
  9685  			"has_organization_projects": true,
  9686  			"has_repository_projects": true,
  9687  			"default_repository_permission": "drp",
  9688  			"members_can_create_repositories": true,
  9689  			"members_can_create_public_repositories": false,
  9690  			"members_can_create_private_repositories": true,
  9691  			"members_can_create_internal_repositories": true,
  9692  			"members_allowed_repository_creation_type": "marct",
  9693  			"members_can_create_pages": true,
  9694  			"members_can_create_public_pages": false,
  9695  			"members_can_create_private_pages": true
  9696  		},
  9697  		"sender": {
  9698  			"login": "l",
  9699  			"id": 1,
  9700  			"node_id": "n",
  9701  			"avatar_url": "a",
  9702  			"url": "u",
  9703  			"events_url": "e",
  9704  			"repos_url": "r"
  9705  		},
  9706  		"installation": {
  9707  			"id": 1,
  9708  			"node_id": "nid",
  9709  			"app_id": 1,
  9710  			"app_slug": "as",
  9711  			"target_id": 1,
  9712  			"account": {
  9713  				"login": "l",
  9714  				"id": 1,
  9715  				"avatar_url": "a",
  9716  				"gravatar_id": "g",
  9717  				"name": "n",
  9718  				"company": "c",
  9719  				"blog": "b",
  9720  				"location": "l",
  9721  				"email": "e",
  9722  				"hireable": true,
  9723  				"bio": "b",
  9724  				"twitter_username": "t",
  9725  				"public_repos": 1,
  9726  				"followers": 1,
  9727  				"following": 1,
  9728  				"created_at": ` + referenceTimeStr + `,
  9729  				"suspended_at": ` + referenceTimeStr + `,
  9730  				"url": "u"
  9731  			},
  9732  			"access_tokens_url": "atu",
  9733  			"repositories_url": "ru",
  9734  			"html_url": "hu",
  9735  			"target_type": "tt",
  9736  			"single_file_name": "sfn",
  9737  			"repository_selection": "rs",
  9738  			"events": [
  9739  				"e"
  9740  			],
  9741  			"single_file_paths": [
  9742  				"s"
  9743  			],
  9744  			"permissions": {
  9745  				"actions": "a",
  9746  				"administration": "ad",
  9747  				"checks": "c",
  9748  				"contents": "co",
  9749  				"content_references": "cr",
  9750  				"deployments": "d",
  9751  				"environments": "e",
  9752  				"issues": "i",
  9753  				"metadata": "md",
  9754  				"members": "m",
  9755  				"organization_administration": "oa",
  9756  				"organization_hooks": "oh",
  9757  				"organization_plan": "op",
  9758  				"organization_pre_receive_hooks": "opr",
  9759  				"organization_projects": "op",
  9760  				"organization_secrets": "os",
  9761  				"organization_self_hosted_runners": "osh",
  9762  				"organization_user_blocking": "oub",
  9763  				"packages": "pkg",
  9764  				"pages": "pg",
  9765  				"pull_requests": "pr",
  9766  				"repository_hooks": "rh",
  9767  				"repository_projects": "rp",
  9768  				"repository_pre_receive_hooks": "rprh",
  9769  				"secrets": "s",
  9770  				"secret_scanning_alerts": "ssa",
  9771  				"security_events": "se",
  9772  				"single_file": "sf",
  9773  				"statuses": "s",
  9774  				"team_discussions": "td",
  9775  				"vulnerability_alerts": "va",
  9776  				"workflows": "w"
  9777  			},
  9778  			"created_at": ` + referenceTimeStr + `,
  9779  			"updated_at": ` + referenceTimeStr + `,
  9780  			"has_multiple_single_files": false,
  9781  			"suspended_by": {
  9782  				"login": "l",
  9783  				"id": 1,
  9784  				"avatar_url": "a",
  9785  				"gravatar_id": "g",
  9786  				"name": "n",
  9787  				"company": "c",
  9788  				"blog": "b",
  9789  				"location": "l",
  9790  				"email": "e",
  9791  				"hireable": true,
  9792  				"bio": "b",
  9793  				"twitter_username": "t",
  9794  				"public_repos": 1,
  9795  				"followers": 1,
  9796  				"following": 1,
  9797  				"created_at": ` + referenceTimeStr + `,
  9798  				"suspended_at": ` + referenceTimeStr + `,
  9799  				"url": "u"
  9800  			},
  9801  			"suspended_at": ` + referenceTimeStr + `
  9802  		},
  9803  		"requested_action": {
  9804  			"identifier": "i"
  9805  		}
  9806  	}`
  9807  
  9808  	testJSONMarshal(t, r, want)
  9809  }
  9810  
  9811  func TestCheckSuiteEvent_Marshal(t *testing.T) {
  9812  	testJSONMarshal(t, &CheckSuiteEvent{}, "{}")
  9813  
  9814  	r := &CheckSuiteEvent{
  9815  		CheckSuite: &CheckSuite{
  9816  			ID:         Int64(1),
  9817  			NodeID:     String("n"),
  9818  			HeadBranch: String("h"),
  9819  			HeadSHA:    String("h"),
  9820  			URL:        String("u"),
  9821  			BeforeSHA:  String("b"),
  9822  			AfterSHA:   String("a"),
  9823  			Status:     String("s"),
  9824  			Conclusion: String("c"),
  9825  			App: &App{
  9826  				ID:     Int64(1),
  9827  				NodeID: String("n"),
  9828  				Owner: &User{
  9829  					Login:     String("l"),
  9830  					ID:        Int64(1),
  9831  					NodeID:    String("n"),
  9832  					URL:       String("u"),
  9833  					ReposURL:  String("r"),
  9834  					EventsURL: String("e"),
  9835  					AvatarURL: String("a"),
  9836  				},
  9837  				Name:        String("n"),
  9838  				Description: String("d"),
  9839  				HTMLURL:     String("h"),
  9840  				ExternalURL: String("u"),
  9841  				CreatedAt:   &Timestamp{referenceTime},
  9842  				UpdatedAt:   &Timestamp{referenceTime},
  9843  			},
  9844  			Repository: &Repository{
  9845  				ID: Int64(1),
  9846  			},
  9847  			PullRequests: []*PullRequest{
  9848  				{
  9849  					URL:    String("u"),
  9850  					ID:     Int64(1),
  9851  					Number: Int(1),
  9852  					Head: &PullRequestBranch{
  9853  						Ref: String("r"),
  9854  						SHA: String("s"),
  9855  						Repo: &Repository{
  9856  							ID:   Int64(1),
  9857  							URL:  String("s"),
  9858  							Name: String("n"),
  9859  						},
  9860  					},
  9861  					Base: &PullRequestBranch{
  9862  						Ref: String("r"),
  9863  						SHA: String("s"),
  9864  						Repo: &Repository{
  9865  							ID:   Int64(1),
  9866  							URL:  String("u"),
  9867  							Name: String("n"),
  9868  						},
  9869  					},
  9870  				},
  9871  			},
  9872  			HeadCommit: &Commit{
  9873  				SHA: String("s"),
  9874  			},
  9875  		},
  9876  		Action: String("a"),
  9877  		Repo: &Repository{
  9878  			ID:   Int64(1),
  9879  			URL:  String("s"),
  9880  			Name: String("n"),
  9881  		},
  9882  		Org: &Organization{
  9883  			BillingEmail:                         String("be"),
  9884  			Blog:                                 String("b"),
  9885  			Company:                              String("c"),
  9886  			Email:                                String("e"),
  9887  			TwitterUsername:                      String("tu"),
  9888  			Location:                             String("loc"),
  9889  			Name:                                 String("n"),
  9890  			Description:                          String("d"),
  9891  			IsVerified:                           Bool(true),
  9892  			HasOrganizationProjects:              Bool(true),
  9893  			HasRepositoryProjects:                Bool(true),
  9894  			DefaultRepoPermission:                String("drp"),
  9895  			MembersCanCreateRepos:                Bool(true),
  9896  			MembersCanCreateInternalRepos:        Bool(true),
  9897  			MembersCanCreatePrivateRepos:         Bool(true),
  9898  			MembersCanCreatePublicRepos:          Bool(false),
  9899  			MembersAllowedRepositoryCreationType: String("marct"),
  9900  			MembersCanCreatePages:                Bool(true),
  9901  			MembersCanCreatePublicPages:          Bool(false),
  9902  			MembersCanCreatePrivatePages:         Bool(true),
  9903  		},
  9904  		Sender: &User{
  9905  			Login:     String("l"),
  9906  			ID:        Int64(1),
  9907  			NodeID:    String("n"),
  9908  			URL:       String("u"),
  9909  			ReposURL:  String("r"),
  9910  			EventsURL: String("e"),
  9911  			AvatarURL: String("a"),
  9912  		},
  9913  		Installation: &Installation{
  9914  			ID:       Int64(1),
  9915  			NodeID:   String("nid"),
  9916  			AppID:    Int64(1),
  9917  			AppSlug:  String("as"),
  9918  			TargetID: Int64(1),
  9919  			Account: &User{
  9920  				Login:           String("l"),
  9921  				ID:              Int64(1),
  9922  				URL:             String("u"),
  9923  				AvatarURL:       String("a"),
  9924  				GravatarID:      String("g"),
  9925  				Name:            String("n"),
  9926  				Company:         String("c"),
  9927  				Blog:            String("b"),
  9928  				Location:        String("l"),
  9929  				Email:           String("e"),
  9930  				Hireable:        Bool(true),
  9931  				Bio:             String("b"),
  9932  				TwitterUsername: String("t"),
  9933  				PublicRepos:     Int(1),
  9934  				Followers:       Int(1),
  9935  				Following:       Int(1),
  9936  				CreatedAt:       &Timestamp{referenceTime},
  9937  				SuspendedAt:     &Timestamp{referenceTime},
  9938  			},
  9939  			AccessTokensURL:     String("atu"),
  9940  			RepositoriesURL:     String("ru"),
  9941  			HTMLURL:             String("hu"),
  9942  			TargetType:          String("tt"),
  9943  			SingleFileName:      String("sfn"),
  9944  			RepositorySelection: String("rs"),
  9945  			Events:              []string{"e"},
  9946  			SingleFilePaths:     []string{"s"},
  9947  			Permissions: &InstallationPermissions{
  9948  				Actions:                       String("a"),
  9949  				Administration:                String("ad"),
  9950  				Checks:                        String("c"),
  9951  				Contents:                      String("co"),
  9952  				ContentReferences:             String("cr"),
  9953  				Deployments:                   String("d"),
  9954  				Environments:                  String("e"),
  9955  				Issues:                        String("i"),
  9956  				Metadata:                      String("md"),
  9957  				Members:                       String("m"),
  9958  				OrganizationAdministration:    String("oa"),
  9959  				OrganizationHooks:             String("oh"),
  9960  				OrganizationPlan:              String("op"),
  9961  				OrganizationPreReceiveHooks:   String("opr"),
  9962  				OrganizationProjects:          String("op"),
  9963  				OrganizationSecrets:           String("os"),
  9964  				OrganizationSelfHostedRunners: String("osh"),
  9965  				OrganizationUserBlocking:      String("oub"),
  9966  				Packages:                      String("pkg"),
  9967  				Pages:                         String("pg"),
  9968  				PullRequests:                  String("pr"),
  9969  				RepositoryHooks:               String("rh"),
  9970  				RepositoryProjects:            String("rp"),
  9971  				RepositoryPreReceiveHooks:     String("rprh"),
  9972  				Secrets:                       String("s"),
  9973  				SecretScanningAlerts:          String("ssa"),
  9974  				SecurityEvents:                String("se"),
  9975  				SingleFile:                    String("sf"),
  9976  				Statuses:                      String("s"),
  9977  				TeamDiscussions:               String("td"),
  9978  				VulnerabilityAlerts:           String("va"),
  9979  				Workflows:                     String("w"),
  9980  			},
  9981  			CreatedAt:              &Timestamp{referenceTime},
  9982  			UpdatedAt:              &Timestamp{referenceTime},
  9983  			HasMultipleSingleFiles: Bool(false),
  9984  			SuspendedBy: &User{
  9985  				Login:           String("l"),
  9986  				ID:              Int64(1),
  9987  				URL:             String("u"),
  9988  				AvatarURL:       String("a"),
  9989  				GravatarID:      String("g"),
  9990  				Name:            String("n"),
  9991  				Company:         String("c"),
  9992  				Blog:            String("b"),
  9993  				Location:        String("l"),
  9994  				Email:           String("e"),
  9995  				Hireable:        Bool(true),
  9996  				Bio:             String("b"),
  9997  				TwitterUsername: String("t"),
  9998  				PublicRepos:     Int(1),
  9999  				Followers:       Int(1),
 10000  				Following:       Int(1),
 10001  				CreatedAt:       &Timestamp{referenceTime},
 10002  				SuspendedAt:     &Timestamp{referenceTime},
 10003  			},
 10004  			SuspendedAt: &Timestamp{referenceTime},
 10005  		},
 10006  	}
 10007  
 10008  	want := `{
 10009  		"check_suite": {
 10010  			"id": 1,
 10011  			"node_id": "n",
 10012  			"head_branch": "h",
 10013  			"head_sha": "h",
 10014  			"url": "u",
 10015  			"before": "b",
 10016  			"after": "a",
 10017  			"status": "s",
 10018  			"conclusion": "c",
 10019  			"app": {
 10020  				"id": 1,
 10021  				"node_id": "n",
 10022  				"owner": {
 10023  					"login": "l",
 10024  					"id": 1,
 10025  					"node_id": "n",
 10026  					"avatar_url": "a",
 10027  					"url": "u",
 10028  					"events_url": "e",
 10029  					"repos_url": "r"
 10030  				},
 10031  				"name": "n",
 10032  				"description": "d",
 10033  				"external_url": "u",
 10034  				"html_url": "h",
 10035  				"created_at": ` + referenceTimeStr + `,
 10036  				"updated_at": ` + referenceTimeStr + `
 10037  			},
 10038  			"repository": {
 10039  				"id": 1
 10040  			},
 10041  			"pull_requests": [
 10042  			{
 10043  				"id": 1,
 10044  				"number": 1,
 10045  				"url": "u",
 10046  				"head": {
 10047  					"ref": "r",
 10048  					"sha": "s",
 10049  					"repo": {
 10050  						"id": 1,
 10051  						"name": "n",
 10052  						"url": "s"
 10053  					}
 10054  				},
 10055  				"base": {
 10056  					"ref": "r",
 10057  					"sha": "s",
 10058  					"repo": {
 10059  						"id": 1,
 10060  						"name": "n",
 10061  						"url": "u"
 10062  					}
 10063  				}
 10064  			}
 10065  		],
 10066  		"head_commit": {
 10067  			"sha": "s"
 10068  		}
 10069  		},
 10070  		"action": "a",
 10071  		"repository": {
 10072  			"id": 1,
 10073  			"name": "n",
 10074  			"url": "s"
 10075  		},
 10076  		"organization": {
 10077  			"name": "n",
 10078  			"company": "c",
 10079  			"blog": "b",
 10080  			"location": "loc",
 10081  			"email": "e",
 10082  			"twitter_username": "tu",
 10083  			"description": "d",
 10084  			"billing_email": "be",
 10085  			"is_verified": true,
 10086  			"has_organization_projects": true,
 10087  			"has_repository_projects": true,
 10088  			"default_repository_permission": "drp",
 10089  			"members_can_create_repositories": true,
 10090  			"members_can_create_public_repositories": false,
 10091  			"members_can_create_private_repositories": true,
 10092  			"members_can_create_internal_repositories": true,
 10093  			"members_allowed_repository_creation_type": "marct",
 10094  			"members_can_create_pages": true,
 10095  			"members_can_create_public_pages": false,
 10096  			"members_can_create_private_pages": true
 10097  		},
 10098  		"sender": {
 10099  			"login": "l",
 10100  			"id": 1,
 10101  			"node_id": "n",
 10102  			"avatar_url": "a",
 10103  			"url": "u",
 10104  			"events_url": "e",
 10105  			"repos_url": "r"
 10106  		},
 10107  		"installation": {
 10108  			"id": 1,
 10109  			"node_id": "nid",
 10110  			"app_id": 1,
 10111  			"app_slug": "as",
 10112  			"target_id": 1,
 10113  			"account": {
 10114  				"login": "l",
 10115  				"id": 1,
 10116  				"avatar_url": "a",
 10117  				"gravatar_id": "g",
 10118  				"name": "n",
 10119  				"company": "c",
 10120  				"blog": "b",
 10121  				"location": "l",
 10122  				"email": "e",
 10123  				"hireable": true,
 10124  				"bio": "b",
 10125  				"twitter_username": "t",
 10126  				"public_repos": 1,
 10127  				"followers": 1,
 10128  				"following": 1,
 10129  				"created_at": ` + referenceTimeStr + `,
 10130  				"suspended_at": ` + referenceTimeStr + `,
 10131  				"url": "u"
 10132  			},
 10133  			"access_tokens_url": "atu",
 10134  			"repositories_url": "ru",
 10135  			"html_url": "hu",
 10136  			"target_type": "tt",
 10137  			"single_file_name": "sfn",
 10138  			"repository_selection": "rs",
 10139  			"events": [
 10140  				"e"
 10141  			],
 10142  			"single_file_paths": [
 10143  				"s"
 10144  			],
 10145  			"permissions": {
 10146  				"actions": "a",
 10147  				"administration": "ad",
 10148  				"checks": "c",
 10149  				"contents": "co",
 10150  				"content_references": "cr",
 10151  				"deployments": "d",
 10152  				"environments": "e",
 10153  				"issues": "i",
 10154  				"metadata": "md",
 10155  				"members": "m",
 10156  				"organization_administration": "oa",
 10157  				"organization_hooks": "oh",
 10158  				"organization_plan": "op",
 10159  				"organization_pre_receive_hooks": "opr",
 10160  				"organization_projects": "op",
 10161  				"organization_secrets": "os",
 10162  				"organization_self_hosted_runners": "osh",
 10163  				"organization_user_blocking": "oub",
 10164  				"packages": "pkg",
 10165  				"pages": "pg",
 10166  				"pull_requests": "pr",
 10167  				"repository_hooks": "rh",
 10168  				"repository_projects": "rp",
 10169  				"repository_pre_receive_hooks": "rprh",
 10170  				"secrets": "s",
 10171  				"secret_scanning_alerts": "ssa",
 10172  				"security_events": "se",
 10173  				"single_file": "sf",
 10174  				"statuses": "s",
 10175  				"team_discussions": "td",
 10176  				"vulnerability_alerts": "va",
 10177  				"workflows": "w"
 10178  			},
 10179  			"created_at": ` + referenceTimeStr + `,
 10180  			"updated_at": ` + referenceTimeStr + `,
 10181  			"has_multiple_single_files": false,
 10182  			"suspended_by": {
 10183  				"login": "l",
 10184  				"id": 1,
 10185  				"avatar_url": "a",
 10186  				"gravatar_id": "g",
 10187  				"name": "n",
 10188  				"company": "c",
 10189  				"blog": "b",
 10190  				"location": "l",
 10191  				"email": "e",
 10192  				"hireable": true,
 10193  				"bio": "b",
 10194  				"twitter_username": "t",
 10195  				"public_repos": 1,
 10196  				"followers": 1,
 10197  				"following": 1,
 10198  				"created_at": ` + referenceTimeStr + `,
 10199  				"suspended_at": ` + referenceTimeStr + `,
 10200  				"url": "u"
 10201  			},
 10202  			"suspended_at": ` + referenceTimeStr + `
 10203  		}
 10204  	}`
 10205  
 10206  	testJSONMarshal(t, r, want)
 10207  }
 10208  
 10209  func TestDeployKeyEvent_Marshal(t *testing.T) {
 10210  	testJSONMarshal(t, &DeployKeyEvent{}, "{}")
 10211  
 10212  	u := &DeployKeyEvent{
 10213  		Action: String("a"),
 10214  		Key: &Key{
 10215  			ID:        Int64(1),
 10216  			Key:       String("k"),
 10217  			URL:       String("k"),
 10218  			Title:     String("k"),
 10219  			ReadOnly:  Bool(false),
 10220  			Verified:  Bool(false),
 10221  			CreatedAt: &Timestamp{referenceTime},
 10222  		},
 10223  	}
 10224  
 10225  	want := `{
 10226  		"action": "a",
 10227  		"key": {
 10228  			"id": 1,
 10229  			"key": "k",
 10230  			"url": "k",
 10231  			"title": "k",
 10232  			"read_only": false,
 10233  			"verified": false,
 10234  			"created_at": ` + referenceTimeStr + `
 10235  		}
 10236  	}`
 10237  
 10238  	testJSONMarshal(t, u, want)
 10239  }
 10240  
 10241  func TestMetaEvent_Marshal(t *testing.T) {
 10242  	testJSONMarshal(t, &MetaEvent{}, "{}")
 10243  
 10244  	v := make(map[string]interface{})
 10245  	v["a"] = "b"
 10246  
 10247  	u := &MetaEvent{
 10248  		Action: String("a"),
 10249  		HookID: Int64(1),
 10250  		Hook: &Hook{
 10251  			CreatedAt:    &referenceTime,
 10252  			UpdatedAt:    &referenceTime,
 10253  			URL:          String("u"),
 10254  			ID:           Int64(1),
 10255  			Type:         String("t"),
 10256  			Name:         String("n"),
 10257  			TestURL:      String("tu"),
 10258  			PingURL:      String("pu"),
 10259  			LastResponse: v,
 10260  			Config:       v,
 10261  			Events:       []string{"a"},
 10262  			Active:       Bool(true),
 10263  		},
 10264  	}
 10265  
 10266  	want := `{
 10267  		"action": "a",
 10268  		"hook_id": 1,
 10269  		"hook": {
 10270  			"created_at": ` + referenceTimeStr + `,
 10271  			"updated_at": ` + referenceTimeStr + `,
 10272  			"url": "u",
 10273  			"id": 1,
 10274  			"type": "t",
 10275  			"name": "n",
 10276  			"test_url": "tu",
 10277  			"ping_url": "pu",
 10278  			"last_response": {
 10279  				"a": "b"
 10280  			},
 10281  			"config": {
 10282  				"a": "b"
 10283  			},
 10284  			"events": [
 10285  				"a"
 10286  			],
 10287  			"active": true
 10288  		}
 10289  	}`
 10290  
 10291  	testJSONMarshal(t, u, want)
 10292  }
 10293  
 10294  func TestRequestedAction_Marshal(t *testing.T) {
 10295  	testJSONMarshal(t, &RequestedAction{}, "{}")
 10296  
 10297  	r := &RequestedAction{
 10298  		Identifier: "i",
 10299  	}
 10300  
 10301  	want := `{
 10302  		"identifier": "i"
 10303  	}`
 10304  
 10305  	testJSONMarshal(t, r, want)
 10306  }
 10307  
 10308  func TestCreateEvent_Marshal(t *testing.T) {
 10309  	testJSONMarshal(t, &CreateEvent{}, "{}")
 10310  
 10311  	r := &CreateEvent{
 10312  		Ref:          String("r"),
 10313  		RefType:      String("rt"),
 10314  		MasterBranch: String("mb"),
 10315  		Description:  String("d"),
 10316  		PusherType:   String("pt"),
 10317  		Repo: &Repository{
 10318  			ID:   Int64(1),
 10319  			URL:  String("s"),
 10320  			Name: String("n"),
 10321  		},
 10322  		Sender: &User{
 10323  			Login:     String("l"),
 10324  			ID:        Int64(1),
 10325  			NodeID:    String("n"),
 10326  			URL:       String("u"),
 10327  			ReposURL:  String("r"),
 10328  			EventsURL: String("e"),
 10329  			AvatarURL: String("a"),
 10330  		},
 10331  		Installation: &Installation{
 10332  			ID:       Int64(1),
 10333  			NodeID:   String("nid"),
 10334  			AppID:    Int64(1),
 10335  			AppSlug:  String("as"),
 10336  			TargetID: Int64(1),
 10337  			Account: &User{
 10338  				Login:           String("l"),
 10339  				ID:              Int64(1),
 10340  				URL:             String("u"),
 10341  				AvatarURL:       String("a"),
 10342  				GravatarID:      String("g"),
 10343  				Name:            String("n"),
 10344  				Company:         String("c"),
 10345  				Blog:            String("b"),
 10346  				Location:        String("l"),
 10347  				Email:           String("e"),
 10348  				Hireable:        Bool(true),
 10349  				Bio:             String("b"),
 10350  				TwitterUsername: String("t"),
 10351  				PublicRepos:     Int(1),
 10352  				Followers:       Int(1),
 10353  				Following:       Int(1),
 10354  				CreatedAt:       &Timestamp{referenceTime},
 10355  				SuspendedAt:     &Timestamp{referenceTime},
 10356  			},
 10357  			AccessTokensURL:     String("atu"),
 10358  			RepositoriesURL:     String("ru"),
 10359  			HTMLURL:             String("hu"),
 10360  			TargetType:          String("tt"),
 10361  			SingleFileName:      String("sfn"),
 10362  			RepositorySelection: String("rs"),
 10363  			Events:              []string{"e"},
 10364  			SingleFilePaths:     []string{"s"},
 10365  			Permissions: &InstallationPermissions{
 10366  				Actions:                       String("a"),
 10367  				Administration:                String("ad"),
 10368  				Checks:                        String("c"),
 10369  				Contents:                      String("co"),
 10370  				ContentReferences:             String("cr"),
 10371  				Deployments:                   String("d"),
 10372  				Environments:                  String("e"),
 10373  				Issues:                        String("i"),
 10374  				Metadata:                      String("md"),
 10375  				Members:                       String("m"),
 10376  				OrganizationAdministration:    String("oa"),
 10377  				OrganizationHooks:             String("oh"),
 10378  				OrganizationPlan:              String("op"),
 10379  				OrganizationPreReceiveHooks:   String("opr"),
 10380  				OrganizationProjects:          String("op"),
 10381  				OrganizationSecrets:           String("os"),
 10382  				OrganizationSelfHostedRunners: String("osh"),
 10383  				OrganizationUserBlocking:      String("oub"),
 10384  				Packages:                      String("pkg"),
 10385  				Pages:                         String("pg"),
 10386  				PullRequests:                  String("pr"),
 10387  				RepositoryHooks:               String("rh"),
 10388  				RepositoryProjects:            String("rp"),
 10389  				RepositoryPreReceiveHooks:     String("rprh"),
 10390  				Secrets:                       String("s"),
 10391  				SecretScanningAlerts:          String("ssa"),
 10392  				SecurityEvents:                String("se"),
 10393  				SingleFile:                    String("sf"),
 10394  				Statuses:                      String("s"),
 10395  				TeamDiscussions:               String("td"),
 10396  				VulnerabilityAlerts:           String("va"),
 10397  				Workflows:                     String("w"),
 10398  			},
 10399  			CreatedAt:              &Timestamp{referenceTime},
 10400  			UpdatedAt:              &Timestamp{referenceTime},
 10401  			HasMultipleSingleFiles: Bool(false),
 10402  			SuspendedBy: &User{
 10403  				Login:           String("l"),
 10404  				ID:              Int64(1),
 10405  				URL:             String("u"),
 10406  				AvatarURL:       String("a"),
 10407  				GravatarID:      String("g"),
 10408  				Name:            String("n"),
 10409  				Company:         String("c"),
 10410  				Blog:            String("b"),
 10411  				Location:        String("l"),
 10412  				Email:           String("e"),
 10413  				Hireable:        Bool(true),
 10414  				Bio:             String("b"),
 10415  				TwitterUsername: String("t"),
 10416  				PublicRepos:     Int(1),
 10417  				Followers:       Int(1),
 10418  				Following:       Int(1),
 10419  				CreatedAt:       &Timestamp{referenceTime},
 10420  				SuspendedAt:     &Timestamp{referenceTime},
 10421  			},
 10422  			SuspendedAt: &Timestamp{referenceTime},
 10423  		},
 10424  	}
 10425  
 10426  	want := `{
 10427  		"ref": "r",
 10428  		"ref_type": "rt",
 10429  		"master_branch": "mb",
 10430  		"description": "d",
 10431  		"pusher_type": "pt",
 10432  		"repository": {
 10433  			"id": 1,
 10434  			"name": "n",
 10435  			"url": "s"
 10436  		},
 10437  		"sender": {
 10438  			"login": "l",
 10439  			"id": 1,
 10440  			"node_id": "n",
 10441  			"avatar_url": "a",
 10442  			"url": "u",
 10443  			"events_url": "e",
 10444  			"repos_url": "r"
 10445  		},
 10446  		"installation": {
 10447  			"id": 1,
 10448  			"node_id": "nid",
 10449  			"app_id": 1,
 10450  			"app_slug": "as",
 10451  			"target_id": 1,
 10452  			"account": {
 10453  				"login": "l",
 10454  				"id": 1,
 10455  				"avatar_url": "a",
 10456  				"gravatar_id": "g",
 10457  				"name": "n",
 10458  				"company": "c",
 10459  				"blog": "b",
 10460  				"location": "l",
 10461  				"email": "e",
 10462  				"hireable": true,
 10463  				"bio": "b",
 10464  				"twitter_username": "t",
 10465  				"public_repos": 1,
 10466  				"followers": 1,
 10467  				"following": 1,
 10468  				"created_at": ` + referenceTimeStr + `,
 10469  				"suspended_at": ` + referenceTimeStr + `,
 10470  				"url": "u"
 10471  			},
 10472  			"access_tokens_url": "atu",
 10473  			"repositories_url": "ru",
 10474  			"html_url": "hu",
 10475  			"target_type": "tt",
 10476  			"single_file_name": "sfn",
 10477  			"repository_selection": "rs",
 10478  			"events": [
 10479  				"e"
 10480  			],
 10481  			"single_file_paths": [
 10482  				"s"
 10483  			],
 10484  			"permissions": {
 10485  				"actions": "a",
 10486  				"administration": "ad",
 10487  				"checks": "c",
 10488  				"contents": "co",
 10489  				"content_references": "cr",
 10490  				"deployments": "d",
 10491  				"environments": "e",
 10492  				"issues": "i",
 10493  				"metadata": "md",
 10494  				"members": "m",
 10495  				"organization_administration": "oa",
 10496  				"organization_hooks": "oh",
 10497  				"organization_plan": "op",
 10498  				"organization_pre_receive_hooks": "opr",
 10499  				"organization_projects": "op",
 10500  				"organization_secrets": "os",
 10501  				"organization_self_hosted_runners": "osh",
 10502  				"organization_user_blocking": "oub",
 10503  				"packages": "pkg",
 10504  				"pages": "pg",
 10505  				"pull_requests": "pr",
 10506  				"repository_hooks": "rh",
 10507  				"repository_projects": "rp",
 10508  				"repository_pre_receive_hooks": "rprh",
 10509  				"secrets": "s",
 10510  				"secret_scanning_alerts": "ssa",
 10511  				"security_events": "se",
 10512  				"single_file": "sf",
 10513  				"statuses": "s",
 10514  				"team_discussions": "td",
 10515  				"vulnerability_alerts": "va",
 10516  				"workflows": "w"
 10517  			},
 10518  			"created_at": ` + referenceTimeStr + `,
 10519  			"updated_at": ` + referenceTimeStr + `,
 10520  			"has_multiple_single_files": false,
 10521  			"suspended_by": {
 10522  				"login": "l",
 10523  				"id": 1,
 10524  				"avatar_url": "a",
 10525  				"gravatar_id": "g",
 10526  				"name": "n",
 10527  				"company": "c",
 10528  				"blog": "b",
 10529  				"location": "l",
 10530  				"email": "e",
 10531  				"hireable": true,
 10532  				"bio": "b",
 10533  				"twitter_username": "t",
 10534  				"public_repos": 1,
 10535  				"followers": 1,
 10536  				"following": 1,
 10537  				"created_at": ` + referenceTimeStr + `,
 10538  				"suspended_at": ` + referenceTimeStr + `,
 10539  				"url": "u"
 10540  			},
 10541  			"suspended_at": ` + referenceTimeStr + `
 10542  		}
 10543  	}`
 10544  
 10545  	testJSONMarshal(t, r, want)
 10546  }
 10547  
 10548  func TestDeleteEvent_Marshal(t *testing.T) {
 10549  	testJSONMarshal(t, &DeleteEvent{}, "{}")
 10550  
 10551  	r := &DeleteEvent{
 10552  		Ref:        String("r"),
 10553  		RefType:    String("rt"),
 10554  		PusherType: String("pt"),
 10555  		Repo: &Repository{
 10556  			ID:   Int64(1),
 10557  			URL:  String("s"),
 10558  			Name: String("n"),
 10559  		},
 10560  		Sender: &User{
 10561  			Login:     String("l"),
 10562  			ID:        Int64(1),
 10563  			NodeID:    String("n"),
 10564  			URL:       String("u"),
 10565  			ReposURL:  String("r"),
 10566  			EventsURL: String("e"),
 10567  			AvatarURL: String("a"),
 10568  		},
 10569  		Installation: &Installation{
 10570  			ID:       Int64(1),
 10571  			NodeID:   String("nid"),
 10572  			AppID:    Int64(1),
 10573  			AppSlug:  String("as"),
 10574  			TargetID: Int64(1),
 10575  			Account: &User{
 10576  				Login:           String("l"),
 10577  				ID:              Int64(1),
 10578  				URL:             String("u"),
 10579  				AvatarURL:       String("a"),
 10580  				GravatarID:      String("g"),
 10581  				Name:            String("n"),
 10582  				Company:         String("c"),
 10583  				Blog:            String("b"),
 10584  				Location:        String("l"),
 10585  				Email:           String("e"),
 10586  				Hireable:        Bool(true),
 10587  				Bio:             String("b"),
 10588  				TwitterUsername: String("t"),
 10589  				PublicRepos:     Int(1),
 10590  				Followers:       Int(1),
 10591  				Following:       Int(1),
 10592  				CreatedAt:       &Timestamp{referenceTime},
 10593  				SuspendedAt:     &Timestamp{referenceTime},
 10594  			},
 10595  			AccessTokensURL:     String("atu"),
 10596  			RepositoriesURL:     String("ru"),
 10597  			HTMLURL:             String("hu"),
 10598  			TargetType:          String("tt"),
 10599  			SingleFileName:      String("sfn"),
 10600  			RepositorySelection: String("rs"),
 10601  			Events:              []string{"e"},
 10602  			SingleFilePaths:     []string{"s"},
 10603  			Permissions: &InstallationPermissions{
 10604  				Actions:                       String("a"),
 10605  				Administration:                String("ad"),
 10606  				Checks:                        String("c"),
 10607  				Contents:                      String("co"),
 10608  				ContentReferences:             String("cr"),
 10609  				Deployments:                   String("d"),
 10610  				Environments:                  String("e"),
 10611  				Issues:                        String("i"),
 10612  				Metadata:                      String("md"),
 10613  				Members:                       String("m"),
 10614  				OrganizationAdministration:    String("oa"),
 10615  				OrganizationHooks:             String("oh"),
 10616  				OrganizationPlan:              String("op"),
 10617  				OrganizationPreReceiveHooks:   String("opr"),
 10618  				OrganizationProjects:          String("op"),
 10619  				OrganizationSecrets:           String("os"),
 10620  				OrganizationSelfHostedRunners: String("osh"),
 10621  				OrganizationUserBlocking:      String("oub"),
 10622  				Packages:                      String("pkg"),
 10623  				Pages:                         String("pg"),
 10624  				PullRequests:                  String("pr"),
 10625  				RepositoryHooks:               String("rh"),
 10626  				RepositoryProjects:            String("rp"),
 10627  				RepositoryPreReceiveHooks:     String("rprh"),
 10628  				Secrets:                       String("s"),
 10629  				SecretScanningAlerts:          String("ssa"),
 10630  				SecurityEvents:                String("se"),
 10631  				SingleFile:                    String("sf"),
 10632  				Statuses:                      String("s"),
 10633  				TeamDiscussions:               String("td"),
 10634  				VulnerabilityAlerts:           String("va"),
 10635  				Workflows:                     String("w"),
 10636  			},
 10637  			CreatedAt:              &Timestamp{referenceTime},
 10638  			UpdatedAt:              &Timestamp{referenceTime},
 10639  			HasMultipleSingleFiles: Bool(false),
 10640  			SuspendedBy: &User{
 10641  				Login:           String("l"),
 10642  				ID:              Int64(1),
 10643  				URL:             String("u"),
 10644  				AvatarURL:       String("a"),
 10645  				GravatarID:      String("g"),
 10646  				Name:            String("n"),
 10647  				Company:         String("c"),
 10648  				Blog:            String("b"),
 10649  				Location:        String("l"),
 10650  				Email:           String("e"),
 10651  				Hireable:        Bool(true),
 10652  				Bio:             String("b"),
 10653  				TwitterUsername: String("t"),
 10654  				PublicRepos:     Int(1),
 10655  				Followers:       Int(1),
 10656  				Following:       Int(1),
 10657  				CreatedAt:       &Timestamp{referenceTime},
 10658  				SuspendedAt:     &Timestamp{referenceTime},
 10659  			},
 10660  			SuspendedAt: &Timestamp{referenceTime},
 10661  		},
 10662  	}
 10663  
 10664  	want := `{
 10665  		"ref": "r",
 10666  		"ref_type": "rt",
 10667  		"pusher_type": "pt",
 10668  		"repository": {
 10669  			"id": 1,
 10670  			"name": "n",
 10671  			"url": "s"
 10672  		},
 10673  		"sender": {
 10674  			"login": "l",
 10675  			"id": 1,
 10676  			"node_id": "n",
 10677  			"avatar_url": "a",
 10678  			"url": "u",
 10679  			"events_url": "e",
 10680  			"repos_url": "r"
 10681  		},
 10682  		"installation": {
 10683  			"id": 1,
 10684  			"node_id": "nid",
 10685  			"app_id": 1,
 10686  			"app_slug": "as",
 10687  			"target_id": 1,
 10688  			"account": {
 10689  				"login": "l",
 10690  				"id": 1,
 10691  				"avatar_url": "a",
 10692  				"gravatar_id": "g",
 10693  				"name": "n",
 10694  				"company": "c",
 10695  				"blog": "b",
 10696  				"location": "l",
 10697  				"email": "e",
 10698  				"hireable": true,
 10699  				"bio": "b",
 10700  				"twitter_username": "t",
 10701  				"public_repos": 1,
 10702  				"followers": 1,
 10703  				"following": 1,
 10704  				"created_at": ` + referenceTimeStr + `,
 10705  				"suspended_at": ` + referenceTimeStr + `,
 10706  				"url": "u"
 10707  			},
 10708  			"access_tokens_url": "atu",
 10709  			"repositories_url": "ru",
 10710  			"html_url": "hu",
 10711  			"target_type": "tt",
 10712  			"single_file_name": "sfn",
 10713  			"repository_selection": "rs",
 10714  			"events": [
 10715  				"e"
 10716  			],
 10717  			"single_file_paths": [
 10718  				"s"
 10719  			],
 10720  			"permissions": {
 10721  				"actions": "a",
 10722  				"administration": "ad",
 10723  				"checks": "c",
 10724  				"contents": "co",
 10725  				"content_references": "cr",
 10726  				"deployments": "d",
 10727  				"environments": "e",
 10728  				"issues": "i",
 10729  				"metadata": "md",
 10730  				"members": "m",
 10731  				"organization_administration": "oa",
 10732  				"organization_hooks": "oh",
 10733  				"organization_plan": "op",
 10734  				"organization_pre_receive_hooks": "opr",
 10735  				"organization_projects": "op",
 10736  				"organization_secrets": "os",
 10737  				"organization_self_hosted_runners": "osh",
 10738  				"organization_user_blocking": "oub",
 10739  				"packages": "pkg",
 10740  				"pages": "pg",
 10741  				"pull_requests": "pr",
 10742  				"repository_hooks": "rh",
 10743  				"repository_projects": "rp",
 10744  				"repository_pre_receive_hooks": "rprh",
 10745  				"secrets": "s",
 10746  				"secret_scanning_alerts": "ssa",
 10747  				"security_events": "se",
 10748  				"single_file": "sf",
 10749  				"statuses": "s",
 10750  				"team_discussions": "td",
 10751  				"vulnerability_alerts": "va",
 10752  				"workflows": "w"
 10753  			},
 10754  			"created_at": ` + referenceTimeStr + `,
 10755  			"updated_at": ` + referenceTimeStr + `,
 10756  			"has_multiple_single_files": false,
 10757  			"suspended_by": {
 10758  				"login": "l",
 10759  				"id": 1,
 10760  				"avatar_url": "a",
 10761  				"gravatar_id": "g",
 10762  				"name": "n",
 10763  				"company": "c",
 10764  				"blog": "b",
 10765  				"location": "l",
 10766  				"email": "e",
 10767  				"hireable": true,
 10768  				"bio": "b",
 10769  				"twitter_username": "t",
 10770  				"public_repos": 1,
 10771  				"followers": 1,
 10772  				"following": 1,
 10773  				"created_at": ` + referenceTimeStr + `,
 10774  				"suspended_at": ` + referenceTimeStr + `,
 10775  				"url": "u"
 10776  			},
 10777  			"suspended_at": ` + referenceTimeStr + `
 10778  		}
 10779  	}`
 10780  
 10781  	testJSONMarshal(t, r, want)
 10782  }
 10783  
 10784  func TestForkEvent_Marshal(t *testing.T) {
 10785  	testJSONMarshal(t, &ForkEvent{}, "{}")
 10786  
 10787  	u := &ForkEvent{
 10788  		Forkee: &Repository{
 10789  			ID:   Int64(1),
 10790  			URL:  String("s"),
 10791  			Name: String("n"),
 10792  		},
 10793  		Repo: &Repository{
 10794  			ID:   Int64(1),
 10795  			URL:  String("s"),
 10796  			Name: String("n"),
 10797  		},
 10798  		Sender: &User{
 10799  			Login:     String("l"),
 10800  			ID:        Int64(1),
 10801  			NodeID:    String("n"),
 10802  			URL:       String("u"),
 10803  			ReposURL:  String("r"),
 10804  			EventsURL: String("e"),
 10805  			AvatarURL: String("a"),
 10806  		},
 10807  		Installation: &Installation{
 10808  			ID:       Int64(1),
 10809  			NodeID:   String("nid"),
 10810  			AppID:    Int64(1),
 10811  			AppSlug:  String("as"),
 10812  			TargetID: Int64(1),
 10813  			Account: &User{
 10814  				Login:           String("l"),
 10815  				ID:              Int64(1),
 10816  				URL:             String("u"),
 10817  				AvatarURL:       String("a"),
 10818  				GravatarID:      String("g"),
 10819  				Name:            String("n"),
 10820  				Company:         String("c"),
 10821  				Blog:            String("b"),
 10822  				Location:        String("l"),
 10823  				Email:           String("e"),
 10824  				Hireable:        Bool(true),
 10825  				Bio:             String("b"),
 10826  				TwitterUsername: String("t"),
 10827  				PublicRepos:     Int(1),
 10828  				Followers:       Int(1),
 10829  				Following:       Int(1),
 10830  				CreatedAt:       &Timestamp{referenceTime},
 10831  				SuspendedAt:     &Timestamp{referenceTime},
 10832  			},
 10833  			AccessTokensURL:     String("atu"),
 10834  			RepositoriesURL:     String("ru"),
 10835  			HTMLURL:             String("hu"),
 10836  			TargetType:          String("tt"),
 10837  			SingleFileName:      String("sfn"),
 10838  			RepositorySelection: String("rs"),
 10839  			Events:              []string{"e"},
 10840  			SingleFilePaths:     []string{"s"},
 10841  			Permissions: &InstallationPermissions{
 10842  				Actions:                       String("a"),
 10843  				Administration:                String("ad"),
 10844  				Checks:                        String("c"),
 10845  				Contents:                      String("co"),
 10846  				ContentReferences:             String("cr"),
 10847  				Deployments:                   String("d"),
 10848  				Environments:                  String("e"),
 10849  				Issues:                        String("i"),
 10850  				Metadata:                      String("md"),
 10851  				Members:                       String("m"),
 10852  				OrganizationAdministration:    String("oa"),
 10853  				OrganizationHooks:             String("oh"),
 10854  				OrganizationPlan:              String("op"),
 10855  				OrganizationPreReceiveHooks:   String("opr"),
 10856  				OrganizationProjects:          String("op"),
 10857  				OrganizationSecrets:           String("os"),
 10858  				OrganizationSelfHostedRunners: String("osh"),
 10859  				OrganizationUserBlocking:      String("oub"),
 10860  				Packages:                      String("pkg"),
 10861  				Pages:                         String("pg"),
 10862  				PullRequests:                  String("pr"),
 10863  				RepositoryHooks:               String("rh"),
 10864  				RepositoryProjects:            String("rp"),
 10865  				RepositoryPreReceiveHooks:     String("rprh"),
 10866  				Secrets:                       String("s"),
 10867  				SecretScanningAlerts:          String("ssa"),
 10868  				SecurityEvents:                String("se"),
 10869  				SingleFile:                    String("sf"),
 10870  				Statuses:                      String("s"),
 10871  				TeamDiscussions:               String("td"),
 10872  				VulnerabilityAlerts:           String("va"),
 10873  				Workflows:                     String("w"),
 10874  			},
 10875  			CreatedAt:              &Timestamp{referenceTime},
 10876  			UpdatedAt:              &Timestamp{referenceTime},
 10877  			HasMultipleSingleFiles: Bool(false),
 10878  			SuspendedBy: &User{
 10879  				Login:           String("l"),
 10880  				ID:              Int64(1),
 10881  				URL:             String("u"),
 10882  				AvatarURL:       String("a"),
 10883  				GravatarID:      String("g"),
 10884  				Name:            String("n"),
 10885  				Company:         String("c"),
 10886  				Blog:            String("b"),
 10887  				Location:        String("l"),
 10888  				Email:           String("e"),
 10889  				Hireable:        Bool(true),
 10890  				Bio:             String("b"),
 10891  				TwitterUsername: String("t"),
 10892  				PublicRepos:     Int(1),
 10893  				Followers:       Int(1),
 10894  				Following:       Int(1),
 10895  				CreatedAt:       &Timestamp{referenceTime},
 10896  				SuspendedAt:     &Timestamp{referenceTime},
 10897  			},
 10898  			SuspendedAt: &Timestamp{referenceTime},
 10899  		},
 10900  	}
 10901  
 10902  	want := `{
 10903  		"forkee": {
 10904  			"id": 1,
 10905  			"name": "n",
 10906  			"url": "s"
 10907  		},
 10908  		"repository": {
 10909  			"id": 1,
 10910  			"name": "n",
 10911  			"url": "s"
 10912  		},
 10913  		"sender": {
 10914  			"login": "l",
 10915  			"id": 1,
 10916  			"node_id": "n",
 10917  			"avatar_url": "a",
 10918  			"url": "u",
 10919  			"events_url": "e",
 10920  			"repos_url": "r"
 10921  		},
 10922  		"installation": {
 10923  			"id": 1,
 10924  			"node_id": "nid",
 10925  			"app_id": 1,
 10926  			"app_slug": "as",
 10927  			"target_id": 1,
 10928  			"account": {
 10929  				"login": "l",
 10930  				"id": 1,
 10931  				"avatar_url": "a",
 10932  				"gravatar_id": "g",
 10933  				"name": "n",
 10934  				"company": "c",
 10935  				"blog": "b",
 10936  				"location": "l",
 10937  				"email": "e",
 10938  				"hireable": true,
 10939  				"bio": "b",
 10940  				"twitter_username": "t",
 10941  				"public_repos": 1,
 10942  				"followers": 1,
 10943  				"following": 1,
 10944  				"created_at": ` + referenceTimeStr + `,
 10945  				"suspended_at": ` + referenceTimeStr + `,
 10946  				"url": "u"
 10947  			},
 10948  			"access_tokens_url": "atu",
 10949  			"repositories_url": "ru",
 10950  			"html_url": "hu",
 10951  			"target_type": "tt",
 10952  			"single_file_name": "sfn",
 10953  			"repository_selection": "rs",
 10954  			"events": [
 10955  				"e"
 10956  			],
 10957  			"single_file_paths": [
 10958  				"s"
 10959  			],
 10960  			"permissions": {
 10961  				"actions": "a",
 10962  				"administration": "ad",
 10963  				"checks": "c",
 10964  				"contents": "co",
 10965  				"content_references": "cr",
 10966  				"deployments": "d",
 10967  				"environments": "e",
 10968  				"issues": "i",
 10969  				"metadata": "md",
 10970  				"members": "m",
 10971  				"organization_administration": "oa",
 10972  				"organization_hooks": "oh",
 10973  				"organization_plan": "op",
 10974  				"organization_pre_receive_hooks": "opr",
 10975  				"organization_projects": "op",
 10976  				"organization_secrets": "os",
 10977  				"organization_self_hosted_runners": "osh",
 10978  				"organization_user_blocking": "oub",
 10979  				"packages": "pkg",
 10980  				"pages": "pg",
 10981  				"pull_requests": "pr",
 10982  				"repository_hooks": "rh",
 10983  				"repository_projects": "rp",
 10984  				"repository_pre_receive_hooks": "rprh",
 10985  				"secrets": "s",
 10986  				"secret_scanning_alerts": "ssa",
 10987  				"security_events": "se",
 10988  				"single_file": "sf",
 10989  				"statuses": "s",
 10990  				"team_discussions": "td",
 10991  				"vulnerability_alerts": "va",
 10992  				"workflows": "w"
 10993  			},
 10994  			"created_at": ` + referenceTimeStr + `,
 10995  			"updated_at": ` + referenceTimeStr + `,
 10996  			"has_multiple_single_files": false,
 10997  			"suspended_by": {
 10998  				"login": "l",
 10999  				"id": 1,
 11000  				"avatar_url": "a",
 11001  				"gravatar_id": "g",
 11002  				"name": "n",
 11003  				"company": "c",
 11004  				"blog": "b",
 11005  				"location": "l",
 11006  				"email": "e",
 11007  				"hireable": true,
 11008  				"bio": "b",
 11009  				"twitter_username": "t",
 11010  				"public_repos": 1,
 11011  				"followers": 1,
 11012  				"following": 1,
 11013  				"created_at": ` + referenceTimeStr + `,
 11014  				"suspended_at": ` + referenceTimeStr + `,
 11015  				"url": "u"
 11016  			},
 11017  			"suspended_at": ` + referenceTimeStr + `
 11018  		}
 11019  	}`
 11020  
 11021  	testJSONMarshal(t, u, want)
 11022  }
 11023  
 11024  func TestGitHubAppAuthorizationEvent_Marshal(t *testing.T) {
 11025  	testJSONMarshal(t, &GitHubAppAuthorizationEvent{}, "{}")
 11026  
 11027  	u := &GitHubAppAuthorizationEvent{
 11028  		Action: String("a"),
 11029  		Sender: &User{
 11030  			Login:     String("l"),
 11031  			ID:        Int64(1),
 11032  			NodeID:    String("n"),
 11033  			URL:       String("u"),
 11034  			ReposURL:  String("r"),
 11035  			EventsURL: String("e"),
 11036  			AvatarURL: String("a"),
 11037  		},
 11038  	}
 11039  
 11040  	want := `{
 11041  		"action": "a",
 11042  		"sender": {
 11043  			"login": "l",
 11044  			"id": 1,
 11045  			"node_id": "n",
 11046  			"avatar_url": "a",
 11047  			"url": "u",
 11048  			"events_url": "e",
 11049  			"repos_url": "r"
 11050  		}
 11051  	}`
 11052  
 11053  	testJSONMarshal(t, u, want)
 11054  }
 11055  
 11056  func TestInstallationEvent_Marshal(t *testing.T) {
 11057  	testJSONMarshal(t, &InstallationEvent{}, "{}")
 11058  
 11059  	u := &InstallationEvent{
 11060  		Action: String("a"),
 11061  		Repositories: []*Repository{
 11062  			{
 11063  				ID:   Int64(1),
 11064  				URL:  String("u"),
 11065  				Name: String("n"),
 11066  			},
 11067  		},
 11068  		Sender: &User{
 11069  			Login:     String("l"),
 11070  			ID:        Int64(1),
 11071  			NodeID:    String("n"),
 11072  			URL:       String("u"),
 11073  			ReposURL:  String("r"),
 11074  			EventsURL: String("e"),
 11075  			AvatarURL: String("a"),
 11076  		},
 11077  		Installation: &Installation{
 11078  			ID:       Int64(1),
 11079  			NodeID:   String("nid"),
 11080  			AppID:    Int64(1),
 11081  			AppSlug:  String("as"),
 11082  			TargetID: Int64(1),
 11083  			Account: &User{
 11084  				Login:           String("l"),
 11085  				ID:              Int64(1),
 11086  				URL:             String("u"),
 11087  				AvatarURL:       String("a"),
 11088  				GravatarID:      String("g"),
 11089  				Name:            String("n"),
 11090  				Company:         String("c"),
 11091  				Blog:            String("b"),
 11092  				Location:        String("l"),
 11093  				Email:           String("e"),
 11094  				Hireable:        Bool(true),
 11095  				Bio:             String("b"),
 11096  				TwitterUsername: String("t"),
 11097  				PublicRepos:     Int(1),
 11098  				Followers:       Int(1),
 11099  				Following:       Int(1),
 11100  				CreatedAt:       &Timestamp{referenceTime},
 11101  				SuspendedAt:     &Timestamp{referenceTime},
 11102  			},
 11103  			AccessTokensURL:     String("atu"),
 11104  			RepositoriesURL:     String("ru"),
 11105  			HTMLURL:             String("hu"),
 11106  			TargetType:          String("tt"),
 11107  			SingleFileName:      String("sfn"),
 11108  			RepositorySelection: String("rs"),
 11109  			Events:              []string{"e"},
 11110  			SingleFilePaths:     []string{"s"},
 11111  			Permissions: &InstallationPermissions{
 11112  				Actions:                       String("a"),
 11113  				Administration:                String("ad"),
 11114  				Checks:                        String("c"),
 11115  				Contents:                      String("co"),
 11116  				ContentReferences:             String("cr"),
 11117  				Deployments:                   String("d"),
 11118  				Environments:                  String("e"),
 11119  				Issues:                        String("i"),
 11120  				Metadata:                      String("md"),
 11121  				Members:                       String("m"),
 11122  				OrganizationAdministration:    String("oa"),
 11123  				OrganizationHooks:             String("oh"),
 11124  				OrganizationPlan:              String("op"),
 11125  				OrganizationPreReceiveHooks:   String("opr"),
 11126  				OrganizationProjects:          String("op"),
 11127  				OrganizationSecrets:           String("os"),
 11128  				OrganizationSelfHostedRunners: String("osh"),
 11129  				OrganizationUserBlocking:      String("oub"),
 11130  				Packages:                      String("pkg"),
 11131  				Pages:                         String("pg"),
 11132  				PullRequests:                  String("pr"),
 11133  				RepositoryHooks:               String("rh"),
 11134  				RepositoryProjects:            String("rp"),
 11135  				RepositoryPreReceiveHooks:     String("rprh"),
 11136  				Secrets:                       String("s"),
 11137  				SecretScanningAlerts:          String("ssa"),
 11138  				SecurityEvents:                String("se"),
 11139  				SingleFile:                    String("sf"),
 11140  				Statuses:                      String("s"),
 11141  				TeamDiscussions:               String("td"),
 11142  				VulnerabilityAlerts:           String("va"),
 11143  				Workflows:                     String("w"),
 11144  			},
 11145  			CreatedAt:              &Timestamp{referenceTime},
 11146  			UpdatedAt:              &Timestamp{referenceTime},
 11147  			HasMultipleSingleFiles: Bool(false),
 11148  			SuspendedBy: &User{
 11149  				Login:           String("l"),
 11150  				ID:              Int64(1),
 11151  				URL:             String("u"),
 11152  				AvatarURL:       String("a"),
 11153  				GravatarID:      String("g"),
 11154  				Name:            String("n"),
 11155  				Company:         String("c"),
 11156  				Blog:            String("b"),
 11157  				Location:        String("l"),
 11158  				Email:           String("e"),
 11159  				Hireable:        Bool(true),
 11160  				Bio:             String("b"),
 11161  				TwitterUsername: String("t"),
 11162  				PublicRepos:     Int(1),
 11163  				Followers:       Int(1),
 11164  				Following:       Int(1),
 11165  				CreatedAt:       &Timestamp{referenceTime},
 11166  				SuspendedAt:     &Timestamp{referenceTime},
 11167  			},
 11168  			SuspendedAt: &Timestamp{referenceTime},
 11169  		},
 11170  	}
 11171  
 11172  	want := `{
 11173  		"action": "a",
 11174  		"repositories": [
 11175  			{
 11176  				"id":1,
 11177  				"name":"n",
 11178  				"url":"u"
 11179  			}
 11180  		],
 11181  		"sender": {
 11182  			"login": "l",
 11183  			"id": 1,
 11184  			"node_id": "n",
 11185  			"avatar_url": "a",
 11186  			"url": "u",
 11187  			"events_url": "e",
 11188  			"repos_url": "r"
 11189  		},
 11190  		"installation": {
 11191  			"id": 1,
 11192  			"node_id": "nid",
 11193  			"app_id": 1,
 11194  			"app_slug": "as",
 11195  			"target_id": 1,
 11196  			"account": {
 11197  				"login": "l",
 11198  				"id": 1,
 11199  				"avatar_url": "a",
 11200  				"gravatar_id": "g",
 11201  				"name": "n",
 11202  				"company": "c",
 11203  				"blog": "b",
 11204  				"location": "l",
 11205  				"email": "e",
 11206  				"hireable": true,
 11207  				"bio": "b",
 11208  				"twitter_username": "t",
 11209  				"public_repos": 1,
 11210  				"followers": 1,
 11211  				"following": 1,
 11212  				"created_at": ` + referenceTimeStr + `,
 11213  				"suspended_at": ` + referenceTimeStr + `,
 11214  				"url": "u"
 11215  			},
 11216  			"access_tokens_url": "atu",
 11217  			"repositories_url": "ru",
 11218  			"html_url": "hu",
 11219  			"target_type": "tt",
 11220  			"single_file_name": "sfn",
 11221  			"repository_selection": "rs",
 11222  			"events": [
 11223  				"e"
 11224  			],
 11225  			"single_file_paths": [
 11226  				"s"
 11227  			],
 11228  			"permissions": {
 11229  				"actions": "a",
 11230  				"administration": "ad",
 11231  				"checks": "c",
 11232  				"contents": "co",
 11233  				"content_references": "cr",
 11234  				"deployments": "d",
 11235  				"environments": "e",
 11236  				"issues": "i",
 11237  				"metadata": "md",
 11238  				"members": "m",
 11239  				"organization_administration": "oa",
 11240  				"organization_hooks": "oh",
 11241  				"organization_plan": "op",
 11242  				"organization_pre_receive_hooks": "opr",
 11243  				"organization_projects": "op",
 11244  				"organization_secrets": "os",
 11245  				"organization_self_hosted_runners": "osh",
 11246  				"organization_user_blocking": "oub",
 11247  				"packages": "pkg",
 11248  				"pages": "pg",
 11249  				"pull_requests": "pr",
 11250  				"repository_hooks": "rh",
 11251  				"repository_projects": "rp",
 11252  				"repository_pre_receive_hooks": "rprh",
 11253  				"secrets": "s",
 11254  				"secret_scanning_alerts": "ssa",
 11255  				"security_events": "se",
 11256  				"single_file": "sf",
 11257  				"statuses": "s",
 11258  				"team_discussions": "td",
 11259  				"vulnerability_alerts": "va",
 11260  				"workflows": "w"
 11261  			},
 11262  			"created_at": ` + referenceTimeStr + `,
 11263  			"updated_at": ` + referenceTimeStr + `,
 11264  			"has_multiple_single_files": false,
 11265  			"suspended_by": {
 11266  				"login": "l",
 11267  				"id": 1,
 11268  				"avatar_url": "a",
 11269  				"gravatar_id": "g",
 11270  				"name": "n",
 11271  				"company": "c",
 11272  				"blog": "b",
 11273  				"location": "l",
 11274  				"email": "e",
 11275  				"hireable": true,
 11276  				"bio": "b",
 11277  				"twitter_username": "t",
 11278  				"public_repos": 1,
 11279  				"followers": 1,
 11280  				"following": 1,
 11281  				"created_at": ` + referenceTimeStr + `,
 11282  				"suspended_at": ` + referenceTimeStr + `,
 11283  				"url": "u"
 11284  			},
 11285  			"suspended_at": ` + referenceTimeStr + `
 11286  		}
 11287  	}`
 11288  
 11289  	testJSONMarshal(t, u, want)
 11290  }
 11291  
 11292  func TestHeadCommit_Marshal(t *testing.T) {
 11293  	testJSONMarshal(t, &HeadCommit{}, "{}")
 11294  
 11295  	u := &HeadCommit{
 11296  		Message: String("m"),
 11297  		Author: &CommitAuthor{
 11298  			Date:  &referenceTime,
 11299  			Name:  String("n"),
 11300  			Email: String("e"),
 11301  			Login: String("u"),
 11302  		},
 11303  		URL:       String("u"),
 11304  		Distinct:  Bool(true),
 11305  		SHA:       String("s"),
 11306  		ID:        String("id"),
 11307  		TreeID:    String("tid"),
 11308  		Timestamp: &Timestamp{referenceTime},
 11309  		Committer: &CommitAuthor{
 11310  			Date:  &referenceTime,
 11311  			Name:  String("n"),
 11312  			Email: String("e"),
 11313  			Login: String("u"),
 11314  		},
 11315  		Added:    []string{"a"},
 11316  		Removed:  []string{"r"},
 11317  		Modified: []string{"m"},
 11318  	}
 11319  
 11320  	want := `{
 11321  		"message": "m",
 11322  		"author": {
 11323  			"date": ` + referenceTimeStr + `,
 11324  			"name": "n",
 11325  			"email": "e",
 11326  			"username": "u"
 11327  		},
 11328  		"url": "u",
 11329  		"distinct": true,
 11330  		"sha": "s",
 11331  		"id": "id",
 11332  		"tree_id": "tid",
 11333  		"timestamp": ` + referenceTimeStr + `,
 11334  		"committer": {
 11335  			"date": ` + referenceTimeStr + `,
 11336  			"name": "n",
 11337  			"email": "e",
 11338  			"username": "u"
 11339  		},
 11340  		"added": [
 11341  			"a"
 11342  		],
 11343  		"removed":  [
 11344  			"r"
 11345  		],
 11346  		"modified":  [
 11347  			"m"
 11348  		]
 11349  	}`
 11350  
 11351  	testJSONMarshal(t, u, want)
 11352  }
 11353  
 11354  func TestPushEventRepository_Marshal(t *testing.T) {
 11355  	testJSONMarshal(t, &PushEventRepository{}, "{}")
 11356  
 11357  	u := &PushEventRepository{
 11358  		ID:       Int64(1),
 11359  		NodeID:   String("nid"),
 11360  		Name:     String("n"),
 11361  		FullName: String("fn"),
 11362  		Owner: &User{
 11363  			Login:       String("l"),
 11364  			ID:          Int64(1),
 11365  			AvatarURL:   String("a"),
 11366  			GravatarID:  String("g"),
 11367  			Name:        String("n"),
 11368  			Company:     String("c"),
 11369  			Blog:        String("b"),
 11370  			Location:    String("l"),
 11371  			Email:       String("e"),
 11372  			Hireable:    Bool(true),
 11373  			PublicRepos: Int(1),
 11374  			Followers:   Int(1),
 11375  			Following:   Int(1),
 11376  			CreatedAt:   &Timestamp{referenceTime},
 11377  			URL:         String("u"),
 11378  		},
 11379  		Private:         Bool(true),
 11380  		Description:     String("d"),
 11381  		Fork:            Bool(true),
 11382  		CreatedAt:       &Timestamp{referenceTime},
 11383  		PushedAt:        &Timestamp{referenceTime},
 11384  		UpdatedAt:       &Timestamp{referenceTime},
 11385  		Homepage:        String("h"),
 11386  		PullsURL:        String("p"),
 11387  		Size:            Int(1),
 11388  		StargazersCount: Int(1),
 11389  		WatchersCount:   Int(1),
 11390  		Language:        String("l"),
 11391  		HasIssues:       Bool(true),
 11392  		HasDownloads:    Bool(true),
 11393  		HasWiki:         Bool(true),
 11394  		HasPages:        Bool(true),
 11395  		ForksCount:      Int(1),
 11396  		Archived:        Bool(true),
 11397  		Disabled:        Bool(true),
 11398  		OpenIssuesCount: Int(1),
 11399  		DefaultBranch:   String("d"),
 11400  		MasterBranch:    String("m"),
 11401  		Organization:    String("o"),
 11402  		URL:             String("u"),
 11403  		ArchiveURL:      String("a"),
 11404  		HTMLURL:         String("h"),
 11405  		StatusesURL:     String("s"),
 11406  		GitURL:          String("g"),
 11407  		SSHURL:          String("s"),
 11408  		CloneURL:        String("c"),
 11409  		SVNURL:          String("s"),
 11410  	}
 11411  
 11412  	want := `{
 11413  		"id": 1,
 11414  		"node_id": "nid",
 11415  		"name": "n",
 11416  		"full_name": "fn",
 11417  		"owner": {
 11418  			"login": "l",
 11419  			"id": 1,
 11420  			"avatar_url": "a",
 11421  			"gravatar_id": "g",
 11422  			"name": "n",
 11423  			"company": "c",
 11424  			"blog": "b",
 11425  			"location": "l",
 11426  			"email": "e",
 11427  			"hireable": true,
 11428  			"public_repos": 1,
 11429  			"followers": 1,
 11430  			"following": 1,
 11431  			"created_at": ` + referenceTimeStr + `,
 11432  			"url": "u"
 11433  		},
 11434  		"private": true,
 11435  		"description": "d",
 11436  		"fork": true,
 11437  		"created_at": ` + referenceTimeStr + `,
 11438  		"pushed_at": ` + referenceTimeStr + `,
 11439  		"updated_at": ` + referenceTimeStr + `,
 11440  		"homepage": "h",
 11441  		"pulls_url": "p",
 11442  		"size": 1,
 11443  		"stargazers_count": 1,
 11444  		"watchers_count": 1,
 11445  		"language": "l",
 11446  		"has_issues": true,
 11447  		"has_downloads": true,
 11448  		"has_wiki": true,
 11449  		"has_pages": true,
 11450  		"forks_count": 1,
 11451  		"archived": true,
 11452  		"disabled": true,
 11453  		"open_issues_count": 1,
 11454  		"default_branch": "d",
 11455  		"master_branch": "m",
 11456  		"organization": "o",
 11457  		"url": "u",
 11458  		"archive_url": "a",
 11459  		"html_url": "h",
 11460  		"statuses_url": "s",
 11461  		"git_url": "g",
 11462  		"ssh_url": "s",
 11463  		"clone_url": "c",
 11464  		"svn_url": "s"
 11465  	}`
 11466  
 11467  	testJSONMarshal(t, u, want)
 11468  }
 11469  
 11470  func TestPushEventRepoOwner_Marshal(t *testing.T) {
 11471  	testJSONMarshal(t, &PushEventRepoOwner{}, "{}")
 11472  
 11473  	u := &PushEventRepoOwner{
 11474  		Name:  String("n"),
 11475  		Email: String("e"),
 11476  	}
 11477  
 11478  	want := `{
 11479  		"name": "n",
 11480  		"email": "e"
 11481  	}`
 11482  
 11483  	testJSONMarshal(t, u, want)
 11484  }
 11485  
 11486  func TestProjectEvent_Marshal(t *testing.T) {
 11487  	testJSONMarshal(t, &ProjectEvent{}, "{}")
 11488  
 11489  	u := &ProjectEvent{
 11490  		Project: &Project{ID: Int64(1)},
 11491  		Action:  String("a"),
 11492  		Changes: &ProjectChange{
 11493  			Name: &ProjectName{From: String("NameFrom")},
 11494  			Body: &ProjectBody{From: String("BodyFrom")},
 11495  		},
 11496  		Repo: &Repository{
 11497  			ID:   Int64(1),
 11498  			URL:  String("s"),
 11499  			Name: String("n"),
 11500  		},
 11501  		Org: &Organization{
 11502  			BillingEmail:                         String("be"),
 11503  			Blog:                                 String("b"),
 11504  			Company:                              String("c"),
 11505  			Email:                                String("e"),
 11506  			TwitterUsername:                      String("tu"),
 11507  			Location:                             String("loc"),
 11508  			Name:                                 String("n"),
 11509  			Description:                          String("d"),
 11510  			IsVerified:                           Bool(true),
 11511  			HasOrganizationProjects:              Bool(true),
 11512  			HasRepositoryProjects:                Bool(true),
 11513  			DefaultRepoPermission:                String("drp"),
 11514  			MembersCanCreateRepos:                Bool(true),
 11515  			MembersCanCreateInternalRepos:        Bool(true),
 11516  			MembersCanCreatePrivateRepos:         Bool(true),
 11517  			MembersCanCreatePublicRepos:          Bool(false),
 11518  			MembersAllowedRepositoryCreationType: String("marct"),
 11519  			MembersCanCreatePages:                Bool(true),
 11520  			MembersCanCreatePublicPages:          Bool(false),
 11521  			MembersCanCreatePrivatePages:         Bool(true),
 11522  		},
 11523  		Sender: &User{
 11524  			Login:     String("l"),
 11525  			ID:        Int64(1),
 11526  			NodeID:    String("n"),
 11527  			URL:       String("u"),
 11528  			ReposURL:  String("r"),
 11529  			EventsURL: String("e"),
 11530  			AvatarURL: String("a"),
 11531  		},
 11532  		Installation: &Installation{
 11533  			ID:       Int64(1),
 11534  			NodeID:   String("nid"),
 11535  			AppID:    Int64(1),
 11536  			AppSlug:  String("as"),
 11537  			TargetID: Int64(1),
 11538  			Account: &User{
 11539  				Login:           String("l"),
 11540  				ID:              Int64(1),
 11541  				URL:             String("u"),
 11542  				AvatarURL:       String("a"),
 11543  				GravatarID:      String("g"),
 11544  				Name:            String("n"),
 11545  				Company:         String("c"),
 11546  				Blog:            String("b"),
 11547  				Location:        String("l"),
 11548  				Email:           String("e"),
 11549  				Hireable:        Bool(true),
 11550  				Bio:             String("b"),
 11551  				TwitterUsername: String("t"),
 11552  				PublicRepos:     Int(1),
 11553  				Followers:       Int(1),
 11554  				Following:       Int(1),
 11555  				CreatedAt:       &Timestamp{referenceTime},
 11556  				SuspendedAt:     &Timestamp{referenceTime},
 11557  			},
 11558  			AccessTokensURL:     String("atu"),
 11559  			RepositoriesURL:     String("ru"),
 11560  			HTMLURL:             String("hu"),
 11561  			TargetType:          String("tt"),
 11562  			SingleFileName:      String("sfn"),
 11563  			RepositorySelection: String("rs"),
 11564  			Events:              []string{"e"},
 11565  			SingleFilePaths:     []string{"s"},
 11566  			Permissions: &InstallationPermissions{
 11567  				Actions:                       String("a"),
 11568  				Administration:                String("ad"),
 11569  				Checks:                        String("c"),
 11570  				Contents:                      String("co"),
 11571  				ContentReferences:             String("cr"),
 11572  				Deployments:                   String("d"),
 11573  				Environments:                  String("e"),
 11574  				Issues:                        String("i"),
 11575  				Metadata:                      String("md"),
 11576  				Members:                       String("m"),
 11577  				OrganizationAdministration:    String("oa"),
 11578  				OrganizationHooks:             String("oh"),
 11579  				OrganizationPlan:              String("op"),
 11580  				OrganizationPreReceiveHooks:   String("opr"),
 11581  				OrganizationProjects:          String("op"),
 11582  				OrganizationSecrets:           String("os"),
 11583  				OrganizationSelfHostedRunners: String("osh"),
 11584  				OrganizationUserBlocking:      String("oub"),
 11585  				Packages:                      String("pkg"),
 11586  				Pages:                         String("pg"),
 11587  				PullRequests:                  String("pr"),
 11588  				RepositoryHooks:               String("rh"),
 11589  				RepositoryProjects:            String("rp"),
 11590  				RepositoryPreReceiveHooks:     String("rprh"),
 11591  				Secrets:                       String("s"),
 11592  				SecretScanningAlerts:          String("ssa"),
 11593  				SecurityEvents:                String("se"),
 11594  				SingleFile:                    String("sf"),
 11595  				Statuses:                      String("s"),
 11596  				TeamDiscussions:               String("td"),
 11597  				VulnerabilityAlerts:           String("va"),
 11598  				Workflows:                     String("w"),
 11599  			},
 11600  			CreatedAt:              &Timestamp{referenceTime},
 11601  			UpdatedAt:              &Timestamp{referenceTime},
 11602  			HasMultipleSingleFiles: Bool(false),
 11603  			SuspendedBy: &User{
 11604  				Login:           String("l"),
 11605  				ID:              Int64(1),
 11606  				URL:             String("u"),
 11607  				AvatarURL:       String("a"),
 11608  				GravatarID:      String("g"),
 11609  				Name:            String("n"),
 11610  				Company:         String("c"),
 11611  				Blog:            String("b"),
 11612  				Location:        String("l"),
 11613  				Email:           String("e"),
 11614  				Hireable:        Bool(true),
 11615  				Bio:             String("b"),
 11616  				TwitterUsername: String("t"),
 11617  				PublicRepos:     Int(1),
 11618  				Followers:       Int(1),
 11619  				Following:       Int(1),
 11620  				CreatedAt:       &Timestamp{referenceTime},
 11621  				SuspendedAt:     &Timestamp{referenceTime},
 11622  			},
 11623  			SuspendedAt: &Timestamp{referenceTime},
 11624  		},
 11625  	}
 11626  
 11627  	want := `{
 11628  		"action": "a",
 11629  		"changes": {
 11630  			"name": {
 11631  				"from": "NameFrom"
 11632  			},
 11633  			"body": {
 11634  				"from": "BodyFrom"
 11635  			}
 11636  		},
 11637  		"project": {
 11638  			"id": 1
 11639  		},
 11640  		"repository": {
 11641  			"id": 1,
 11642  			"name": "n",
 11643  			"url": "s"
 11644  		},
 11645  		"organization": {
 11646  			"name": "n",
 11647  			"company": "c",
 11648  			"blog": "b",
 11649  			"location": "loc",
 11650  			"email": "e",
 11651  			"twitter_username": "tu",
 11652  			"description": "d",
 11653  			"billing_email": "be",
 11654  			"is_verified": true,
 11655  			"has_organization_projects": true,
 11656  			"has_repository_projects": true,
 11657  			"default_repository_permission": "drp",
 11658  			"members_can_create_repositories": true,
 11659  			"members_can_create_public_repositories": false,
 11660  			"members_can_create_private_repositories": true,
 11661  			"members_can_create_internal_repositories": true,
 11662  			"members_allowed_repository_creation_type": "marct",
 11663  			"members_can_create_pages": true,
 11664  			"members_can_create_public_pages": false,
 11665  			"members_can_create_private_pages": true
 11666  		},
 11667  		"sender": {
 11668  			"login": "l",
 11669  			"id": 1,
 11670  			"node_id": "n",
 11671  			"avatar_url": "a",
 11672  			"url": "u",
 11673  			"events_url": "e",
 11674  			"repos_url": "r"
 11675  		},
 11676  		"installation": {
 11677  			"id": 1,
 11678  			"node_id": "nid",
 11679  			"app_id": 1,
 11680  			"app_slug": "as",
 11681  			"target_id": 1,
 11682  			"account": {
 11683  				"login": "l",
 11684  				"id": 1,
 11685  				"avatar_url": "a",
 11686  				"gravatar_id": "g",
 11687  				"name": "n",
 11688  				"company": "c",
 11689  				"blog": "b",
 11690  				"location": "l",
 11691  				"email": "e",
 11692  				"hireable": true,
 11693  				"bio": "b",
 11694  				"twitter_username": "t",
 11695  				"public_repos": 1,
 11696  				"followers": 1,
 11697  				"following": 1,
 11698  				"created_at": ` + referenceTimeStr + `,
 11699  				"suspended_at": ` + referenceTimeStr + `,
 11700  				"url": "u"
 11701  			},
 11702  			"access_tokens_url": "atu",
 11703  			"repositories_url": "ru",
 11704  			"html_url": "hu",
 11705  			"target_type": "tt",
 11706  			"single_file_name": "sfn",
 11707  			"repository_selection": "rs",
 11708  			"events": [
 11709  				"e"
 11710  			],
 11711  			"single_file_paths": [
 11712  				"s"
 11713  			],
 11714  			"permissions": {
 11715  				"actions": "a",
 11716  				"administration": "ad",
 11717  				"checks": "c",
 11718  				"contents": "co",
 11719  				"content_references": "cr",
 11720  				"deployments": "d",
 11721  				"environments": "e",
 11722  				"issues": "i",
 11723  				"metadata": "md",
 11724  				"members": "m",
 11725  				"organization_administration": "oa",
 11726  				"organization_hooks": "oh",
 11727  				"organization_plan": "op",
 11728  				"organization_pre_receive_hooks": "opr",
 11729  				"organization_projects": "op",
 11730  				"organization_secrets": "os",
 11731  				"organization_self_hosted_runners": "osh",
 11732  				"organization_user_blocking": "oub",
 11733  				"packages": "pkg",
 11734  				"pages": "pg",
 11735  				"pull_requests": "pr",
 11736  				"repository_hooks": "rh",
 11737  				"repository_projects": "rp",
 11738  				"repository_pre_receive_hooks": "rprh",
 11739  				"secrets": "s",
 11740  				"secret_scanning_alerts": "ssa",
 11741  				"security_events": "se",
 11742  				"single_file": "sf",
 11743  				"statuses": "s",
 11744  				"team_discussions": "td",
 11745  				"vulnerability_alerts": "va",
 11746  				"workflows": "w"
 11747  			},
 11748  			"created_at": ` + referenceTimeStr + `,
 11749  			"updated_at": ` + referenceTimeStr + `,
 11750  			"has_multiple_single_files": false,
 11751  			"suspended_by": {
 11752  				"login": "l",
 11753  				"id": 1,
 11754  				"avatar_url": "a",
 11755  				"gravatar_id": "g",
 11756  				"name": "n",
 11757  				"company": "c",
 11758  				"blog": "b",
 11759  				"location": "l",
 11760  				"email": "e",
 11761  				"hireable": true,
 11762  				"bio": "b",
 11763  				"twitter_username": "t",
 11764  				"public_repos": 1,
 11765  				"followers": 1,
 11766  				"following": 1,
 11767  				"created_at": ` + referenceTimeStr + `,
 11768  				"suspended_at": ` + referenceTimeStr + `,
 11769  				"url": "u"
 11770  			},
 11771  			"suspended_at": ` + referenceTimeStr + `
 11772  		}
 11773  	}`
 11774  
 11775  	testJSONMarshal(t, u, want)
 11776  }
 11777  
 11778  func TestProjectCardEvent_Marshal(t *testing.T) {
 11779  	testJSONMarshal(t, &ProjectCardEvent{}, "{}")
 11780  
 11781  	u := &ProjectCardEvent{
 11782  		Action: String("a"),
 11783  		Changes: &ProjectCardChange{
 11784  			Note: &ProjectCardNote{From: String("NoteFrom")},
 11785  		},
 11786  		AfterID:     Int64(1),
 11787  		ProjectCard: &ProjectCard{ID: Int64(1)},
 11788  		Repo: &Repository{
 11789  			ID:   Int64(1),
 11790  			URL:  String("s"),
 11791  			Name: String("n"),
 11792  		},
 11793  		Org: &Organization{
 11794  			BillingEmail:                         String("be"),
 11795  			Blog:                                 String("b"),
 11796  			Company:                              String("c"),
 11797  			Email:                                String("e"),
 11798  			TwitterUsername:                      String("tu"),
 11799  			Location:                             String("loc"),
 11800  			Name:                                 String("n"),
 11801  			Description:                          String("d"),
 11802  			IsVerified:                           Bool(true),
 11803  			HasOrganizationProjects:              Bool(true),
 11804  			HasRepositoryProjects:                Bool(true),
 11805  			DefaultRepoPermission:                String("drp"),
 11806  			MembersCanCreateRepos:                Bool(true),
 11807  			MembersCanCreateInternalRepos:        Bool(true),
 11808  			MembersCanCreatePrivateRepos:         Bool(true),
 11809  			MembersCanCreatePublicRepos:          Bool(false),
 11810  			MembersAllowedRepositoryCreationType: String("marct"),
 11811  			MembersCanCreatePages:                Bool(true),
 11812  			MembersCanCreatePublicPages:          Bool(false),
 11813  			MembersCanCreatePrivatePages:         Bool(true),
 11814  		},
 11815  		Sender: &User{
 11816  			Login:     String("l"),
 11817  			ID:        Int64(1),
 11818  			NodeID:    String("n"),
 11819  			URL:       String("u"),
 11820  			ReposURL:  String("r"),
 11821  			EventsURL: String("e"),
 11822  			AvatarURL: String("a"),
 11823  		},
 11824  		Installation: &Installation{
 11825  			ID:       Int64(1),
 11826  			NodeID:   String("nid"),
 11827  			AppID:    Int64(1),
 11828  			AppSlug:  String("as"),
 11829  			TargetID: Int64(1),
 11830  			Account: &User{
 11831  				Login:           String("l"),
 11832  				ID:              Int64(1),
 11833  				URL:             String("u"),
 11834  				AvatarURL:       String("a"),
 11835  				GravatarID:      String("g"),
 11836  				Name:            String("n"),
 11837  				Company:         String("c"),
 11838  				Blog:            String("b"),
 11839  				Location:        String("l"),
 11840  				Email:           String("e"),
 11841  				Hireable:        Bool(true),
 11842  				Bio:             String("b"),
 11843  				TwitterUsername: String("t"),
 11844  				PublicRepos:     Int(1),
 11845  				Followers:       Int(1),
 11846  				Following:       Int(1),
 11847  				CreatedAt:       &Timestamp{referenceTime},
 11848  				SuspendedAt:     &Timestamp{referenceTime},
 11849  			},
 11850  			AccessTokensURL:     String("atu"),
 11851  			RepositoriesURL:     String("ru"),
 11852  			HTMLURL:             String("hu"),
 11853  			TargetType:          String("tt"),
 11854  			SingleFileName:      String("sfn"),
 11855  			RepositorySelection: String("rs"),
 11856  			Events:              []string{"e"},
 11857  			SingleFilePaths:     []string{"s"},
 11858  			Permissions: &InstallationPermissions{
 11859  				Actions:                       String("a"),
 11860  				Administration:                String("ad"),
 11861  				Checks:                        String("c"),
 11862  				Contents:                      String("co"),
 11863  				ContentReferences:             String("cr"),
 11864  				Deployments:                   String("d"),
 11865  				Environments:                  String("e"),
 11866  				Issues:                        String("i"),
 11867  				Metadata:                      String("md"),
 11868  				Members:                       String("m"),
 11869  				OrganizationAdministration:    String("oa"),
 11870  				OrganizationHooks:             String("oh"),
 11871  				OrganizationPlan:              String("op"),
 11872  				OrganizationPreReceiveHooks:   String("opr"),
 11873  				OrganizationProjects:          String("op"),
 11874  				OrganizationSecrets:           String("os"),
 11875  				OrganizationSelfHostedRunners: String("osh"),
 11876  				OrganizationUserBlocking:      String("oub"),
 11877  				Packages:                      String("pkg"),
 11878  				Pages:                         String("pg"),
 11879  				PullRequests:                  String("pr"),
 11880  				RepositoryHooks:               String("rh"),
 11881  				RepositoryProjects:            String("rp"),
 11882  				RepositoryPreReceiveHooks:     String("rprh"),
 11883  				Secrets:                       String("s"),
 11884  				SecretScanningAlerts:          String("ssa"),
 11885  				SecurityEvents:                String("se"),
 11886  				SingleFile:                    String("sf"),
 11887  				Statuses:                      String("s"),
 11888  				TeamDiscussions:               String("td"),
 11889  				VulnerabilityAlerts:           String("va"),
 11890  				Workflows:                     String("w"),
 11891  			},
 11892  			CreatedAt:              &Timestamp{referenceTime},
 11893  			UpdatedAt:              &Timestamp{referenceTime},
 11894  			HasMultipleSingleFiles: Bool(false),
 11895  			SuspendedBy: &User{
 11896  				Login:           String("l"),
 11897  				ID:              Int64(1),
 11898  				URL:             String("u"),
 11899  				AvatarURL:       String("a"),
 11900  				GravatarID:      String("g"),
 11901  				Name:            String("n"),
 11902  				Company:         String("c"),
 11903  				Blog:            String("b"),
 11904  				Location:        String("l"),
 11905  				Email:           String("e"),
 11906  				Hireable:        Bool(true),
 11907  				Bio:             String("b"),
 11908  				TwitterUsername: String("t"),
 11909  				PublicRepos:     Int(1),
 11910  				Followers:       Int(1),
 11911  				Following:       Int(1),
 11912  				CreatedAt:       &Timestamp{referenceTime},
 11913  				SuspendedAt:     &Timestamp{referenceTime},
 11914  			},
 11915  			SuspendedAt: &Timestamp{referenceTime},
 11916  		},
 11917  	}
 11918  
 11919  	want := `{
 11920  		"action": "a",
 11921  		"changes": {
 11922  			"note": {
 11923  				"from": "NoteFrom"
 11924  			}
 11925  		},
 11926  		"after_id": 1,
 11927  		"project_card": {
 11928  			"id": 1
 11929  		},
 11930  		"repository": {
 11931  			"id": 1,
 11932  			"name": "n",
 11933  			"url": "s"
 11934  		},
 11935  		"organization": {
 11936  			"name": "n",
 11937  			"company": "c",
 11938  			"blog": "b",
 11939  			"location": "loc",
 11940  			"email": "e",
 11941  			"twitter_username": "tu",
 11942  			"description": "d",
 11943  			"billing_email": "be",
 11944  			"is_verified": true,
 11945  			"has_organization_projects": true,
 11946  			"has_repository_projects": true,
 11947  			"default_repository_permission": "drp",
 11948  			"members_can_create_repositories": true,
 11949  			"members_can_create_public_repositories": false,
 11950  			"members_can_create_private_repositories": true,
 11951  			"members_can_create_internal_repositories": true,
 11952  			"members_allowed_repository_creation_type": "marct",
 11953  			"members_can_create_pages": true,
 11954  			"members_can_create_public_pages": false,
 11955  			"members_can_create_private_pages": true
 11956  		},
 11957  		"sender": {
 11958  			"login": "l",
 11959  			"id": 1,
 11960  			"node_id": "n",
 11961  			"avatar_url": "a",
 11962  			"url": "u",
 11963  			"events_url": "e",
 11964  			"repos_url": "r"
 11965  		},
 11966  		"installation": {
 11967  			"id": 1,
 11968  			"node_id": "nid",
 11969  			"app_id": 1,
 11970  			"app_slug": "as",
 11971  			"target_id": 1,
 11972  			"account": {
 11973  				"login": "l",
 11974  				"id": 1,
 11975  				"avatar_url": "a",
 11976  				"gravatar_id": "g",
 11977  				"name": "n",
 11978  				"company": "c",
 11979  				"blog": "b",
 11980  				"location": "l",
 11981  				"email": "e",
 11982  				"hireable": true,
 11983  				"bio": "b",
 11984  				"twitter_username": "t",
 11985  				"public_repos": 1,
 11986  				"followers": 1,
 11987  				"following": 1,
 11988  				"created_at": ` + referenceTimeStr + `,
 11989  				"suspended_at": ` + referenceTimeStr + `,
 11990  				"url": "u"
 11991  			},
 11992  			"access_tokens_url": "atu",
 11993  			"repositories_url": "ru",
 11994  			"html_url": "hu",
 11995  			"target_type": "tt",
 11996  			"single_file_name": "sfn",
 11997  			"repository_selection": "rs",
 11998  			"events": [
 11999  				"e"
 12000  			],
 12001  			"single_file_paths": [
 12002  				"s"
 12003  			],
 12004  			"permissions": {
 12005  				"actions": "a",
 12006  				"administration": "ad",
 12007  				"checks": "c",
 12008  				"contents": "co",
 12009  				"content_references": "cr",
 12010  				"deployments": "d",
 12011  				"environments": "e",
 12012  				"issues": "i",
 12013  				"metadata": "md",
 12014  				"members": "m",
 12015  				"organization_administration": "oa",
 12016  				"organization_hooks": "oh",
 12017  				"organization_plan": "op",
 12018  				"organization_pre_receive_hooks": "opr",
 12019  				"organization_projects": "op",
 12020  				"organization_secrets": "os",
 12021  				"organization_self_hosted_runners": "osh",
 12022  				"organization_user_blocking": "oub",
 12023  				"packages": "pkg",
 12024  				"pages": "pg",
 12025  				"pull_requests": "pr",
 12026  				"repository_hooks": "rh",
 12027  				"repository_projects": "rp",
 12028  				"repository_pre_receive_hooks": "rprh",
 12029  				"secrets": "s",
 12030  				"secret_scanning_alerts": "ssa",
 12031  				"security_events": "se",
 12032  				"single_file": "sf",
 12033  				"statuses": "s",
 12034  				"team_discussions": "td",
 12035  				"vulnerability_alerts": "va",
 12036  				"workflows": "w"
 12037  			},
 12038  			"created_at": ` + referenceTimeStr + `,
 12039  			"updated_at": ` + referenceTimeStr + `,
 12040  			"has_multiple_single_files": false,
 12041  			"suspended_by": {
 12042  				"login": "l",
 12043  				"id": 1,
 12044  				"avatar_url": "a",
 12045  				"gravatar_id": "g",
 12046  				"name": "n",
 12047  				"company": "c",
 12048  				"blog": "b",
 12049  				"location": "l",
 12050  				"email": "e",
 12051  				"hireable": true,
 12052  				"bio": "b",
 12053  				"twitter_username": "t",
 12054  				"public_repos": 1,
 12055  				"followers": 1,
 12056  				"following": 1,
 12057  				"created_at": ` + referenceTimeStr + `,
 12058  				"suspended_at": ` + referenceTimeStr + `,
 12059  				"url": "u"
 12060  			},
 12061  			"suspended_at": ` + referenceTimeStr + `
 12062  		}
 12063  	}`
 12064  
 12065  	testJSONMarshal(t, u, want)
 12066  }
 12067  
 12068  func TestProjectColumnEvent_Marshal(t *testing.T) {
 12069  	testJSONMarshal(t, &ProjectColumnEvent{}, "{}")
 12070  
 12071  	u := &ProjectColumnEvent{
 12072  		Action: String("a"),
 12073  		Changes: &ProjectColumnChange{
 12074  			Name: &ProjectColumnName{From: String("NameFrom")},
 12075  		},
 12076  		AfterID:       Int64(1),
 12077  		ProjectColumn: &ProjectColumn{ID: Int64(1)},
 12078  		Repo: &Repository{
 12079  			ID:   Int64(1),
 12080  			URL:  String("s"),
 12081  			Name: String("n"),
 12082  		},
 12083  		Org: &Organization{
 12084  			BillingEmail:                         String("be"),
 12085  			Blog:                                 String("b"),
 12086  			Company:                              String("c"),
 12087  			Email:                                String("e"),
 12088  			TwitterUsername:                      String("tu"),
 12089  			Location:                             String("loc"),
 12090  			Name:                                 String("n"),
 12091  			Description:                          String("d"),
 12092  			IsVerified:                           Bool(true),
 12093  			HasOrganizationProjects:              Bool(true),
 12094  			HasRepositoryProjects:                Bool(true),
 12095  			DefaultRepoPermission:                String("drp"),
 12096  			MembersCanCreateRepos:                Bool(true),
 12097  			MembersCanCreateInternalRepos:        Bool(true),
 12098  			MembersCanCreatePrivateRepos:         Bool(true),
 12099  			MembersCanCreatePublicRepos:          Bool(false),
 12100  			MembersAllowedRepositoryCreationType: String("marct"),
 12101  			MembersCanCreatePages:                Bool(true),
 12102  			MembersCanCreatePublicPages:          Bool(false),
 12103  			MembersCanCreatePrivatePages:         Bool(true),
 12104  		},
 12105  		Sender: &User{
 12106  			Login:     String("l"),
 12107  			ID:        Int64(1),
 12108  			NodeID:    String("n"),
 12109  			URL:       String("u"),
 12110  			ReposURL:  String("r"),
 12111  			EventsURL: String("e"),
 12112  			AvatarURL: String("a"),
 12113  		},
 12114  		Installation: &Installation{
 12115  			ID:       Int64(1),
 12116  			NodeID:   String("nid"),
 12117  			AppID:    Int64(1),
 12118  			AppSlug:  String("as"),
 12119  			TargetID: Int64(1),
 12120  			Account: &User{
 12121  				Login:           String("l"),
 12122  				ID:              Int64(1),
 12123  				URL:             String("u"),
 12124  				AvatarURL:       String("a"),
 12125  				GravatarID:      String("g"),
 12126  				Name:            String("n"),
 12127  				Company:         String("c"),
 12128  				Blog:            String("b"),
 12129  				Location:        String("l"),
 12130  				Email:           String("e"),
 12131  				Hireable:        Bool(true),
 12132  				Bio:             String("b"),
 12133  				TwitterUsername: String("t"),
 12134  				PublicRepos:     Int(1),
 12135  				Followers:       Int(1),
 12136  				Following:       Int(1),
 12137  				CreatedAt:       &Timestamp{referenceTime},
 12138  				SuspendedAt:     &Timestamp{referenceTime},
 12139  			},
 12140  			AccessTokensURL:     String("atu"),
 12141  			RepositoriesURL:     String("ru"),
 12142  			HTMLURL:             String("hu"),
 12143  			TargetType:          String("tt"),
 12144  			SingleFileName:      String("sfn"),
 12145  			RepositorySelection: String("rs"),
 12146  			Events:              []string{"e"},
 12147  			SingleFilePaths:     []string{"s"},
 12148  			Permissions: &InstallationPermissions{
 12149  				Actions:                       String("a"),
 12150  				Administration:                String("ad"),
 12151  				Checks:                        String("c"),
 12152  				Contents:                      String("co"),
 12153  				ContentReferences:             String("cr"),
 12154  				Deployments:                   String("d"),
 12155  				Environments:                  String("e"),
 12156  				Issues:                        String("i"),
 12157  				Metadata:                      String("md"),
 12158  				Members:                       String("m"),
 12159  				OrganizationAdministration:    String("oa"),
 12160  				OrganizationHooks:             String("oh"),
 12161  				OrganizationPlan:              String("op"),
 12162  				OrganizationPreReceiveHooks:   String("opr"),
 12163  				OrganizationProjects:          String("op"),
 12164  				OrganizationSecrets:           String("os"),
 12165  				OrganizationSelfHostedRunners: String("osh"),
 12166  				OrganizationUserBlocking:      String("oub"),
 12167  				Packages:                      String("pkg"),
 12168  				Pages:                         String("pg"),
 12169  				PullRequests:                  String("pr"),
 12170  				RepositoryHooks:               String("rh"),
 12171  				RepositoryProjects:            String("rp"),
 12172  				RepositoryPreReceiveHooks:     String("rprh"),
 12173  				Secrets:                       String("s"),
 12174  				SecretScanningAlerts:          String("ssa"),
 12175  				SecurityEvents:                String("se"),
 12176  				SingleFile:                    String("sf"),
 12177  				Statuses:                      String("s"),
 12178  				TeamDiscussions:               String("td"),
 12179  				VulnerabilityAlerts:           String("va"),
 12180  				Workflows:                     String("w"),
 12181  			},
 12182  			CreatedAt:              &Timestamp{referenceTime},
 12183  			UpdatedAt:              &Timestamp{referenceTime},
 12184  			HasMultipleSingleFiles: Bool(false),
 12185  			SuspendedBy: &User{
 12186  				Login:           String("l"),
 12187  				ID:              Int64(1),
 12188  				URL:             String("u"),
 12189  				AvatarURL:       String("a"),
 12190  				GravatarID:      String("g"),
 12191  				Name:            String("n"),
 12192  				Company:         String("c"),
 12193  				Blog:            String("b"),
 12194  				Location:        String("l"),
 12195  				Email:           String("e"),
 12196  				Hireable:        Bool(true),
 12197  				Bio:             String("b"),
 12198  				TwitterUsername: String("t"),
 12199  				PublicRepos:     Int(1),
 12200  				Followers:       Int(1),
 12201  				Following:       Int(1),
 12202  				CreatedAt:       &Timestamp{referenceTime},
 12203  				SuspendedAt:     &Timestamp{referenceTime},
 12204  			},
 12205  			SuspendedAt: &Timestamp{referenceTime},
 12206  		},
 12207  	}
 12208  
 12209  	want := `{
 12210  		"action": "a",
 12211  		"changes": {
 12212  			"name": {
 12213  				"from": "NameFrom"
 12214  			}
 12215  		},
 12216  		"after_id": 1,
 12217  		"project_column": {
 12218  			"id": 1
 12219  		},
 12220  		"repository": {
 12221  			"id": 1,
 12222  			"name": "n",
 12223  			"url": "s"
 12224  		},
 12225  		"organization": {
 12226  			"name": "n",
 12227  			"company": "c",
 12228  			"blog": "b",
 12229  			"location": "loc",
 12230  			"email": "e",
 12231  			"twitter_username": "tu",
 12232  			"description": "d",
 12233  			"billing_email": "be",
 12234  			"is_verified": true,
 12235  			"has_organization_projects": true,
 12236  			"has_repository_projects": true,
 12237  			"default_repository_permission": "drp",
 12238  			"members_can_create_repositories": true,
 12239  			"members_can_create_public_repositories": false,
 12240  			"members_can_create_private_repositories": true,
 12241  			"members_can_create_internal_repositories": true,
 12242  			"members_allowed_repository_creation_type": "marct",
 12243  			"members_can_create_pages": true,
 12244  			"members_can_create_public_pages": false,
 12245  			"members_can_create_private_pages": true
 12246  		},
 12247  		"sender": {
 12248  			"login": "l",
 12249  			"id": 1,
 12250  			"node_id": "n",
 12251  			"avatar_url": "a",
 12252  			"url": "u",
 12253  			"events_url": "e",
 12254  			"repos_url": "r"
 12255  		},
 12256  		"installation": {
 12257  			"id": 1,
 12258  			"node_id": "nid",
 12259  			"app_id": 1,
 12260  			"app_slug": "as",
 12261  			"target_id": 1,
 12262  			"account": {
 12263  				"login": "l",
 12264  				"id": 1,
 12265  				"avatar_url": "a",
 12266  				"gravatar_id": "g",
 12267  				"name": "n",
 12268  				"company": "c",
 12269  				"blog": "b",
 12270  				"location": "l",
 12271  				"email": "e",
 12272  				"hireable": true,
 12273  				"bio": "b",
 12274  				"twitter_username": "t",
 12275  				"public_repos": 1,
 12276  				"followers": 1,
 12277  				"following": 1,
 12278  				"created_at": ` + referenceTimeStr + `,
 12279  				"suspended_at": ` + referenceTimeStr + `,
 12280  				"url": "u"
 12281  			},
 12282  			"access_tokens_url": "atu",
 12283  			"repositories_url": "ru",
 12284  			"html_url": "hu",
 12285  			"target_type": "tt",
 12286  			"single_file_name": "sfn",
 12287  			"repository_selection": "rs",
 12288  			"events": [
 12289  				"e"
 12290  			],
 12291  			"single_file_paths": [
 12292  				"s"
 12293  			],
 12294  			"permissions": {
 12295  				"actions": "a",
 12296  				"administration": "ad",
 12297  				"checks": "c",
 12298  				"contents": "co",
 12299  				"content_references": "cr",
 12300  				"deployments": "d",
 12301  				"environments": "e",
 12302  				"issues": "i",
 12303  				"metadata": "md",
 12304  				"members": "m",
 12305  				"organization_administration": "oa",
 12306  				"organization_hooks": "oh",
 12307  				"organization_plan": "op",
 12308  				"organization_pre_receive_hooks": "opr",
 12309  				"organization_projects": "op",
 12310  				"organization_secrets": "os",
 12311  				"organization_self_hosted_runners": "osh",
 12312  				"organization_user_blocking": "oub",
 12313  				"packages": "pkg",
 12314  				"pages": "pg",
 12315  				"pull_requests": "pr",
 12316  				"repository_hooks": "rh",
 12317  				"repository_projects": "rp",
 12318  				"repository_pre_receive_hooks": "rprh",
 12319  				"secrets": "s",
 12320  				"secret_scanning_alerts": "ssa",
 12321  				"security_events": "se",
 12322  				"single_file": "sf",
 12323  				"statuses": "s",
 12324  				"team_discussions": "td",
 12325  				"vulnerability_alerts": "va",
 12326  				"workflows": "w"
 12327  			},
 12328  			"created_at": ` + referenceTimeStr + `,
 12329  			"updated_at": ` + referenceTimeStr + `,
 12330  			"has_multiple_single_files": false,
 12331  			"suspended_by": {
 12332  				"login": "l",
 12333  				"id": 1,
 12334  				"avatar_url": "a",
 12335  				"gravatar_id": "g",
 12336  				"name": "n",
 12337  				"company": "c",
 12338  				"blog": "b",
 12339  				"location": "l",
 12340  				"email": "e",
 12341  				"hireable": true,
 12342  				"bio": "b",
 12343  				"twitter_username": "t",
 12344  				"public_repos": 1,
 12345  				"followers": 1,
 12346  				"following": 1,
 12347  				"created_at": ` + referenceTimeStr + `,
 12348  				"suspended_at": ` + referenceTimeStr + `,
 12349  				"url": "u"
 12350  			},
 12351  			"suspended_at": ` + referenceTimeStr + `
 12352  		}
 12353  	}`
 12354  
 12355  	testJSONMarshal(t, u, want)
 12356  }
 12357  
 12358  func TestPullRequestEvent_Marshal(t *testing.T) {
 12359  	testJSONMarshal(t, &PullRequestEvent{}, "{}")
 12360  
 12361  	u := &PullRequestEvent{
 12362  		Action: String("a"),
 12363  		Assignee: &User{
 12364  			Login:     String("l"),
 12365  			ID:        Int64(1),
 12366  			NodeID:    String("n"),
 12367  			URL:       String("u"),
 12368  			ReposURL:  String("r"),
 12369  			EventsURL: String("e"),
 12370  			AvatarURL: String("a"),
 12371  		},
 12372  		Number:      Int(1),
 12373  		PullRequest: &PullRequest{ID: Int64(1)},
 12374  		Changes: &EditChange{
 12375  			Title: &EditTitle{
 12376  				From: String("TitleFrom"),
 12377  			},
 12378  			Body: &EditBody{
 12379  				From: String("BodyFrom"),
 12380  			},
 12381  			Base: &EditBase{
 12382  				Ref: &EditRef{
 12383  					From: String("BaseRefFrom"),
 12384  				},
 12385  				SHA: &EditSHA{
 12386  					From: String("BaseSHAFrom"),
 12387  				},
 12388  			},
 12389  		},
 12390  		RequestedReviewer: &User{
 12391  			Login:     String("l"),
 12392  			ID:        Int64(1),
 12393  			NodeID:    String("n"),
 12394  			URL:       String("u"),
 12395  			ReposURL:  String("r"),
 12396  			EventsURL: String("e"),
 12397  			AvatarURL: String("a"),
 12398  		},
 12399  		RequestedTeam: &Team{ID: Int64(1)},
 12400  		Label:         &Label{ID: Int64(1)},
 12401  		Before:        String("before"),
 12402  		After:         String("after"),
 12403  		Repo: &Repository{
 12404  			ID:   Int64(1),
 12405  			URL:  String("s"),
 12406  			Name: String("n"),
 12407  		},
 12408  		Organization: &Organization{
 12409  			BillingEmail:                         String("be"),
 12410  			Blog:                                 String("b"),
 12411  			Company:                              String("c"),
 12412  			Email:                                String("e"),
 12413  			TwitterUsername:                      String("tu"),
 12414  			Location:                             String("loc"),
 12415  			Name:                                 String("n"),
 12416  			Description:                          String("d"),
 12417  			IsVerified:                           Bool(true),
 12418  			HasOrganizationProjects:              Bool(true),
 12419  			HasRepositoryProjects:                Bool(true),
 12420  			DefaultRepoPermission:                String("drp"),
 12421  			MembersCanCreateRepos:                Bool(true),
 12422  			MembersCanCreateInternalRepos:        Bool(true),
 12423  			MembersCanCreatePrivateRepos:         Bool(true),
 12424  			MembersCanCreatePublicRepos:          Bool(false),
 12425  			MembersAllowedRepositoryCreationType: String("marct"),
 12426  			MembersCanCreatePages:                Bool(true),
 12427  			MembersCanCreatePublicPages:          Bool(false),
 12428  			MembersCanCreatePrivatePages:         Bool(true),
 12429  		},
 12430  		Sender: &User{
 12431  			Login:     String("l"),
 12432  			ID:        Int64(1),
 12433  			NodeID:    String("n"),
 12434  			URL:       String("u"),
 12435  			ReposURL:  String("r"),
 12436  			EventsURL: String("e"),
 12437  			AvatarURL: String("a"),
 12438  		},
 12439  		Installation: &Installation{
 12440  			ID:       Int64(1),
 12441  			NodeID:   String("nid"),
 12442  			AppID:    Int64(1),
 12443  			AppSlug:  String("as"),
 12444  			TargetID: Int64(1),
 12445  			Account: &User{
 12446  				Login:           String("l"),
 12447  				ID:              Int64(1),
 12448  				URL:             String("u"),
 12449  				AvatarURL:       String("a"),
 12450  				GravatarID:      String("g"),
 12451  				Name:            String("n"),
 12452  				Company:         String("c"),
 12453  				Blog:            String("b"),
 12454  				Location:        String("l"),
 12455  				Email:           String("e"),
 12456  				Hireable:        Bool(true),
 12457  				Bio:             String("b"),
 12458  				TwitterUsername: String("t"),
 12459  				PublicRepos:     Int(1),
 12460  				Followers:       Int(1),
 12461  				Following:       Int(1),
 12462  				CreatedAt:       &Timestamp{referenceTime},
 12463  				SuspendedAt:     &Timestamp{referenceTime},
 12464  			},
 12465  			AccessTokensURL:     String("atu"),
 12466  			RepositoriesURL:     String("ru"),
 12467  			HTMLURL:             String("hu"),
 12468  			TargetType:          String("tt"),
 12469  			SingleFileName:      String("sfn"),
 12470  			RepositorySelection: String("rs"),
 12471  			Events:              []string{"e"},
 12472  			SingleFilePaths:     []string{"s"},
 12473  			Permissions: &InstallationPermissions{
 12474  				Actions:                       String("a"),
 12475  				Administration:                String("ad"),
 12476  				Checks:                        String("c"),
 12477  				Contents:                      String("co"),
 12478  				ContentReferences:             String("cr"),
 12479  				Deployments:                   String("d"),
 12480  				Environments:                  String("e"),
 12481  				Issues:                        String("i"),
 12482  				Metadata:                      String("md"),
 12483  				Members:                       String("m"),
 12484  				OrganizationAdministration:    String("oa"),
 12485  				OrganizationHooks:             String("oh"),
 12486  				OrganizationPlan:              String("op"),
 12487  				OrganizationPreReceiveHooks:   String("opr"),
 12488  				OrganizationProjects:          String("op"),
 12489  				OrganizationSecrets:           String("os"),
 12490  				OrganizationSelfHostedRunners: String("osh"),
 12491  				OrganizationUserBlocking:      String("oub"),
 12492  				Packages:                      String("pkg"),
 12493  				Pages:                         String("pg"),
 12494  				PullRequests:                  String("pr"),
 12495  				RepositoryHooks:               String("rh"),
 12496  				RepositoryProjects:            String("rp"),
 12497  				RepositoryPreReceiveHooks:     String("rprh"),
 12498  				Secrets:                       String("s"),
 12499  				SecretScanningAlerts:          String("ssa"),
 12500  				SecurityEvents:                String("se"),
 12501  				SingleFile:                    String("sf"),
 12502  				Statuses:                      String("s"),
 12503  				TeamDiscussions:               String("td"),
 12504  				VulnerabilityAlerts:           String("va"),
 12505  				Workflows:                     String("w"),
 12506  			},
 12507  			CreatedAt:              &Timestamp{referenceTime},
 12508  			UpdatedAt:              &Timestamp{referenceTime},
 12509  			HasMultipleSingleFiles: Bool(false),
 12510  			SuspendedBy: &User{
 12511  				Login:           String("l"),
 12512  				ID:              Int64(1),
 12513  				URL:             String("u"),
 12514  				AvatarURL:       String("a"),
 12515  				GravatarID:      String("g"),
 12516  				Name:            String("n"),
 12517  				Company:         String("c"),
 12518  				Blog:            String("b"),
 12519  				Location:        String("l"),
 12520  				Email:           String("e"),
 12521  				Hireable:        Bool(true),
 12522  				Bio:             String("b"),
 12523  				TwitterUsername: String("t"),
 12524  				PublicRepos:     Int(1),
 12525  				Followers:       Int(1),
 12526  				Following:       Int(1),
 12527  				CreatedAt:       &Timestamp{referenceTime},
 12528  				SuspendedAt:     &Timestamp{referenceTime},
 12529  			},
 12530  			SuspendedAt: &Timestamp{referenceTime},
 12531  		},
 12532  	}
 12533  
 12534  	want := `{
 12535  		"action": "a",
 12536  		"assignee": {
 12537  			"login": "l",
 12538  			"id": 1,
 12539  			"node_id": "n",
 12540  			"avatar_url": "a",
 12541  			"url": "u",
 12542  			"events_url": "e",
 12543  			"repos_url": "r"
 12544  		},
 12545  		"number": 1,
 12546  		"pull_request": {
 12547  			"id": 1
 12548  		},
 12549  		"changes": {
 12550  			"title": {
 12551  				"from": "TitleFrom"
 12552  			},
 12553  			"body": {
 12554  				"from": "BodyFrom"
 12555  			},
 12556  			"base": {
 12557  				"ref": {
 12558  					"from": "BaseRefFrom"
 12559  				},
 12560  				"sha": {
 12561  					"from": "BaseSHAFrom"
 12562  				}
 12563  			}
 12564  		},
 12565  		"requested_reviewer": {
 12566  			"login": "l",
 12567  			"id": 1,
 12568  			"node_id": "n",
 12569  			"avatar_url": "a",
 12570  			"url": "u",
 12571  			"events_url": "e",
 12572  			"repos_url": "r"
 12573  		},
 12574  		"requested_team": {
 12575  			"id": 1
 12576  		},
 12577  		"repository": {
 12578  			"id": 1,
 12579  			"name": "n",
 12580  			"url": "s"
 12581  		},
 12582  		"sender": {
 12583  			"login": "l",
 12584  			"id": 1,
 12585  			"node_id": "n",
 12586  			"avatar_url": "a",
 12587  			"url": "u",
 12588  			"events_url": "e",
 12589  			"repos_url": "r"
 12590  		},
 12591  		"installation": {
 12592  			"id": 1,
 12593  			"node_id": "nid",
 12594  			"app_id": 1,
 12595  			"app_slug": "as",
 12596  			"target_id": 1,
 12597  			"account": {
 12598  				"login": "l",
 12599  				"id": 1,
 12600  				"avatar_url": "a",
 12601  				"gravatar_id": "g",
 12602  				"name": "n",
 12603  				"company": "c",
 12604  				"blog": "b",
 12605  				"location": "l",
 12606  				"email": "e",
 12607  				"hireable": true,
 12608  				"bio": "b",
 12609  				"twitter_username": "t",
 12610  				"public_repos": 1,
 12611  				"followers": 1,
 12612  				"following": 1,
 12613  				"created_at": ` + referenceTimeStr + `,
 12614  				"suspended_at": ` + referenceTimeStr + `,
 12615  				"url": "u"
 12616  			},
 12617  			"access_tokens_url": "atu",
 12618  			"repositories_url": "ru",
 12619  			"html_url": "hu",
 12620  			"target_type": "tt",
 12621  			"single_file_name": "sfn",
 12622  			"repository_selection": "rs",
 12623  			"events": [
 12624  				"e"
 12625  			],
 12626  			"single_file_paths": [
 12627  				"s"
 12628  			],
 12629  			"permissions": {
 12630  				"actions": "a",
 12631  				"administration": "ad",
 12632  				"checks": "c",
 12633  				"contents": "co",
 12634  				"content_references": "cr",
 12635  				"deployments": "d",
 12636  				"environments": "e",
 12637  				"issues": "i",
 12638  				"metadata": "md",
 12639  				"members": "m",
 12640  				"organization_administration": "oa",
 12641  				"organization_hooks": "oh",
 12642  				"organization_plan": "op",
 12643  				"organization_pre_receive_hooks": "opr",
 12644  				"organization_projects": "op",
 12645  				"organization_secrets": "os",
 12646  				"organization_self_hosted_runners": "osh",
 12647  				"organization_user_blocking": "oub",
 12648  				"packages": "pkg",
 12649  				"pages": "pg",
 12650  				"pull_requests": "pr",
 12651  				"repository_hooks": "rh",
 12652  				"repository_projects": "rp",
 12653  				"repository_pre_receive_hooks": "rprh",
 12654  				"secrets": "s",
 12655  				"secret_scanning_alerts": "ssa",
 12656  				"security_events": "se",
 12657  				"single_file": "sf",
 12658  				"statuses": "s",
 12659  				"team_discussions": "td",
 12660  				"vulnerability_alerts": "va",
 12661  				"workflows": "w"
 12662  			},
 12663  			"created_at": ` + referenceTimeStr + `,
 12664  			"updated_at": ` + referenceTimeStr + `,
 12665  			"has_multiple_single_files": false,
 12666  			"suspended_by": {
 12667  				"login": "l",
 12668  				"id": 1,
 12669  				"avatar_url": "a",
 12670  				"gravatar_id": "g",
 12671  				"name": "n",
 12672  				"company": "c",
 12673  				"blog": "b",
 12674  				"location": "l",
 12675  				"email": "e",
 12676  				"hireable": true,
 12677  				"bio": "b",
 12678  				"twitter_username": "t",
 12679  				"public_repos": 1,
 12680  				"followers": 1,
 12681  				"following": 1,
 12682  				"created_at": ` + referenceTimeStr + `,
 12683  				"suspended_at": ` + referenceTimeStr + `,
 12684  				"url": "u"
 12685  			},
 12686  			"suspended_at": ` + referenceTimeStr + `
 12687  		},
 12688  		"label": {
 12689  			"id": 1
 12690  		},
 12691  		"organization": {
 12692  			"name": "n",
 12693  			"company": "c",
 12694  			"blog": "b",
 12695  			"location": "loc",
 12696  			"email": "e",
 12697  			"twitter_username": "tu",
 12698  			"description": "d",
 12699  			"billing_email": "be",
 12700  			"is_verified": true,
 12701  			"has_organization_projects": true,
 12702  			"has_repository_projects": true,
 12703  			"default_repository_permission": "drp",
 12704  			"members_can_create_repositories": true,
 12705  			"members_can_create_public_repositories": false,
 12706  			"members_can_create_private_repositories": true,
 12707  			"members_can_create_internal_repositories": true,
 12708  			"members_allowed_repository_creation_type": "marct",
 12709  			"members_can_create_pages": true,
 12710  			"members_can_create_public_pages": false,
 12711  			"members_can_create_private_pages": true
 12712  		},
 12713  		"before": "before",
 12714  		"after": "after"
 12715  	}`
 12716  
 12717  	testJSONMarshal(t, u, want)
 12718  }
 12719  
 12720  func TestPullRequestReviewCommentEvent_Marshal(t *testing.T) {
 12721  	testJSONMarshal(t, &PullRequestReviewCommentEvent{}, "{}")
 12722  
 12723  	u := &PullRequestReviewCommentEvent{
 12724  		Action:      String("a"),
 12725  		PullRequest: &PullRequest{ID: Int64(1)},
 12726  		Comment:     &PullRequestComment{ID: Int64(1)},
 12727  		Changes: &EditChange{
 12728  			Title: &EditTitle{
 12729  				From: String("TitleFrom"),
 12730  			},
 12731  			Body: &EditBody{
 12732  				From: String("BodyFrom"),
 12733  			},
 12734  			Base: &EditBase{
 12735  				Ref: &EditRef{
 12736  					From: String("BaseRefFrom"),
 12737  				},
 12738  				SHA: &EditSHA{
 12739  					From: String("BaseSHAFrom"),
 12740  				},
 12741  			},
 12742  		},
 12743  		Repo: &Repository{
 12744  			ID:   Int64(1),
 12745  			URL:  String("s"),
 12746  			Name: String("n"),
 12747  		},
 12748  		Sender: &User{
 12749  			Login:     String("l"),
 12750  			ID:        Int64(1),
 12751  			NodeID:    String("n"),
 12752  			URL:       String("u"),
 12753  			ReposURL:  String("r"),
 12754  			EventsURL: String("e"),
 12755  			AvatarURL: String("a"),
 12756  		},
 12757  		Installation: &Installation{
 12758  			ID:       Int64(1),
 12759  			NodeID:   String("nid"),
 12760  			AppID:    Int64(1),
 12761  			AppSlug:  String("as"),
 12762  			TargetID: Int64(1),
 12763  			Account: &User{
 12764  				Login:           String("l"),
 12765  				ID:              Int64(1),
 12766  				URL:             String("u"),
 12767  				AvatarURL:       String("a"),
 12768  				GravatarID:      String("g"),
 12769  				Name:            String("n"),
 12770  				Company:         String("c"),
 12771  				Blog:            String("b"),
 12772  				Location:        String("l"),
 12773  				Email:           String("e"),
 12774  				Hireable:        Bool(true),
 12775  				Bio:             String("b"),
 12776  				TwitterUsername: String("t"),
 12777  				PublicRepos:     Int(1),
 12778  				Followers:       Int(1),
 12779  				Following:       Int(1),
 12780  				CreatedAt:       &Timestamp{referenceTime},
 12781  				SuspendedAt:     &Timestamp{referenceTime},
 12782  			},
 12783  			AccessTokensURL:     String("atu"),
 12784  			RepositoriesURL:     String("ru"),
 12785  			HTMLURL:             String("hu"),
 12786  			TargetType:          String("tt"),
 12787  			SingleFileName:      String("sfn"),
 12788  			RepositorySelection: String("rs"),
 12789  			Events:              []string{"e"},
 12790  			SingleFilePaths:     []string{"s"},
 12791  			Permissions: &InstallationPermissions{
 12792  				Actions:                       String("a"),
 12793  				Administration:                String("ad"),
 12794  				Checks:                        String("c"),
 12795  				Contents:                      String("co"),
 12796  				ContentReferences:             String("cr"),
 12797  				Deployments:                   String("d"),
 12798  				Environments:                  String("e"),
 12799  				Issues:                        String("i"),
 12800  				Metadata:                      String("md"),
 12801  				Members:                       String("m"),
 12802  				OrganizationAdministration:    String("oa"),
 12803  				OrganizationHooks:             String("oh"),
 12804  				OrganizationPlan:              String("op"),
 12805  				OrganizationPreReceiveHooks:   String("opr"),
 12806  				OrganizationProjects:          String("op"),
 12807  				OrganizationSecrets:           String("os"),
 12808  				OrganizationSelfHostedRunners: String("osh"),
 12809  				OrganizationUserBlocking:      String("oub"),
 12810  				Packages:                      String("pkg"),
 12811  				Pages:                         String("pg"),
 12812  				PullRequests:                  String("pr"),
 12813  				RepositoryHooks:               String("rh"),
 12814  				RepositoryProjects:            String("rp"),
 12815  				RepositoryPreReceiveHooks:     String("rprh"),
 12816  				Secrets:                       String("s"),
 12817  				SecretScanningAlerts:          String("ssa"),
 12818  				SecurityEvents:                String("se"),
 12819  				SingleFile:                    String("sf"),
 12820  				Statuses:                      String("s"),
 12821  				TeamDiscussions:               String("td"),
 12822  				VulnerabilityAlerts:           String("va"),
 12823  				Workflows:                     String("w"),
 12824  			},
 12825  			CreatedAt:              &Timestamp{referenceTime},
 12826  			UpdatedAt:              &Timestamp{referenceTime},
 12827  			HasMultipleSingleFiles: Bool(false),
 12828  			SuspendedBy: &User{
 12829  				Login:           String("l"),
 12830  				ID:              Int64(1),
 12831  				URL:             String("u"),
 12832  				AvatarURL:       String("a"),
 12833  				GravatarID:      String("g"),
 12834  				Name:            String("n"),
 12835  				Company:         String("c"),
 12836  				Blog:            String("b"),
 12837  				Location:        String("l"),
 12838  				Email:           String("e"),
 12839  				Hireable:        Bool(true),
 12840  				Bio:             String("b"),
 12841  				TwitterUsername: String("t"),
 12842  				PublicRepos:     Int(1),
 12843  				Followers:       Int(1),
 12844  				Following:       Int(1),
 12845  				CreatedAt:       &Timestamp{referenceTime},
 12846  				SuspendedAt:     &Timestamp{referenceTime},
 12847  			},
 12848  			SuspendedAt: &Timestamp{referenceTime},
 12849  		},
 12850  	}
 12851  
 12852  	want := `{
 12853  		"action": "a",
 12854  		"pull_request": {
 12855  			"id": 1
 12856  		},
 12857  		"comment": {
 12858  			"id": 1
 12859  		},
 12860  		"changes": {
 12861  			"title": {
 12862  				"from": "TitleFrom"
 12863  			},
 12864  			"body": {
 12865  				"from": "BodyFrom"
 12866  			},
 12867  			"base": {
 12868  				"ref": {
 12869  					"from": "BaseRefFrom"
 12870  				},
 12871  				"sha": {
 12872  					"from": "BaseSHAFrom"
 12873  				}
 12874  			}
 12875  		},
 12876  		"repository": {
 12877  			"id": 1,
 12878  			"name": "n",
 12879  			"url": "s"
 12880  		},
 12881  		"sender": {
 12882  			"login": "l",
 12883  			"id": 1,
 12884  			"node_id": "n",
 12885  			"avatar_url": "a",
 12886  			"url": "u",
 12887  			"events_url": "e",
 12888  			"repos_url": "r"
 12889  		},
 12890  		"installation": {
 12891  			"id": 1,
 12892  			"node_id": "nid",
 12893  			"app_id": 1,
 12894  			"app_slug": "as",
 12895  			"target_id": 1,
 12896  			"account": {
 12897  				"login": "l",
 12898  				"id": 1,
 12899  				"avatar_url": "a",
 12900  				"gravatar_id": "g",
 12901  				"name": "n",
 12902  				"company": "c",
 12903  				"blog": "b",
 12904  				"location": "l",
 12905  				"email": "e",
 12906  				"hireable": true,
 12907  				"bio": "b",
 12908  				"twitter_username": "t",
 12909  				"public_repos": 1,
 12910  				"followers": 1,
 12911  				"following": 1,
 12912  				"created_at": ` + referenceTimeStr + `,
 12913  				"suspended_at": ` + referenceTimeStr + `,
 12914  				"url": "u"
 12915  			},
 12916  			"access_tokens_url": "atu",
 12917  			"repositories_url": "ru",
 12918  			"html_url": "hu",
 12919  			"target_type": "tt",
 12920  			"single_file_name": "sfn",
 12921  			"repository_selection": "rs",
 12922  			"events": [
 12923  				"e"
 12924  			],
 12925  			"single_file_paths": [
 12926  				"s"
 12927  			],
 12928  			"permissions": {
 12929  				"actions": "a",
 12930  				"administration": "ad",
 12931  				"checks": "c",
 12932  				"contents": "co",
 12933  				"content_references": "cr",
 12934  				"deployments": "d",
 12935  				"environments": "e",
 12936  				"issues": "i",
 12937  				"metadata": "md",
 12938  				"members": "m",
 12939  				"organization_administration": "oa",
 12940  				"organization_hooks": "oh",
 12941  				"organization_plan": "op",
 12942  				"organization_pre_receive_hooks": "opr",
 12943  				"organization_projects": "op",
 12944  				"organization_secrets": "os",
 12945  				"organization_self_hosted_runners": "osh",
 12946  				"organization_user_blocking": "oub",
 12947  				"packages": "pkg",
 12948  				"pages": "pg",
 12949  				"pull_requests": "pr",
 12950  				"repository_hooks": "rh",
 12951  				"repository_projects": "rp",
 12952  				"repository_pre_receive_hooks": "rprh",
 12953  				"secrets": "s",
 12954  				"secret_scanning_alerts": "ssa",
 12955  				"security_events": "se",
 12956  				"single_file": "sf",
 12957  				"statuses": "s",
 12958  				"team_discussions": "td",
 12959  				"vulnerability_alerts": "va",
 12960  				"workflows": "w"
 12961  			},
 12962  			"created_at": ` + referenceTimeStr + `,
 12963  			"updated_at": ` + referenceTimeStr + `,
 12964  			"has_multiple_single_files": false,
 12965  			"suspended_by": {
 12966  				"login": "l",
 12967  				"id": 1,
 12968  				"avatar_url": "a",
 12969  				"gravatar_id": "g",
 12970  				"name": "n",
 12971  				"company": "c",
 12972  				"blog": "b",
 12973  				"location": "l",
 12974  				"email": "e",
 12975  				"hireable": true,
 12976  				"bio": "b",
 12977  				"twitter_username": "t",
 12978  				"public_repos": 1,
 12979  				"followers": 1,
 12980  				"following": 1,
 12981  				"created_at": ` + referenceTimeStr + `,
 12982  				"suspended_at": ` + referenceTimeStr + `,
 12983  				"url": "u"
 12984  			},
 12985  			"suspended_at": ` + referenceTimeStr + `
 12986  		}
 12987  	}`
 12988  
 12989  	testJSONMarshal(t, u, want)
 12990  }
 12991  
 12992  func TestPullRequestTargetEvent_Marshal(t *testing.T) {
 12993  	testJSONMarshal(t, &PullRequestTargetEvent{}, "{}")
 12994  
 12995  	u := &PullRequestTargetEvent{
 12996  		Action: String("a"),
 12997  		Assignee: &User{
 12998  			Login:     String("l"),
 12999  			ID:        Int64(1),
 13000  			NodeID:    String("n"),
 13001  			URL:       String("u"),
 13002  			ReposURL:  String("r"),
 13003  			EventsURL: String("e"),
 13004  			AvatarURL: String("a"),
 13005  		},
 13006  		Number:      Int(1),
 13007  		PullRequest: &PullRequest{ID: Int64(1)},
 13008  		Changes: &EditChange{
 13009  			Title: &EditTitle{
 13010  				From: String("TitleFrom"),
 13011  			},
 13012  			Body: &EditBody{
 13013  				From: String("BodyFrom"),
 13014  			},
 13015  			Base: &EditBase{
 13016  				Ref: &EditRef{
 13017  					From: String("BaseRefFrom"),
 13018  				},
 13019  				SHA: &EditSHA{
 13020  					From: String("BaseSHAFrom"),
 13021  				},
 13022  			},
 13023  		},
 13024  		RequestedReviewer: &User{
 13025  			Login:     String("l"),
 13026  			ID:        Int64(1),
 13027  			NodeID:    String("n"),
 13028  			URL:       String("u"),
 13029  			ReposURL:  String("r"),
 13030  			EventsURL: String("e"),
 13031  			AvatarURL: String("a"),
 13032  		},
 13033  		RequestedTeam: &Team{ID: Int64(1)},
 13034  		Label:         &Label{ID: Int64(1)},
 13035  		Before:        String("before"),
 13036  		After:         String("after"),
 13037  		Repo: &Repository{
 13038  			ID:   Int64(1),
 13039  			URL:  String("s"),
 13040  			Name: String("n"),
 13041  		},
 13042  		Organization: &Organization{
 13043  			BillingEmail:                         String("be"),
 13044  			Blog:                                 String("b"),
 13045  			Company:                              String("c"),
 13046  			Email:                                String("e"),
 13047  			TwitterUsername:                      String("tu"),
 13048  			Location:                             String("loc"),
 13049  			Name:                                 String("n"),
 13050  			Description:                          String("d"),
 13051  			IsVerified:                           Bool(true),
 13052  			HasOrganizationProjects:              Bool(true),
 13053  			HasRepositoryProjects:                Bool(true),
 13054  			DefaultRepoPermission:                String("drp"),
 13055  			MembersCanCreateRepos:                Bool(true),
 13056  			MembersCanCreateInternalRepos:        Bool(true),
 13057  			MembersCanCreatePrivateRepos:         Bool(true),
 13058  			MembersCanCreatePublicRepos:          Bool(false),
 13059  			MembersAllowedRepositoryCreationType: String("marct"),
 13060  			MembersCanCreatePages:                Bool(true),
 13061  			MembersCanCreatePublicPages:          Bool(false),
 13062  			MembersCanCreatePrivatePages:         Bool(true),
 13063  		},
 13064  		Sender: &User{
 13065  			Login:     String("l"),
 13066  			ID:        Int64(1),
 13067  			NodeID:    String("n"),
 13068  			URL:       String("u"),
 13069  			ReposURL:  String("r"),
 13070  			EventsURL: String("e"),
 13071  			AvatarURL: String("a"),
 13072  		},
 13073  		Installation: &Installation{
 13074  			ID:       Int64(1),
 13075  			NodeID:   String("nid"),
 13076  			AppID:    Int64(1),
 13077  			AppSlug:  String("as"),
 13078  			TargetID: Int64(1),
 13079  			Account: &User{
 13080  				Login:           String("l"),
 13081  				ID:              Int64(1),
 13082  				URL:             String("u"),
 13083  				AvatarURL:       String("a"),
 13084  				GravatarID:      String("g"),
 13085  				Name:            String("n"),
 13086  				Company:         String("c"),
 13087  				Blog:            String("b"),
 13088  				Location:        String("l"),
 13089  				Email:           String("e"),
 13090  				Hireable:        Bool(true),
 13091  				Bio:             String("b"),
 13092  				TwitterUsername: String("t"),
 13093  				PublicRepos:     Int(1),
 13094  				Followers:       Int(1),
 13095  				Following:       Int(1),
 13096  				CreatedAt:       &Timestamp{referenceTime},
 13097  				SuspendedAt:     &Timestamp{referenceTime},
 13098  			},
 13099  			AccessTokensURL:     String("atu"),
 13100  			RepositoriesURL:     String("ru"),
 13101  			HTMLURL:             String("hu"),
 13102  			TargetType:          String("tt"),
 13103  			SingleFileName:      String("sfn"),
 13104  			RepositorySelection: String("rs"),
 13105  			Events:              []string{"e"},
 13106  			SingleFilePaths:     []string{"s"},
 13107  			Permissions: &InstallationPermissions{
 13108  				Actions:                       String("a"),
 13109  				Administration:                String("ad"),
 13110  				Checks:                        String("c"),
 13111  				Contents:                      String("co"),
 13112  				ContentReferences:             String("cr"),
 13113  				Deployments:                   String("d"),
 13114  				Environments:                  String("e"),
 13115  				Issues:                        String("i"),
 13116  				Metadata:                      String("md"),
 13117  				Members:                       String("m"),
 13118  				OrganizationAdministration:    String("oa"),
 13119  				OrganizationHooks:             String("oh"),
 13120  				OrganizationPlan:              String("op"),
 13121  				OrganizationPreReceiveHooks:   String("opr"),
 13122  				OrganizationProjects:          String("op"),
 13123  				OrganizationSecrets:           String("os"),
 13124  				OrganizationSelfHostedRunners: String("osh"),
 13125  				OrganizationUserBlocking:      String("oub"),
 13126  				Packages:                      String("pkg"),
 13127  				Pages:                         String("pg"),
 13128  				PullRequests:                  String("pr"),
 13129  				RepositoryHooks:               String("rh"),
 13130  				RepositoryProjects:            String("rp"),
 13131  				RepositoryPreReceiveHooks:     String("rprh"),
 13132  				Secrets:                       String("s"),
 13133  				SecretScanningAlerts:          String("ssa"),
 13134  				SecurityEvents:                String("se"),
 13135  				SingleFile:                    String("sf"),
 13136  				Statuses:                      String("s"),
 13137  				TeamDiscussions:               String("td"),
 13138  				VulnerabilityAlerts:           String("va"),
 13139  				Workflows:                     String("w"),
 13140  			},
 13141  			CreatedAt:              &Timestamp{referenceTime},
 13142  			UpdatedAt:              &Timestamp{referenceTime},
 13143  			HasMultipleSingleFiles: Bool(false),
 13144  			SuspendedBy: &User{
 13145  				Login:           String("l"),
 13146  				ID:              Int64(1),
 13147  				URL:             String("u"),
 13148  				AvatarURL:       String("a"),
 13149  				GravatarID:      String("g"),
 13150  				Name:            String("n"),
 13151  				Company:         String("c"),
 13152  				Blog:            String("b"),
 13153  				Location:        String("l"),
 13154  				Email:           String("e"),
 13155  				Hireable:        Bool(true),
 13156  				Bio:             String("b"),
 13157  				TwitterUsername: String("t"),
 13158  				PublicRepos:     Int(1),
 13159  				Followers:       Int(1),
 13160  				Following:       Int(1),
 13161  				CreatedAt:       &Timestamp{referenceTime},
 13162  				SuspendedAt:     &Timestamp{referenceTime},
 13163  			},
 13164  			SuspendedAt: &Timestamp{referenceTime},
 13165  		},
 13166  	}
 13167  
 13168  	want := `{
 13169  		"action": "a",
 13170  		"assignee": {
 13171  			"login": "l",
 13172  			"id": 1,
 13173  			"node_id": "n",
 13174  			"avatar_url": "a",
 13175  			"url": "u",
 13176  			"events_url": "e",
 13177  			"repos_url": "r"
 13178  		},
 13179  		"number": 1,
 13180  		"pull_request": {
 13181  			"id": 1
 13182  		},
 13183  		"changes": {
 13184  			"title": {
 13185  				"from": "TitleFrom"
 13186  			},
 13187  			"body": {
 13188  				"from": "BodyFrom"
 13189  			},
 13190  			"base": {
 13191  				"ref": {
 13192  					"from": "BaseRefFrom"
 13193  				},
 13194  				"sha": {
 13195  					"from": "BaseSHAFrom"
 13196  				}
 13197  			}
 13198  		},
 13199  		"requested_reviewer": {
 13200  			"login": "l",
 13201  			"id": 1,
 13202  			"node_id": "n",
 13203  			"avatar_url": "a",
 13204  			"url": "u",
 13205  			"events_url": "e",
 13206  			"repos_url": "r"
 13207  		},
 13208  		"requested_team": {
 13209  			"id": 1
 13210  		},
 13211  		"repository": {
 13212  			"id": 1,
 13213  			"name": "n",
 13214  			"url": "s"
 13215  		},
 13216  		"sender": {
 13217  			"login": "l",
 13218  			"id": 1,
 13219  			"node_id": "n",
 13220  			"avatar_url": "a",
 13221  			"url": "u",
 13222  			"events_url": "e",
 13223  			"repos_url": "r"
 13224  		},
 13225  		"installation": {
 13226  			"id": 1,
 13227  			"node_id": "nid",
 13228  			"app_id": 1,
 13229  			"app_slug": "as",
 13230  			"target_id": 1,
 13231  			"account": {
 13232  				"login": "l",
 13233  				"id": 1,
 13234  				"avatar_url": "a",
 13235  				"gravatar_id": "g",
 13236  				"name": "n",
 13237  				"company": "c",
 13238  				"blog": "b",
 13239  				"location": "l",
 13240  				"email": "e",
 13241  				"hireable": true,
 13242  				"bio": "b",
 13243  				"twitter_username": "t",
 13244  				"public_repos": 1,
 13245  				"followers": 1,
 13246  				"following": 1,
 13247  				"created_at": ` + referenceTimeStr + `,
 13248  				"suspended_at": ` + referenceTimeStr + `,
 13249  				"url": "u"
 13250  			},
 13251  			"access_tokens_url": "atu",
 13252  			"repositories_url": "ru",
 13253  			"html_url": "hu",
 13254  			"target_type": "tt",
 13255  			"single_file_name": "sfn",
 13256  			"repository_selection": "rs",
 13257  			"events": [
 13258  				"e"
 13259  			],
 13260  			"single_file_paths": [
 13261  				"s"
 13262  			],
 13263  			"permissions": {
 13264  				"actions": "a",
 13265  				"administration": "ad",
 13266  				"checks": "c",
 13267  				"contents": "co",
 13268  				"content_references": "cr",
 13269  				"deployments": "d",
 13270  				"environments": "e",
 13271  				"issues": "i",
 13272  				"metadata": "md",
 13273  				"members": "m",
 13274  				"organization_administration": "oa",
 13275  				"organization_hooks": "oh",
 13276  				"organization_plan": "op",
 13277  				"organization_pre_receive_hooks": "opr",
 13278  				"organization_projects": "op",
 13279  				"organization_secrets": "os",
 13280  				"organization_self_hosted_runners": "osh",
 13281  				"organization_user_blocking": "oub",
 13282  				"packages": "pkg",
 13283  				"pages": "pg",
 13284  				"pull_requests": "pr",
 13285  				"repository_hooks": "rh",
 13286  				"repository_projects": "rp",
 13287  				"repository_pre_receive_hooks": "rprh",
 13288  				"secrets": "s",
 13289  				"secret_scanning_alerts": "ssa",
 13290  				"security_events": "se",
 13291  				"single_file": "sf",
 13292  				"statuses": "s",
 13293  				"team_discussions": "td",
 13294  				"vulnerability_alerts": "va",
 13295  				"workflows": "w"
 13296  			},
 13297  			"created_at": ` + referenceTimeStr + `,
 13298  			"updated_at": ` + referenceTimeStr + `,
 13299  			"has_multiple_single_files": false,
 13300  			"suspended_by": {
 13301  				"login": "l",
 13302  				"id": 1,
 13303  				"avatar_url": "a",
 13304  				"gravatar_id": "g",
 13305  				"name": "n",
 13306  				"company": "c",
 13307  				"blog": "b",
 13308  				"location": "l",
 13309  				"email": "e",
 13310  				"hireable": true,
 13311  				"bio": "b",
 13312  				"twitter_username": "t",
 13313  				"public_repos": 1,
 13314  				"followers": 1,
 13315  				"following": 1,
 13316  				"created_at": ` + referenceTimeStr + `,
 13317  				"suspended_at": ` + referenceTimeStr + `,
 13318  				"url": "u"
 13319  			},
 13320  			"suspended_at": ` + referenceTimeStr + `
 13321  		},
 13322  		"label": {
 13323  			"id": 1
 13324  		},
 13325  		"organization": {
 13326  			"name": "n",
 13327  			"company": "c",
 13328  			"blog": "b",
 13329  			"location": "loc",
 13330  			"email": "e",
 13331  			"twitter_username": "tu",
 13332  			"description": "d",
 13333  			"billing_email": "be",
 13334  			"is_verified": true,
 13335  			"has_organization_projects": true,
 13336  			"has_repository_projects": true,
 13337  			"default_repository_permission": "drp",
 13338  			"members_can_create_repositories": true,
 13339  			"members_can_create_public_repositories": false,
 13340  			"members_can_create_private_repositories": true,
 13341  			"members_can_create_internal_repositories": true,
 13342  			"members_allowed_repository_creation_type": "marct",
 13343  			"members_can_create_pages": true,
 13344  			"members_can_create_public_pages": false,
 13345  			"members_can_create_private_pages": true
 13346  		},
 13347  		"before": "before",
 13348  		"after": "after"
 13349  	}`
 13350  
 13351  	testJSONMarshal(t, u, want)
 13352  }
 13353  
 13354  func TestRepositoryVulnerabilityAlertEvent_Marshal(t *testing.T) {
 13355  	testJSONMarshal(t, &RepositoryVulnerabilityAlertEvent{}, "{}")
 13356  
 13357  	u := &RepositoryVulnerabilityAlertEvent{
 13358  		Action: String("a"),
 13359  		Alert: &RepositoryVulnerabilityAlert{
 13360  			ID:                  Int64(1),
 13361  			AffectedRange:       String("ar"),
 13362  			AffectedPackageName: String("apn"),
 13363  			ExternalReference:   String("er"),
 13364  			ExternalIdentifier:  String("ei"),
 13365  			FixedIn:             String("fi"),
 13366  			Dismisser: &User{
 13367  				Login:     String("l"),
 13368  				ID:        Int64(1),
 13369  				NodeID:    String("n"),
 13370  				URL:       String("u"),
 13371  				ReposURL:  String("r"),
 13372  				EventsURL: String("e"),
 13373  				AvatarURL: String("a"),
 13374  			},
 13375  			DismissReason: String("dr"),
 13376  			DismissedAt:   &Timestamp{referenceTime},
 13377  		},
 13378  		Repository: &Repository{
 13379  			ID:   Int64(1),
 13380  			URL:  String("s"),
 13381  			Name: String("n"),
 13382  		},
 13383  	}
 13384  
 13385  	want := `{
 13386  		"action": "a",
 13387  		"alert": {
 13388  			"id": 1,
 13389  			"affected_range": "ar",
 13390  			"affected_package_name": "apn",
 13391  			"external_reference": "er",
 13392  			"external_identifier": "ei",
 13393  			"fixed_in": "fi",
 13394  			"dismisser": {
 13395  				"login": "l",
 13396  				"id": 1,
 13397  				"node_id": "n",
 13398  				"avatar_url": "a",
 13399  				"url": "u",
 13400  				"events_url": "e",
 13401  				"repos_url": "r"
 13402  			},
 13403  			"dismiss_reason": "dr",
 13404  			"dismissed_at": ` + referenceTimeStr + `
 13405  		},
 13406  		"repository": {
 13407  			"id": 1,
 13408  			"name": "n",
 13409  			"url": "s"
 13410  		}
 13411  	}`
 13412  
 13413  	testJSONMarshal(t, u, want)
 13414  }