Changeset - cd32d44ee7ff
[Not reviewed]
default
0 2 0
Mads Kiilerich - 9 years ago 2016-07-28 16:28:34
madski@unity3d.com
tests: improve test data in test_notifications mail template dump test
2 files changed with 62 insertions and 54 deletions:
0 comments (0 inline, 0 general)
kallithea/tests/models/test_dump_html_mails.ref.html
Show inline comments
 
@@ -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
 

	
 

	
 

	
 
<p>Comment from Commenter Name on repo_target changeset c0ffeecafe:</p>
 
<p>Comment from Opinionated User (jsmith) on repo_target changeset cafe1234c0ff:</p>
 
<p><div class="formatted-fixed">This is the new comment.
 

	
 
 - and here it ends indented.</div></p>
 
@@ -39,7 +39,7 @@ This is an automatic notification. Don't
 

	
 
<p>URL: <a href="http://comment.org">http://comment.org</a></p>
 

	
 
<p>Changeset: c0ffeecafe</p>
 
<p>Changeset: cafe1234c0ff</p>
 
<p>Description:<br/>
 
This changeset did something clever which is hard to explain
 
</p>
 
@@ -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
 

	
 

	
 

	
 
<p>Comment from Commenter Name on repo_target changeset c0ffeecafe mentioned you:</p>
 
<p>Comment from Opinionated User (jsmith) on repo_target changeset cafe1234c0ff mentioned you:</p>
 
<p><div class="formatted-fixed">This is the new comment.
 

	
 
 - and here it ends indented.</div></p>
 
@@ -91,7 +91,7 @@ This is an automatic notification. Don't
 

	
 
<p>URL: <a href="http://comment.org">http://comment.org</a></p>
 

	
 
<p>Changeset: c0ffeecafe</p>
 
<p>Changeset: cafe1234c0ff</p>
 
<p>Description:<br/>
 
This changeset did something clever which is hard to explain
 
</p>
 
@@ -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
 

	
 

	
 

	
 
<p>Comment from Commenter Name on repo_target changeset c0ffeecafe:</p>
 
<p>Comment from Opinionated User (jsmith) on repo_target changeset cafe1234c0ff:</p>
 
<p><div class="formatted-fixed">This is the new comment.
 

	
 
 - and here it ends indented.</div></p>
 
@@ -145,7 +145,7 @@ This is an automatic notification. Don't
 

	
 
<p>URL: <a href="http://comment.org">http://comment.org</a></p>
 

	
 
<p>Changeset: c0ffeecafe</p>
 
<p>Changeset: cafe1234c0ff</p>
 
<p>Description:<br/>
 
This changeset did something clever which is hard to explain
 
</p>
 
@@ -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
 

	
 

	
 

	
 
<p>Comment from Commenter Name on repo_target changeset c0ffeecafe mentioned you:</p>
 
<p>Comment from Opinionated User (jsmith) on repo_target changeset cafe1234c0ff mentioned you:</p>
 
<p><div class="formatted-fixed">This is the new comment.
 

	
 
 - and here it ends indented.</div></p>
 
@@ -199,7 +199,7 @@ This is an automatic notification. Don't
 

	
 
<p>URL: <a href="http://comment.org">http://comment.org</a></p>
 

	
 
<p>Changeset: c0ffeecafe</p>
 
<p>Changeset: cafe1234c0ff</p>
 
<p>Description:<br/>
 
This changeset did something clever which is hard to explain
 
</p>
 
@@ -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&amp;revision=123abc
 
123abc123abc: http://changeset_home/?repo_name=repo_org&amp;revision=123abc123abc123abc123abc123abc123abc123abc
 
Introduce one and two
 

	
 
567fed: http://changeset_home/?repo_name=repo_org&amp;revision=567fed
 
and that's it
 

	
 
567fed567fed: http://changeset_home/?repo_name=repo_org&amp;revision=567fed567fed567fed567fed567fed567fed567fed
 
Make one plus two equal tree
 

	
 

	
 
@@ -315,9 +317,9 @@ This is an automatic notification. Don't
 

	
 

	
 

	
 
<p>Requester Name requested your review of repo/name pull request &#34;The Title&#34;</p>
 
<p>Requesting User (root) requested your review of repo/name pull request &#34;The Title&#34;</p>
 

	
 
<p>URL: <a href="http://pr.org">http://pr.org</a></p>
 
<p>URL: <a href="http://pr.org/7">http://pr.org/7</a></p>
 

	
 
<p>Description:</p>
 
<p style="white-space: pre-wrap; font-family: monospace"><div class="formatted-fixed">This PR is awesome because it does stuff
 
