Changeset - 8bd957e6cccb
[Not reviewed]
default
0 3 0
Mads Kiilerich - 9 years ago 2016-07-28 16:36:51
madski@unity3d.com
tests: make the html from mail template dump valid html even when the html mails contain html
3 files changed with 316 insertions and 215 deletions:
0 comments (0 inline, 0 general)
kallithea/templates/email_templates/main.html
Show inline comments
 
<!doctype html>
 
<html lang="en">
 
<head>
 
    <title></title>
 
    <meta name="viewport" content="width=device-width">
 
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 
</head>
 
<body>
 
${self.body()}
 

	
 
<br/>
 
<br/>
 
-- <br/>
 
${_("This is an automatic notification. Don't reply to this mail.")}
 
</body>
 
</html>
kallithea/tests/models/test_dump_html_mails.ref.html
Show inline comments
 
<html><body>
 

	
 

	
 
<!doctype html>
 
<html lang="en">
 
<head><title>Notifications</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head>
 
<body>
 
<hr/>
 
<h1>cs_comment, is_mention=False, status_change=None</h1>
 
<pre>
 

	
 
From: u1
 
To: u2@example.com
 
Subject: [Comment] repo/name changeset cafe1234 "This changeset did something cl..." on brunch
 

	
 
--------------------
 

	
 
</pre>
 
<hr/>
 
<pre>
 

	
 
Comment from Opinionated User (jsmith) on repo_target changeset cafe1234c0ff:
 
This is the new comment.
 
@@ -26,9 +27,16 @@ This changeset did something clever whic
 

	
 
-- 
 
This is an automatic notification. Don't reply to this mail.
 

	
 
--------------------</pre>
 

	
 
</pre>
 
<hr/>
 
<!--!doctype html-->
 
<!--html lang="en"-->
 
<!--head-->
 
    <!--title--><!--/title-->
 
    <!--meta name="viewport" content="width=device-width"-->
 
    <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"-->
 
<!--/head-->
 
<!--body-->
 

	
 

	
 
<p>Comment from Opinionated User (jsmith) on repo_target changeset cafe1234c0ff:</p>
 
@@ -44,24 +52,22 @@ This is an automatic notification. Don't
 
This changeset did something clever which is hard to explain
 
</p>
 

	
 

	
 
<br/>
 
<br/>
 
-- <br/>
 
This is an automatic notification. Don&#39;t reply to this mail.
 

	
 
<pre>--------------------</pre>
 

	
 

	
 
<!--/body-->
 
<!--/html-->
 
<hr/>
 
<hr/>
 
<h1>cs_comment, is_mention=True, status_change=None</h1>
 
<pre>
 

	
 
From: u1
 
To: u2@example.com
 
Subject: [Comment] repo/name changeset cafe1234 "This changeset did something cl..." on brunch
 

	
 
--------------------
 

	
 
</pre>
 
<hr/>
 
<pre>
 

	
 
Comment from Opinionated User (jsmith) on repo_target changeset cafe1234c0ff mentioned you:
 
This is the new comment.
 
@@ -78,9 +84,16 @@ This changeset did something clever whic
 

	
 
-- 
 
This is an automatic notification. Don't reply to this mail.
 

	
 
--------------------</pre>
 

	
 
</pre>
 
<hr/>
 
<!--!doctype html-->
 
<!--html lang="en"-->
 
<!--head-->
 
    <!--title--><!--/title-->
 
    <!--meta name="viewport" content="width=device-width"-->
 
    <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"-->
 
<!--/head-->
 
<!--body-->
 

	
 

	
 
<p>Comment from Opinionated User (jsmith) on repo_target changeset cafe1234c0ff mentioned you:</p>
 
@@ -96,24 +109,22 @@ This is an automatic notification. Don't
 
This changeset did something clever which is hard to explain
 
</p>
 

	
 

	
 
<br/>
 
<br/>
 
-- <br/>
 
This is an automatic notification. Don&#39;t reply to this mail.
 

	
 
<pre>--------------------</pre>
 

	
 

	
 
