Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
1a6dc0f
chore: Replace time.Date with referenceTime
gmlewis Jun 23, 2026
0c9f706
Cleanup
gmlewis Jun 23, 2026
611d23b
Cleanup
gmlewis Jun 23, 2026
0a0aa5c
Fix rate_limit_test.go
gmlewis Jun 24, 2026
def77c9
Revert git_commits_test.go changes
gmlewis Jun 24, 2026
edb714c
Fix actions_workflow_runs_test.go
gmlewis Jun 24, 2026
351fafd
Fix actions_secrets_test.go
gmlewis Jun 24, 2026
1f498af
Fix actions_variables_test.go
gmlewis Jun 24, 2026
6cb88ec
Fix actions_workflow_jobs_test.go
gmlewis Jun 24, 2026
d8e0dc8
Fix actions_workflows_test.go
gmlewis Jun 24, 2026
36d22fe
Fix activity_notifications_test.go and repos_commits_test.go
gmlewis Jun 24, 2026
89e2c28
Fix admin_users_test.go
gmlewis Jun 24, 2026
4646a70
Fix apps_test.go
gmlewis Jun 24, 2026
37db75c
Fix code_scanning_test.go
gmlewis Jun 24, 2026
94a5fde
Fix codespaces_secrets_test.go
gmlewis Jun 24, 2026
76b4362
Fix codespaces_test.go
gmlewis Jun 24, 2026
ab27bdd
Fix copilot_test.go
gmlewis Jun 24, 2026
f2ef4ea
Fix dependabot_secrets_test.go
gmlewis Jun 24, 2026
2f7e925
Fix enterprise_manage_ghes_config_test.go
gmlewis Jun 24, 2026
2994398
Fix enterprise_team_test.go
gmlewis Jun 24, 2026
aafb0b4
Fix gists_test.go
gmlewis Jun 24, 2026
1e0433d
Fix github/orgs_credential_authorizations_test.go
gmlewis Jun 24, 2026
8a72a2b
Fix github/orgs_custom_repository_roles_test.go
gmlewis Jun 24, 2026
8e3511b
Fix github/orgs_issue_types_test.go
gmlewis Jun 24, 2026
dea9370
Fix github/orgs_members_test.go
gmlewis Jun 24, 2026
7585773
Fix github/orgs_organization_roles_test.go
gmlewis Jun 24, 2026
bb0db51
Fix github/orgs_personal_access_tokens_test.go
gmlewis Jun 24, 2026
25988b5
Fix github/private_registries_test.go
gmlewis Jun 24, 2026
b70e6aa
Fix github/repos_test.go
gmlewis Jun 24, 2026
8f67dd1
Fix github/scim_test.go
gmlewis Jun 24, 2026
7b33125
Fix github/secret_scanning_test.go
gmlewis Jun 24, 2026
90e6202
Fix github/security_advisories_test.go
gmlewis Jun 24, 2026
96852cb
Fix github/teams_discussion_comments_test.go
gmlewis Jun 24, 2026
c73aa69
Fix github/teams_discussions_test.go
gmlewis Jun 24, 2026
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
43 changes: 18 additions & 25 deletions github/actions_hosted_runners_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"fmt"
"net/http"
"testing"
"time"

"github.com/google/go-cmp/cmp"
)
Expand Down Expand Up @@ -48,7 +47,7 @@ func TestActionsService_ListHostedRunners(t *testing.T) {
"length": 31
}
],
"last_active_on": "2023-04-26T15:23:37Z"
"last_active_on": `+referenceTimeStr+`
},
{
"id": 7,
Expand All @@ -69,7 +68,7 @@ func TestActionsService_ListHostedRunners(t *testing.T) {
"maximum_runners": 20,
"public_ip_enabled": false,
"public_ips": [],
"last_active_on": "2023-04-26T15:23:37Z"
"last_active_on": `+referenceTimeStr+`
}
]
}`)
Expand All @@ -81,8 +80,6 @@ func TestActionsService_ListHostedRunners(t *testing.T) {
t.Errorf("Actions.ListHostedRunners returned error: %v", err)
}

lastActiveOn := Timestamp{time.Date(2023, 4, 26, 15, 23, 37, 0, time.UTC)}

want := &HostedRunners{
TotalCount: 2,
Runners: []*HostedRunner{
Expand Down Expand Up @@ -111,7 +108,7 @@ func TestActionsService_ListHostedRunners(t *testing.T) {
Length: 31,
},
},
LastActiveOn: &lastActiveOn,
LastActiveOn: &referenceTimestamp,
},
{
ID: Ptr(int64(7)),
Expand All @@ -132,7 +129,7 @@ func TestActionsService_ListHostedRunners(t *testing.T) {
MaximumRunners: Ptr(int64(20)),
PublicIPEnabled: Ptr(false),
PublicIPs: []*HostedRunnerPublicIP{},
LastActiveOn: &lastActiveOn,
LastActiveOn: &referenceTimestamp,
},
},
}
Expand Down Expand Up @@ -186,7 +183,7 @@ func TestActionsService_CreateHostedRunner(t *testing.T) {
"length": 31
}
],
"last_active_on": "2023-04-26T15:23:37Z"
"last_active_on": `+referenceTimeStr+`
}`)
})

