mirror of
https://github.com/go-gitea/gitea.git
synced 2024-09-01 14:56:30 +00:00
time mocked for arch package unit tests
This commit is contained in:
parent
b5218eb4b1
commit
38024b50de
1
go.mod
1
go.mod
@ -3,6 +3,7 @@ module code.gitea.io/gitea
|
||||
go 1.20
|
||||
|
||||
require (
|
||||
bou.ke/monkey v1.0.2
|
||||
code.gitea.io/actions-proto-go v0.3.0
|
||||
code.gitea.io/gitea-vet v0.2.2
|
||||
code.gitea.io/sdk/gitea v0.15.1
|
||||
|
2
go.sum
2
go.sum
@ -1,3 +1,5 @@
|
||||
bou.ke/monkey v1.0.2 h1:kWcnsrCNUatbxncxR/ThdYqbytgOIArtYWqcQLQzKLI=
|
||||
bou.ke/monkey v1.0.2/go.mod h1:OqickVX3tNx6t33n1xvtTtu85YN5s6cKwVug+oHMaIA=
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
|
||||
|
@ -12,7 +12,9 @@ import (
|
||||
"net/http"
|
||||
"path"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"bou.ke/monkey"
|
||||
auth_model "code.gitea.io/gitea/models/auth"
|
||||
"code.gitea.io/gitea/models/unittest"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
@ -274,9 +276,14 @@ ht719b7ZWR3+SRcXySXC/cP8DL/N12kaf8wQSBkjjLKkAPBDnLyL32YFQur67qtbXtxcd/23w375
|
||||
|
||||
rootURL := fmt.Sprintf("/api/packages/%s/arch", user.Name)
|
||||
|
||||
// Set test time to 2023-07-04T19:57:09+03:00 before test execution.
|
||||
// Add package gpg key to user in tests.
|
||||
|
||||
wayback, err := time.Parse(time.RFC3339, "2023-07-04T19:57:09+03:00")
|
||||
assert.NoError(t, err)
|
||||
|
||||
patch := monkey.Patch(time.Now, func() time.Time { return wayback })
|
||||
defer patch.Unpatch()
|
||||
|
||||
t.Run("push", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user