[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Security/tests - testLoginPassword.py:1.1.2.1

Guido van Rossum guido@python.org
Wed, 12 Dec 2001 17:54:04 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/App/Security/tests
In directory cvs.zope.org:/tmp/cvs-serv1912/tests

Added Files:
      Tag: Zope-3x-branch
	testLoginPassword.py 
Log Message:
Add LoginPassword class and ILoginPasswor interface.

=== Added File Zope3/lib/python/Zope/App/Security/tests/testLoginPassword.py ===
##############################################################################
# Copyright (c) 2001 Zope Corporation and Contributors.  All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 1.1 (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, sys

from Zope.App.Security.LoginPassword import LoginPassword

class Test(unittest.TestCase):

    def testLoginPassword(self):
        lp = LoginPassword("tim", "123")
        self.assertEqual(lp.getLogin(), "tim")
        self.assertEqual(lp.getPassword(), "123")
        lp = LoginPassword(None, None)
        self.assertEqual(lp.getLogin(), None)
        self.assertEqual(lp.getPassword(), None)
        lp = LoginPassword(None, "123")
        self.assertEqual(lp.getLogin(), None)
        self.assertEqual(lp.getPassword(), None)
        lp = LoginPassword("tim", None)
        self.assertEqual(lp.getLogin(), "tim")
        self.assertEqual(lp.getPassword(), "")

def test_suite():
    loader=unittest.TestLoader()
    return loader.loadTestsFromTestCase(Test)

if __name__=='__main__':
    unittest.TextTestRunner().run(test_suite())