Expand All @@ -210,7 +207,6 @@ func TestActionsService_CreateHostedRunner(t *testing.T) {
t.Errorf("Actions.CreateHostedRunner returned error: %v", err)
}

lastActiveOn := Timestamp{time.Date(2023, 4, 26, 15, 23, 37, 0, time.UTC)}
want := &HostedRunner{
ID: Ptr(int64(5)),
Name: Ptr("My hosted ubuntu runner"),
Expand All @@ -236,7 +232,7 @@ func TestActionsService_CreateHostedRunner(t *testing.T) {
Length: 31,
},
},
LastActiveOn: &lastActiveOn,
LastActiveOn: &referenceTimestamp,
}

if !cmp.Equal(hostedRunner, want) {
Expand Down Expand Up @@ -616,7 +612,7 @@ func TestActionsService_GetHostedRunner(t *testing.T) {
"length": 31
}
],
"last_active_on": "2023-04-26T15:23:37Z"
"last_active_on": `+referenceTimeStr+`
}`)
})

Expand All @@ -626,7 +622,6 @@ func TestActionsService_GetHostedRunner(t *testing.T) {
t.Errorf("Actions.GetHostedRunner returned error: %v", err)
}

lastActiveOn := Timestamp{time.Date(2023, 4, 26, 15, 23, 37, 0, time.UTC)}
want := &HostedRunner{
ID: Ptr(int64(5)),
Name: Ptr("My hosted ubuntu runner"),
Expand All @@ -652,7 +647,7 @@ func TestActionsService_GetHostedRunner(t *testing.T) {
Length: 31,
},
},
LastActiveOn: &lastActiveOn,
LastActiveOn: &referenceTimestamp,
}

if !cmp.Equal(hostedRunner, want) {
Expand Down Expand Up @@ -705,7 +700,7 @@ func TestActionsService_UpdateHostedRunner(t *testing.T) {
"length": 31
}
],
"last_active_on": "2023-04-26T15:23:37Z"
"last_active_on": `+referenceTimeStr+`
}`)
})

Expand All @@ -722,7 +717,6 @@ func TestActionsService_UpdateHostedRunner(t *testing.T) {
t.Errorf("Actions.UpdateHostedRunner returned error: %v", err)
}

lastActiveOn := Timestamp{time.Date(2023, 4, 26, 15, 23, 37, 0, time.UTC)}
want := &HostedRunner{
ID: Ptr(int64(5)),
Name: Ptr("My hosted ubuntu runner"),
Expand All @@ -748,7 +742,7 @@ func TestActionsService_UpdateHostedRunner(t *testing.T) {
Length: 31,
},
},
LastActiveOn: &lastActiveOn,
LastActiveOn: &referenceTimestamp,
}

