# HG changeset patch # User Mads Kiilerich # Date 2016-07-28 16:28:34 # Node ID cd32d44ee7ffa6000a145e65e3bb0932508ce848 # Parent 092971c1d6dc7799ea352ca026523b01711cc4f8 tests: improve test data in test_notifications mail template dump test diff --git a/kallithea/tests/models/test_dump_html_mails.ref.html b/kallithea/tests/models/test_dump_html_mails.ref.html --- a/kallithea/tests/models/test_dump_html_mails.ref.html +++ b/kallithea/tests/models/test_dump_html_mails.ref.html @@ -6,12 +6,12 @@ From: u1 To: u2@example.com -Subject: [Comment] repo/name changeset cafe on brunch +Subject: [Comment] repo/name changeset cafe1234 on brunch -------------------- -Comment from Commenter Name on repo_target changeset c0ffeecafe: +Comment from Opinionated User (jsmith) on repo_target changeset cafe1234c0ff: This is the new comment. - and here it ends indented. @@ -19,7 +19,7 @@ This is the new comment. URL: http://comment.org -Changeset: c0ffeecafe +Changeset: cafe1234c0ff Description: This changeset did something clever which is hard to explain @@ -31,7 +31,7 @@ This is an automatic notification. Don't -

Comment from Commenter Name on repo_target changeset c0ffeecafe:

+

Comment from Opinionated User (jsmith) on repo_target changeset cafe1234c0ff:

This is the new comment. - and here it ends indented.

@@ -39,7 +39,7 @@ This is an automatic notification. Don't

URL: http://comment.org

-

Changeset: c0ffeecafe

+

Changeset: cafe1234c0ff

Description:
This changeset did something clever which is hard to explain

@@ -58,12 +58,12 @@ This is an automatic notification. Don&# From: u1 To: u2@example.com -Subject: [Comment] repo/name changeset cafe on brunch +Subject: [Comment] repo/name changeset cafe1234 on brunch -------------------- -Comment from Commenter Name on repo_target changeset c0ffeecafe mentioned you: +Comment from Opinionated User (jsmith) on repo_target changeset cafe1234c0ff mentioned you: This is the new comment. - and here it ends indented. @@ -71,7 +71,7 @@ This is the new comment. URL: http://comment.org -Changeset: c0ffeecafe +Changeset: cafe1234c0ff Description: This changeset did something clever which is hard to explain @@ -83,7 +83,7 @@ This is an automatic notification. Don't -

Comment from Commenter Name on repo_target changeset c0ffeecafe mentioned you:

+

Comment from Opinionated User (jsmith) on repo_target changeset cafe1234c0ff mentioned you:

This is the new comment. - and here it ends indented.

@@ -91,7 +91,7 @@ This is an automatic notification. Don't

URL: http://comment.org

-

Changeset: c0ffeecafe

+

Changeset: cafe1234c0ff

Description:
This changeset did something clever which is hard to explain

@@ -110,12 +110,12 @@ This is an automatic notification. Don&# From: u1 To: u2@example.com -Subject: [Approved: Comment] repo/name changeset cafe on brunch +Subject: [Approved: Comment] repo/name changeset cafe1234 on brunch -------------------- -Comment from Commenter Name on repo_target changeset c0ffeecafe: +Comment from Opinionated User (jsmith) on repo_target changeset cafe1234c0ff: This is the new comment. - and here it ends indented. @@ -124,7 +124,7 @@ The changeset status was changed to: App URL: http://comment.org -Changeset: c0ffeecafe +Changeset: cafe1234c0ff Description: This changeset did something clever which is hard to explain @@ -136,7 +136,7 @@ This is an automatic notification. Don't -

Comment from Commenter Name on repo_target changeset c0ffeecafe:

+

Comment from Opinionated User (jsmith) on repo_target changeset cafe1234c0ff:

This is the new comment. - and here it ends indented.

@@ -145,7 +145,7 @@ This is an automatic notification. Don't

URL: http://comment.org

-

Changeset: c0ffeecafe

+

Changeset: cafe1234c0ff

Description:
This changeset did something clever which is hard to explain

@@ -164,12 +164,12 @@ This is an automatic notification. Don&# From: u1 To: u2@example.com -Subject: [Approved: Comment] repo/name changeset cafe on brunch +Subject: [Approved: Comment] repo/name changeset cafe1234 on brunch -------------------- -Comment from Commenter Name on repo_target changeset c0ffeecafe mentioned you: +Comment from Opinionated User (jsmith) on repo_target changeset cafe1234c0ff mentioned you: This is the new comment. - and here it ends indented. @@ -178,7 +178,7 @@ The changeset status was changed to: App URL: http://comment.org -Changeset: c0ffeecafe +Changeset: cafe1234c0ff Description: This changeset did something clever which is hard to explain @@ -190,7 +190,7 @@ This is an automatic notification. Don't -

