[Zope3-checkins] CVS: Zope3/src/zope/app/security/tests - test_principallogging.py:1.1
Viktorija Zaksiene
ryzaja@codeworks.lt
Tue, 22 Jul 2003 11:09:44 -0400
Update of /cvs-repository/Zope3/src/zope/app/security/tests
In directory cvs.zope.org:/tmp/cvs-serv14056/src/zope/app/security/tests
Added Files:
test_principallogging.py
Log Message:
Vika and Bjorn Tillenius:
Made HTTPRequest.setUser use an adapter to choose what name to log. We don't want to
make policy decisions there.
=== Added File Zope3/src/zope/app/security/tests/test_principallogging.py ===
##############################################################################
#
# Copyright (c) 2003 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.
#
##############################################################################
"""Test for PrincipalLogging.
$Id: test_principallogging.py,v 1.1 2003/07/22 15:09:39 ryzaja Exp $
"""
import unittest
from zope.interface.verify import verifyObject
class PrincipalStub:
#implements(IPrincipal)
def getId(self):
return 42
class TestPrincipalLogging(unittest.TestCase):
def test_interface(self):
from zope.app.security.principallogging import PrincipalLogging
from zope.publisher.interfaces.logginginfo import ILoggingInfo
principal = PrincipalStub()
pl = PrincipalLogging(principal)
verifyObject(ILoggingInfo, pl)
def test_getLogMessage(self):
from zope.app.security.principallogging import PrincipalLogging
principal = PrincipalStub()
pl = PrincipalLogging(principal)
self.assertEquals(pl.getLogMessage(), "42")
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestPrincipalLogging))
return suite
if __name__ == '__main__':
unittest.main()