Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes
plone.openid.tests.testExtraction.TestOpenIdExtraction Class Reference
Inheritance diagram for plone.openid.tests.testExtraction.TestOpenIdExtraction:
Inheritance graph
[legend]
Collaboration diagram for plone.openid.tests.testExtraction.TestOpenIdExtraction:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def testEmptyExtraction
def testEmptyStringIdentityExtraction
def testRedirect
def testPositiveOpenIdResponse
def testNegativeOpenIdResponse
def testFormRedirectPriorities
def afterSetUp

Static Public Attributes

 layer = PloneOpenId
string identity = "http://plone.myopenid.com"
dictionary server_response

Detailed Description

Definition at line 5 of file testExtraction.py.


Member Function Documentation

Reimplemented from plone.session.tests.sessioncase.PloneSessionTestCase.

Definition at line 29 of file oitestcase.py.

00029 
00030     def afterSetUp(self):
00031         PloneSessionTestCase.afterSetUp(self)
00032         self.app.folder = self.folder
00033 
00034         if self.folder.pas.hasObject("openid"):
00035             self.app.folder.pas._delObject("openid")
00036 
00037         self.app.folder.pas._setObject("openid", OpenIdPlugin("openid"))

Here is the call graph for this function:

Test if we do not invent credentials out of thin air.

Definition at line 7 of file testExtraction.py.

00007 
00008     def testEmptyExtraction(self):
00009         """Test if we do not invent credentials out of thin air.
00010         """
00011         creds=self.folder.pas.openid.extractCredentials(self.app.REQUEST)
00012         self.assertEqual(creds, {})

Test coverage for bug #7176. In the case where "" (i.e an empty
   string) is passed in as the identity via the request, 
   we essentially want to ensure that a Redirect isn't raised, which 
   would signify that an IOpenIdExtractionPlugin challenge was initialized.
   
   This test demonstrates our openid plugin's extractCredentials eliminates
   credentials that aren't in the openid.* namespace.

Definition at line 13 of file testExtraction.py.

00013 
00014     def testEmptyStringIdentityExtraction(self):
00015         """Test coverage for bug #7176. In the case where "" (i.e an empty
00016            string) is passed in as the identity via the request, 
00017            we essentially want to ensure that a Redirect isn't raised, which 
00018            would signify that an IOpenIdExtractionPlugin challenge was initialized.
00019            
00020            This test demonstrates our openid plugin's extractCredentials eliminates
00021            credentials that aren't in the openid.* namespace.
00022         """
00023         self.app.REQUEST.form.update(self.server_response)
00024         self.app.REQUEST.form["__ac_identity_url"]=""
00025         creds=self.folder.pas.openid.extractCredentials(self.app.REQUEST)
00026         self.failIf(creds.has_key("__ac_identity_url"))
00027         

Check if a new login identity has preference over openid server
reponse.

Definition at line 57 of file testExtraction.py.

00057 
00058     def testFormRedirectPriorities(self):
00059         """Check if a new login identity has preference over openid server
00060         reponse.
00061         """
00062         self.app.REQUEST.form.update(self.server_response)
00063         self.app.REQUEST.form["__ac_identity_url"]=self.identity
00064         self.assertRaises(Redirect,
00065                 self.folder.pas.openid.extractCredentials,
00066                 self.app.REQUEST)
00067 

Check if a cancelled authentication request is correctly ignored.

Definition at line 48 of file testExtraction.py.

00048 
00049     def testNegativeOpenIdResponse(self):
00050         """Check if a cancelled authentication request is correctly ignored.
00051         """
00052         self.app.REQUEST.form.update(self.server_response)
00053         self.app.REQUEST.form["openid.mode"]="cancel"
00054         creds=self.folder.pas.openid.extractCredentials(self.app.REQUEST)
00055         self.assertEqual(creds, {})
00056 

Test if a positive authentication is extracted.

Definition at line 38 of file testExtraction.py.

00038 
00039     def testPositiveOpenIdResponse(self):
00040         """Test if a positive authentication is extracted.
00041         """
00042         self.app.REQUEST.form.update(self.server_response)
00043         creds=self.folder.pas.openid.extractCredentials(self.app.REQUEST)
00044         self.assertEqual(creds["openid.identity"], self.identity)
00045         self.assertEqual(creds["openid.mode"], "id_res")
00046         self.assertEqual(creds["openid.return_to"], "return_to")
00047 

Test if a redirect is generated for a login attempt.
This test requires a working internet connection!

Definition at line 28 of file testExtraction.py.

00028 
00029     def testRedirect(self):
00030         """Test if a redirect is generated for a login attempt.
00031         This test requires a working internet connection!
00032         """
00033         self.app.REQUEST.form["__ac_identity_url"]=self.identity
00034         self.assertRaises(Redirect,
00035                 self.folder.pas.openid.extractCredentials,
00036                 self.app.REQUEST)
00037 


Member Data Documentation

string plone.openid.tests.oitestcase.OpenIdTestCase.identity = "http://plone.myopenid.com" [static, inherited]

Definition at line 17 of file oitestcase.py.

plone.openid.tests.oitestcase.OpenIdTestCase.layer = PloneOpenId [static, inherited]

Reimplemented from plone.session.tests.sessioncase.PloneSessionTestCase.

Definition at line 15 of file oitestcase.py.

Initial value:
{
            "openid.mode"              : "id_res",
            "nonce"                    : "nonce",
            "openid.identity"          : "http://plone.myopenid.com",
            "openid.assoc_handle"      : "assoc_handle",
            "openid.return_to"         : "return_to",
            "openid.signed"            : "signed",
            "openid.sig"               : "sig",
            "openid.invalidate_handle" : "invalidate_handle",
            }

Definition at line 18 of file oitestcase.py.


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