Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
CMFPlone.tests.testLoggedIn.TestLogin Class Reference
Inheritance diagram for CMFPlone.tests.testLoggedIn.TestLogin:
Inheritance graph
[legend]
Collaboration diagram for CMFPlone.tests.testLoggedIn.TestLogin:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def afterSetUp
def testLoggedInCreatesMemberArea
def testLoggedInSetsLoginTime
def testLoggedInSetsLastLoginTime
def testLoggedInSetsLastLoginTimeIfMemberLacksSetOwnPropertiesPermission
def testInitialLoginTimeDoesChange
def setRequestMethod
def getAuthenticator
def setupAuthenticator

Public Attributes

 membership

Detailed Description

Definition at line 12 of file testLoggedIn.py.


Member Function Documentation

Definition at line 14 of file testLoggedIn.py.

00014 
00015     def afterSetUp(self):
00016         self.membership = self.portal.portal_membership
00017         self.membership.addMember('member', 'secret', ['Member'], [])
00018         self.login('member')

Definition at line 30 of file PloneTestCase.py.

00030 
00031     def getAuthenticator(self):
00032         tag = AuthenticatorView('context', 'request').authenticator()
00033         pattern = '<input .*name="(\w+)".*value="(\w+)"'
00034         return match(pattern, tag).groups()

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFPlone.tests.PloneTestCase.PloneTestCase.setRequestMethod (   self,
  method 
) [inherited]
This is a stub now, but in case you want to try
   something fancy on Your Branch (tm), put it here.

Definition at line 26 of file PloneTestCase.py.

00026 
00027     def setRequestMethod(self, method):
00028         self.app.REQUEST.set('REQUEST_METHOD', method)
00029         self.app.REQUEST.method = method

Here is the caller graph for this function:

Definition at line 35 of file PloneTestCase.py.

00035 
00036     def setupAuthenticator(self):
00037         name, token = self.getAuthenticator()
00038         self.app.REQUEST.form[name] = token
00039 

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 50 of file testLoggedIn.py.

00050 
00051     def testInitialLoginTimeDoesChange(self):
00052         member = self.membership.getAuthenticatedMember()
00053         self.portal.logged_in()
00054         member = self.membership.getAuthenticatedMember()
00055         login_time = DateTime(member.getProperty('login_time'))
00056         # Log in again later
00057         sleep(0.2)
00058         self.portal.logged_in()
00059         # login_time did change
00060         member = self.membership.getAuthenticatedMember()
00061         self.failUnless(DateTime(member.getProperty('login_time')) > login_time)
00062 

Definition at line 19 of file testLoggedIn.py.

00019 
00020     def testLoggedInCreatesMemberArea(self):
00021         if self.membership.memberareaCreationFlag == 'True':
00022             self.assertEqual(self.membership.getHomeFolder(), None) 
00023             self.portal.logged_in()
00024             self.failIfEqual(self.membership.getHomeFolder(), None)

Definition at line 33 of file testLoggedIn.py.

00033 
00034     def testLoggedInSetsLastLoginTime(self):
00035         now = DateTime()
00036         member = self.membership.getAuthenticatedMember()
00037         self.failUnless(DateTime(member.getProperty('last_login_time')) < now)
00038         self.portal.logged_in()
00039         member = self.membership.getAuthenticatedMember()
00040         self.failUnless(DateTime(member.getProperty('last_login_time')) >= now)

Definition at line 41 of file testLoggedIn.py.

00041 
00042     def testLoggedInSetsLastLoginTimeIfMemberLacksSetOwnPropertiesPermission(self):
00043         # If members lack the "Set own properties" permission, they should still
00044         # be able to log in, and their login times should be set.
00045         now = DateTime()
00046         self.portal.manage_permission(SetOwnProperties, ['Manager'], acquire=0)
00047         self.portal.logged_in()
00048         member = self.membership.getAuthenticatedMember()
00049         self.failUnless(DateTime(member.getProperty('last_login_time')) >= now)

Definition at line 25 of file testLoggedIn.py.

00025 
00026     def testLoggedInSetsLoginTime(self):
00027         now = DateTime()
00028         member = self.membership.getAuthenticatedMember()
00029         self.failUnless(DateTime(member.getProperty('login_time')) < now)
00030         self.portal.logged_in()
00031         member = self.membership.getAuthenticatedMember()
00032         self.failUnless(DateTime(member.getProperty('login_time')) >= now)


Member Data Documentation

Definition at line 15 of file testLoggedIn.py.


The documentation for this class was generated from the following file: