summaryrefslogtreecommitdiffstats
path: root/modules/migrations/gitlab_test.go
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2021-08-22 00:47:45 +0200
committerGitHub <noreply@github.com>2021-08-22 00:47:45 +0200
commitcee5f7c5e2bfe3132d7089a6bffc1a4bfc392e21 (patch)
tree41cf982a5b7a759645238fa7a99446e09761d359 /modules/migrations/gitlab_test.go
parent2d1935acc7b2a6ecc797346625b80caa7e0b5787 (diff)
downloadgitea-cee5f7c5e2bfe3132d7089a6bffc1a4bfc392e21.tar.gz
gitea-cee5f7c5e2bfe3132d7089a6bffc1a4bfc392e21.zip
Add migrate from OneDev (#16356)
* Use context to simplify logic. * Added migration from OneDev. This PR adds [OneDev](https://code.onedev.io/) as migration source. Supported: - [x] Milestones - [x] Issues - [x] Pull Requests - [x] Comments - [x] Reviews - [x] Labels
Diffstat (limited to 'modules/migrations/gitlab_test.go')
-rw-r--r--modules/migrations/gitlab_test.go32
1 files changed, 20 insertions, 12 deletions
diff --git a/modules/migrations/gitlab_test.go b/modules/migrations/gitlab_test.go
index 8fd915e0f5..c3ee8118c5 100644
--- a/modules/migrations/gitlab_test.go
+++ b/modules/migrations/gitlab_test.go
@@ -210,7 +210,11 @@ func TestGitlabDownloadRepo(t *testing.T) {
}, issues)
comments, _, err := downloader.GetComments(base.GetCommentOptions{
- IssueNumber: 2,
+ Context: gitlabIssueContext{
+ foreignID: 2,
+ localID: 2,
+ IsMergeRequest: false,
+ },
})
assert.NoError(t, err)
assertCommentsEqual(t, []*base.Comment{
@@ -252,15 +256,14 @@ func TestGitlabDownloadRepo(t *testing.T) {
assert.NoError(t, err)
assertPullRequestsEqual(t, []*base.PullRequest{
{
- Number: 4,
- OriginalNumber: 2,
- Title: "Test branch",
- Content: "do not merge this PR",
- Milestone: "1.0.0",
- PosterID: 1241334,
- PosterName: "lafriks",
- State: "opened",
- Created: time.Date(2019, 11, 28, 15, 56, 54, 104000000, time.UTC),
+ Number: 4,
+ Title: "Test branch",
+ Content: "do not merge this PR",
+ Milestone: "1.0.0",
+ PosterID: 1241334,
+ PosterName: "lafriks",
+ State: "opened",
+ Created: time.Date(2019, 11, 28, 15, 56, 54, 104000000, time.UTC),
Labels: []*base.Label{
{
Name: "bug",
@@ -293,10 +296,15 @@ func TestGitlabDownloadRepo(t *testing.T) {
Merged: false,
MergedTime: nil,
MergeCommitSHA: "",
+ Context: gitlabIssueContext{
+ foreignID: 2,
+ localID: 4,
+ IsMergeRequest: true,
+ },
},
}, prs)
- rvs, err := downloader.GetReviews(1)
+ rvs, err := downloader.GetReviews(base.BasicIssueContext(1))
assert.NoError(t, err)
assertReviewsEqual(t, []*base.Review{
{
@@ -313,7 +321,7 @@ func TestGitlabDownloadRepo(t *testing.T) {
},
}, rvs)
- rvs, err = downloader.GetReviews(2)
+ rvs, err = downloader.GetReviews(base.BasicIssueContext(2))
assert.NoError(t, err)
assertReviewsEqual(t, []*base.Review{
{