Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
plone.openid.tests.consumer.MockConsumer Class Reference

List of all members.

Public Member Functions

def begin
def complete

Public Attributes

 identity

Detailed Description

A mock OpenID consumerclass.

Definition at line 17 of file consumer.py.


Member Function Documentation

def plone.openid.tests.consumer.MockConsumer.begin (   self,
  identity 
)

Definition at line 21 of file consumer.py.

00021 
00022     def begin(self, identity):
00023         self.identity=identity
00024         return MockAuthRequest()

def plone.openid.tests.consumer.MockConsumer.complete (   self,
  credentials,
  current_url 
)

Definition at line 25 of file consumer.py.

00025 
00026     def complete(self, credentials, current_url):
00027         status=SUCCESS
00028         message="authentication completed succesfully"
00029         
00030         if credentials.has_key("openid.identity") and credentials["openid.identity"] == "":
00031             # if the python openid is passed an identity of an empty string
00032             # an IndexError is raised in the depths of its XRI identification
00033             # see: http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=xri
00034 
00035             # an empty string is common when the submit button of the
00036             # openid login is clicked prior to providing an identity url
00037             # we simulate openid's response here in our mock object
00038             message="invalid identity"
00039             status=FAILURE
00040         else:
00041             for field in [ "openid.source", "nonce", "openid.identity",
00042                     "openid.assoc_handle", "openid.return_to", "openid.signed",
00043                     "openid.sig", "openid.invalidate_handle", "openid.mode"]:
00044                 if field not in credentials:
00045                     message="field missing"
00046                     status=FAILURE
00047                 
00048 
00049         return MockAuthRequest(status=status,
00050                                 message=message,
00051                                 identity_url=credentials["openid.identity"])


Member Data Documentation

Definition at line 22 of file consumer.py.


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