@@ -130,7 +130,7 @@ func TestGitlabDownloadRepo(t *testing.T) {
130130 PosterName : "lafriks" ,
131131 State : "closed" ,
132132 Created : time .Date (2019 , 11 , 28 , 8 , 43 , 35 , 459000000 , time .UTC ),
133- Updated : time .Date (2019 , 11 , 28 , 8 , 46 , 23 , 275000000 , time .UTC ),
133+ Updated : time .Date (2019 , 11 , 28 , 8 , 46 , 23 , 304000000 , time .UTC ),
134134 Labels : []* base.Label {
135135 {
136136 Name : "bug" ,
@@ -139,8 +139,18 @@ func TestGitlabDownloadRepo(t *testing.T) {
139139 Name : "discussion" ,
140140 },
141141 },
142- Reactions : nil ,
143- Closed : & closed1 ,
142+ Reactions : []* base.Reaction {
143+ {
144+ UserID : 1241334 ,
145+ UserName : "lafriks" ,
146+ Content : "thumbsup" ,
147+ },
148+ {
149+ UserID : 1241334 ,
150+ UserName : "lafriks" ,
151+ Content : "open_mouth" ,
152+ }},
153+ Closed : & closed1 ,
144154 },
145155 {
146156 Number : 2 ,
@@ -157,8 +167,38 @@ func TestGitlabDownloadRepo(t *testing.T) {
157167 Name : "duplicate" ,
158168 },
159169 },
160- Reactions : nil ,
161- Closed : & closed2 ,
170+ Reactions : []* base.Reaction {
171+ {
172+ UserID : 1241334 ,
173+ UserName : "lafriks" ,
174+ Content : "thumbsup" ,
175+ },
176+ {
177+ UserID : 1241334 ,
178+ UserName : "lafriks" ,
179+ Content : "thumbsdown" ,
180+ },
181+ {
182+ UserID : 1241334 ,
183+ UserName : "lafriks" ,
184+ Content : "laughing" ,
185+ },
186+ {
187+ UserID : 1241334 ,
188+ UserName : "lafriks" ,
189+ Content : "tada" ,
190+ },
191+ {
192+ UserID : 1241334 ,
193+ UserName : "lafriks" ,
194+ Content : "confused" ,
195+ },
196+ {
197+ UserID : 1241334 ,
198+ UserName : "lafriks" ,
199+ Content : "hearts" ,
200+ }},
201+ Closed : & closed2 ,
162202 },
163203 }, issues )
164204
@@ -171,7 +211,6 @@ func TestGitlabDownloadRepo(t *testing.T) {
171211 PosterID : 1241334 ,
172212 PosterName : "lafriks" ,
173213 Created : time .Date (2019 , 11 , 28 , 8 , 44 , 52 , 501000000 , time .UTC ),
174- Updated : time .Date (2019 , 11 , 28 , 8 , 44 , 52 , 501000000 , time .UTC ),
175214 Content : "This is a comment" ,
176215 Reactions : nil ,
177216 },
@@ -207,20 +246,29 @@ func TestGitlabDownloadRepo(t *testing.T) {
207246
208247 assert .EqualValues (t , []* base.PullRequest {
209248 {
210- Number : 4 ,
211- Title : "Test branch" ,
212- Content : "do not merge this PR " ,
213- Milestone : "1.0.0 " ,
214- PosterID : 1241334 ,
215- PosterName : "lafriks" ,
216- State : "opened " ,
217- Created : time . Date ( 2019 , 11 , 28 , 15 , 56 , 54 , 104000000 , time . UTC ) ,
218- Updated : time .Date (2019 , 11 , 28 , 15 , 56 , 54 , 104000000 , time .UTC ),
249+ Number : 4 ,
250+ OriginalNumber : 2 ,
251+ Title : "Test branch " ,
252+ Content : "do not merge this PR " ,
253+ Milestone : "1.0.0" ,
254+ PosterID : 1241334 ,
255+ PosterName : "lafriks " ,
256+ State : "opened" ,
257+ Created : time .Date (2019 , 11 , 28 , 15 , 56 , 54 , 104000000 , time .UTC ),
219258 Labels : []* base.Label {
220259 {
221260 Name : "bug" ,
222261 },
223262 },
263+ Reactions : []* base.Reaction {{
264+ UserID : 4575606 ,
265+ UserName : "real6543" ,
266+ Content : "thumbsup" ,
267+ }, {
268+ UserID : 4575606 ,
269+ UserName : "real6543" ,
270+ Content : "tada" ,
271+ }},
224272 PatchURL : "https://gitlab.com/gitea/test_repo/-/merge_requests/2.patch" ,
225273 Head : base.PullRequestBranch {
226274 Ref : "feat/test" ,
@@ -244,13 +292,20 @@ func TestGitlabDownloadRepo(t *testing.T) {
244292
245293 rvs , err := downloader .GetReviews (1 )
246294 assert .NoError (t , err )
247- if assert .Len (t , prs , 2 ) {
248- assert .EqualValues (t , 527793 , rvs [0 ].ReviewerID )
249- assert .EqualValues (t , "axifive" , rvs [0 ].ReviewerName )
250- assert .EqualValues (t , "APPROVED" , rvs [0 ].State )
251- assert .EqualValues (t , 4102996 , rvs [1 ].ReviewerID )
252- assert .EqualValues (t , "zeripath" , rvs [1 ].ReviewerName )
253- assert .EqualValues (t , "APPROVED" , rvs [1 ].State )
295+ if assert .Len (t , rvs , 2 ) {
296+ for i := range rvs {
297+ switch rvs [i ].ReviewerID {
298+ case 4102996 :
299+ assert .EqualValues (t , "zeripath" , rvs [i ].ReviewerName )
300+ assert .EqualValues (t , "APPROVED" , rvs [i ].State )
301+ case 527793 :
302+ assert .EqualValues (t , "axifive" , rvs [i ].ReviewerName )
303+ assert .EqualValues (t , "APPROVED" , rvs [i ].State )
304+ default :
305+ t .Errorf ("Unexpected Reviewer ID: %d" , rvs [i ].ReviewerID )
306+
307+ }
308+ }
254309 }
255310 rvs , err = downloader .GetReviews (2 )
256311 assert .NoError (t , err )
0 commit comments