From a1fcd9653e38d405bd0285bde8e2e403c8d527d7 Mon Sep 17 00:00:00 2001
From: Sebastien Robin <seb@nexedi.com>
Date: Thu, 20 Oct 2005 08:14:06 +0000
Subject: [PATCH] added script used for the reporting of unit test

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4082 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Type/tests/run_unit_test  | 40 +++++++++++++++++++++++++++
 product/ERP5Type/tests/sendMailToList | 40 +++++++++++++++++++++++++++
 2 files changed, 80 insertions(+)
 create mode 100755 product/ERP5Type/tests/run_unit_test
 create mode 100755 product/ERP5Type/tests/sendMailToList

diff --git a/product/ERP5Type/tests/run_unit_test b/product/ERP5Type/tests/run_unit_test
new file mode 100755
index 0000000000..3301dce937
--- /dev/null
+++ b/product/ERP5Type/tests/run_unit_test
@@ -0,0 +1,40 @@
+#!/bin/bash
+DIRECTORY='/home/seb/zope/Products'
+export USER=seb
+rm -f $DIRECTORY/../tests/zLOG.log
+rm -f $DIRECTORY/test_output
+touch $DIRECTORY/test_output
+rm -f $DIRECTORY/test_full_output
+touch $DIRECTORY/test_full_output
+$DIRECTORY/update_cvs
+# missing : Portal Preference, ERP5Catalog, order , testERP5Categories
+$DIRECTORY/ERP5Type/tests/runUnitTest.py testCMFActivity >> $DIRECTORY/test_full_output 2>&1
+$DIRECTORY/ERP5Type/tests/runUnitTest.py testAlarm >> $DIRECTORY/test_full_output 2>&1
+$DIRECTORY/ERP5Type/tests/runUnitTest.py testAccountingRules >> $DIRECTORY/test_full_output 2>&1
+$DIRECTORY/ERP5Type/tests/runUnitTest.py testResource >> $DIRECTORY/test_full_output 2>&1
+$DIRECTORY/ERP5Type/tests/runUnitTest.py testInteractionWorkflow >> $DIRECTORY/test_full_output 2>&1
+#$DIRECTORY/ERP5Type/tests/runUnitTest.py testImmobilisation >> $DIRECTORY/test_full_output 2>&1
+$DIRECTORY/ERP5Type/tests/runUnitTest.py testERP5BankingCashTransfer >> $DIRECTORY/test_full_output 2>&1
+$DIRECTORY/ERP5Type/tests/runUnitTest.py testDomainTool >> $DIRECTORY/test_full_output 2>&1
+$DIRECTORY/ERP5Type/tests/runUnitTest.py testERP5Category >> $DIRECTORY/test_full_output 2>&1
+$DIRECTORY/ERP5Type/tests/runUnitTest.py testOrder >> $DIRECTORY/test_full_output 2>&1
+$DIRECTORY/ERP5Type/tests/runUnitTest.py testPackingList >> $DIRECTORY/test_full_output 2>&1
+$DIRECTORY/ERP5Type/tests/runUnitTest.py testTransformation >> $DIRECTORY/test_full_output 2>&1
+$DIRECTORY/ERP5Type/tests/runUnitTest.py testProductionOrder >> $DIRECTORY/test_full_output 2>&1
+$DIRECTORY/ERP5Type/tests/runUnitTest.py testInventory >> $DIRECTORY/test_full_output 2>&1
+$DIRECTORY/ERP5Type/tests/runUnitTest.py testERP5HR >> $DIRECTORY/test_full_output 2>&1
+$DIRECTORY/ERP5Type/tests/runUnitTest.py testBase >> $DIRECTORY/test_full_output 2>&1
+$DIRECTORY/ERP5Type/tests/runUnitTest.py testBusinessTemplate >> $DIRECTORY/test_full_output 2>&1
+$DIRECTORY/ERP5Type/tests/runUnitTest.py testERP5Type >> $DIRECTORY/test_full_output 2>&1
+$DIRECTORY/ERP5Type/tests/runUnitTest.py testXMLMatrix >> $DIRECTORY/test_full_output 2>&1
+$DIRECTORY/ERP5Type/tests/runUnitTest.py testConstraint >> $DIRECTORY/test_full_output 2>&1
+$DIRECTORY/ERP5Type/tests/runUnitTest.py testCMFCategory >> $DIRECTORY/test_full_output 2>&1
+$DIRECTORY/ERP5Type/tests/runUnitTest.py testERP5Catalog >> $DIRECTORY/test_full_output 2>&1
+$DIRECTORY/ERP5Type/tests/runUnitTest.py testPreferences >> $DIRECTORY/test_full_output 2>&1
+$DIRECTORY/ERP5Type/tests/runUnitTest.py testERP5SyncML >> $DIRECTORY/test_full_output 2>&1
+
+cat $DIRECTORY/test_full_output | grep '\(^OK\|^FAILED\|^Ran\)' >> $DIRECTORY/test_output
+
+$DIRECTORY/sendMailToList
+
+
diff --git a/product/ERP5Type/tests/sendMailToList b/product/ERP5Type/tests/sendMailToList
new file mode 100755
index 0000000000..05df1e7779
--- /dev/null
+++ b/product/ERP5Type/tests/sendMailToList
@@ -0,0 +1,40 @@
+#!/usr/bin/python
+
+import smtplib
+from datetime import date
+from email.MIMEText import MIMEText
+from email.MIMEBase import MIMEBase
+
+# Here are the email pacakge modules we'll need
+from email.MIMEImage import MIMEImage
+from email.MIMEMultipart import MIMEMultipart
+
+COMMASPACE = ', '
+
+test_msg = file('/home/seb/zope/Products/test_output','r').read()
+test_msg = "Date : %s\n\n" % date.today().isoformat() + test_msg
+#msg.set_payload(test_msg)
+msg = MIMEMultipart()
+#msg['content-type']=test_msg
+msg['Subject'] = 'ERP5 Unit Test'
+from_mail = "seb@nexedi.com"
+msg['From'] = from_mail
+to_mail = "erp5-report@nexedi.com"
+msg['To'] = to_mail
+#msg.preamble = 'ERP5 Unit Test'
+# Guarantees the message ends in a newline
+msg.preamble = 'ERP5 Unit Test'
+msg.epilogue = ''
+file_content = file('/home/seb/zope/Products/test_full_output','r').read()
+mime_text = MIMEText(test_msg)
+mime_text.add_header('Content-Disposition', 'attachment', filename='test_output')
+msg.attach(mime_text)
+mime_text = MIMEText(file_content)
+mime_text.add_header('Content-Disposition', 'attachment', filename='test_full_output')
+msg.attach(mime_text)
+# Send the email via our own SMTP server.
+s = smtplib.SMTP()
+s.connect()
+s.sendmail(from_mail, to_mail, msg.as_string())
+s.close()
+
-- 
2.30.9