##// END OF EJS Templates
tests: add test coverage of PR comment @mention
Mads Kiilerich -
r6020:55280080 default
parent child Browse files
Show More
@@ -213,6 +213,7 b' class ChangesetCommentsModel(BaseModel):'
213 if mention_recipients:
213 if mention_recipients:
214 email_kwargs['is_mention'] = True
214 email_kwargs['is_mention'] = True
215 subj = _('[Mention]') + ' ' + subj
215 subj = _('[Mention]') + ' ' + subj
216 # FIXME: this subject is wrong and unused!
216 NotificationModel().create(
217 NotificationModel().create(
217 created_by=user, subject=subj, body=body,
218 created_by=user, subject=subj, body=body,
218 recipients=mention_recipients,
219 recipients=mention_recipients,
@@ -185,6 +185,7 b' class PullRequestModel(BaseModel):'
185 if mention_recipients:
185 if mention_recipients:
186 email_kwargs['is_mention'] = True
186 email_kwargs['is_mention'] = True
187 subject = _('[Mention]') + ' ' + subject
187 subject = _('[Mention]') + ' ' + subject
188 # FIXME: this subject is wrong and unused!
188 NotificationModel().create(created_by=user, subject=subject, body=body,
189 NotificationModel().create(created_by=user, subject=subject, body=body,
189 recipients=mention_recipients,
190 recipients=mention_recipients,
190 type_=Notification.TYPE_PULL_REQUEST,
191 type_=Notification.TYPE_PULL_REQUEST,
@@ -411,7 +411,7 b' This is an automatic notification. Don&#'
411 <pre>--------------------</pre>
411 <pre>--------------------</pre>
412
412
413
413
414 <h1>pull_request_comment, status_change=None, closing_pr=False</h1>
414 <h1>pull_request_comment, is_mention=False, status_change=None, closing_pr=False</h1>
415 <pre>
415 <pre>
416
416
417 From: u1
417 From: u1
@@ -454,7 +454,50 b' This is an automatic notification. Don&#'
454 <pre>--------------------</pre>
454 <pre>--------------------</pre>
455
455
456
456
457 <h1>pull_request_comment, status_change='Under Review', closing_pr=False</h1>
457 <h1>pull_request_comment, is_mention=True, status_change=None, closing_pr=False</h1>
458 <pre>
459
460 From: u1
461 To: u2@example.com
462 Subject: [Comment] repo/name pull request #7 from devbranch
463
464 --------------------
465
466
467 Comment from Opinionated User (jsmith) on repo/name pull request "The Title":
468 Me too!
469
470 - and indented on second line
471
472
473 URL: http://pr.org/comment
474
475
476 --
477 This is an automatic notification. Don't reply to this mail.
478
479 --------------------</pre>
480
481
482
483 <p>Comment from Opinionated User (jsmith) on repo/name pull request &#34;The Title&#34;:</p>
484 <p><div class="formatted-fixed">Me too!
485
486 - and indented on second line</div></p>
487
488
489 <p>URL: <a href="http://pr.org/comment">http://pr.org/comment</a></p>
490
491
492 <br/>
493 <br/>
494 -- <br/>
495 This is an automatic notification. Don&#39;t reply to this mail.
496
497 <pre>--------------------</pre>
498
499
500 <h1>pull_request_comment, is_mention=False, status_change='Under Review', closing_pr=False</h1>
458 <pre>
501 <pre>
459
502
460 From: u1
503 From: u1
@@ -499,7 +542,52 b' This is an automatic notification. Don&#'
499 <pre>--------------------</pre>
542 <pre>--------------------</pre>
500
543
501
544
502 <h1>pull_request_comment, status_change=None, closing_pr=True</h1>
545 <h1>pull_request_comment, is_mention=True, status_change='Under Review', closing_pr=False</h1>
546 <pre>
547
548 From: u1
549 To: u2@example.com
550 Subject: [Under Review: Comment] repo/name pull request #7 from devbranch
551
552 --------------------
553
554
555 Comment from Opinionated User (jsmith) on repo/name pull request "The Title":
556 Me too!
557
558 - and indented on second line
559
560 The comment was made with status: Under Review
561
562 URL: http://pr.org/comment
563
564
565 --
566 This is an automatic notification. Don't reply to this mail.
567
568 --------------------</pre>
569
570
571
572 <p>Comment from Opinionated User (jsmith) on repo/name pull request &#34;The Title&#34;:</p>
573 <p><div class="formatted-fixed">Me too!
574
575 - and indented on second line</div></p>
576
577 <p>The comment was made with status: <b>Under Review</b></p>
578
579 <p>URL: <a href="http://pr.org/comment">http://pr.org/comment</a></p>
580
581
582 <br/>
583 <br/>
584 -- <br/>
585 This is an automatic notification. Don&#39;t reply to this mail.
586
587 <pre>--------------------</pre>
588
589
590 <h1>pull_request_comment, is_mention=False, status_change=None, closing_pr=True</h1>
503 <pre>
591 <pre>
504
592
505 From: u1
593 From: u1
@@ -542,7 +630,95 b' This is an automatic notification. Don&#'
542 <pre>--------------------</pre>
630 <pre>--------------------</pre>
543
631
544
632
545 <h1>pull_request_comment, status_change='Under Review', closing_pr=True</h1>
633 <h1>pull_request_comment, is_mention=True, status_change=None, closing_pr=True</h1>
634 <pre>
635
636 From: u1
637 To: u2@example.com
638 Subject: [Closing: Comment] repo/name pull request #7 from devbranch
639
640 --------------------
641
642
643 Comment from Opinionated User (jsmith) on repo/name pull request "The Title":
644 Me too!
645
646 - and indented on second line
647
648
649 URL: http://pr.org/comment
650
651
652 --
653 This is an automatic notification. Don't reply to this mail.
654
655 --------------------</pre>
656
657
658
659 <p>Comment from Opinionated User (jsmith) on repo/name pull request &#34;The Title&#34;:</p>
660 <p><div class="formatted-fixed">Me too!
661
662 - and indented on second line</div></p>
663
664
665 <p>URL: <a href="http://pr.org/comment">http://pr.org/comment</a></p>
666
667
668 <br/>
669 <br/>
670 -- <br/>
671 This is an automatic notification. Don&#39;t reply to this mail.
672
673 <pre>--------------------</pre>
674
675
676 <h1>pull_request_comment, is_mention=False, status_change='Under Review', closing_pr=True</h1>
677 <pre>
678
679 From: u1
680 To: u2@example.com
681 Subject: [Under Review, Closing: Comment] repo/name pull request #7 from devbranch
682
683 --------------------
684
685
686 Comment from Opinionated User (jsmith) on repo/name pull request "The Title":
687 Me too!
688
689 - and indented on second line
690
691 The comment closed the pull request with status: Under Review
692
693 URL: http://pr.org/comment
694
695
696 --
697 This is an automatic notification. Don't reply to this mail.
698
699 --------------------</pre>
700
701
702
703 <p>Comment from Opinionated User (jsmith) on repo/name pull request &#34;The Title&#34;:</p>
704 <p><div class="formatted-fixed">Me too!
705
706 - and indented on second line</div></p>
707
708 <p>The comment closed the pull request with status: <b>Under Review</b></p>
709
710 <p>URL: <a href="http://pr.org/comment">http://pr.org/comment</a></p>
711
712
713 <br/>
714 <br/>
715 -- <br/>
716 This is an automatic notification. Don&#39;t reply to this mail.
717
718 <pre>--------------------</pre>
719
720
721 <h1>pull_request_comment, is_mention=True, status_change='Under Review', closing_pr=True</h1>
546 <pre>
722 <pre>
547
723
548 From: u1
724 From: u1
@@ -231,6 +231,7 b' class TestNotifications(TestController):'
231 u'Me too!\n\n - and indented on second line',
231 u'Me too!\n\n - and indented on second line',
232 dict(
232 dict(
233 closing_pr=[False, True],
233 closing_pr=[False, True],
234 is_mention=[False, True],
234 pr_comment_user='Opinionated User (jsmith)',
235 pr_comment_user='Opinionated User (jsmith)',
235 pr_comment_url='http://pr.org/comment',
236 pr_comment_url='http://pr.org/comment',
236 status_change=[None, 'Under Review'],
237 status_change=[None, 'Under Review'],
General Comments 0
You need to be logged in to leave comments. Login now