Back to index

plone3  3.1.7
tests.py
Go to the documentation of this file.
00001 import doctest
00002 import unittest
00003 
00004 from DateTime.DateTime import DateTime
00005 from Testing.ZopeTestCase import FunctionalDocFileSuite as Suite
00006 
00007 from Products.PloneTestCase.PloneTestCase import FunctionalTestCase
00008 from Products.PloneTestCase.PloneTestCase import setupPloneSite
00009 
00010 setupPloneSite()
00011 
00012 OPTIONFLAGS = (doctest.REPORT_ONLY_FIRST_FAILURE |
00013                doctest.ELLIPSIS |
00014                doctest.NORMALIZE_WHITESPACE)
00015 
00016 def addMember(self, username, fullname="", email="", roles=('Member',), last_login_time=None):
00017     self.portal.portal_membership.addMember(username, 'secret', roles, [])
00018     member = self.portal.portal_membership.getMemberById(username)
00019     member.setMemberProperties({'fullname': fullname, 'email': email,
00020                                 'last_login_time': DateTime(last_login_time),})
00021                                 
00022 def setUp(self):
00023     addMember(self, 'member1', 'Member one')
00024     addMember(self, 'member2', 'Member two')
00025 
00026 def test_suite():
00027     from unittest import TestSuite, makeSuite
00028     return unittest.TestSuite((Suite('README.txt',
00029                                      optionflags=OPTIONFLAGS,
00030                                      package='plone.locking',
00031                                      setUp=setUp,
00032                                      test_class=FunctionalTestCase),))