<!--/body-->
 
<!--/html-->
 
<hr/>
 
<hr/>
 
<h1>cs_comment, is_mention=False, status_change='Approved'</h1>
 
<pre>
 

	
 
From: u1
 
To: u2@example.com
 
Subject: [Approved: Comment] repo/name changeset cafe1234 "This changeset did something cl..." on brunch
 

	
 
--------------------
 

	
 
</pre>
 
<hr/>
 
<pre>
 

	
 
Comment from Opinionated User (jsmith) on repo_target changeset cafe1234c0ff:
 
This is the new comment.
 
@@ -131,9 +142,16 @@ This changeset did something clever whic
 

	
 
-- 
 
This is an automatic notification. Don't reply to this mail.
 

	
 
--------------------</pre>
 

	
 
</pre>
 
<hr/>
 
<!--!doctype html-->
 
<!--html lang="en"-->
 
<!--head-->
 
    <!--title--><!--/title-->
 
    <!--meta name="viewport" content="width=device-width"-->
 
    <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"-->
 
<!--/head-->
 
<!--body-->
 

	
 

	
 
<p>Comment from Opinionated User (jsmith) on repo_target changeset cafe1234c0ff:</p>
 
@@ -150,24 +168,22 @@ This is an automatic notification. Don't
 
This changeset did something clever which is hard to explain
 
</p>
 

	
 

	
 
<br/>
 
<br/>
 
-- <br/>
 
This is an automatic notification. Don&#39;t reply to this mail.
 

	
 
<pre>--------------------</pre>
 

	
 

	
 
<!--/body-->
 
<!--/html-->
 
<hr/>
 
<hr/>
 
<h1>cs_comment, is_mention=True, status_change='Approved'</h1>
 
<pre>
 

	
 
From: u1
 
To: u2@example.com
 
Subject: [Approved: Comment] repo/name changeset cafe1234 "This changeset did something cl..." on brunch
 

	
 
--------------------
 

	
 
</pre>
 
<hr/>
 
<pre>
 

	
 
Comment from Opinionated User (jsmith) on repo_target changeset cafe1234c0ff mentioned you:
 
This is the new comment.
 
@@ -185,9 +201,16 @@ This changeset did something clever whic
 

	
 
-- 
 
This is an automatic notification. Don't reply to this mail.
 

	
 
--------------------</pre>
 

	
 
</pre>
 
<hr/>
 
<!--!doctype html-->
 
<!--html lang="en"-->
 
<!--head-->
 
    <!--title--><!--/title-->
 
    <!--meta name="viewport" content="width=device-width"-->
 
    <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"-->
 
<!--/head-->
 
<!--body-->
 

	
 

	
 
<p>Comment from Opinionated User (jsmith) on repo_target changeset cafe1234c0ff mentioned you:</p>
 
@@ -204,24 +227,22 @@ This is an automatic notification. Don't
 
This changeset did something clever which is hard to explain
 
</p>
 

	
 

	
 
<br/>
 
<br/>
 
-- <br/>
 
This is an automatic notification. Don&#39;t reply to this mail.
 

	
 
<pre>--------------------</pre>
 

	
 

	
 
<!--/body-->
 
<!--/html-->
 
<hr/>
 
<hr/>
 
<h1>message</h1>
 
<pre>
 

	
 
From: u1
 
To: u2@example.com
 
Subject: Test Message
 

	
 
--------------------
 

	
 
</pre>
 
<hr/>
 
<pre>
 

	
 
This is the body of the test message
 
 - nothing interesting here except indentation.
 
@@ -229,32 +250,37 @@ This is the body of the test message
 

	
 
-- 
 
This is an automatic notification. Don't reply to this mail.
 

	
 
--------------------</pre>
 

	
 
</pre>
 
<hr/>
 
<!--!doctype html-->
 
<!--html lang="en"-->
 
<!--head-->
 
    <!--title--><!--/title-->
 
    <!--meta name="viewport" content="width=device-width"-->
 
    <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"-->
 
<!--/head-->
 
