summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--askbot/mail/__init__.py4
-rw-r--r--askbot/skins/default/templates/email/post_as_subthread.html1
-rw-r--r--askbot/tests/email_alert_tests.py26
-rw-r--r--askbot/tests/reply_by_email_tests.py128
4 files changed, 16 insertions, 143 deletions
diff --git a/askbot/mail/__init__.py b/askbot/mail/__init__.py
index 2629aa47..d4f83310 100644
--- a/askbot/mail/__init__.py
+++ b/askbot/mail/__init__.py
@@ -288,8 +288,8 @@ def extract_user_signature(text, reply_code):
"""extracts email signature as text trailing
the reply code"""
#FIXME: buggy in html code
- striped_text = clean_html_email(text.replace('<br>', '\n'))
- #striped_text = strip_tags(text.replace('<br>', '\n'))
+ #striped_text = clean_html_email(text.replace('<br>', '\n'))
+ striped_text = strip_tags(text.replace('<br>', '\n'))
if reply_code in striped_text:
#extract the signature
tail = list()
diff --git a/askbot/skins/default/templates/email/post_as_subthread.html b/askbot/skins/default/templates/email/post_as_subthread.html
index cba5a3fd..f796ff8b 100644
--- a/askbot/skins/default/templates/email/post_as_subthread.html
+++ b/askbot/skins/default/templates/email/post_as_subthread.html
@@ -19,5 +19,6 @@
{% endif %}
{% endif %}
{% endblock %}
+{%block footer%}
{% include "email/footer.html" %}
{% endblock %}
diff --git a/askbot/tests/email_alert_tests.py b/askbot/tests/email_alert_tests.py
index b377a429..5ad08978 100644
--- a/askbot/tests/email_alert_tests.py
+++ b/askbot/tests/email_alert_tests.py
@@ -39,7 +39,7 @@ def email_alert_test(test_func):
test_object.check_results(test_name)
else:
raise ValueError('test method names must have prefix "test_"')
- return wrapped_test
+ return wrapped_test
def setup_email_alert_tests(setup_func):
@functools.wraps(setup_func)
@@ -107,7 +107,7 @@ class SubjectLineTests(TestCase):
self.assertEquals(subj, 'hahah')
class EmailAlertTests(TestCase):
- """Base class for testing delayed Email notifications
+ """Base class for testing delayed Email notifications
that are triggered by the send_email_alerts
command
@@ -145,7 +145,7 @@ class EmailAlertTests(TestCase):
@setup_email_alert_tests
def setUp(self):
"""generic pre-test setup method:
-
+
this function is empty - because it's intendend content is
entirely defined by the decorator
@@ -157,7 +157,7 @@ class EmailAlertTests(TestCase):
def setUpUsers(self):
self.other_user = utils.create_user(
- username = 'other',
+ username = 'other',
email = 'other@domain.com',
date_joined = self.setup_timestamp,
status = 'm'
@@ -177,8 +177,8 @@ class EmailAlertTests(TestCase):
body_text = 'dummy test comment',
timestamp = None
):
- """posts and returns a comment to parent post, uses
- now timestamp if not given, dummy body_text
+ """posts and returns a comment to parent post, uses
+ now timestamp if not given, dummy body_text
author is required
"""
if timestamp is None:
@@ -211,8 +211,8 @@ class EmailAlertTests(TestCase):
)
def post_question(
- self,
- author = None,
+ self,
+ author = None,
timestamp = None,
title = 'test question title',
body_text = 'test question body',
@@ -234,7 +234,7 @@ class EmailAlertTests(TestCase):
return self.question
def maybe_visit_question(self, user = None):
- """visits question on behalf of a given user and applies
+ """visits question on behalf of a given user and applies
a timestamp set in the class attribute ``visit_timestamp``
if ``visit_timestamp`` is None, then visit is skipped
@@ -298,7 +298,7 @@ class EmailAlertTests(TestCase):
(self.target_user.email, outbox[0].recipients()[0])
#verify that target user receives the email
self.assertEqual(
- outbox[0].recipients()[0],
+ outbox[0].recipients()[0],
self.target_user.email,
error_message
)
@@ -806,7 +806,7 @@ class EmailReminderTestCase(utils.AskbotTestCase):
#frequency_setting_name = 'UNANSWERED_REMINDER_FREQUENCY'
#days_before_setting_name = 'DAYS_BEFORE_SENDING_UNANSWERED_REMINDER'
#max_reminder_setting_name = 'MAX_UNANSWERED_REMINDERS'
-
+
def setUp(self):
self.u1 = self.create_user(username = 'user1')
self.u2 = self.create_user(username = 'user2')
@@ -871,7 +871,7 @@ class AcceptAnswerReminderTests(EmailReminderTestCase):
class UnansweredReminderTests(EmailReminderTestCase):
-
+
enable_setting_name = 'ENABLE_UNANSWERED_REMINDERS'
frequency_setting_name = 'UNANSWERED_REMINDER_FREQUENCY'
days_before_setting_name = 'DAYS_BEFORE_SENDING_UNANSWERED_REMINDER'
@@ -980,7 +980,7 @@ class PostApprovalTests(utils.AskbotTestCase):
self.enable_content_moderation
)
askbot_settings.update(
- 'SELF_NOTIFY_EMAILED_POST_AUTHOR_WHEN',
+ 'SELF_NOTIFY_EMAILED_POST_AUTHOR_WHEN',
self.self_notify_when
)
diff --git a/askbot/tests/reply_by_email_tests.py b/askbot/tests/reply_by_email_tests.py
index 3336a3af..30cb48be 100644
--- a/askbot/tests/reply_by_email_tests.py
+++ b/askbot/tests/reply_by_email_tests.py
@@ -193,131 +193,3 @@ class EmailSignatureDetectionTests(AskbotTestCase):
signature = self.reload_object(self.u2).email_signature
self.assertEqual(signature, 'Yours Truly')
-
-class SignatureDetectionTests(AskbotTestCase):
- '''Simple test to detect signature from text'''
-
- def setUp(self):
- self.u1 = self.create_user('user1', status = 'a')
- self.u1.email_signature = '''--\nFoo Bar'''
- self.u1.save()
- self.plain_text = '''welcome!
-
-On Mon, Sep 17, 2012 at 9:01 AM, <foo@bar.com> wrote:
-
-> **
-> Welcome to Askbot!
->
-> Important: *Please reply* to this message, without editing it. We need
-> this to determine your email signature and that the email address is valid
-> and was typed correctly.
->
-> Until we receive the response from you, you will not be able ask or answer
-> questions on askbot by email.
-> ------------------------------
->
-> Sincerely,
-> askbot Administrator
->
-> ofqssnfqkvlw
->
-
-
-
---
-Foo Bar
-'''
- self.html = '''welcome!<br><br><div class=3D"gmail_quote">On Mon, Sep 17, 2012 at 9:01 AM,=
- <span dir=3D"ltr">&lt;<a href=3D"mailto:foo@bar.com" target=
-=3D"_blank">foo@bar.com</a>&gt;</span> wrote:<br><blockquote c=
-lass=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;=
-padding-left:1ex">
-<u></u>=20
-
-
- =20
- =20
- =20
- =20
-
- =20
- =20
-
- =20
-
- =20
-
-<div>
-<table cellpadding=3D"0" cellspacing=3D"0" border=3D"0">
- <tbody><tr>
- <td>
- <table border=3D"0" align=3D"center" cellspacing=3D"0" cellpadding=3D=
-"0" style=3D"background-color:#e7e8e8">
- <tbody><tr height=3D"20">
- <td valign=3D"top">=20
- </td>
- </tr>
- <tr>
- <td valign=3D"top">=20
- <table border=3D"0" align=3D"center" cellspacing=3D"0" cellpadd=
-ing=3D"0" style=3D"background-color:#fff" width=3D"80%">
- <tbody><tr>
- <td valign=3D"top">=20
- <table border=3D"0" align=3D"center" cellspacing=3D"0" ce=
-llpadding=3D"0" width=3D"80%">
- <tbody><tr>
- <td valign=3D"top">=20
- <h1>Welcome to KnowledgePoint!</h1>
- </td>
- </tr>
- <tr>
- <td valign=3D"top">=20
- =20
-
-<p>
- Important: <em>Please reply</em> to this message, without editing it. W=
-e need this to determine your email signature and that the email address is=
- valid and was typed correctly.
-</p>
-<p>
- Until we receive the response from you, you will not be able ask or ans=
-wer questions on KnowledgePoint by email.
-</p>
-
- </td>
- </tr>
- <tr>
- <td valign=3D"top">=20
- <hr>
- =20
-<p>Sincerely,<br>KnowledgePoint Administrator</p>
-<p style=3D"font-size:8px;color:#aaa;margin-bottom:0px">ofqssnfqkvlw</p>
-
- </td>
- </tr>
- </tbody></table>
- </td>
- </tr>
- </tbody></table>
- </td>
- </tr>
- <tr height=3D"20">
- <td valign=3D"top">=20
- </td>
- </tr>
- </tbody></table>
- </td>
- </tr>
- </tbody></table> =20
-</div>
-</blockquote></div><br><br clear=3D"all"><div><br></div>-- <br> Foo Bar
-<br>'''
-
- def test_plain_text_parse(self):
- signature = extract_user_signature(self.plain_text, 'ofqssnfqkvlw')
- self.assertEquals(signature, self.u1.email_signature)
-
- def test_html_parse(self):
- signature = extract_user_signature(self.html, 'ofqssnfqkvlw')
- self.assertEquals(signature, self.u1.email_signature)
-