[Commits] (bkirsch) Added email validation tests

commits at osafoundation.org commits at osafoundation.org
Wed Aug 11 16:38:22 PDT 2004


Commit by: bkirsch
Modified files:
chandler/parcels/osaf/mail/tests/TestMessage.py 1.1 1.2

Log message:
Added email validation tests

ViewCVS links:
http://cvs.osafoundation.org/index.cgi/chandler/parcels/osaf/mail/tests/TestMessage.py.diff?r1=text&tr1=1.1&r2=text&tr2=1.2

Index: chandler/parcels/osaf/mail/tests/TestMessage.py
diff -u chandler/parcels/osaf/mail/tests/TestMessage.py:1.1 chandler/parcels/osaf/mail/tests/TestMessage.py:1.2
--- chandler/parcels/osaf/mail/tests/TestMessage.py:1.1	Mon Aug  9 17:46:41 2004
+++ chandler/parcels/osaf/mail/tests/TestMessage.py	Wed Aug 11 16:38:21 2004
@@ -1,5 +1,5 @@
-__revision__  = "$Revision: 1.1 $"
-__date__      = "$Date: 2004/08/10 00:46:41 $"
+__revision__  = "$Revision: 1.2 $"
+__date__      = "$Date: 2004/08/11 23:38:21 $"
 __copyright__ = "Copyright (c) 2004 Open Source Applications Foundation"
 __license__   = "http://osafoundation.org/Chandler_0.1_license_terms.htm"
 
@@ -29,6 +29,8 @@
 
 This is the body"""
 
+    __addresses = [None, "    ", "john", "sd$%dsd at dsd-fffd!.com", "bill.jones at tc.unernet.com"]
+
 
     def __getMessageObject(self):
         if self.__messageObject is None:
@@ -143,6 +145,13 @@
         self.assertEquals(mOne['Subject'], mTwo['Subject'])
 
 
+    def testEmailValidation(self):
+         self.assertEquals(message.isValidEmailAddress(self.__addresses[0]), False)
+         self.assertEquals(message.isValidEmailAddress(self.__addresses[1]), False)
+         self.assertEquals(message.isValidEmailAddress(self.__addresses[2]), False)
+         self.assertEquals(message.isValidEmailAddress(self.__addresses[3]), False)
+         self.assertEquals(message.isValidEmailAddress(self.__addresses[4]), True)
+
     def testMessageTextToKind(self):
         """Conditions:
            1. Only strings can be passed to messageTextToKind



More information about the Commits mailing list