[Zope-CVS] CVS: Products/NotifyList/tests - __init__.py:1.2 testNotifyList.py:1.2

Shane Hathaway shane@cvs.zope.org
Wed, 16 Jan 2002 17:28:21 -0500


Update of /cvs-repository/Products/NotifyList/tests
In directory cvs.zope.org:/tmp/cvs-serv30731/tests

Modified Files:
	__init__.py testNotifyList.py 
Log Message:
Notify list manipulation is now 90% functional.


=== Products/NotifyList/tests/__init__.py 1.1.1.1 => 1.2 ===
+#
+# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
+# 
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE
+# 
+##############################################################################
 """NotifyList tests
 """


=== Products/NotifyList/tests/testNotifyList.py 1.1.1.1 => 1.2 ===
+#
+# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
+# 
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE
+# 
+##############################################################################
 
 
 import unittest
@@ -21,7 +33,7 @@
         id = notify.addEmail(name='Shane', email='x@y.com')
         emails = notify.listAllEmailsAndGroups()
         self.assertEqual(len(emails), 1)
-        self.assertEqual(emails[0]['name_email'], 'Shane <x@y.com>')
+        self.assertEqual(emails[0]['description'], 'Shane <x@y.com>')
 
     def testAddEmailToGroup(self):
         notify = self.app.site.notify
@@ -59,6 +71,18 @@
         notify.addEmail(name='Joe', email='l@y.com')
         emails = notify.listAllEmailsAndGroups()
         self.assertEqual(len(emails), 3)
+
+    def testAddBadId(self):
+        notify = self.app.site.notify
+        id_shane = notify.addEmail(name='Shane', email='x@y.com')
+        id_group = notify.addGroup(name='testing')
+        self.assertEqual(len(notify.listGroupContents(id_group)), 0)
+        self.assertRaises(ValueError, notify.addToGroupList,
+                          id_group, ['xxxxx'])
+
+        # Now remove email from the group.
+        notify.removeFromGroupList(id_group, [id_shane])
+        self.assertEqual(len(notify.listGroupContents(id_group)), 0)
 
 def test_suite():
     suite = unittest.TestSuite()