summaryrefslogtreecommitdiffstats
path: root/modules/migrations
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2021-06-07 07:27:09 +0200
committerGitHub <noreply@github.com>2021-06-07 07:27:09 +0200
commit3607f79d7869046d919fed05a21b55b6e61df1fa (patch)
tree9a176a4d5b67ac3a81ae210e9164d81959221ce0 /modules/migrations
parent51775f65bc933843199320b040186703a2bb9f51 (diff)
downloadgitea-3607f79d7869046d919fed05a21b55b6e61df1fa.tar.gz
gitea-3607f79d7869046d919fed05a21b55b6e61df1fa.zip
Fixed assert statements. (#16089)
Diffstat (limited to 'modules/migrations')
-rw-r--r--modules/migrations/gitea_downloader_test.go4
-rw-r--r--modules/migrations/gitea_uploader_test.go18
-rw-r--r--modules/migrations/github_test.go6
-rw-r--r--modules/migrations/gitlab_test.go4
-rw-r--r--modules/migrations/gogs_test.go4
5 files changed, 18 insertions, 18 deletions
diff --git a/modules/migrations/gitea_downloader_test.go b/modules/migrations/gitea_downloader_test.go
index c52c1225f4..babf038280 100644
--- a/modules/migrations/gitea_downloader_test.go
+++ b/modules/migrations/gitea_downloader_test.go
@@ -158,13 +158,13 @@ func TestGiteaDownloadRepo(t *testing.T) {
issues, isEnd, err := downloader.GetIssues(1, 50)
assert.NoError(t, err)
- assert.EqualValues(t, 7, len(issues))
+ assert.Len(t, issues, 7)
assert.True(t, isEnd)
assert.EqualValues(t, "open", issues[0].State)
issues, isEnd, err = downloader.GetIssues(3, 2)
assert.NoError(t, err)
- assert.EqualValues(t, 2, len(issues))
+ assert.Len(t, issues, 2)
assert.False(t, isEnd)
var (
diff --git a/modules/migrations/gitea_uploader_test.go b/modules/migrations/gitea_uploader_test.go
index 3c7def4675..cf975020a3 100644
--- a/modules/migrations/gitea_uploader_test.go
+++ b/modules/migrations/gitea_uploader_test.go
@@ -59,18 +59,18 @@ func TestGiteaUploadRepo(t *testing.T) {
State: structs.StateOpen,
})
assert.NoError(t, err)
- assert.EqualValues(t, 1, len(milestones))
+ assert.Len(t, milestones, 1)
milestones, err = models.GetMilestones(models.GetMilestonesOption{
RepoID: repo.ID,
State: structs.StateClosed,
})
assert.NoError(t, err)
- assert.EqualValues(t, 0, len(milestones))
+ assert.Empty(t, milestones)
labels, err := models.GetLabelsByRepoID(repo.ID, "", models.ListOptions{})
assert.NoError(t, err)
- assert.EqualValues(t, 11, len(labels))
+ assert.Len(t, labels, 11)
releases, err := models.GetReleasesByRepoID(repo.ID, models.FindReleasesOptions{
ListOptions: models.ListOptions{
@@ -80,7 +80,7 @@ func TestGiteaUploadRepo(t *testing.T) {
IncludeTags: true,
})
assert.NoError(t, err)
- assert.EqualValues(t, 8, len(releases))
+ assert.Len(t, releases, 8)
releases, err = models.GetReleasesByRepoID(repo.ID, models.FindReleasesOptions{
ListOptions: models.ListOptions{
@@ -90,7 +90,7 @@ func TestGiteaUploadRepo(t *testing.T) {
IncludeTags: false,
})
assert.NoError(t, err)
- assert.EqualValues(t, 1, len(releases))
+ assert.Len(t, releases, 1)
issues, err := models.Issues(&models.IssuesOptions{
RepoIDs: []int64{repo.ID},
@@ -98,16 +98,16 @@ func TestGiteaUploadRepo(t *testing.T) {
SortType: "oldest",
})
assert.NoError(t, err)
- assert.EqualValues(t, 14, len(issues))
+ assert.Len(t, issues, 14)
assert.NoError(t, issues[0].LoadDiscussComments())
- assert.EqualValues(t, 0, len(issues[0].Comments))
+ assert.Empty(t, issues[0].Comments)
pulls, _, err := models.PullRequests(repo.ID, &models.PullRequestsOptions{
SortType: "oldest",
})
assert.NoError(t, err)
- assert.EqualValues(t, 34, len(pulls))
+ assert.Len(t, pulls, 34)
assert.NoError(t, pulls[0].LoadIssue())
assert.NoError(t, pulls[0].Issue.LoadDiscussComments())
- assert.EqualValues(t, 2, len(pulls[0].Issue.Comments))
+ assert.Len(t, pulls[0].Issue.Comments, 2)
}
diff --git a/modules/migrations/github_test.go b/modules/migrations/github_test.go
index efa8b6ba9b..5bd980a9d8 100644
--- a/modules/migrations/github_test.go
+++ b/modules/migrations/github_test.go
@@ -147,7 +147,7 @@ func TestGitHubDownloadRepo(t *testing.T) {
// downloader.GetIssues()
issues, isEnd, err := downloader.GetIssues(1, 2)
assert.NoError(t, err)
- assert.EqualValues(t, 2, len(issues))
+ assert.Len(t, issues, 2)
assert.False(t, isEnd)
var (
@@ -242,7 +242,7 @@ func TestGitHubDownloadRepo(t *testing.T) {
// downloader.GetComments()
comments, err := downloader.GetComments(2)
assert.NoError(t, err)
- assert.EqualValues(t, 2, len(comments))
+ assert.Len(t, comments, 2)
assert.EqualValues(t, []*base.Comment{
{
IssueIndex: 2,
@@ -273,7 +273,7 @@ func TestGitHubDownloadRepo(t *testing.T) {
// downloader.GetPullRequests()
prs, _, err := downloader.GetPullRequests(1, 2)
assert.NoError(t, err)
- assert.EqualValues(t, 2, len(prs))
+ assert.Len(t, prs, 2)
closed1 = time.Date(2019, 11, 12, 21, 39, 27, 0, time.UTC)
var merged1 = time.Date(2019, 11, 12, 21, 39, 27, 0, time.UTC)
diff --git a/modules/migrations/gitlab_test.go b/modules/migrations/gitlab_test.go
index f64d72147c..32ed6d807a 100644
--- a/modules/migrations/gitlab_test.go
+++ b/modules/migrations/gitlab_test.go
@@ -115,7 +115,7 @@ func TestGitlabDownloadRepo(t *testing.T) {
issues, isEnd, err := downloader.GetIssues(1, 2)
assert.NoError(t, err)
- assert.EqualValues(t, 2, len(issues))
+ assert.Len(t, issues, 2)
assert.False(t, isEnd)
var (
@@ -206,7 +206,7 @@ func TestGitlabDownloadRepo(t *testing.T) {
comments, err := downloader.GetComments(2)
assert.NoError(t, err)
- assert.EqualValues(t, 4, len(comments))
+ assert.Len(t, comments, 4)
assert.EqualValues(t, []*base.Comment{
{
IssueIndex: 2,
diff --git a/modules/migrations/gogs_test.go b/modules/migrations/gogs_test.go
index c240ae6432..d173952b06 100644
--- a/modules/migrations/gogs_test.go
+++ b/modules/migrations/gogs_test.go
@@ -80,7 +80,7 @@ func TestGogsDownloadRepo(t *testing.T) {
// downloader.GetIssues()
issues, isEnd, err := downloader.GetIssues(1, 8)
assert.NoError(t, err)
- assert.EqualValues(t, 1, len(issues))
+ assert.Len(t, issues, 1)
assert.False(t, isEnd)
assert.EqualValues(t, []*base.Issue{
@@ -105,7 +105,7 @@ func TestGogsDownloadRepo(t *testing.T) {
// downloader.GetComments()
comments, err := downloader.GetComments(1)
assert.NoError(t, err)
- assert.EqualValues(t, 1, len(comments))
+ assert.Len(t, comments, 1)
assert.EqualValues(t, []*base.Comment{
{
PosterName: "lunny",