Comment from Commenter Name on repo_target changeset c0ffeecafe mentioned you:

+

Comment from Opinionated User (jsmith) on repo_target changeset cafe1234c0ff mentioned you:

This is the new comment. - and here it ends indented.

@@ -199,7 +199,7 @@ This is an automatic notification. Don't

URL: http://comment.org

-

Changeset: c0ffeecafe

+

Changeset: cafe1234c0ff

Description:
This changeset did something clever which is hard to explain

@@ -286,24 +286,26 @@ This is an automatic notification. Don&# From: u1 To: u2@example.com -Subject: [Added] repo/name pull request 7 from ref +Subject: [Added] repo/name pull request #7 from devbranch -------------------- -Requester Name requested your review of repo/name pull request "The Title" +Requesting User (root) requested your review of repo/name pull request "The Title" -URL: http://pr.org +URL: http://pr.org/7 Description: This PR is awesome because it does stuff - please approve indented! Changesets: -123abc: http://changeset_home/?repo_name=repo_org&revision=123abc +123abc123abc: http://changeset_home/?repo_name=repo_org&revision=123abc123abc123abc123abc123abc123abc123abc Introduce one and two -567fed: http://changeset_home/?repo_name=repo_org&revision=567fed +and that's it + +567fed567fed: http://changeset_home/?repo_name=repo_org&revision=567fed567fed567fed567fed567fed567fed567fed Make one plus two equal tree @@ -315,9 +317,9 @@ This is an automatic notification. Don't -

Requester Name requested your review of repo/name pull request "The Title"

+

Requesting User (root) requested your review of repo/name pull request "The Title"

-

URL: http://pr.org

+

URL: http://pr.org/7

Description:

This PR is awesome because it does stuff @@ -325,10 +327,12 @@ This is an automatic notification. Don't

Changesets:

-123abc: +123abc123abc: Introduce one and two -567fed: +and that's it + +567fed567fed: Make one plus two equal tree

@@ -347,24 +351,26 @@ This is an automatic notification. Don&# From: u1 To: u2@example.com -Subject: [Added] repo/name pull request 7 from ref +Subject: [Added] repo/name pull request #7 from devbranch -------------------- -Requester Name mentioned you on repo/name pull request "The Title" +Requesting User (root) mentioned you on repo/name pull request "The Title" -URL: http://pr.org +URL: http://pr.org/7 Description: This PR is awesome because it does stuff - please approve indented! Changesets: -123abc: http://changeset_home/?repo_name=repo_org&revision=123abc +123abc123abc: http://changeset_home/?repo_name=repo_org&revision=123abc123abc123abc123abc123abc123abc123abc Introduce one and two -567fed: http://changeset_home/?repo_name=repo_org&revision=567fed +and that's it + +567fed567fed: http://changeset_home/?repo_name=repo_org&revision=567fed567fed567fed567fed567fed567fed567fed Make one plus two equal tree @@ -376,9 +382,9 @@ This is an automatic notification. Don't -

Requester Name mentioned you on repo/name pull request "The Title"

+

Requesting User (root) mentioned you on repo/name pull request "The Title"

-

URL: http://pr.org

+

URL: http://pr.org/7

Description:

This PR is awesome because it does stuff @@ -386,10 +392,12 @@ This is an automatic notification. Don't

Changesets:

-123abc: +123abc123abc: Introduce one and two -567fed: +and that's it + +567fed567fed: Make one plus two equal tree

@@ -408,12 +416,12 @@ This is an automatic notification. Don&# From: u1 To: u2@example.com -Subject: [Comment] repo/name pull request 7 from ref +Subject: [Comment] repo/name pull request #7 from devbranch -------------------- -Comment from Commenter Name on repo/name pull request "The Title": +Comment from Opinionated User (jsmith) on repo/name pull request "The Title": Me too! - and indented on second line @@ -429,7 +437,7 @@ This is an automatic notification. Don't -

Comment from Commenter Name on repo/name pull request "The Title":

+

Comment from Opinionated User (jsmith) on repo/name pull request "The Title":

Me too! - and indented on second line

@@ -451,12 +459,12 @@ This is an automatic notification. Don&# From: u1 To: u2@example.com -Subject: [Under Review: Comment] repo/name pull request 7 from ref +Subject: [Under Review: Comment] repo/name pull request #7 from devbranch -------------------- -Comment from Commenter Name on repo/name pull request "The Title": +Comment from Opinionated User (jsmith) on repo/name pull request "The Title": Me too! - and indented on second line @@ -473,7 +481,7 @@ This is an automatic notification. Don't -

Comment from Commenter Name on repo/name pull request "The Title":

+

Comment from Opinionated User (jsmith) on repo/name pull request "The Title":

Me too! - and indented on second line

