@@ -21,6 +21,8 @@ const (
21
21
MockChannelID = "mockChannelID"
22
22
MockCreatorID = "mockCreatorID"
23
23
MockBotID = "mockBotID"
24
+ MockOrg = "mockOrg"
25
+ MockSender = "mockSender"
24
26
MockPostMessage = "mockPostMessage"
25
27
MockOrgRepo = "mockOrg/mockRepo"
26
28
MockHead = "mockHead"
@@ -253,22 +255,25 @@ func GetMockDeleteEventWithInvalidType() *github.DeleteEvent {
253
255
}
254
256
}
255
257
256
- func GetMockPullRequestReviewEvent (action , state string ) * github.PullRequestReviewEvent {
258
+ func GetMockPullRequestReviewEvent (action , state , repo string , isPrivate bool , reviewer , author string ) * github.PullRequestReviewEvent {
257
259
return & github.PullRequestReviewEvent {
258
260
Action : github .String (action ),
259
261
Repo : & github.Repository {
260
- Name : github .String (MockRepoName ),
262
+ Name : github .String (repo ),
261
263
FullName : github .String (MockOrgRepo ),
262
- Private : github .Bool (false ),
264
+ Private : github .Bool (isPrivate ),
263
265
HTMLURL : github .String (fmt .Sprintf ("%s%s" , GithubBaseURL , MockOrgRepo )),
264
266
},
267
+ Sender : & github.User {Login : github .String (reviewer )},
265
268
Review : & github.PullRequestReview {
269
+ User : & github.User {
270
+ Login : github .String (reviewer ),
271
+ },
266
272
State : github .String (state ),
267
273
},
268
- Sender : & github.User {
269
- Login : github .String (MockUserLogin ) ,
274
+ PullRequest : & github.PullRequest {
275
+ User : & github. User { Login : github .String (author )} ,
270
276
},
271
- PullRequest : & github.PullRequest {},
272
277
}
273
278
}
274
279
@@ -366,3 +371,70 @@ func GetMockPullRequestEvent(action, repoName string, isPrivate bool, sender, us
366
371
RequestedReviewer : & github.User {Login : github .String (user )},
367
372
}
368
373
}
374
+
375
+ func GetMockIssuesEvent (action , repoName string , isPrivate bool , author , sender , assignee string ) * github.IssuesEvent {
376
+ return & github.IssuesEvent {
377
+ Action : & action ,
378
+ Repo : & github.Repository {FullName : & repoName , Private : & isPrivate },
379
+ Issue : & github.Issue {User : & github.User {Login : & author }},
380
+ Sender : & github.User {Login : & sender },
381
+ Assignee : func () * github.User {
382
+ if assignee == "" {
383
+ return nil
384
+ }
385
+ return & github.User {Login : & assignee }
386
+ }(),
387
+ }
388
+ }
389
+
390
+ func GetMockStarEvent (repo , org string , isPrivate bool , sender string ) * github.StarEvent {
391
+ return & github.StarEvent {
392
+ Repo : & github.Repository {
393
+ Name : github .String (repo ),
394
+ Private : github .Bool (isPrivate ),
395
+ FullName : github .String (fmt .Sprintf ("%s/%s" , repo , org )),
396
+ },
397
+ Sender : & github.User {Login : github .String (sender )},
398
+ }
399
+ }
400
+
401
+ func GetMockReleaseEvent (repo , org , action , sender string ) * github.ReleaseEvent {
402
+ return & github.ReleaseEvent {
403
+ Action : & action ,
404
+ Repo : & github.Repository {
405
+ Name : github .String (repo ),
406
+ Owner : & github.User {Login : github .String (org )},
407
+ FullName : github .String (fmt .Sprintf ("%s/%s" , repo , org )),
408
+ },
409
+ Sender : & github.User {Login : github .String (sender )},
410
+ }
411
+ }
412
+
413
+ func GetMockDiscussionEvent (repo , org , sender string ) * github.DiscussionEvent {
414
+ return & github.DiscussionEvent {
415
+ Repo : & github.Repository {
416
+ Name : github .String (repo ),
417
+ Owner : & github.User {Login : github .String (org )},
418
+ FullName : github .String (fmt .Sprintf ("%s/%s" , repo , org )),
419
+ },
420
+ Sender : & github.User {Login : github .String (sender )},
421
+ Discussion : & github.Discussion {
422
+ Number : github .Int (123 ),
423
+ },
424
+ }
425
+ }
426
+
427
+ func GetMockDiscussionCommentEvent (repo , org , action , sender string ) * github.DiscussionCommentEvent {
428
+ return & github.DiscussionCommentEvent {
429
+ Action : & action ,
430
+ Repo : & github.Repository {
431
+ Name : github .String (repo ),
432
+ Owner : & github.User {Login : github .String (org )},
433
+ FullName : github .String (fmt .Sprintf ("%s/%s" , repo , org )),
434
+ },
435
+ Sender : & github.User {Login : github .String (sender )},
436
+ Comment : & github.CommentDiscussion {
437
+ ID : github .Int64 (456 ),
438
+ },
439
+ }
440
+ }
0 commit comments