Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions github/admin_users_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestAdminUsers_Create(t *testing.T) {
assertNilError(t, json.NewDecoder(r.Body).Decode(v))

testMethod(t, r, "POST")
want := &CreateUserRequest{Login: "github", Email: Ptr("email@domain.com"), Suspended: Ptr(false)}
want := &CreateUserRequest{Login: "github", Email: Ptr("email@example.com"), Suspended: Ptr(false)}
if !cmp.Equal(v, want) {
t.Errorf("Request body = %+v, want %+v", v, want)
}
Expand All @@ -35,7 +35,7 @@ func TestAdminUsers_Create(t *testing.T) {
ctx := t.Context()
org, _, err := client.Admin.CreateUser(ctx, CreateUserRequest{
Login: "github",
Email: Ptr("email@domain.com"),
Email: Ptr("email@example.com"),
Suspended: Ptr(false),
})
if err != nil {
Expand All @@ -51,7 +51,7 @@ func TestAdminUsers_Create(t *testing.T) {
testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
got, resp, err := client.Admin.CreateUser(ctx, CreateUserRequest{
Login: "github",
Email: Ptr("email@domain.com"),
Email: Ptr("email@example.com"),
Suspended: Ptr(false),
})
if got != nil {
Expand Down Expand Up @@ -94,7 +94,7 @@ func TestUserImpersonation_Create(t *testing.T) {
testMethod(t, r, "POST")
testBody(t, r, `{"scopes":["repo"]}`+"\n")
fmt.Fprint(w, `{"id": 1234,
"url": "https://git.company.com/api/v3/authorizations/1234",
"url": "https://example.com/authorizations",
"app": {
"name": "GitHub Site Administrator",
"url": "https://docs.github.com/en/rest/enterprise/users/",
Expand Down Expand Up @@ -123,7 +123,7 @@ func TestUserImpersonation_Create(t *testing.T) {
date := Timestamp{Time: time.Date(2018, time.January, 1, 0, 0, 0, 0, time.UTC)}
want := &UserAuthorization{
ID: Ptr(int64(1234)),
URL: Ptr("https://git.company.com/api/v3/authorizations/1234"),
URL: Ptr("https://example.com/authorizations"),
App: &OAuthAPP{
Name: Ptr("GitHub Site Administrator"),
URL: Ptr("https://docs.github.com/en/rest/enterprise/users/"),
Expand Down
16 changes: 8 additions & 8 deletions github/dependabot_alerts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,19 +296,19 @@ func TestDependabotSecurityAdvisory_Marshal(t *testing.T) {
},
References: []*AdvisoryReference{
{
URL: Ptr("https://nvd.nist.gov/vuln/detail/CVE-2018-6188"),
URL: Ptr("https://example.com/vuln/detail/CVE-2018-6188"),
},
{
URL: Ptr("https://github.com/advisories/GHSA-rf4j-j272-fj86"),
},
{
URL: Ptr("https://usn.ubuntu.com/3559-1/"),
URL: Ptr("https://example.com/3559-1/"),
},
{
URL: Ptr("https://www.djangoproject.com/weblog/2018/feb/01/security-releases/"),
URL: Ptr("https://example.com/weblog/2018/feb/01/security-releases/"),
},
{
URL: Ptr("https://www.securitytracker.com/id/1040422"),
URL: Ptr("https://example.com/id/1040422"),
},
},
PublishedAt: &Timestamp{publishedAt},
Expand Down Expand Up @@ -372,19 +372,19 @@ func TestDependabotSecurityAdvisory_Marshal(t *testing.T) {
],
"references": [
{
"url": "https://nvd.nist.gov/vuln/detail/CVE-2018-6188"
"url": "https://example.com/vuln/detail/CVE-2018-6188"
},
{
"url": "https://github.com/advisories/GHSA-rf4j-j272-fj86"
},
{
"url": "https://usn.ubuntu.com/3559-1/"
"url": "https://example.com/3559-1/"
},
{
"url": "https://www.djangoproject.com/weblog/2018/feb/01/security-releases/"
"url": "https://example.com/weblog/2018/feb/01/security-releases/"
},
{
"url": "https://www.securitytracker.com/id/1040422"
"url": "https://example.com/id/1040422"
}
],
"published_at": "2018-10-03T21:13:54Z",
Expand Down
8 changes: 4 additions & 4 deletions github/enterprise_licenses_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ func TestEnterpriseService_GetConsumedLicenses(t *testing.T) {
"github_com_saml_name_id": "saml123",
"github_com_orgs_with_pending_invites": [],
"github_com_two_factor_auth": true,
"enterprise_server_emails": ["user1@enterprise.local"],
"enterprise_server_emails": ["user1@example.com"],
"visual_studio_license_status": "active",
"visual_studio_subscription_email": "user1@visualstudio.com",
"visual_studio_subscription_email": "user1@example.com",
"total_user_accounts": 1
}]
}`)
Expand All @@ -60,7 +60,7 @@ func TestEnterpriseService_GetConsumedLicenses(t *testing.T) {
samlNameID := "saml123"
twoFactorAuth := true
licenseStatus := "active"
vsEmail := "user1@visualstudio.com"
vsEmail := "user1@example.com"

want := &EnterpriseConsumedLicenses{
TotalSeatsConsumed: 20,
Expand All @@ -81,7 +81,7 @@ func TestEnterpriseService_GetConsumedLicenses(t *testing.T) {
GithubComSamlNameID: &samlNameID,
GithubComOrgsWithPendingInvites: []string{},
GithubComTwoFactorAuth: &twoFactorAuth,
EnterpriseServerEmails: []string{"user1@enterprise.local"},
EnterpriseServerEmails: []string{"user1@example.com"},
VisualStudioLicenseStatus: &licenseStatus,
VisualStudioSubscriptionEmail: &vsEmail,
TotalUserAccounts: 1,
Expand Down
8 changes: 4 additions & 4 deletions github/enterprise_manage_ghes_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ func TestEnterpriseService_Settings(t *testing.T) {
"noreply_address": "noreply@github.com"
},
"ntp": {
"primary_server": "0.pool.ntp.org",
"secondary_server": "1.pool.ntp.org"
"primary_server": "example.com/primary",
"secondary_server": "example.com/secondary"
},
"timezone": null,
"snmp": {
Expand Down Expand Up @@ -266,8 +266,8 @@ func TestEnterpriseService_Settings(t *testing.T) {
EnableStarttlsAuto: Ptr(true),
},
NTP: &ConfigSettingsNTP{
PrimaryServer: Ptr("0.pool.ntp.org"),
SecondaryServer: Ptr("1.pool.ntp.org"),
PrimaryServer: Ptr("example.com/primary"),
SecondaryServer: Ptr("example.com/secondary"),
},
Timezone: nil,
SNMP: &ConfigSettingsSNMP{
Expand Down
28 changes: 14 additions & 14 deletions github/enterprise_scim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func TestSCIMEnterpriseUsers_Marshal(t *testing.T) {
Emails: []*SCIMEnterpriseUserEmail{{
Primary: true,
Type: "work",
Value: "un1@email.com",
Value: "un1@example.com",
}},
Roles: []*SCIMEnterpriseUserRole{{
Display: Ptr("rd1"),
Expand Down Expand Up @@ -125,7 +125,7 @@ func TestSCIMEnterpriseUsers_Marshal(t *testing.T) {
"emails": [{
"primary": true,
"type": "work",
"value": "un1@email.com"
"value": "un1@example.com"
}],
"roles": [{
"display": "rd1",
Expand Down Expand Up @@ -559,7 +559,7 @@ func TestEnterpriseService_SetProvisionedSCIMUser(t *testing.T) {
mux.HandleFunc("/scim/v2/enterprises/ee/Users/7fce", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "PUT")
testHeader(t, r, "Accept", mediaTypeSCIM)
testBody(t, r, `{"displayName":"John Doe","userName":"e123","emails":[{"value":"john@email.com","primary":true,"type":"work"}],"externalId":"e123","active":true,"schemas":["`+SCIMSchemasURINamespacesUser+`"]}`+"\n")
testBody(t, r, `{"displayName":"John Doe","userName":"e123","emails":[{"value":"john@example.com","primary":true,"type":"work"}],"externalId":"e123","active":true,"schemas":["`+SCIMSchemasURINamespacesUser+`"]}`+"\n")
w.WriteHeader(http.StatusOK)
fmt.Fprint(w, `{
"schemas": ["`+SCIMSchemasURINamespacesUser+`"],
Expand All @@ -569,7 +569,7 @@ func TestEnterpriseService_SetProvisionedSCIMUser(t *testing.T) {
"userName": "e123",
"displayName": "John Doe",
"emails": [{
"value": "john@email.com",
"value": "john@example.com",
"type": "work",
"primary": true
}],
Expand All @@ -589,7 +589,7 @@ func TestEnterpriseService_SetProvisionedSCIMUser(t *testing.T) {
UserName: "e123",
DisplayName: "John Doe",
Emails: []*SCIMEnterpriseUserEmail{{
Value: "john@email.com",
Value: "john@example.com",
Type: "work",
Primary: true,
}},
Expand All @@ -609,7 +609,7 @@ func TestEnterpriseService_SetProvisionedSCIMUser(t *testing.T) {
UserName: "e123",
DisplayName: "John Doe",
Emails: []*SCIMEnterpriseUserEmail{{
Value: "john@email.com",
Value: "john@example.com",
Type: "work",
Primary: true,
}},
Expand Down Expand Up @@ -721,7 +721,7 @@ func TestEnterpriseService_UpdateSCIMUserAttribute(t *testing.T) {
mux.HandleFunc("/scim/v2/enterprises/ee/Users/7fce", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "PATCH")
testHeader(t, r, "Accept", mediaTypeSCIM)
testBody(t, r, `{"schemas":["`+SCIMSchemasURINamespacesPatchOp+`"],"Operations":[{"op":"replace","path":"emails[type eq 'work'].value","value":"updatedEmail@email.com"},{"op":"replace","path":"name.familyName","value":"updatedFamilyName"}]}`+"\n")
testBody(t, r, `{"schemas":["`+SCIMSchemasURINamespacesPatchOp+`"],"Operations":[{"op":"replace","path":"emails[type eq 'work'].value","value":"updatedEmail@example.com"},{"op":"replace","path":"name.familyName","value":"updatedFamilyName"}]}`+"\n")
w.WriteHeader(http.StatusOK)
fmt.Fprint(w, `{
"schemas": ["`+SCIMSchemasURINamespacesUser+`"],
Expand All @@ -737,7 +737,7 @@ func TestEnterpriseService_UpdateSCIMUserAttribute(t *testing.T) {
},
"displayName": "John Doe",
"emails": [{
"value": "john@email.com",
"value": "john@example.com",
"type": "work",
"primary": true
}],
Expand Down Expand Up @@ -767,7 +767,7 @@ func TestEnterpriseService_UpdateSCIMUserAttribute(t *testing.T) {
MiddleName: Ptr("X"),
},
Emails: []*SCIMEnterpriseUserEmail{{
Value: "john@email.com",
Value: "john@example.com",
Type: "work",
Primary: true,
}},
Expand All @@ -789,7 +789,7 @@ func TestEnterpriseService_UpdateSCIMUserAttribute(t *testing.T) {
Operations: []*SCIMEnterpriseAttributeOperation{{
Op: "replace",
Path: Ptr("emails[type eq 'work'].value"),
Value: Ptr("updatedEmail@email.com"),
Value: Ptr("updatedEmail@example.com"),
}, {
Op: "replace",
Path: Ptr("name.familyName"),
Expand Down Expand Up @@ -918,7 +918,7 @@ func TestEnterpriseService_ProvisionSCIMUser(t *testing.T) {
mux.HandleFunc("/scim/v2/enterprises/ee/Users", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
testHeader(t, r, "Accept", mediaTypeSCIM)
testBody(t, r, `{"displayName":"DOE John","name":{"givenName":"John","familyName":"Doe","formatted":"John Doe"},"userName":"e123","emails":[{"value":"john@email.com","primary":true,"type":"work"}],"roles":[{"value":"User","primary":false}],"externalId":"e123","active":true,"schemas":["`+SCIMSchemasURINamespacesUser+`"]}`+"\n")
testBody(t, r, `{"displayName":"DOE John","name":{"givenName":"John","familyName":"Doe","formatted":"John Doe"},"userName":"e123","emails":[{"value":"john@example.com","primary":true,"type":"work"}],"roles":[{"value":"User","primary":false}],"externalId":"e123","active":true,"schemas":["`+SCIMSchemasURINamespacesUser+`"]}`+"\n")
w.WriteHeader(http.StatusCreated)
fmt.Fprint(w, `{
"schemas": ["`+SCIMSchemasURINamespacesUser+`"],
Expand All @@ -933,7 +933,7 @@ func TestEnterpriseService_ProvisionSCIMUser(t *testing.T) {
},
"displayName": "DOE John",
"emails": [{
"value": "john@email.com",
"value": "john@example.com",
"type": "work",
"primary": true
}],
Expand Down Expand Up @@ -962,7 +962,7 @@ func TestEnterpriseService_ProvisionSCIMUser(t *testing.T) {
GivenName: "John",
},
Emails: []*SCIMEnterpriseUserEmail{{
Value: "john@email.com",
Value: "john@example.com",
Type: "work",
Primary: true,
}},
Expand Down Expand Up @@ -991,7 +991,7 @@ func TestEnterpriseService_ProvisionSCIMUser(t *testing.T) {
},
DisplayName: "DOE John",
Emails: []*SCIMEnterpriseUserEmail{{
Value: "john@email.com",
Value: "john@example.com",
Type: "work",
Primary: true,
}},
Expand Down
4 changes: 2 additions & 2 deletions github/git_commits_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -482,13 +482,13 @@ func TestGitService_createSignatureMessage_withoutCommitter(t *testing.T) {
},
Committer: &CommitAuthor{
Name: Ptr("foo"),
Email: Ptr("foo@bar.com"),
Email: Ptr("foo@example.com"),
Date: &Timestamp{date},
},
})
expected := `parent p
author go-github <go-github@github.com> 1493849023 +0200
committer foo <foo@bar.com> 1493849023 +0200
committer foo <foo@example.com> 1493849023 +0200
Commit Message.`
if msg != expected {
Expand Down
30 changes: 15 additions & 15 deletions github/meta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func TestAPIMeta_Marshal(t *testing.T) {
Importer: []string{"i"},
GithubEnterpriseImporter: []string{"gei"},
Actions: []string{"a"},
ActionsMacos: []string{"192.0.2.1/32", "198.51.100.0/24"},
ActionsMacos: []string{"example.com/1", "example.com/2"},
Dependabot: []string{"d"},
SSHKeyFingerprints: map[string]string{"a": "f"},
SSHKeys: []string{"k"},
Expand All @@ -36,16 +36,16 @@ func TestAPIMeta_Marshal(t *testing.T) {
"*.github.com",
"*.github.dev",
"*.github.io",
"*.githubassets.com",
"*.githubusercontent.com",
"*.example.com/assets",
"*.example.com",
},
ArtifactAttestations: &APIMetaArtifactAttestations{
TrustDomain: "",
Services: []string{
"*.actions.githubusercontent.com",
"*.actions.github.com",
"tuf-repo.github.com",
"fulcio.githubapp.com",
"timestamp.githubapp.com",
"fulcio.github.com",
"timestamp.github.com",
},
},
},
Expand All @@ -58,13 +58,13 @@ func TestAPIMeta_Marshal(t *testing.T) {
"importer":["i"],
"github_enterprise_importer":["gei"],
"actions":["a"],
"actions_macos":["192.0.2.1/32", "198.51.100.0/24"],
"actions_macos":["example.com/1", "example.com/2"],
"dependabot":["d"],
"ssh_key_fingerprints":{"a":"f"},
"ssh_keys":["k"],
"api":["a"],
"web":["w"],
"domains":{"website":["*.github.com","*.github.dev","*.github.io","*.githubassets.com","*.githubusercontent.com"],"artifact_attestations":{"trust_domain":"","services":["*.actions.githubusercontent.com","tuf-repo.github.com","fulcio.githubapp.com","timestamp.githubapp.com"]}}
"domains":{"website":["*.github.com","*.github.dev","*.github.io","*.example.com/assets","*.example.com"],"artifact_attestations":{"trust_domain":"","services":["*.actions.github.com","tuf-repo.github.com","fulcio.github.com","timestamp.github.com"]}}
}`

testJSONMarshal(t, a, want)
Expand All @@ -76,7 +76,7 @@ func TestMetaService_Get(t *testing.T) {

mux.HandleFunc("/meta", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "GET")
fmt.Fprint(w, `{"web":["w"],"api":["a"],"hooks":["h"], "git":["g"], "pages":["p"], "importer":["i"], "github_enterprise_importer": ["gei"], "actions":["a"], "actions_macos": ["192.0.2.1/32", "198.51.100.0/24"], "dependabot":["d"], "verifiable_password_authentication": true, "domains":{"website":["*.github.com","*.github.dev","*.github.io","*.githubassets.com","*.githubusercontent.com"],"artifact_attestations":{"trust_domain":"","services":["*.actions.githubusercontent.com","tuf-repo.github.com","fulcio.githubapp.com","timestamp.githubapp.com"]}}}`)
fmt.Fprint(w, `{"web":["w"],"api":["a"],"hooks":["h"], "git":["g"], "pages":["p"], "importer":["i"], "github_enterprise_importer": ["gei"], "actions":["a"], "actions_macos": ["example.com/1", "example.com/2"], "dependabot":["d"], "verifiable_password_authentication": true, "domains":{"website":["*.github.com","*.github.dev","*.github.io","*.example.com/assets","*.example.com"],"artifact_attestations":{"trust_domain":"","services":["*.actions.github.com","tuf-repo.github.com","fulcio.github.com","timestamp.github.com"]}}}`)
})

ctx := t.Context()
Expand All @@ -92,7 +92,7 @@ func TestMetaService_Get(t *testing.T) {
Importer: []string{"i"},
GithubEnterpriseImporter: []string{"gei"},
Actions: []string{"a"},
ActionsMacos: []string{"192.0.2.1/32", "198.51.100.0/24"},
ActionsMacos: []string{"example.com/1", "example.com/2"},
Dependabot: []string{"d"},
API: []string{"a"},
Web: []string{"w"},
Expand All @@ -101,16 +101,16 @@ func TestMetaService_Get(t *testing.T) {
"*.github.com",
"*.github.dev",
"*.github.io",
"*.githubassets.com",
"*.githubusercontent.com",
"*.example.com/assets",
"*.example.com",
},
ArtifactAttestations: &APIMetaArtifactAttestations{
TrustDomain: "",
Services: []string{
"*.actions.githubusercontent.com",
"*.actions.github.com",
"tuf-repo.github.com",
"fulcio.githubapp.com",
"timestamp.githubapp.com",
"fulcio.github.com",
"timestamp.github.com",
},
},
},
Expand Down
Loading
Loading