<!--body-->
 

	
 

	
 
<div class="formatted-fixed">This is the body of the test message
 
 - nothing interesting here except indentation.</div>
 

	
 

	
 
<br/>
 
<br/>
 
-- <br/>
 
This is an automatic notification. Don&#39;t reply to this mail.
 

	
 
<pre>--------------------</pre>
 

	
 

	
 
<!--/body-->
 
<!--/html-->
 
<hr/>
 
<hr/>
 
<h1>registration</h1>
 
<pre>
 

	
 
From: u1
 
To: u2@example.com
 
Subject: New user newbie registered
 

	
 
--------------------
 

	
 
</pre>
 
<hr/>
 
<pre>
 

	
 
Registration body
 

	
 
@@ -263,33 +289,38 @@ View this user here: http://newbie.org
 

	
 
-- 
 
This is an automatic notification. Don't reply to this mail.
 

	
 
--------------------</pre>
 

	
 
</pre>
 
<hr/>
 
<!--!doctype html-->
 
<!--html lang="en"-->
 
<!--head-->
 
    <!--title--><!--/title-->
 
    <!--meta name="viewport" content="width=device-width"-->
 
    <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"-->
 
<!--/head-->
 
<!--body-->
 

	
 

	
 
<div class="formatted-fixed">Registration body</div>
 

	
 
View this user here: <a href="http://newbie.org">http://newbie.org</a>
 

	
 

	
 
<br/>
 
<br/>
 
-- <br/>
 
This is an automatic notification. Don&#39;t reply to this mail.
 

	
 
<pre>--------------------</pre>
 

	
 

	
 
<!--/body-->
 
<!--/html-->
 
<hr/>
 
<hr/>
 
<h1>pull_request, is_mention=False</h1>
 
<pre>
 

	
 
From: u1
 
To: u2@example.com
 
Subject: [Review] repo/name PR #7 "The Title" from devbranch by u2
 

	
 
--------------------
 

	
 
</pre>
 
<hr/>
 
<pre>
 

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

	
 
@@ -312,9 +343,16 @@ Make one plus two equal tree
 

	
 
-- 
 
This is an automatic notification. Don't reply to this mail.
 

	
 
--------------------</pre>
 

	
 
</pre>
 
<hr/>
 
<!--!doctype html-->
 
<!--html lang="en"-->
 
<!--head-->
 
    <!--title--><!--/title-->
 
    <!--meta name="viewport" content="width=device-width"-->
 
    <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"-->
 
<!--/head-->
 
<!--body-->
 

	
 

	
 
<p>Requesting User (root) requested your review of repo/name pull request &#34;The Title&#34;</p>
 
@@ -337,24 +375,22 @@ Make one plus two equal tree
 

	
 
</p>
 

	
 

	
 
<br/>
 
<br/>
 
-- <br/>
 
This is an automatic notification. Don&#39;t reply to this mail.
 

	
 
<pre>--------------------</pre>
 

	
 

	
 
<!--/body-->
 
<!--/html-->
 
<hr/>
 
<hr/>
 
<h1>pull_request, is_mention=True</h1>
 
<pre>
 

	
 
From: u1
 
To: u2@example.com
 
Subject: [Review] repo/name PR #7 "The Title" from devbranch by u2
 

	
 
--------------------
 

	
 
</pre>
 
<hr/>
 
<pre>
 

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

	
 
@@ -377,9 +413,16 @@ Make one plus two equal tree
 

	
 
-- 
 
This is an automatic notification. Don't reply to this mail.
 

	
 
--------------------</pre>
 

	
 
</pre>
 
<hr/>
 
<!--!doctype html-->
 
<!--html lang="en"-->
 
<!--head-->
 
    <!--title--><!--/title-->
 
    <!--meta name="viewport" content="width=device-width"-->
 
    <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"-->
 
<!--/head-->
 
<!--body-->
 

	
 

	
 
<p>Requesting User (root) mentioned you on repo/name pull request &#34;The Title&#34;</p>
 
@@ -402,24 +445,22 @@ Make one plus two equal tree
 

	
 
