diff options
author | 6543 <6543@obermui.de> | 2022-01-05 07:27:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-05 07:27:53 +0100 |
commit | 0572c78938d3d8287f81f53effc7ffaacd75d3e7 (patch) | |
tree | 7dc1e9d29732332490d5a81c16c5e60cc90616a9 /services | |
parent | 6da078d61690816643f082b2230c0842660bbf4c (diff) | |
download | gitea-0572c78938d3d8287f81f53effc7ffaacd75d3e7.tar.gz gitea-0572c78938d3d8287f81f53effc7ffaacd75d3e7.zip |
refactoring nits (#18188)
* no octal for time values
* rm artifact from refactoring
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'services')
-rw-r--r-- | services/mailer/mailer_test.go | 4 | ||||
-rw-r--r-- | services/migrations/github_test.go | 18 | ||||
-rw-r--r-- | services/migrations/gitlab_test.go | 12 | ||||
-rw-r--r-- | services/migrations/gogs_test.go | 8 |
4 files changed, 22 insertions, 20 deletions
diff --git a/services/mailer/mailer_test.go b/services/mailer/mailer_test.go index 56f2eb52b0..b94fce8443 100644 --- a/services/mailer/mailer_test.go +++ b/services/mailer/mailer_test.go @@ -14,14 +14,14 @@ import ( ) func TestGenerateMessageID(t *testing.T) { - var mailService = setting.Mailer{ + mailService := setting.Mailer{ From: "test@gitea.com", } setting.MailService = &mailService setting.Domain = "localhost" - date := time.Date(2000, 01, 02, 03, 04, 05, 06, time.UTC) + date := time.Date(2000, 1, 2, 3, 4, 5, 6, time.UTC) m := NewMessageFrom(nil, "display-name", "from-address", "subject", "body") m.Date = date gm := m.ToMessage() diff --git a/services/migrations/github_test.go b/services/migrations/github_test.go index c8249dfdb2..7540037d92 100644 --- a/services/migrations/github_test.go +++ b/services/migrations/github_test.go @@ -17,7 +17,7 @@ import ( ) func TestGitHubDownloadRepo(t *testing.T) { - GithubLimitRateRemaining = 3 //Wait at 3 remaining since we could have 3 CI in // + GithubLimitRateRemaining = 3 // Wait at 3 remaining since we could have 3 CI in // downloader := NewGithubDownloaderV3(context.Background(), "https://github.com", "", "", os.Getenv("GITHUB_READ_TOKEN"), "go-gitea", "test_repo") err := downloader.RefreshRate() assert.NoError(t, err) @@ -364,7 +364,7 @@ func TestGitHubDownloadRepo(t *testing.T) { ReviewerID: 165205, ReviewerName: "lafriks", CommitID: "076160cf0b039f13e5eff19619932d181269414b", - CreatedAt: time.Date(2019, 11, 12, 21, 38, 00, 0, time.UTC), + CreatedAt: time.Date(2019, 11, 12, 21, 38, 0, 0, time.UTC), State: base.ReviewStateApproved, }, }, reviews) @@ -378,7 +378,7 @@ func TestGitHubDownloadRepo(t *testing.T) { ReviewerID: 81045, ReviewerName: "lunny", CommitID: "2be9101c543658591222acbee3eb799edfc3853d", - CreatedAt: time.Date(2020, 01, 04, 05, 33, 18, 0, time.UTC), + CreatedAt: time.Date(2020, 1, 4, 5, 33, 18, 0, time.UTC), State: base.ReviewStateApproved, Comments: []*base.ReviewComment{ { @@ -389,8 +389,8 @@ func TestGitHubDownloadRepo(t *testing.T) { Position: 3, CommitID: "2be9101c543658591222acbee3eb799edfc3853d", PosterID: 81045, - CreatedAt: time.Date(2020, 01, 04, 05, 33, 06, 0, time.UTC), - UpdatedAt: time.Date(2020, 01, 04, 05, 33, 18, 0, time.UTC), + CreatedAt: time.Date(2020, 1, 4, 5, 33, 6, 0, time.UTC), + UpdatedAt: time.Date(2020, 1, 4, 5, 33, 18, 0, time.UTC), }, }, }, @@ -400,7 +400,7 @@ func TestGitHubDownloadRepo(t *testing.T) { ReviewerID: 81045, ReviewerName: "lunny", CommitID: "2be9101c543658591222acbee3eb799edfc3853d", - CreatedAt: time.Date(2020, 01, 04, 06, 07, 06, 0, time.UTC), + CreatedAt: time.Date(2020, 1, 4, 6, 7, 6, 0, time.UTC), State: base.ReviewStateChangesRequested, Content: "Don't add more reviews", }, @@ -410,7 +410,7 @@ func TestGitHubDownloadRepo(t *testing.T) { ReviewerID: 81045, ReviewerName: "lunny", CommitID: "2be9101c543658591222acbee3eb799edfc3853d", - CreatedAt: time.Date(2020, 01, 04, 11, 21, 41, 0, time.UTC), + CreatedAt: time.Date(2020, 1, 4, 11, 21, 41, 0, time.UTC), State: base.ReviewStateCommented, Comments: []*base.ReviewComment{ { @@ -421,8 +421,8 @@ func TestGitHubDownloadRepo(t *testing.T) { Position: 4, CommitID: "2be9101c543658591222acbee3eb799edfc3853d", PosterID: 81045, - CreatedAt: time.Date(2020, 01, 04, 11, 21, 41, 0, time.UTC), - UpdatedAt: time.Date(2020, 01, 04, 11, 21, 41, 0, time.UTC), + CreatedAt: time.Date(2020, 1, 4, 11, 21, 41, 0, time.UTC), + UpdatedAt: time.Date(2020, 1, 4, 11, 21, 41, 0, time.UTC), }, }, }, diff --git a/services/migrations/gitlab_test.go b/services/migrations/gitlab_test.go index f6dc7510cb..6b77aa62ef 100644 --- a/services/migrations/gitlab_test.go +++ b/services/migrations/gitlab_test.go @@ -156,7 +156,8 @@ func TestGitlabDownloadRepo(t *testing.T) { UserID: 1241334, UserName: "lafriks", Content: "open_mouth", - }}, + }, + }, Closed: timePtr(time.Date(2019, 11, 28, 8, 46, 23, 275000000, time.UTC)), }, { @@ -204,7 +205,8 @@ func TestGitlabDownloadRepo(t *testing.T) { UserID: 1241334, UserName: "lafriks", Content: "hearts", - }}, + }, + }, Closed: timePtr(time.Date(2019, 11, 28, 8, 45, 44, 959000000, time.UTC)), }, }, issues) @@ -310,13 +312,13 @@ func TestGitlabDownloadRepo(t *testing.T) { { ReviewerID: 4102996, ReviewerName: "zeripath", - CreatedAt: time.Date(2019, 11, 28, 16, 02, 8, 377000000, time.UTC), + CreatedAt: time.Date(2019, 11, 28, 16, 2, 8, 377000000, time.UTC), State: "APPROVED", }, { ReviewerID: 527793, ReviewerName: "axifive", - CreatedAt: time.Date(2019, 11, 28, 16, 02, 8, 377000000, time.UTC), + CreatedAt: time.Date(2019, 11, 28, 16, 2, 8, 377000000, time.UTC), State: "APPROVED", }, }, rvs) @@ -327,7 +329,7 @@ func TestGitlabDownloadRepo(t *testing.T) { { ReviewerID: 4575606, ReviewerName: "real6543", - CreatedAt: time.Date(2020, 04, 19, 19, 24, 21, 108000000, time.UTC), + CreatedAt: time.Date(2020, 4, 19, 19, 24, 21, 108000000, time.UTC), State: "APPROVED", }, }, rvs) diff --git a/services/migrations/gogs_test.go b/services/migrations/gogs_test.go index 57eda59b92..f9d74d3be3 100644 --- a/services/migrations/gogs_test.go +++ b/services/migrations/gogs_test.go @@ -99,8 +99,8 @@ func TestGogsDownloadRepo(t *testing.T) { Content: "test", Milestone: "", State: "open", - Created: time.Date(2019, 06, 11, 8, 16, 44, 0, time.UTC), - Updated: time.Date(2019, 10, 26, 11, 07, 2, 0, time.UTC), + Created: time.Date(2019, 6, 11, 8, 16, 44, 0, time.UTC), + Updated: time.Date(2019, 10, 26, 11, 7, 2, 0, time.UTC), Labels: []*base.Label{ { Name: "bug", @@ -121,8 +121,8 @@ func TestGogsDownloadRepo(t *testing.T) { PosterID: 5331, PosterName: "lunny", PosterEmail: "xiaolunwen@gmail.com", - Created: time.Date(2019, 06, 11, 8, 19, 50, 0, time.UTC), - Updated: time.Date(2019, 06, 11, 8, 19, 50, 0, time.UTC), + Created: time.Date(2019, 6, 11, 8, 19, 50, 0, time.UTC), + Updated: time.Date(2019, 6, 11, 8, 19, 50, 0, time.UTC), Content: "1111", }, { |