if !cmp.Equal(hostedRunner, want) {
Expand Down Expand Up @@ -801,7 +795,7 @@ func TestActionsService_DeleteHostedRunner(t *testing.T) {
"length": 31
}
],
"last_active_on": "2023-04-26T15:23:37Z"
"last_active_on": `+referenceTimeStr+`
}`)
})

Expand All @@ -811,7 +805,6 @@ func TestActionsService_DeleteHostedRunner(t *testing.T) {
t.Errorf("Actions.DeleteHostedRunner returned error: %v", err)
}

lastActiveOn := Timestamp{time.Date(2023, 4, 26, 15, 23, 37, 0, time.UTC)}
want := &HostedRunner{
ID: Ptr(int64(5)),
Name: Ptr("My hosted ubuntu runner"),
Expand All @@ -837,7 +830,7 @@ func TestActionsService_DeleteHostedRunner(t *testing.T) {
Length: 31,
},
},
LastActiveOn: &lastActiveOn,
LastActiveOn: &referenceTimestamp,
}

if !cmp.Equal(hostedRunner, want) {
Expand Down Expand Up @@ -1036,14 +1029,14 @@ func TestActionsService_ListHostedRunnerCustomImageVersions(t *testing.T) {
"size_gb": 75,
"state": "Ready",
"state_details": "None",
"created_on": "2024-11-09T23:39:01Z"
"created_on": `+referenceTimeStr+`
},
{
"version": "1.0.0",
"size_gb": 75,
"state": "Ready",
"state_details": "None",
"created_on": "2024-11-08T20:39:01Z"
"created_on": `+referenceTimeStr+`
}
]
}`)
Expand All @@ -1063,14 +1056,14 @@ func TestActionsService_ListHostedRunnerCustomImageVersions(t *testing.T) {
SizeGB: 75,
State: "Ready",
StateDetails: "None",
CreatedOn: Timestamp{time.Date(2024, 11, 9, 23, 39, 1, 0, time.UTC)},
CreatedOn: referenceTimestamp,
},
{
Version: "1.0.0",
SizeGB: 75,
State: "Ready",
StateDetails: "None",
CreatedOn: Timestamp{time.Date(2024, 11, 8, 20, 39, 1, 0, time.UTC)},
CreatedOn: referenceTimestamp,
},
},
}
Expand Down Expand Up @@ -1105,7 +1098,7 @@ func TestActionsService_GetHostedRunnerCustomImageVersion(t *testing.T) {
"size_gb": 75,
"state": "Ready",
"state_details": "None",
"created_on": "2024-11-08T20:39:01Z"
"created_on": `+referenceTimeStr+`
}`)
})

Expand All @@ -1120,7 +1113,7 @@ func TestActionsService_GetHostedRunnerCustomImageVersion(t *testing.T) {
SizeGB: 75,
State: "Ready",
StateDetails: "None",
CreatedOn: Timestamp{time.Date(2024, 11, 8, 20, 39, 1, 0, time.UTC)},
CreatedOn: referenceTimestamp,
}

if !cmp.Equal(version, want) {
Expand Down
11 changes: 4 additions & 7 deletions github/actions_runner_groups_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"fmt"
"net/http"
"testing"
"time"

"github.com/google/go-cmp/cmp"
)
Expand Down Expand Up @@ -449,7 +448,7 @@ func TestActionsService_ListRunnerGroupHostedRunners(t *testing.T) {
"length": 31
}
],
"last_active_on": "2023-04-26T15:23:37Z"
"last_active_on": `+referenceTimeStr+`
},
{
"id": 7,
Expand All @@ -470,7 +469,7 @@ func TestActionsService_ListRunnerGroupHostedRunners(t *testing.T) {
"maximum_runners": 20,
"public_ip_enabled": false,
"public_ips": [],
"last_active_on": "2023-04-26T15:23:37Z"
"last_active_on": `+referenceTimeStr+`
}
]
}`)
Expand All @@ -483,8 +482,6 @@ func TestActionsService_ListRunnerGroupHostedRunners(t *testing.T) {
t.Errorf("Actions.ListRunnerGroupHostedRunners returned error: %v", err)
}

lastActiveOn := Timestamp{time.Date(2023, 4, 26, 15, 23, 37, 0, time.UTC)}

want := &HostedRunners{
TotalCount: 2,
Runners: []*HostedRunner{
Expand Down Expand Up @@ -513,7 +510,7 @@ func TestActionsService_ListRunnerGroupHostedRunners(t *testing.T) {
Length: 31,
},
},
LastActiveOn: &lastActiveOn,
LastActiveOn: &referenceTimestamp,
},
{
ID: Ptr(int64(7)),
Expand All @@ -534,7 +531,7 @@ func TestActionsService_ListRunnerGroupHostedRunners(t *testing.T) {
MaximumRunners: Ptr(int64(20)),
PublicIPEnabled: Ptr(false),
PublicIPs: []*HostedRunnerPublicIP{},
LastActiveOn: &lastActiveOn,
LastActiveOn: &referenceTimestamp,
},
},
}
Expand Down
23 changes: 10 additions & 13 deletions github/actions_runners_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"fmt"
"net/http"
"testing"
"time"

"github.com/google/go-cmp/cmp"
)
Expand Down Expand Up @@ -137,7 +136,7 @@ func TestActionsService_CreateRegistrationToken(t *testing.T) {

mux.HandleFunc("/repos/o/r/actions/runners/registration-token", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
fmt.Fprint(w, `{"token":"LLBF3JGZDX3P5PMEXLND6TS6FCWO6","expires_at":"2020-01-22T12:13:35.123Z"}`)
fmt.Fprint(w, `{"token":"LLBF3JGZDX3P5PMEXLND6TS6FCWO6","expires_at":`+referenceTimeStr+`}`)
})

ctx := t.Context()
Expand All @@ -147,9 +146,8 @@ func TestActionsService_CreateRegistrationToken(t *testing.T) {
}

