@ -5,426 +5,415 @@
package migrations
package migrations
import (
//func TestGitHubDownloadRepo(t *testing.T) {
"context"
// GithubLimitRateRemaining = 3 // Wait at 3 remaining since we could have 3 CI in //
"os"
// downloader := NewGithubDownloaderV3(context.Background(), "https://github.com", "", "", os.Getenv("GITHUB_READ_TOKEN"), "go-gitea", "test_repo")
"testing"
// err := downloader.RefreshRate()
"time"
// assert.NoError(t, err)
//
base "code.gitea.io/gitea/modules/migration"
// repo, err := downloader.GetRepoInfo()
// assert.NoError(t, err)
"github.com/stretchr/testify/assert"
// assertRepositoryEqual(t, &base.Repository{
)
// Name: "test_repo",
// Owner: "go-gitea",
func TestGitHubDownloadRepo ( t * testing . T ) {
// Description: "Test repository for testing migration from github to gitea",
GithubLimitRateRemaining = 3 // Wait at 3 remaining since we could have 3 CI in //
// CloneURL: "https://github.com/go-gitea/test_repo.git",
downloader := NewGithubDownloaderV3 ( context . Background ( ) , "https://github.com" , "" , "" , os . Getenv ( "GITHUB_READ_TOKEN" ) , "go-gitea" , "test_repo" )
// OriginalURL: "https://github.com/go-gitea/test_repo",
err := downloader . RefreshRate ( )
// DefaultBranch: "master",
assert . NoError ( t , err )
// }, repo)
//
repo , err := downloader . GetRepoInfo ( )
// topics, err := downloader.GetTopics()
assert . NoError ( t , err )
// assert.NoError(t, err)
assertRepositoryEqual ( t , & base . Repository {
// assert.Contains(t, topics, "gitea")
Name : "test_repo" ,
//
Owner : "go-gitea" ,
// milestones, err := downloader.GetMilestones()
Description : "Test repository for testing migration from github to gitea" ,
// assert.NoError(t, err)
CloneURL : "https://github.com/go-gitea/test_repo.git" ,
// assertMilestonesEqual(t, []*base.Milestone{
OriginalURL : "https://github.com/go-gitea/test_repo" ,
// {
DefaultBranch : "master" ,
// Title: "1.0.0",
} , repo )
// Description: "Milestone 1.0.0",
// Deadline: timePtr(time.Date(2019, 11, 11, 8, 0, 0, 0, time.UTC)),
topics , err := downloader . GetTopics ( )
// Created: time.Date(2019, 11, 12, 19, 37, 8, 0, time.UTC),
assert . NoError ( t , err )
// Updated: timePtr(time.Date(2019, 11, 12, 21, 56, 17, 0, time.UTC)),
assert . Contains ( t , topics , "gitea" )
// Closed: timePtr(time.Date(2019, 11, 12, 19, 45, 49, 0, time.UTC)),
// State: "closed",
milestones , err := downloader . GetMilestones ( )
// },
assert . NoError ( t , err )
// {
assertMilestonesEqual ( t , [ ] * base . Milestone {
// Title: "1.1.0",
{
// Description: "Milestone 1.1.0",
Title : "1.0.0" ,
// Deadline: timePtr(time.Date(2019, 11, 12, 8, 0, 0, 0, time.UTC)),
Description : "Milestone 1.0.0" ,
// Created: time.Date(2019, 11, 12, 19, 37, 25, 0, time.UTC),
Deadline : timePtr ( time . Date ( 2019 , 11 , 11 , 8 , 0 , 0 , 0 , time . UTC ) ) ,
// Updated: timePtr(time.Date(2019, 11, 12, 21, 39, 27, 0, time.UTC)),
Created : time . Date ( 2019 , 11 , 12 , 19 , 37 , 8 , 0 , time . UTC ) ,
// Closed: timePtr(time.Date(2019, 11, 12, 19, 45, 46, 0, time.UTC)),
Updated : timePtr ( time . Date ( 2019 , 11 , 12 , 21 , 56 , 17 , 0 , time . UTC ) ) ,
// State: "closed",
Closed : timePtr ( time . Date ( 2019 , 11 , 12 , 19 , 45 , 49 , 0 , time . UTC ) ) ,
// },
State : "closed" ,
// }, milestones)
} ,
//
{
// labels, err := downloader.GetLabels()
Title : "1.1.0" ,
// assert.NoError(t, err)
Description : "Milestone 1.1.0" ,
// assertLabelsEqual(t, []*base.Label{
Deadline : timePtr ( time . Date ( 2019 , 11 , 12 , 8 , 0 , 0 , 0 , time . UTC ) ) ,
// {
Created : time . Date ( 2019 , 11 , 12 , 19 , 37 , 25 , 0 , time . UTC ) ,
// Name: "bug",
Updated : timePtr ( time . Date ( 2019 , 11 , 12 , 21 , 39 , 27 , 0 , time . UTC ) ) ,
// Color: "d73a4a",
Closed : timePtr ( time . Date ( 2019 , 11 , 12 , 19 , 45 , 46 , 0 , time . UTC ) ) ,
// Description: "Something isn't working",
State : "closed" ,
// },
} ,
// {
} , milestones )
// Name: "documentation",
// Color: "0075ca",
labels , err := downloader . GetLabels ( )
// Description: "Improvements or additions to documentation",
assert . NoError ( t , err )
// },
assertLabelsEqual ( t , [ ] * base . Label {
// {
{
// Name: "duplicate",
Name : "bug" ,
// Color: "cfd3d7",
Color : "d73a4a" ,
// Description: "This issue or pull request already exists",
Description : "Something isn't working" ,
// },
} ,
// {
{
// Name: "enhancement",
Name : "documentation" ,
// Color: "a2eeef",
Color : "0075ca" ,
// Description: "New feature or request",
Description : "Improvements or additions to documentation" ,
// },
} ,
// {
{
// Name: "good first issue",
Name : "duplicate" ,
// Color: "7057ff",
Color : "cfd3d7" ,
// Description: "Good for newcomers",
Description : "This issue or pull request already exists" ,
// },
} ,
// {
{
// Name: "help wanted",
Name : "enhancement" ,
// Color: "008672",
Color : "a2eeef" ,
// Description: "Extra attention is needed",
Description : "New feature or request" ,
// },
} ,
// {
{
// Name: "invalid",
Name : "good first issue" ,
// Color: "e4e669",
Color : "7057ff" ,
// Description: "This doesn't seem right",
Description : "Good for newcomers" ,
// },
} ,
// {
{
// Name: "question",
Name : "help wanted" ,
// Color: "d876e3",
Color : "008672" ,
// Description: "Further information is requested",
Description : "Extra attention is needed" ,
// },
} ,
// {
{
// Name: "wontfix",
Name : "invalid" ,
// Color: "ffffff",
Color : "e4e669" ,
// Description: "This will not be worked on",
Description : "This doesn't seem right" ,
// },
} ,
// }, labels)
{
//
Name : "question" ,
// releases, err := downloader.GetReleases()
Color : "d876e3" ,
// assert.NoError(t, err)
Description : "Further information is requested" ,
// assertReleasesEqual(t, []*base.Release{
} ,
// {
{
// TagName: "v0.9.99",
Name : "wontfix" ,
// TargetCommitish: "master",
Color : "ffffff" ,
// Name: "First Release",
Description : "This will not be worked on" ,
// Body: "A test release",
} ,
// Created: time.Date(2019, 11, 9, 16, 49, 21, 0, time.UTC),
} , labels )
// Published: time.Date(2019, 11, 12, 20, 12, 10, 0, time.UTC),
// PublisherID: 1669571,
releases , err := downloader . GetReleases ( )
// PublisherName: "mrsdizzie",
assert . NoError ( t , err )
// },
assertReleasesEqual ( t , [ ] * base . Release {
// }, releases)
{
//
TagName : "v0.9.99" ,
// // downloader.GetIssues()
TargetCommitish : "master" ,
// issues, isEnd, err := downloader.GetIssues(1, 2)
Name : "First Release" ,
// assert.NoError(t, err)
Body : "A test release" ,
// assert.False(t, isEnd)
Created : time . Date ( 2019 , 11 , 9 , 16 , 49 , 21 , 0 , time . UTC ) ,
// assertIssuesEqual(t, []*base.Issue{
Published : time . Date ( 2019 , 11 , 12 , 20 , 12 , 10 , 0 , time . UTC ) ,
// {
PublisherID : 1669571 ,
// Number: 1,
PublisherName : "mrsdizzie" ,
// Title: "Please add an animated gif icon to the merge button",
} ,
// Content: "I just want the merge button to hurt my eyes a little. \xF0\x9F\x98\x9D ",
} , releases )
// Milestone: "1.0.0",
// PosterID: 18600385,
// downloader.GetIssues()
// PosterName: "guillep2k",
issues , isEnd , err := downloader . GetIssues ( 1 , 2 )
// State: "closed",
assert . NoError ( t , err )
// Created: time.Date(2019, 11, 9, 17, 0, 29, 0, time.UTC),
assert . False ( t , isEnd )
// Updated: time.Date(2019, 11, 12, 20, 29, 53, 0, time.UTC),
assertIssuesEqual ( t , [ ] * base . Issue {
// Labels: []*base.Label{
{
// {
Number : 1 ,
// Name: "bug",
Title : "Please add an animated gif icon to the merge button" ,
// Color: "d73a4a",
Content : "I just want the merge button to hurt my eyes a little. \xF0\x9F\x98\x9D " ,
// Description: "Something isn't working",
Milestone : "1.0.0" ,
// },
PosterID : 18600385 ,
// {
PosterName : "guillep2k" ,
// Name: "good first issue",
State : "closed" ,
// Color: "7057ff",
Created : time . Date ( 2019 , 11 , 9 , 17 , 0 , 29 , 0 , time . UTC ) ,
// Description: "Good for newcomers",
Updated : time . Date ( 2019 , 11 , 12 , 20 , 29 , 53 , 0 , time . UTC ) ,
// },
Labels : [ ] * base . Label {
// },
{
// Reactions: []*base.Reaction{
Name : "bug" ,
// {
Color : "d73a4a" ,
// UserID: 1669571,
Description : "Something isn't working" ,
// UserName: "mrsdizzie",
} ,
// Content: "+1",
{
// },
Name : "good first issue" ,
// },
Color : "7057ff" ,
// Closed: timePtr(time.Date(2019, 11, 12, 20, 22, 22, 0, time.UTC)),
Description : "Good for newcomers" ,
// },
} ,
// {
} ,
// Number: 2,
Reactions : [ ] * base . Reaction {
// Title: "Test issue",
{
// Content: "This is test issue 2, do not touch!",
UserID : 1669571 ,
// Milestone: "1.1.0",
UserName : "mrsdizzie" ,
// PosterID: 1669571,
Content : "+1" ,
// PosterName: "mrsdizzie",
} ,
// State: "closed",
} ,
// Created: time.Date(2019, 11, 12, 21, 0, 6, 0, time.UTC),
Closed : timePtr ( time . Date ( 2019 , 11 , 12 , 20 , 22 , 22 , 0 , time . UTC ) ) ,
// Updated: time.Date(2019, 11, 12, 22, 7, 14, 0, time.UTC),
} ,
// Labels: []*base.Label{
{
// {
Number : 2 ,
// Name: "duplicate",
Title : "Test issue" ,
// Color: "cfd3d7",
Content : "This is test issue 2, do not touch!" ,
// Description: "This issue or pull request already exists",
Milestone : "1.1.0" ,
// },
PosterID : 1669571 ,
// },
PosterName : "mrsdizzie" ,
// Reactions: []*base.Reaction{
State : "closed" ,
// {
Created : time . Date ( 2019 , 11 , 12 , 21 , 0 , 6 , 0 , time . UTC ) ,
// UserID: 1669571,
Updated : time . Date ( 2019 , 11 , 12 , 22 , 7 , 14 , 0 , time . UTC ) ,
// UserName: "mrsdizzie",
Labels : [ ] * base . Label {
// Content: "heart",
{
// },
Name : "duplicate" ,
// {
Color : "cfd3d7" ,
// UserID: 1669571,
Description : "This issue or pull request already exists" ,
// UserName: "mrsdizzie",
} ,
// Content: "laugh",
} ,
// },
Reactions : [ ] * base . Reaction {
// {
{
// UserID: 1669571,
UserID : 1669571 ,
// UserName: "mrsdizzie",
UserName : "mrsdizzie" ,
// Content: "-1",
Content : "heart" ,
// },
} ,
// {
{
// UserID: 1669571,
UserID : 1669571 ,
// UserName: "mrsdizzie",
UserName : "mrsdizzie" ,
// Content: "confused",
Content : "laugh" ,
// },
} ,
// {
{
// UserID: 1669571,
UserID : 1669571 ,
// UserName: "mrsdizzie",
UserName : "mrsdizzie" ,
// Content: "hooray",
Content : "-1" ,
// },
} ,
// {
{
// UserID: 1669571,
UserID : 1669571 ,
// UserName: "mrsdizzie",
UserName : "mrsdizzie" ,
// Content: "+1",
Content : "confused" ,
// },
} ,
// },
{
// Closed: timePtr(time.Date(2019, 11, 12, 21, 1, 31, 0, time.UTC)),
UserID : 1669571 ,
// },
UserName : "mrsdizzie" ,
// }, issues)
Content : "hooray" ,
//
} ,
// // downloader.GetComments()
{
// comments, _, err := downloader.GetComments(base.GetCommentOptions{
UserID : 1669571 ,
// Context: base.BasicIssueContext(2),
UserName : "mrsdizzie" ,
// })
Content : "+1" ,
// assert.NoError(t, err)
} ,
// assertCommentsEqual(t, []*base.Comment{
} ,
// {
Closed : timePtr ( time . Date ( 2019 , 11 , 12 , 21 , 1 , 31 , 0 , time . UTC ) ) ,
// IssueIndex: 2,
} ,
// PosterID: 1669571,
} , issues )
// PosterName: "mrsdizzie",
// Created: time.Date(2019, 11, 12, 21, 0, 13, 0, time.UTC),
// downloader.GetComments()
// Updated: time.Date(2019, 11, 12, 21, 0, 13, 0, time.UTC),
comments , _ , err := downloader . GetComments ( base . GetCommentOptions {
// Content: "This is a comment",
Context : base . BasicIssueContext ( 2 ) ,
// Reactions: []*base.Reaction{
} )
// {
assert . NoError ( t , err )
// UserID: 1669571,
assertCommentsEqual ( t , [ ] * base . Comment {
// UserName: "mrsdizzie",
{
// Content: "+1",
IssueIndex : 2 ,
// },
PosterID : 1669571 ,
// },
PosterName : "mrsdizzie" ,
// },
Created : time . Date ( 2019 , 11 , 12 , 21 , 0 , 13 , 0 , time . UTC ) ,
// {
Updated : time . Date ( 2019 , 11 , 12 , 21 , 0 , 13 , 0 , time . UTC ) ,
// IssueIndex: 2,
Content : "This is a comment" ,
// PosterID: 1669571,
Reactions : [ ] * base . Reaction {
// PosterName: "mrsdizzie",
{
// Created: time.Date(2019, 11, 12, 22, 7, 14, 0, time.UTC),
UserID : 1669571 ,
// Updated: time.Date(2019, 11, 12, 22, 7, 14, 0, time.UTC),
UserName : "mrsdizzie" ,
// Content: "A second comment",
Content : "+1" ,
// Reactions: nil,
} ,
// },
} ,
// }, comments)
} ,
//
{
// // downloader.GetPullRequests()
IssueIndex : 2 ,
// prs, _, err := downloader.GetPullRequests(1, 2)
PosterID : 1669571 ,
// assert.NoError(t, err)
PosterName : "mrsdizzie" ,
// assertPullRequestsEqual(t, []*base.PullRequest{
Created : time . Date ( 2019 , 11 , 12 , 22 , 7 , 14 , 0 , time . UTC ) ,
// {
Updated : time . Date ( 2019 , 11 , 12 , 22 , 7 , 14 , 0 , time . UTC ) ,
// Number: 3,
Content : "A second comment" ,
// Title: "Update README.md",
Reactions : nil ,
// Content: "add warning to readme",
} ,
// Milestone: "1.1.0",
} , comments )
// PosterID: 1669571,
// PosterName: "mrsdizzie",
// downloader.GetPullRequests()
// State: "closed",
prs , _ , err := downloader . GetPullRequests ( 1 , 2 )
// Created: time.Date(2019, 11, 12, 21, 21, 43, 0, time.UTC),
assert . NoError ( t , err )
// Updated: time.Date(2019, 11, 12, 21, 39, 28, 0, time.UTC),
assertPullRequestsEqual ( t , [ ] * base . PullRequest {
// Labels: []*base.Label{
{
// {
Number : 3 ,
// Name: "documentation",
Title : "Update README.md" ,
// Color: "0075ca",
Content : "add warning to readme" ,
// Description: "Improvements or additions to documentation",
Milestone : "1.1.0" ,
// },
PosterID : 1669571 ,
// },
PosterName : "mrsdizzie" ,
// PatchURL: "https://github.com/go-gitea/test_repo/pull/3.patch",
State : "closed" ,
// Head: base.PullRequestBranch{
Created : time . Date ( 2019 , 11 , 12 , 21 , 21 , 43 , 0 , time . UTC ) ,
// Ref: "master",
Updated : time . Date ( 2019 , 11 , 12 , 21 , 39 , 28 , 0 , time . UTC ) ,
// CloneURL: "https://github.com/mrsdizzie/test_repo.git",
Labels : [ ] * base . Label {
// SHA: "076160cf0b039f13e5eff19619932d181269414b",
{
// RepoName: "test_repo",
Name : "documentation" ,
//
Color : "0075ca" ,
// OwnerName: "mrsdizzie",
Description : "Improvements or additions to documentation" ,
// },
} ,
// Base: base.PullRequestBranch{
} ,
// Ref: "master",
PatchURL : "https://github.com/go-gitea/test_repo/pull/3.patch" ,
// SHA: "72866af952e98d02a73003501836074b286a78f6",
Head : base . PullRequestBranch {
// OwnerName: "go-gitea",
Ref : "master" ,
// RepoName: "test_repo",
CloneURL : "https://github.com/mrsdizzie/test_repo.git" ,
// },
SHA : "076160cf0b039f13e5eff19619932d181269414b" ,
// Closed: timePtr(time.Date(2019, 11, 12, 21, 39, 27, 0, time.UTC)),
RepoName : "test_repo" ,
// Merged: true,
// MergedTime: timePtr(time.Date(2019, 11, 12, 21, 39, 27, 0, time.UTC)),
OwnerName : "mrsdizzie" ,
// MergeCommitSHA: "f32b0a9dfd09a60f616f29158f772cedd89942d2",
} ,
// Context: base.BasicIssueContext(3),
Base : base . PullRequestBranch {
// },
Ref : "master" ,
// {
SHA : "72866af952e98d02a73003501836074b286a78f6" ,
// Number: 4,
OwnerName : "go-gitea" ,
// Title: "Test branch",
RepoName : "test_repo" ,
// Content: "do not merge this PR",
} ,
// Milestone: "1.0.0",
Closed : timePtr ( time . Date ( 2019 , 11 , 12 , 21 , 39 , 27 , 0 , time . UTC ) ) ,
// PosterID: 1669571,
Merged : true ,
// PosterName: "mrsdizzie",
MergedTime : timePtr ( time . Date ( 2019 , 11 , 12 , 21 , 39 , 27 , 0 , time . UTC ) ) ,
// State: "open",
MergeCommitSHA : "f32b0a9dfd09a60f616f29158f772cedd89942d2" ,
// Created: time.Date(2019, 11, 12, 21, 54, 18, 0, time.UTC),
Context : base . BasicIssueContext ( 3 ) ,
// Updated: time.Date(2020, 1, 4, 11, 30, 1, 0, time.UTC),
} ,
// Labels: []*base.Label{
{
// {
Number : 4 ,
// Name: "bug",
Title : "Test branch" ,
// Color: "d73a4a",
Content : "do not merge this PR" ,
// Description: "Something isn't working",
Milestone : "1.0.0" ,
// },
PosterID : 1669571 ,
// },
PosterName : "mrsdizzie" ,
// PatchURL: "https://github.com/go-gitea/test_repo/pull/4.patch",
State : "open" ,
// Head: base.PullRequestBranch{
Created : time . Date ( 2019 , 11 , 12 , 21 , 54 , 18 , 0 , time . UTC ) ,
// Ref: "test-branch",
Updated : time . Date ( 2020 , 1 , 4 , 11 , 30 , 1 , 0 , time . UTC ) ,
// SHA: "2be9101c543658591222acbee3eb799edfc3853d",
Labels : [ ] * base . Label {
// RepoName: "test_repo",
{
// OwnerName: "mrsdizzie",
Name : "bug" ,
// CloneURL: "https://github.com/mrsdizzie/test_repo.git",
Color : "d73a4a" ,
// },
Description : "Something isn't working" ,
// Base: base.PullRequestBranch{
} ,
// Ref: "master",
} ,
// SHA: "f32b0a9dfd09a60f616f29158f772cedd89942d2",
PatchURL : "https://github.com/go-gitea/test_repo/pull/4.patch" ,
// OwnerName: "go-gitea",
Head : base . PullRequestBranch {
// RepoName: "test_repo",
Ref : "test-branch" ,
// },
SHA : "2be9101c543658591222acbee3eb799edfc3853d" ,
// Merged: false,
RepoName : "test_repo" ,
// MergeCommitSHA: "565d1208f5fffdc1c5ae1a2436491eb9a5e4ebae",
OwnerName : "mrsdizzie" ,
// Reactions: []*base.Reaction{
CloneURL : "https://github.com/mrsdizzie/test_repo.git" ,
// {
} ,
// UserID: 81045,
Base : base . PullRequestBranch {
// UserName: "lunny",
Ref : "master" ,
// Content: "heart",
SHA : "f32b0a9dfd09a60f616f29158f772cedd89942d2" ,
// },
OwnerName : "go-gitea" ,
// {
RepoName : "test_repo" ,
// UserID: 81045,
} ,
// UserName: "lunny",
Merged : false ,
// Content: "+1",
MergeCommitSHA : "565d1208f5fffdc1c5ae1a2436491eb9a5e4ebae" ,
// },
Reactions : [ ] * base . Reaction {
// },
{
// Context: base.BasicIssueContext(4),
UserID : 81045 ,
// },
UserName : "lunny" ,
// }, prs)
Content : "heart" ,
//
} ,
// reviews, err := downloader.GetReviews(base.BasicIssueContext(3))
{
// assert.NoError(t, err)
UserID : 81045 ,
// assertReviewsEqual(t, []*base.Review{
UserName : "lunny" ,
// {
Content : "+1" ,
// ID: 315859956,
} ,
// IssueIndex: 3,
} ,
// ReviewerID: 42128690,
Context : base . BasicIssueContext ( 4 ) ,
// ReviewerName: "jolheiser",
} ,
// CommitID: "076160cf0b039f13e5eff19619932d181269414b",
} , prs )
// CreatedAt: time.Date(2019, 11, 12, 21, 35, 24, 0, time.UTC),
// State: base.ReviewStateApproved,
reviews , err := downloader . GetReviews ( base . BasicIssueContext ( 3 ) )
// },
assert . NoError ( t , err )
// {
assertReviewsEqual ( t , [ ] * base . Review {
// ID: 315860062,
{
// IssueIndex: 3,
ID : 315859956 ,
// ReviewerID: 1824502,
IssueIndex : 3 ,
// ReviewerName: "zeripath",
ReviewerID : 42128690 ,
// CommitID: "076160cf0b039f13e5eff19619932d181269414b",
ReviewerName : "jolheiser" ,
// CreatedAt: time.Date(2019, 11, 12, 21, 35, 36, 0, time.UTC),
CommitID : "076160cf0b039f13e5eff19619932d181269414b" ,
// State: base.ReviewStateApproved,
CreatedAt : time . Date ( 2019 , 11 , 12 , 21 , 35 , 24 , 0 , time . UTC ) ,
// },
State : base . ReviewStateApproved ,
// {
} ,
// ID: 315861440,
{
// IssueIndex: 3,
ID : 315860062 ,
// ReviewerID: 165205,
IssueIndex : 3 ,
// ReviewerName: "lafriks",
ReviewerID : 1824502 ,
// CommitID: "076160cf0b039f13e5eff19619932d181269414b",
ReviewerName : "zeripath" ,
// CreatedAt: time.Date(2019, 11, 12, 21, 38, 0, 0, time.UTC),
CommitID : "076160cf0b039f13e5eff19619932d181269414b" ,
// State: base.ReviewStateApproved,
CreatedAt : time . Date ( 2019 , 11 , 12 , 21 , 35 , 36 , 0 , time . UTC ) ,
// },
State : base . ReviewStateApproved ,
// }, reviews)
} ,
//
{
// reviews, err = downloader.GetReviews(base.BasicIssueContext(4))
ID : 315861440 ,
// assert.NoError(t, err)
IssueIndex : 3 ,
// assertReviewsEqual(t, []*base.Review{
ReviewerID : 165205 ,
// {
ReviewerName : "lafriks" ,
// ID: 338338740,
CommitID : "076160cf0b039f13e5eff19619932d181269414b" ,
// IssueIndex: 4,
CreatedAt : time . Date ( 2019 , 11 , 12 , 21 , 38 , 0 , 0 , time . UTC ) ,
// ReviewerID: 81045,
State : base . ReviewStateApproved ,
// ReviewerName: "lunny",
} ,
// CommitID: "2be9101c543658591222acbee3eb799edfc3853d",
} , reviews )
// CreatedAt: time.Date(2020, 1, 4, 5, 33, 18, 0, time.UTC),
// State: base.ReviewStateApproved,
reviews , err = downloader . GetReviews ( base . BasicIssueContext ( 4 ) )
// Comments: []*base.ReviewComment{
assert . NoError ( t , err )
// {
assertReviewsEqual ( t , [ ] * base . Review {
// ID: 363017488,
{
// Content: "This is a good pull request.",
ID : 338338740 ,
// TreePath: "README.md",
IssueIndex : 4 ,
// DiffHunk: "@@ -1,2 +1,4 @@\n # test_repo\n Test repository for testing migration from github to gitea\n+",
ReviewerID : 81045 ,
// Position: 3,
ReviewerName : "lunny" ,
// CommitID: "2be9101c543658591222acbee3eb799edfc3853d",
CommitID : "2be9101c543658591222acbee3eb799edfc3853d" ,
// PosterID: 81045,
CreatedAt : time . Date ( 2020 , 1 , 4 , 5 , 33 , 18 , 0 , time . UTC ) ,
// CreatedAt: time.Date(2020, 1, 4, 5, 33, 6, 0, time.UTC),
State : base . ReviewStateApproved ,
// UpdatedAt: time.Date(2020, 1, 4, 5, 33, 18, 0, time.UTC),
Comments : [ ] * base . ReviewComment {
// },
{
// },
ID : 363017488 ,
// },
Content : "This is a good pull request." ,
// {
TreePath : "README.md" ,
// ID: 338339651,
DiffHunk : "@@ -1,2 +1,4 @@\n # test_repo\n Test repository for testing migration from github to gitea\n+" ,
// IssueIndex: 4,
Position : 3 ,
// ReviewerID: 81045,
CommitID : "2be9101c543658591222acbee3eb799edfc3853d" ,
// ReviewerName: "lunny",
PosterID : 81045 ,
// CommitID: "2be9101c543658591222acbee3eb799edfc3853d",
CreatedAt : time . Date ( 2020 , 1 , 4 , 5 , 33 , 6 , 0 , time . UTC ) ,
// CreatedAt: time.Date(2020, 1, 4, 6, 7, 6, 0, time.UTC),
UpdatedAt : time . Date ( 2020 , 1 , 4 , 5 , 33 , 18 , 0 , time . UTC ) ,
// State: base.ReviewStateChangesRequested,
} ,
// Content: "Don't add more reviews",
} ,
// },
} ,
// {
{
// ID: 338349019,
ID : 338339651 ,
// IssueIndex: 4,
IssueIndex : 4 ,
// ReviewerID: 81045,
ReviewerID : 81045 ,
// ReviewerName: "lunny",
ReviewerName : "lunny" ,
// CommitID: "2be9101c543658591222acbee3eb799edfc3853d",
CommitID : "2be9101c543658591222acbee3eb799edfc3853d" ,
// CreatedAt: time.Date(2020, 1, 4, 11, 21, 41, 0, time.UTC),
CreatedAt : time . Date ( 2020 , 1 , 4 , 6 , 7 , 6 , 0 , time . UTC ) ,
// State: base.ReviewStateCommented,
State : base . ReviewStateChangesRequested ,
// Comments: []*base.ReviewComment{
Content : "Don't add more reviews" ,
// {
} ,
// ID: 363029944,
{
// Content: "test a single comment.",
ID : 338349019 ,
// TreePath: "LICENSE",
IssueIndex : 4 ,
// DiffHunk: "@@ -19,3 +19,5 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n+",
ReviewerID : 81045 ,
// Position: 4,
ReviewerName : "lunny" ,
// CommitID: "2be9101c543658591222acbee3eb799edfc3853d",
CommitID : "2be9101c543658591222acbee3eb799edfc3853d" ,
// PosterID: 81045,
CreatedAt : time . Date ( 2020 , 1 , 4 , 11 , 21 , 41 , 0 , time . UTC ) ,
// CreatedAt: time.Date(2020, 1, 4, 11, 21, 41, 0, time.UTC),
State : base . ReviewStateCommented ,
// UpdatedAt: time.Date(2020, 1, 4, 11, 21, 41, 0, time.UTC),
Comments : [ ] * base . ReviewComment {
// },
{
// },
ID : 363029944 ,
// },
Content : "test a single comment." ,
// }, reviews)
TreePath : "LICENSE" ,
//}
DiffHunk : "@@ -19,3 +19,5 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n+" ,
Position : 4 ,
CommitID : "2be9101c543658591222acbee3eb799edfc3853d" ,
PosterID : 81045 ,
CreatedAt : time . Date ( 2020 , 1 , 4 , 11 , 21 , 41 , 0 , time . UTC ) ,
UpdatedAt : time . Date ( 2020 , 1 , 4 , 11 , 21 , 41 , 0 , time . UTC ) ,
} ,
} ,
} ,
} , reviews )
}