summaryrefslogtreecommitdiffstats
path: root/modules/migrations
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2021-09-08 16:17:22 +0200
committerGitHub <noreply@github.com>2021-09-08 16:17:22 +0200
commitf55cd033ed8dbee04e90faede5cca2dcf697e102 (patch)
treebfd15a132eb739245c88a1f11ae523f03d8b9395 /modules/migrations
parentbc81d12e68d16458fea4ee024c0168c2f33db1e6 (diff)
downloadgitea-f55cd033ed8dbee04e90faede5cca2dcf697e102.tar.gz
gitea-f55cd033ed8dbee04e90faede5cca2dcf697e102.zip
Make TestOneDevDownloadRepo work again & more resistant (#16987)
* Update TestOneDevDownloadRepo since OneDev api changed * Use test functions for migrations
Diffstat (limited to 'modules/migrations')
-rw-r--r--modules/migrations/onedev_test.go19
1 files changed, 7 insertions, 12 deletions
diff --git a/modules/migrations/onedev_test.go b/modules/migrations/onedev_test.go
index 48d56c3e22..5dabf66bdc 100644
--- a/modules/migrations/onedev_test.go
+++ b/modules/migrations/onedev_test.go
@@ -30,7 +30,7 @@ func TestOneDevDownloadRepo(t *testing.T) {
}
repo, err := downloader.GetRepoInfo()
assert.NoError(t, err)
- assert.EqualValues(t, &base.Repository{
+ assertRepositoryEqual(t, &base.Repository{
Name: "go-gitea-test_repo",
Owner: "",
Description: "Test repository for testing migration from OneDev to gitea",
@@ -40,9 +40,8 @@ func TestOneDevDownloadRepo(t *testing.T) {
milestones, err := downloader.GetMilestones()
assert.NoError(t, err)
- assert.Len(t, milestones, 2)
deadline := time.Unix(1620086400, 0)
- assert.EqualValues(t, []*base.Milestone{
+ assertMilestonesEqual(t, []*base.Milestone{
{
Title: "1.0.0",
Deadline: &deadline,
@@ -60,9 +59,8 @@ func TestOneDevDownloadRepo(t *testing.T) {
issues, isEnd, err := downloader.GetIssues(1, 2)
assert.NoError(t, err)
- assert.Len(t, issues, 2)
assert.False(t, isEnd)
- assert.EqualValues(t, []*base.Issue{
+ assertIssuesEqual(t, []*base.Issue{
{
Number: 4,
Title: "Hi there",
@@ -112,21 +110,19 @@ func TestOneDevDownloadRepo(t *testing.T) {
},
})
assert.NoError(t, err)
- assert.Len(t, comments, 1)
- assert.EqualValues(t, []*base.Comment{
+ assertCommentsEqual(t, []*base.Comment{
{
IssueIndex: 4,
PosterName: "User 336",
Created: time.Unix(1628549791, 128000000),
Updated: time.Unix(1628549791, 128000000),
- Content: "it has a comment\r\n\r\nEDIT: that got edited",
+ Content: "it has a comment\n\nEDIT: that got edited",
},
}, comments)
prs, _, err := downloader.GetPullRequests(1, 1)
assert.NoError(t, err)
- assert.Len(t, prs, 1)
- assert.EqualValues(t, []*base.PullRequest{
+ assertPullRequestsEqual(t, []*base.PullRequest{
{
Number: 5,
Title: "Pull to add a new file",
@@ -158,8 +154,7 @@ func TestOneDevDownloadRepo(t *testing.T) {
localID: 5,
})
assert.NoError(t, err)
- assert.Len(t, rvs, 1)
- assert.EqualValues(t, []*base.Review{
+ assertReviewsEqual(t, []*base.Review{
{
IssueIndex: 5,
ReviewerName: "User 317",