Back to index

plone3  3.1.7
test_RegistrationTool.py
Go to the documentation of this file.
00001 ##############################################################################
00002 #
00003 # Copyright (c) 2002 Zope Corporation and Contributors. All Rights Reserved.
00004 #
00005 # This software is subject to the provisions of the Zope Public License,
00006 # Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
00007 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
00008 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00009 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
00010 # FOR A PARTICULAR PURPOSE.
00011 #
00012 ##############################################################################
00013 """ Unit tests for RegistrationTool module.
00014 
00015 $Id: test_RegistrationTool.py 76996 2007-06-24 00:18:49Z hannosch $
00016 """
00017 
00018 import unittest
00019 import Testing
00020 
00021 
00022 class RegistrationToolTests(unittest.TestCase):
00023 
00024     def _makeOne(self):
00025         from Products.CMFCore.RegistrationTool import RegistrationTool
00026 
00027         return RegistrationTool()
00028 
00029     def test_z2interfaces(self):
00030         from Interface.Verify import verifyClass
00031         from Products.CMFCore.interfaces.portal_registration \
00032                 import portal_registration as IRegistrationTool
00033         from Products.CMFCore.RegistrationTool import RegistrationTool
00034 
00035         verifyClass(IRegistrationTool, RegistrationTool)
00036 
00037     def test_z3interfaces(self):
00038         from zope.interface.verify import verifyClass
00039         from Products.CMFCore.interfaces import IRegistrationTool
00040         from Products.CMFCore.RegistrationTool import RegistrationTool
00041 
00042         verifyClass(IRegistrationTool, RegistrationTool)
00043 
00044     def test_generatePassword(self):
00045         rtool = self._makeOne()
00046         self.failUnless( len( rtool.generatePassword() ) >= 5 )
00047 
00048 
00049 def test_suite():
00050     return unittest.TestSuite((
00051         unittest.makeSuite(RegistrationToolTests),
00052         ))
00053 
00054 if __name__ == '__main__':
00055     unittest.main(defaultTest='test_suite')