@@ -496,12 +504,12 @@ This is an automatic notification. Don&# From: u1 To: u2@example.com -Subject: [Closing: Comment] repo/name pull request 7 from ref +Subject: [Closing: Comment] repo/name pull request #7 from devbranch -------------------- -Comment from Commenter Name on repo/name pull request "The Title": +Comment from Opinionated User (jsmith) on repo/name pull request "The Title": Me too! - and indented on second line @@ -517,7 +525,7 @@ This is an automatic notification. Don't -

Comment from Commenter Name on repo/name pull request "The Title":

+

Comment from Opinionated User (jsmith) on repo/name pull request "The Title":

Me too! - and indented on second line

@@ -539,12 +547,12 @@ This is an automatic notification. Don&# From: u1 To: u2@example.com -Subject: [Under Review, Closing: Comment] repo/name pull request 7 from ref +Subject: [Under Review, Closing: Comment] repo/name pull request #7 from devbranch -------------------- -Comment from Commenter Name on repo/name pull request "The Title": +Comment from Opinionated User (jsmith) on repo/name pull request "The Title": Me too! - and indented on second line @@ -561,7 +569,7 @@ This is an automatic notification. Don't -

Comment from Commenter Name on repo/name pull request "The Title":

+

Comment from Opinionated User (jsmith) on repo/name pull request "The Title":

Me too! - and indented on second line

diff --git a/kallithea/tests/models/test_notifications.py b/kallithea/tests/models/test_notifications.py --- a/kallithea/tests/models/test_notifications.py +++ b/kallithea/tests/models/test_notifications.py @@ -182,15 +182,15 @@ class TestNotifications(TestController): l.append('\n') with mock.patch.object(kallithea.lib.celerylib.tasks, 'send_email', send_email): - pr_kwargs = dict(pr_nice_id='7', ref='ref', org_repo_name='repo_org', pr_title='The Title', pr_url='http://pr.org') + pr_kwargs = dict(pr_nice_id='#7', ref='devbranch', org_repo_name='repo_org', pr_title='The Title', pr_url='http://pr.org/7') for type_, body, kwargs in [ - (Notification.TYPE_CHANGESET_COMMENT, u'This is the new comment.\n\n - and here it ends indented.', dict(short_id='cafe', raw_id='c0ffeecafe', branch='brunch', cs_comment_user='Commenter Name', cs_comment_url='http://comment.org', is_mention=[False, True], message='This changeset did something clever which is hard to explain', status_change=[None, 'Approved'], cs_target_repo='repo_target', cs_url='http://changeset.com')), + (Notification.TYPE_CHANGESET_COMMENT, u'This is the new comment.\n\n - and here it ends indented.', dict(short_id='cafe1234', raw_id='cafe1234c0ffeecafe', branch='brunch', cs_comment_user='Opinionated User (jsmith)', cs_comment_url='http://comment.org', is_mention=[False, True], message='This changeset did something clever which is hard to explain', status_change=[None, 'Approved'], cs_target_repo='repo_target', cs_url='http://changeset.com')), (Notification.TYPE_MESSAGE, u'This is the body of the test message\n - nothing interesting here except indentation.', dict()), #(Notification.TYPE_MENTION, '$body', None), # not used (Notification.TYPE_REGISTRATION, u'Registration body', dict(new_username='newbie', registered_user_url='http://newbie.org', new_email='new@email.com', new_full_name='New Full Name')), - (Notification.TYPE_PULL_REQUEST, u'This PR is awesome because it does stuff\n - please approve indented!', dict(pr_user_created='Requester Name', is_mention=[False, True], pr_revisions=[('123abc', 'Introduce one and two'), ('567fed', 'Make one plus two equal tree')], **pr_kwargs)), - (Notification.TYPE_PULL_REQUEST_COMMENT, u'Me too!\n\n - and indented on second line', dict(closing_pr=[False, True], pr_comment_user='Commenter Name', pr_comment_url='http://pr.org/comment', status_change=[None, 'Under Review'], pr_target_repo='http://target.com/repo', **pr_kwargs)), + (Notification.TYPE_PULL_REQUEST, u'This PR is awesome because it does stuff\n - please approve indented!', dict(pr_user_created='Requesting User (root)', is_mention=[False, True], pr_revisions=[('123abc'*7, "Introduce one and two\n\nand that's it"), ('567fed'*7, 'Make one plus two equal tree')], **pr_kwargs)), + (Notification.TYPE_PULL_REQUEST_COMMENT, u'Me too!\n\n - and indented on second line', dict(closing_pr=[False, True], pr_comment_user='Opinionated User (jsmith)', pr_comment_url='http://pr.org/comment', status_change=[None, 'Under Review'], pr_target_repo='http://target.com/repo', **pr_kwargs)), ]: kwargs['repo_name'] = u'repo/name' params = [(type_, type_, body, kwargs)]