Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
plone.session.tests.testPAS.TestSessionPlugin Class Reference
Inheritance diagram for plone.session.tests.testPAS.TestSessionPlugin:
Inheritance graph
[legend]
Collaboration diagram for plone.session.tests.testPAS.TestSessionPlugin:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def testInterfaces
def makeRequest
def testOneLineCookiesOnly
def testExtraction
def testCredentialsUpdate

Public Attributes

 cookie

Detailed Description

Definition at line 7 of file testPAS.py.


Member Function Documentation

Definition at line 15 of file testPAS.py.

00015 
00016     def makeRequest(self, cookie):
00017         session=self.folder.pas.session
00018         return TestRequest(**{session.cookie_name : cookie})

Here is the caller graph for this function:

Definition at line 52 of file testPAS.py.

00052 
00053     def testCredentialsUpdate(self):
00054         session=self.folder.pas.session
00055         request=self.makeRequest("test string")
00056         session.updateCredentials(request, request.response, "bla", "password")
00057         self.assertEqual(request.response.getCookie(session.cookie_name), None)
00058 
00059         session.updateCredentials(request, request.response,
00060                 "our_user", "password")
00061         self.assertNotEqual(request.response.getCookie(session.cookie_name),
00062                 None)
00063 

Here is the call graph for this function:

Definition at line 40 of file testPAS.py.

00040 
00041     def testExtraction(self):
00042         session=self.folder.pas.session
00043 
00044         request=self.makeRequest("test string".encode("base64"))
00045         creds=session.extractCredentials(request)
00046         self.assertEqual(creds["source"], "plone.session")
00047         self.assertEqual(creds["cookie"], "test string")
00048 
00049         request=self.makeRequest("test string")
00050         creds=session.extractCredentials(request)
00051         self.assertEqual(creds, {})

Here is the call graph for this function:

Definition at line 9 of file testPAS.py.

00009 
00010     def testInterfaces(self):
00011         session=self.folder.pas.session
00012         self.assertEqual(ISessionPlugin.providedBy(session), True)
00013         source=session.source
00014         self.assertEqual(ISessionSource.providedBy(source), True)

Definition at line 19 of file testPAS.py.

00019 
00020     def testOneLineCookiesOnly(self):
00021         def createIdentifier(self, *args):
00022             return "x"*256
00023 
00024         class MockResponse:
00025             def setCookie(self, name, value, path):
00026                 self.cookie=value
00027 
00028         response=MockResponse()
00029         session=self.folder.pas.session
00030 
00031         klass=session.source.__class__
00032         org=klass.createIdentifier
00033         klass.createIdentifier=createIdentifier
00034 
00035         session.setupSession(None, response)
00036 
00037         klass.createIdentifier=org
00038         self.assertEqual(len(response.cookie.split()), 1)
00039         


Member Data Documentation

Definition at line 25 of file testPAS.py.


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