</p>
 

	
 

	
 
<br/>
 
<br/>
 
-- <br/>
 
This is an automatic notification. Don&#39;t reply to this mail.
 

	
 
<pre>--------------------</pre>
 

	
 

	
 
<!--/body-->
 
<!--/html-->
 
<hr/>
 
<hr/>
 
<h1>pull_request_comment, is_mention=False, status_change=None, closing_pr=False</h1>
 
<pre>
 

	
 
From: u1
 
To: u2@example.com
 
Subject: [Comment] repo/name PR #7 "The Title" from devbranch by u2
 

	
 
--------------------
 

	
 
</pre>
 
<hr/>
 
<pre>
 

	
 
Comment from Opinionated User (jsmith) on repo/name pull request "The Title":
 
Me too!
 
@@ -432,9 +473,16 @@ URL: http://pr.org/comment
 

	
 
-- 
 
This is an automatic notification. Don't reply to this mail.
 

	
 
--------------------</pre>
 

	
 
</pre>
 
<hr/>
 
<!--!doctype html-->
 
<!--html lang="en"-->
 
<!--head-->
 
    <!--title--><!--/title-->
 
    <!--meta name="viewport" content="width=device-width"-->
 
    <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"-->
 
<!--/head-->
 
<!--body-->
 

	
 

	
 
<p>Comment from Opinionated User (jsmith) on repo/name pull request &#34;The Title&#34;:</p>
 
@@ -445,24 +493,22 @@ This is an automatic notification. Don't
 

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

	
 

	
 
<br/>
 
<br/>
 
-- <br/>
 
This is an automatic notification. Don&#39;t reply to this mail.
 

	
 
<pre>--------------------</pre>
 

	
 

	
 
<!--/body-->
 
<!--/html-->
 
<hr/>
 
<hr/>
 
<h1>pull_request_comment, is_mention=True, status_change=None, closing_pr=False</h1>
 
<pre>
 

	
 
From: u1
 
To: u2@example.com
 
Subject: [Comment] repo/name PR #7 "The Title" from devbranch by u2
 

	
 
--------------------
 

	
 
</pre>
 
<hr/>
 
<pre>
 

	
 
Comment from Opinionated User (jsmith) on repo/name pull request "The Title":
 
Me too!
 
@@ -475,9 +521,16 @@ URL: http://pr.org/comment
 

	
 
-- 
 
This is an automatic notification. Don't reply to this mail.
 

	
 
--------------------</pre>
 

	
 
</pre>
 
<hr/>
 
<!--!doctype html-->
 
<!--html lang="en"-->
 
<!--head-->
 
    <!--title--><!--/title-->
 
    <!--meta name="viewport" content="width=device-width"-->
 
    <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"-->
 
<!--/head-->
 
<!--body-->
 

	
 

	
 
<p>Comment from Opinionated User (jsmith) on repo/name pull request &#34;The Title&#34;:</p>
 
@@ -488,24 +541,22 @@ This is an automatic notification. Don't
 

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

	
 

	
 
<br/>
 
<br/>
 
-- <br/>
 
This is an automatic notification. Don&#39;t reply to this mail.
 

	
 
<pre>--------------------</pre>
 

	
 

	
 
<!--/body-->
 
<!--/html-->
 
<hr/>
 
<hr/>
 
<h1>pull_request_comment, is_mention=False, status_change='Under Review', closing_pr=False</h1>
 
<pre>
 

	
 
From: u1
 
To: u2@example.com
 
Subject: [Under Review: Comment] repo/name PR #7 "The Title" from devbranch by u2
 

	
 
--------------------
 

	
 
</pre>
 
<hr/>
 
<pre>
 

	
 
Comment from Opinionated User (jsmith) on repo/name pull request "The Title":
 
Me too!
 
@@ -519,9 +570,16 @@ URL: http://pr.org/comment
 

	
 
-- 
 
This is an automatic notification. Don't reply to this mail.
 

	
 
--------------------</pre>
 

	
 
</pre>
 
