[Erp5-report] r28565 - /erp5/trunk/products/ERP5Type/tests/

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Aug 24 10:04:27 CEST 2009


Author: kazuhiko
Date: Mon Aug 24 10:04:27 2009
New Revision: 28565

URL: http://svn.erp5.org?rev=28565&view=rev
Log:
support '--smtp_host=host' parameter in runFunctionalTest.py.

Modified:
    erp5/trunk/products/ERP5Type/tests/runFunctionalTest.py
    erp5/trunk/products/ERP5Type/tests/sendMail.py

Modified: erp5/trunk/products/ERP5Type/tests/runFunctionalTest.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/runFunctionalTest.py?rev=28565&r1=28564&r2=28565&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/runFunctionalTest.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/runFunctionalTest.py [utf8] Mon Aug 24 10:04:27 2009
@@ -20,6 +20,7 @@
   -h, --help                 this help screen
   --email_to_address=STRING  send results to this address by email (defaults to
                              erp5-report at erp5.org)
+  --smtp_host=hostname       specify SMTP server
   -s, --stdout               print the results on stdout instead of sending
                              results by email (unless email_to_address is also
                              passed explictly)
@@ -45,6 +46,7 @@
 stdout = 0
 debug = 0
 email_to_address = 'erp5-report at erp5.org'
+smtp_host = ''
 run_only=''
 
 tests_framework_home = os.path.dirname(os.path.abspath(__file__))
@@ -75,6 +77,7 @@
   global stdout
   global debug
   global email_to_address
+  global smtp_host
   global host
   global port
   global portal_name
@@ -83,7 +86,8 @@
   try:
     opts, args = getopt.getopt(sys.argv[1:],
           "hsd", ["help", "stdout", "debug",
-                 "email_to_address=", "host=", "port=", "portal_name=", "run_only="] )
+                 "email_to_address=", "host=", "port=", "portal_name=", "run_only=",
+                 "smtp_host="] )
   except getopt.GetoptError, msg:
     usage(sys.stderr, msg)
     sys.exit(2)
@@ -96,6 +100,8 @@
     elif opt == '--email_to_address':
       email_to_address = arg
       send_mail = 1
+    elif opt == '--smtp_host':
+      smtp_host = arg
     elif opt in ('-h', '--help'):
       usage(sys.stdout)
       sys.exit()
@@ -287,7 +293,8 @@
              status=status,
              attachments=[detail],
              from_mail='nobody at svn.erp5.org',
-             to_mail=[email_to_address])
+             to_mail=[email_to_address],
+             smtp_host=smtp_host)
   if stdout:
     print '-' * 79
     print subject

Modified: erp5/trunk/products/ERP5Type/tests/sendMail.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/sendMail.py?rev=28565&r1=28564&r2=28565&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/sendMail.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/sendMail.py [utf8] Mon Aug 24 10:04:27 2009
@@ -40,7 +40,8 @@
              attachments = [],
              status = False,
              from_mail = 'nobody at erp5.org',
-             to_mail = [ 'erp5-report at erp5.org' ]):
+             to_mail = [ 'erp5-report at erp5.org' ],
+             smtp_host = ''):
     if attachments:
         msg = MIMEMultipart()
     else:
@@ -78,8 +79,8 @@
     else:
         msg.set_payload(body)
 
-    # Send the email via our own SMTP server.
-    s = smtplib.SMTP()
+    # Send the email via SMTP server.
+    s = smtplib.SMTP(smtp_host)
     s.connect()
     s.sendmail(from_mail, to_mail, msg.as_string())
     s.close()




More information about the Erp5-report mailing list