summaryrefslogtreecommitdiffstats
path: root/askbot/tests/email_parsing_tests.py
blob: 905bff0a74fa92a9414d953c5c7ac503f21c8ef6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from django.conf import settings as django_settings
from askbot.skins.loaders import get_template
from django.template import Context
from askbot import mail
from askbot import models
from askbot.tests import utils

class EmailParseTests(utils.AskbotTestCase):

    def setUp(self):
        self.template_name = 'email/welcome_lamson_on.html'
        self.context = {'site_name': 'askbot.com',
                        'email_code': 'DwFwndQty'}
        template = get_template(self.template_name)
        self.rendered_template = template.render(Context(self.context))
        self.expected_output = 'Welcome to askbot.com!\n\nImportant: 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.\n\nUntil we receive the response from you, you will not be able ask or answer questions on askbot.com by email.\n\nSincerely,askbot.com Administrator\n\nDwFwndQty'

    def test_clean_email_body(self):
        cleaned_body = mail.clean_html_email(self.rendered_template)
        print "EXPECTED BODY"
        print self.expected_output
        print '=================================================='
        print cleaned_body
        print "CLEANED BODY"
        self.assertEquals(cleaned_body, self.expected_output)