<hr/>
 
<!--!doctype html-->
 
<!--html lang="en"-->
 
<!--head-->
 
    <!--title--><!--/title-->
 
    <!--meta name="viewport" content="width=device-width"-->
 
    <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"-->
 
<!--/head-->
 
<!--body-->
 

	
 

	
 
<p>Comment from Opinionated User (jsmith) on repo/name pull request &#34;The Title&#34;:</p>
 
@@ -533,24 +591,22 @@ This is an automatic notification. Don't
 

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

	
 

	
 
<br/>
 
<br/>
 
-- <br/>
 
This is an automatic notification. Don&#39;t reply to this mail.
 

	
 
<pre>--------------------</pre>
 

	
 

	
 
<!--/body-->
 
<!--/html-->
 
<hr/>
 
<hr/>
 
<h1>pull_request_comment, is_mention=True, status_change='Under Review', closing_pr=False</h1>
 
<pre>
 

	
 
From: u1
 
To: u2@example.com
 
Subject: [Under Review: Comment] repo/name PR #7 "The Title" from devbranch by u2
 

	
 
--------------------
 

	
 
</pre>
 
<hr/>
 
<pre>
 

	
 
Comment from Opinionated User (jsmith) on repo/name pull request "The Title":
 
Me too!
 
@@ -564,9 +620,16 @@ URL: http://pr.org/comment
 

	
 
-- 
 
This is an automatic notification. Don't reply to this mail.
 

	
 
--------------------</pre>
 

	
 
</pre>
 
<hr/>
 
<!--!doctype html-->
 
<!--html lang="en"-->
 
<!--head-->
 
    <!--title--><!--/title-->
 
    <!--meta name="viewport" content="width=device-width"-->
 
    <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"-->
 
<!--/head-->
 
<!--body-->
 

	
 

	
 
<p>Comment from Opinionated User (jsmith) on repo/name pull request &#34;The Title&#34;:</p>
 
@@ -578,24 +641,22 @@ This is an automatic notification. Don't
 

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

	
 

	
 
<br/>
 
<br/>
 
-- <br/>
 
This is an automatic notification. Don&#39;t reply to this mail.
 

	
 
<pre>--------------------</pre>
 

	
 

	
 
<!--/body-->
 
<!--/html-->
 
<hr/>
 
<hr/>
 
<h1>pull_request_comment, is_mention=False, status_change=None, closing_pr=True</h1>
 
<pre>
 

	
 
From: u1
 
To: u2@example.com
 
Subject: [Closing: Comment] repo/name PR #7 "The Title" from devbranch by u2
 

	
 
--------------------
 

	
 
</pre>
 
<hr/>
 
<pre>
 

	
 
Comment from Opinionated User (jsmith) on repo/name pull request "The Title":
 
Me too!
 
@@ -608,9 +669,16 @@ URL: http://pr.org/comment
 

	
 
-- 
 
This is an automatic notification. Don't reply to this mail.
 

	
 
--------------------</pre>
 

	
 
</pre>
 
<hr/>
 
<!--!doctype html-->
 
<!--html lang="en"-->
 
<!--head-->
 
    <!--title--><!--/title-->
 
    <!--meta name="viewport" content="width=device-width"-->
 
    <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"-->
 
<!--/head-->
 
<!--body-->
 

	
 

	
 
<p>Comment from Opinionated User (jsmith) on repo/name pull request &#34;The Title&#34;:</p>
 
@@ -621,24 +689,22 @@ This is an automatic notification. Don't
 

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

	
 

	
 
<br/>
 
<br/>
 
-- <br/>
 
This is an automatic notification. Don&#39;t reply to this mail.
 

	
 
<pre>--------------------</pre>
 

	
 

	
 
<!--/body-->
 
<!--/html-->
 
<hr/>
 
<hr/>
 
<h1>pull_request_comment, is_mention=True, status_change=None, closing_pr=True</h1>
 
<pre>
 

	
 
From: u1
 
To: u2@example.com
 