@@ -325,10 +327,12 @@ This is an automatic notification. Don't
 

	
 
<p>Changesets:</p>
 
<p style="white-space: pre-wrap">
 
<i><a href="http://changeset_home/?repo_name=repo_org&amp;revision=123abc">123abc</a></i>:
 
<i><a href="http://changeset_home/?repo_name=repo_org&amp;revision=123abc123abc123abc123abc123abc123abc123abc">123abc123abc</a></i>:
 
Introduce one and two
 

	
 
<i><a href="http://changeset_home/?repo_name=repo_org&amp;revision=567fed">567fed</a></i>:
 
and that&#39;s it
 

	
 
<i><a href="http://changeset_home/?repo_name=repo_org&amp;revision=567fed567fed567fed567fed567fed567fed567fed">567fed567fed</a></i>:
 
Make one plus two equal tree
 

	
 
</p>
 
@@ -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&amp;revision=123abc
 
123abc123abc: http://changeset_home/?repo_name=repo_org&amp;revision=123abc123abc123abc123abc123abc123abc123abc
 
Introduce one and two
 

	
 
567fed: http://changeset_home/?repo_name=repo_org&amp;revision=567fed
 
and that's it
 

	
 
567fed567fed: http://changeset_home/?repo_name=repo_org&amp;revision=567fed567fed567fed567fed567fed567fed567fed
 
Make one plus two equal tree
 

	
 

	
 
@@ -376,9 +382,9 @@ This is an automatic notification. Don't
 

	
 

	
 

	
 
<p>Requester Name mentioned you on repo/name pull request &#34;The Title&#34;</p>
 
<p>Requesting User (root) mentioned you on repo/name pull request &#34;The Title&#34;</p>
 

	
 
<p>URL: <a href="http://pr.org">http://pr.org</a></p>
 
<p>URL: <a href="http://pr.org/7">http://pr.org/7</a></p>
 

	
 
<p>Description:</p>
 
<p style="white-space: pre-wrap; font-family: monospace"><div class="formatted-fixed">This PR is awesome because it does stuff
 
@@ -386,10 +392,12 @@ This is an automatic notification. Don't
 

	
 
<p>Changesets:</p>
 
<p style="white-space: pre-wrap">
 
<i><a href="http://changeset_home/?repo_name=repo_org&amp;revision=123abc">123abc</a></i>:
 
<i><a href="http://changeset_home/?repo_name=repo_org&amp;revision=123abc123abc123abc123abc123abc123abc123abc">123abc123abc</a></i>:
 
Introduce one and two
 

	
 
<i><a href="http://changeset_home/?repo_name=repo_org&amp;revision=567fed">567fed</a></i>:
 
and that&#39;s it
 

	
 
<i><a href="http://changeset_home/?repo_name=repo_org&amp;revision=567fed567fed567fed567fed567fed567fed567fed">567fed567fed</a></i>:
 
Make one plus two equal tree
 

	
 
</p>
 
@@ -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
 

	
 

	
 

	
 
<p>Comment from Commenter Name on repo/name pull request &#34;The Title&#34;:</p>
 
<p>Comment from Opinionated User (jsmith) on repo/name pull request &#34;The Title&#34;:</p>
 
<p><div class="formatted-fixed">Me too!
 

	
 
 - and indented on second line</div></p>
 
@@ -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
 

	
 

	
 

	
 
<p>Comment from Commenter Name on repo/name pull request &#34;The Title&#34;:</p>
 
<p>Comment from Opinionated User (jsmith) on repo/name pull request &#34;The Title&#34;:</p>
 
<p><div class="formatted-fixed">Me too!
 

	
 
 - and indented on second line</div></p>
 
@@ -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
 

	
 

	
 

	
 
<p>Comment from Commenter Name on repo/name pull request &#34;The Title&#34;:</p>
 
<p>Comment from Opinionated User (jsmith) on repo/name pull request &#34;The Title&#34;:</p>
 
<p><div class="formatted-fixed">Me too!
 

	
 
 - and indented on second line</div></p>
 
@@ -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
 

	
 

	
 

	
 
<p>Comment from Commenter Name on repo/name pull request &#34;The Title&#34;:</p>
 
<p>Comment from Opinionated User (jsmith) on repo/name pull request &#34;The Title&#34;:</p>
 
<p><div class="formatted-fixed">Me too!
 

	
 
 - and indented on second line</div></p>
kallithea/tests/models/test_notifications.py
Show inline comments
 
@@ -182,15 +182,15 @@ class TestNotifications(TestController):
 

	
 
        l.append('<html><body>\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)]
0 comments (0 inline, 0 general)