@ -130,7 +130,7 @@ func TestGitlabDownloadRepo(t *testing.T) {
PosterName : "lafriks" ,
PosterName : "lafriks" ,
State : "closed" ,
State : "closed" ,
Created : time . Date ( 2019 , 11 , 28 , 8 , 43 , 35 , 459000000 , time . UTC ) ,
Created : time . Date ( 2019 , 11 , 28 , 8 , 43 , 35 , 459000000 , time . UTC ) ,
Updated : time . Date ( 2019 , 11 , 28 , 8 , 46 , 23 , 275 000000, time . UTC ) ,
Updated : time . Date ( 2019 , 11 , 28 , 8 , 46 , 23 , 304 000000, time . UTC ) ,
Labels : [ ] * base . Label {
Labels : [ ] * base . Label {
{
{
Name : "bug" ,
Name : "bug" ,
@ -139,7 +139,17 @@ func TestGitlabDownloadRepo(t *testing.T) {
Name : "discussion" ,
Name : "discussion" ,
} ,
} ,
} ,
} ,
Reactions : nil ,
Reactions : [ ] * base . Reaction {
{
UserID : 1241334 ,
UserName : "lafriks" ,
Content : "thumbsup" ,
} ,
{
UserID : 1241334 ,
UserName : "lafriks" ,
Content : "open_mouth" ,
} } ,
Closed : & closed1 ,
Closed : & closed1 ,
} ,
} ,
{
{
@ -157,7 +167,37 @@ func TestGitlabDownloadRepo(t *testing.T) {
Name : "duplicate" ,
Name : "duplicate" ,
} ,
} ,
} ,
} ,
Reactions : nil ,
Reactions : [ ] * base . Reaction {
{
UserID : 1241334 ,
UserName : "lafriks" ,
Content : "thumbsup" ,
} ,
{
UserID : 1241334 ,
UserName : "lafriks" ,
Content : "thumbsdown" ,
} ,
{
UserID : 1241334 ,
UserName : "lafriks" ,
Content : "laughing" ,
} ,
{
UserID : 1241334 ,
UserName : "lafriks" ,
Content : "tada" ,
} ,
{
UserID : 1241334 ,
UserName : "lafriks" ,
Content : "confused" ,
} ,
{
UserID : 1241334 ,
UserName : "lafriks" ,
Content : "hearts" ,
} } ,
Closed : & closed2 ,
Closed : & closed2 ,
} ,
} ,
} , issues )
} , issues )
@ -171,7 +211,6 @@ func TestGitlabDownloadRepo(t *testing.T) {
PosterID : 1241334 ,
PosterID : 1241334 ,
PosterName : "lafriks" ,
PosterName : "lafriks" ,
Created : time . Date ( 2019 , 11 , 28 , 8 , 44 , 52 , 501000000 , time . UTC ) ,
Created : time . Date ( 2019 , 11 , 28 , 8 , 44 , 52 , 501000000 , time . UTC ) ,
Updated : time . Date ( 2019 , 11 , 28 , 8 , 44 , 52 , 501000000 , time . UTC ) ,
Content : "This is a comment" ,
Content : "This is a comment" ,
Reactions : nil ,
Reactions : nil ,
} ,
} ,
@ -208,6 +247,7 @@ func TestGitlabDownloadRepo(t *testing.T) {
assert . EqualValues ( t , [ ] * base . PullRequest {
assert . EqualValues ( t , [ ] * base . PullRequest {
{
{
Number : 4 ,
Number : 4 ,
OriginalNumber : 2 ,
Title : "Test branch" ,
Title : "Test branch" ,
Content : "do not merge this PR" ,
Content : "do not merge this PR" ,
Milestone : "1.0.0" ,
Milestone : "1.0.0" ,
@ -215,12 +255,20 @@ func TestGitlabDownloadRepo(t *testing.T) {
PosterName : "lafriks" ,
PosterName : "lafriks" ,
State : "opened" ,
State : "opened" ,
Created : time . Date ( 2019 , 11 , 28 , 15 , 56 , 54 , 104000000 , time . UTC ) ,
Created : time . Date ( 2019 , 11 , 28 , 15 , 56 , 54 , 104000000 , time . UTC ) ,
Updated : time . Date ( 2019 , 11 , 28 , 15 , 56 , 54 , 104000000 , time . UTC ) ,
Labels : [ ] * base . Label {
Labels : [ ] * base . Label {
{
{
Name : "bug" ,
Name : "bug" ,
} ,
} ,
} ,
} ,
Reactions : [ ] * base . Reaction { {
UserID : 4575606 ,
UserName : "real6543" ,
Content : "thumbsup" ,
} , {
UserID : 4575606 ,
UserName : "real6543" ,
Content : "tada" ,
} } ,
PatchURL : "https://gitlab.com/gitea/test_repo/-/merge_requests/2.patch" ,
PatchURL : "https://gitlab.com/gitea/test_repo/-/merge_requests/2.patch" ,
Head : base . PullRequestBranch {
Head : base . PullRequestBranch {
Ref : "feat/test" ,
Ref : "feat/test" ,
@ -244,13 +292,20 @@ func TestGitlabDownloadRepo(t *testing.T) {
rvs , err := downloader . GetReviews ( 1 )
rvs , err := downloader . GetReviews ( 1 )
assert . NoError ( t , err )
assert . NoError ( t , err )
if assert . Len ( t , prs , 2 ) {
if assert . Len ( t , rvs , 2 ) {
assert . EqualValues ( t , 527793 , rvs [ 0 ] . ReviewerID )
for i := range rvs {
assert . EqualValues ( t , "axifive" , rvs [ 0 ] . ReviewerName )
switch rvs [ i ] . ReviewerID {
assert . EqualValues ( t , "APPROVED" , rvs [ 0 ] . State )
case 4102996 :
assert . EqualValues ( t , 4102996 , rvs [ 1 ] . ReviewerID )
assert . EqualValues ( t , "zeripath" , rvs [ i ] . ReviewerName )
assert . EqualValues ( t , "zeripath" , rvs [ 1 ] . ReviewerName )
assert . EqualValues ( t , "APPROVED" , rvs [ i ] . State )
assert . EqualValues ( t , "APPROVED" , rvs [ 1 ] . State )
case 527793 :
assert . EqualValues ( t , "axifive" , rvs [ i ] . ReviewerName )
assert . EqualValues ( t , "APPROVED" , rvs [ i ] . State )
default :
t . Errorf ( "Unexpected Reviewer ID: %d" , rvs [ i ] . ReviewerID )
}
}
}
}
rvs , err = downloader . GetReviews ( 2 )
rvs , err = downloader . GetReviews ( 2 )
assert . NoError ( t , err )
assert . NoError ( t , err )