Subject: [Closing: Comment] repo/name PR #7 "The Title" from devbranch by u2
 

	
 
--------------------
 

	
 
</pre>
 
<hr/>
 
<pre>
 

	
 
Comment from Opinionated User (jsmith) on repo/name pull request "The Title":
 
Me too!
 
@@ -651,9 +717,16 @@ URL: http://pr.org/comment
 

	
 
-- 
 
This is an automatic notification. Don't reply to this mail.
 

	
 
--------------------</pre>
 

	
 
</pre>
 
<hr/>
 
<!--!doctype html-->
 
<!--html lang="en"-->
 
<!--head-->
 
    <!--title--><!--/title-->
 
    <!--meta name="viewport" content="width=device-width"-->
 
    <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"-->
 
<!--/head-->
 
<!--body-->
 

	
 

	
 
<p>Comment from Opinionated User (jsmith) on repo/name pull request &#34;The Title&#34;:</p>
 
@@ -664,24 +737,22 @@ This is an automatic notification. Don't
 

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

	
 

	
 
<br/>
 
<br/>
 
-- <br/>
 
This is an automatic notification. Don&#39;t reply to this mail.
 

	
 
<pre>--------------------</pre>
 

	
 

	
 
<!--/body-->
 
<!--/html-->
 
<hr/>
 
<hr/>
 
<h1>pull_request_comment, is_mention=False, status_change='Under Review', closing_pr=True</h1>
 
<pre>
 

	
 
From: u1
 
To: u2@example.com
 
Subject: [Under Review, Closing: Comment] repo/name PR #7 "The Title" from devbranch by u2
 

	
 
--------------------
 

	
 
</pre>
 
<hr/>
 
<pre>
 

	
 
Comment from Opinionated User (jsmith) on repo/name pull request "The Title":
 
Me too!
 
@@ -695,9 +766,16 @@ URL: http://pr.org/comment
 

	
 
-- 
 
This is an automatic notification. Don't reply to this mail.
 

	
 
--------------------</pre>
 

	
 
</pre>
 
<hr/>
 
<!--!doctype html-->
 
<!--html lang="en"-->
 
<!--head-->
 
    <!--title--><!--/title-->
 
    <!--meta name="viewport" content="width=device-width"-->
 
    <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"-->
 
<!--/head-->
 
<!--body-->
 

	
 

	
 
<p>Comment from Opinionated User (jsmith) on repo/name pull request &#34;The Title&#34;:</p>
 
@@ -709,24 +787,22 @@ This is an automatic notification. Don't
 

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

	
 

	
 
<br/>
 
<br/>
 
-- <br/>
 
This is an automatic notification. Don&#39;t reply to this mail.
 

	
 
<pre>--------------------</pre>
 

	
 

	
 
<!--/body-->
 
<!--/html-->
 
<hr/>
 
<hr/>
 
<h1>pull_request_comment, is_mention=True, status_change='Under Review', closing_pr=True</h1>
 
<pre>
 

	
 
From: u1
 
To: u2@example.com
 
Subject: [Under Review, Closing: Comment] repo/name PR #7 "The Title" from devbranch by u2
 

	
 
--------------------
 

	
 
</pre>
 
<hr/>
 
<pre>
 

	
 
Comment from Opinionated User (jsmith) on repo/name pull request "The Title":
 
Me too!
 
@@ -740,9 +816,16 @@ URL: http://pr.org/comment
 

	
 
-- 
 
This is an automatic notification. Don't reply to this mail.
 

	
 
--------------------</pre>
 

	
 
</pre>
 
<hr/>
 
<!--!doctype html-->
 
<!--html lang="en"-->
 
<!--head-->
 
    <!--title--><!--/title-->
 
    <!--meta name="viewport" content="width=device-width"-->
 
    <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"-->
 
<!--/head-->
 
<!--body-->
 

	
 

	
 
<p>Comment from Opinionated User (jsmith) on repo/name pull request &#34;The Title&#34;:</p>
 
@@ -754,24 +837,22 @@ This is an automatic notification. Don't
 

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

	
 

	
 