want := &RegistrationToken{
Token: Ptr("LLBF3JGZDX3P5PMEXLND6TS6FCWO6"),
ExpiresAt: &Timestamp{time.Date(2020, time.January, 22, 12, 13, 35,
123000000, time.UTC)},
Token: Ptr("LLBF3JGZDX3P5PMEXLND6TS6FCWO6"),
ExpiresAt: &referenceTimestamp,
}
if !cmp.Equal(token, want) {
t.Errorf("Actions.CreateRegistrationToken returned %+v, want %+v", token, want)
Expand Down Expand Up @@ -261,7 +259,7 @@ func TestActionsService_CreateRemoveToken(t *testing.T) {

mux.HandleFunc("/repos/o/r/actions/runners/remove-token", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
fmt.Fprint(w, `{"token":"AABF3JGZDX3P5PMEXLND6TS6FCWO6","expires_at":"2020-01-29T12:13:35.123Z"}`)
fmt.Fprint(w, `{"token":"AABF3JGZDX3P5PMEXLND6TS6FCWO6","expires_at":`+referenceTimeStr+`}`)
})

ctx := t.Context()
Expand All @@ -270,7 +268,7 @@ func TestActionsService_CreateRemoveToken(t *testing.T) {
t.Errorf("Actions.CreateRemoveToken returned error: %v", err)
}

want := &RemoveToken{Token: Ptr("AABF3JGZDX3P5PMEXLND6TS6FCWO6"), ExpiresAt: &Timestamp{time.Date(2020, time.January, 29, 12, 13, 35, 123000000, time.UTC)}}
want := &RemoveToken{Token: Ptr("AABF3JGZDX3P5PMEXLND6TS6FCWO6"), ExpiresAt: &referenceTimestamp}
if !cmp.Equal(token, want) {
t.Errorf("Actions.CreateRemoveToken returned %+v, want %+v", token, want)
}
Expand Down Expand Up @@ -362,7 +360,7 @@ func TestActionsService_CreateOrganizationRegistrationToken(t *testing.T) {

mux.HandleFunc("/orgs/o/actions/runners/registration-token", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
fmt.Fprint(w, `{"token":"LLBF3JGZDX3P5PMEXLND6TS6FCWO6","expires_at":"2020-01-22T12:13:35.123Z"}`)
fmt.Fprint(w, `{"token":"LLBF3JGZDX3P5PMEXLND6TS6FCWO6","expires_at":`+referenceTimeStr+`}`)
})

ctx := t.Context()
Expand All @@ -372,9 +370,8 @@ func TestActionsService_CreateOrganizationRegistrationToken(t *testing.T) {
}

want := &RegistrationToken{
Token: Ptr("LLBF3JGZDX3P5PMEXLND6TS6FCWO6"),
ExpiresAt: &Timestamp{time.Date(2020, time.January, 22, 12, 13, 35,
123000000, time.UTC)},
Token: Ptr("LLBF3JGZDX3P5PMEXLND6TS6FCWO6"),
ExpiresAt: &referenceTimestamp,
}
if !cmp.Equal(token, want) {
t.Errorf("Actions.CreateOrganizationRegistrationToken returned %+v, want %+v", token, want)
Expand Down Expand Up @@ -486,7 +483,7 @@ func TestActionsService_CreateOrganizationRemoveToken(t *testing.T) {

mux.HandleFunc("/orgs/o/actions/runners/remove-token", func(w http.ResponseWriter, r *http.Request) {
testMethod(t, r, "POST")
fmt.Fprint(w, `{"token":"AABF3JGZDX3P5PMEXLND6TS6FCWO6","expires_at":"2020-01-29T12:13:35.123Z"}`)
fmt.Fprint(w, `{"token":"AABF3JGZDX3P5PMEXLND6TS6FCWO6","expires_at":`+referenceTimeStr+`}`)
})

ctx := t.Context()
Expand All @@ -495,7 +492,7 @@ func TestActionsService_CreateOrganizationRemoveToken(t *testing.T) {
t.Errorf("Actions.CreateOrganizationRemoveToken returned error: %v", err)
}

want := &RemoveToken{Token: Ptr("AABF3JGZDX3P5PMEXLND6TS6FCWO6"), ExpiresAt: &Timestamp{time.Date(2020, time.January, 29, 12, 13, 35, 123000000, time.UTC)}}
want := &RemoveToken{Token: Ptr("AABF3JGZDX3P5PMEXLND6TS6FCWO6"), ExpiresAt: &referenceTimestamp}
if !cmp.Equal(token, want) {
t.Errorf("Actions.CreateOrganizationRemoveToken returned %+v, want %+v", token, want)
}
Expand Down
Loading
Loading