[pycopia] r748 committed - ezmail test case.

1 view
Skip to first unread message

pyc...@googlecode.com

unread,
Apr 25, 2014, 5:16:00 PM4/25/14
to pyc...@googlegroups.com
Revision: 748
Author: keith.dart
Date: Fri Apr 25 21:15:51 2014 UTC
Log: ezmail test case.

http://code.google.com/p/pycopia/source/detail?r=748

Added:
/testing/testcases/unittests/core/ezmail.py

=======================================
--- /dev/null
+++ /testing/testcases/unittests/core/ezmail.py Fri Apr 25 21:15:51 2014 UTC
@@ -0,0 +1,86 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+# vim:ts=4:sw=4:softtabstop=0:smarttab
+
+"""
+ezmail module
+-------------
+
+Unit tests for ezmail module.
+
+"""
+
+from pycopia import ezmail
+
+from pycopia.QA import core
+
+
+class SendUnicode(core.Test):
+ """
+ Purpose
+ +++++++
+
+ Send an attachment with unicode.
+
+ Pass Criteria
+ +++++++++++++
+
+ Mail is received without errors.
+
+ Start Condition
+ +++++++++++++++
+
+ None
+
+ End Condition
+ +++++++++++++
+
+ No change
+
+ Reference
+ +++++++++
+
+ NA
+
+ Prerequisites
+ +++++++++++++
+
+ None
+
+ Procedure
+ +++++++++
+
+ #. Send email with unicode attachement.
+ #. Step 2 ...
+ #. Step 3 ...
+
+ """
+ def execute(self):
+
+ message = ezmail.MultipartMessage()
+ message.From(self.config.get("from", ezmail.self_address()))
+ recipients = [self.config.get("recipient", ezmail.self_address())]
+ message.To(recipients)
+
+ main = ezmail.MIMEText.MIMEText("Main message,\nThis is a test of
ezmail mailer.\n", "plain")
+ main["Content-Disposition"] = "inline"
+ message.attach(main)
+
+ second = ezmail.MIMEText.MIMEText(u"'Some unicode
text'\n", "plain", "utf-8")
+ second["Content-Disposition"] = 'attachment; filename=utf8.txt'
+ message.attach(second)
+
+ ezmail.mail(message,
mailhost=self.config.get("mailhost", "localhost"))
+
+ return self.passed("Mail sent.")
+
+
+def get_suite(config):
+ suite = core.TestSuite(config, name="EZMailSuite")
+ suite.add_test(SendUnicode)
+ return suite
+
+def run(config):
+ suite = get_suite(config)
+ suite.run()
+
Reply all
Reply to author
Forward
0 new messages