<br/>
 
<br/>
 
-- <br/>
 
This is an automatic notification. Don&#39;t reply to this mail.
 

	
 
<pre>--------------------</pre>
 

	
 

	
 
<!--/body-->
 
<!--/html-->
 
<hr/>
 
<hr/>
 
<h1>TYPE_PASSWORD_RESET</h1>
 
<pre>
 

	
 
From: u1
 
To: john@doe.com
 
Subject: Password reset link
 

	
 
--------------------
 

	
 
</pre>
 
<hr/>
 
<pre>
 

	
 
Hello John Doe
 

	
 
@@ -787,9 +868,16 @@ If it weren't you who requested the pass
 

	
 
-- 
 
This is an automatic notification. Don't reply to this mail.
 

	
 
--------------------</pre>
 

	
 
</pre>
 
<hr/>
 
<!--!doctype html-->
 
<!--html lang="en"-->
 
<!--head-->
 
    <!--title--><!--/title-->
 
    <!--meta name="viewport" content="width=device-width"-->
 
    <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"-->
 
<!--/head-->
 
<!--body-->
 

	
 

	
 
<h4>Hello John Doe</h4>
 
@@ -802,12 +890,13 @@ This is an automatic notification. Don't
 

	
 
<p>If it weren&#39;t you who requested the password reset, just disregard this message.</p>
 

	
 

	
 
<br/>
 
<br/>
 
-- <br/>
 
This is an automatic notification. Don&#39;t reply to this mail.
 
<!--/body-->
 
<!--/html-->
 
<hr/>
 

	
 
<pre>--------------------</pre>
 

	
 
</body></html>
 
</body>
 
</html>
kallithea/tests/models/test_notifications.py
Show inline comments
 
import os
 
import re
 

	
 
import mock
 
import routes.util
 
@@ -170,17 +171,19 @@ class TestNotifications(TestController):
 
        l = []
 

	
 
        def send_email(recipients, subject, body='', html_body='', headers=None, author=None):
 
            l.append('\n\n<h1>%s</h1>\n' % desc) # desc is from outer scope
 
            l.append('<pre>\n\n')
 
            l.append('<hr/>\n')
 
            l.append('<h1>%s</h1>\n' % desc) # desc is from outer scope
 
            l.append('<pre>\n')
 
            l.append('From: %s\n' % author.username)
 
            l.append('To: %s\n' % ' '.join(recipients))
 
            l.append('Subject: %s\n' % subject)
 
            l.append('\n--------------------\n%s\n--------------------' % body)
 
            l.append('</pre>\n')
 
            l.append('\n%s\n' % html_body)
 
            l.append('<pre>--------------------</pre>\n')
 
            l.append('<hr/>\n')
 
            l.append('<pre>%s</pre>\n' % body)
 
            l.append('<hr/>\n')
 
            l.append(html_body)
 
            l.append('<hr/>\n')
 

	
 
        l.append('<html><body>\n')
 
        with mock.patch.object(kallithea.lib.celerylib.tasks, 'send_email', send_email):
 
            pr_kwargs = dict(
 
                pr_nice_id='#7',
 
@@ -268,8 +271,8 @@ class TestNotifications(TestController):
 
                EmailNotificationModel().get_email_tmpl(EmailNotificationModel.TYPE_PASSWORD_RESET, 'html', **kwargs),
 
                author=User.get(self.u1))
 

	
 
        l.append('\n</body></html>\n')
 
        out = ''.join(l)
 
        out = '<!doctype html>\n<html lang="en">\n<head><title>Notifications</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head>\n<body>\n%s\n</body>\n</html>\n' % \
 
            re.sub(r'<(/?(?:!doctype|html|head|title|meta|body)\b[^>]*)>', r'<!--\1-->', ''.join(l))
 

	
 
        outfn = os.path.join(os.path.dirname(__file__), 'test_dump_html_mails.out.html')
 
        reffn = os.path.join(os.path.dirname(__file__), 'test_dump_html_mails.ref.html')
0 comments (0 inline, 0 general)