Ejemplo n.º 1
0
 def test_plaintext_only(self):
     """
     Test that emails created with just a "plain" block are plaintext only
     """
     
     email_msg = shortcuts._render_mail("shortcuts/plain.tpl", "*****@*****.**",
     ["*****@*****.**"])
     self.assertEqual(email_msg.body, 
         "This message should only have plain text")
     self.assertEqual(email_msg.attachments, [])
Ejemplo n.º 2
0
    def test_plain_and_html(self):
        """
        Tests an email with both html and plain
	    """

    	email_msg = shortcuts._render_mail("shortcuts/plain_and_html.tpl","*****@*****.**",
    	["*****@*****.**"])
    	self.assertEqual(email_msg.body,
    	    u"This is the plaintext block")
    	self.assertEqual(email_msg.alternatives,
    	    [(u"<span> This is the html block </span>",'text/html')])
Ejemplo n.º 3
0
 def test_html_only(self):
     """
     Test that an email created with only an html block resolves to a
     multipart message with auto generated html text
     """
     
     email_msg = shortcuts._render_mail("shortcuts/html.tpl", "*****@*****.**",
     ["*****@*****.**"])
     self.assertEqual(email_msg.body, 
         u"This message should be multipart and have an auto generated "+\
 		"plaintext component")
Ejemplo n.º 4
0
 def test_plaintext_with_files(self):
     """
     Test that emails with only a "plain" block but with attached files
     are plaintext only but still contain the files within their list of
     attachments
     """
     
     email_msg = shortcuts._render_mail("shortcuts/plain.tpl",
         "*****@*****.**", ["*****@*****.**"], files=[__file__])
     self.assertEqual(email_msg.body, 
         "This message should only have plain text")
     self.assertEqual(email_msg.attachments, ["tests.py"])
Ejemplo n.º 5
0
 def test_render_mail_html_only(self):
     """
     Test that an email created by _render_node with only an html block
     resolves to a multipart message with an auto generated plaintext 
     component.
     """
     
     email_msg = shortcuts._render_mail("shortcuts/html.tpl", 
         "*****@*****.**",
         ["*****@*****.**"])
     self.assertEqual(email_msg.body, 
         u"This message should be multipart and have an auto generated "+\
 		"plaintext component")
 	self.assertEqual(email_msg.alternatives[0], 
 	    (u"<span>This message should be multipart and have " +\
 	        "an auto generated plaintext component</span>", 'text/html'))