[CMF-checkins] CVS: CMF/CMFDefault/tests - test_MembershipTool.py:1.2.8.1

Yvo Schubbe schubbe@web.de
Tue, 18 Feb 2003 08:09:30 -0500


Update of /cvs-repository/CMF/CMFDefault/tests
In directory cvs.zope.org:/tmp/cvs-serv21762/CMFDefault/tests

Modified Files:
      Tag: yuppie-collector128-branch
	test_MembershipTool.py 
Log Message:
- un-hardwired members folder (Collector #128)
- made registerHelp work with 2 directories

=== CMF/CMFDefault/tests/test_MembershipTool.py 1.2 => 1.2.8.1 ===
--- CMF/CMFDefault/tests/test_MembershipTool.py:1.2	Mon Jan  6 16:06:57 2003
+++ CMF/CMFDefault/tests/test_MembershipTool.py	Tue Feb 18 08:09:30 2003
@@ -7,13 +7,34 @@
     # for Zope versions before 2.6.0
     from Interface import verify_class_implementation as verifyClass
 
+from Products.CMFCore.tests.base.dummy import DummyFolder
+
 from Products.CMFDefault.MembershipTool import MembershipTool
 
 
 class MembershipToolTests(TestCase):
 
+    def setUp(self):
+        self.site = DummyFolder()
+
+    def _makeOne(self, *args, **kw):
+        mtool = apply(MembershipTool, args, kw)
+        return mtool.__of__(self.site)
+
+    def test_MembersFolder_methods(self):
+        mtool = self._makeOne()
+        self.assertEqual( mtool.getMembersFolder(), None )
+        self.site._setObject( 'Members', DummyFolder() )
+        self.assertEqual( mtool.getMembersFolder(), self.site.Members )
+        mtool.setMembersFolderById(id='foo')
+        self.assertEqual( mtool.getMembersFolder(), None )
+        self.site._setObject( 'foo', DummyFolder() )
+        self.assertEqual( mtool.getMembersFolder(), self.site.foo )
+        mtool.setMembersFolderById()
+        self.assertEqual( mtool.getMembersFolder(), None )
+
     def test_interface(self):
-        from Products.CMFCore.interfaces.portal_membership \
+        from Products.CMFDefault.interfaces.portal_membership \
                 import portal_membership as IMembershipTool
         from Products.CMFCore.interfaces.portal_actions \
                 import ActionProvider as IActionProvider