summaryrefslogtreecommitdiff
path: root/src/leap/crypto/tests/fake_provider.py
diff options
context:
space:
mode:
authorkali <kali@leap.se>2013-04-08 23:44:22 +0900
committerkali <kali@leap.se>2013-04-08 23:44:22 +0900
commit42593d4c6bda51a544a72abc0f935633939dad49 (patch)
tree54e592870377d6a69929c2b7b6c7ac51fca3f7e0 /src/leap/crypto/tests/fake_provider.py
parent05fe7f44a899288a8a69b9a46793513b87f8d228 (diff)
Several fixes as per review
Diffstat (limited to 'src/leap/crypto/tests/fake_provider.py')
-rwxr-xr-xsrc/leap/crypto/tests/fake_provider.py29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/leap/crypto/tests/fake_provider.py b/src/leap/crypto/tests/fake_provider.py
index d3e05812..d533b82b 100755
--- a/src/leap/crypto/tests/fake_provider.py
+++ b/src/leap/crypto/tests/fake_provider.py
@@ -78,6 +78,9 @@ safe_unhexlify = lambda x: binascii.unhexlify(x) \
class IUser(Interface):
+ """
+ Defines the User Interface
+ """
login = Attribute("User login.")
salt = Attribute("Password salt.")
verifier = Attribute("Password verifier.")
@@ -86,6 +89,10 @@ class IUser(Interface):
class User(object):
+ """
+ User object.
+ We store it in our simple session mocks
+ """
implements(IUser)
@@ -94,20 +101,37 @@ class User(object):
self.salt = salt
self.verifier = verifier
self.session = None
+ self.svr = None
def set_server_verifier(self, svr):
+ """
+ Adds a svr verifier object to this
+ User instance
+ """
self.svr = svr
def set_session(self, session):
+ """
+ Adds this instance of User to the
+ global session dict
+ """
_SESSIONDB[session] = self
self.session = session
class FakeUsers(Resource):
+ """
+ Resource that handles user registration.
+ """
+
def __init__(self, name):
self.name = name
def render_POST(self, request):
+ """
+ Handles POST to the users api resource
+ Simulates a login.
+ """
args = request.args
login = args['user[login]'][0]
@@ -268,11 +292,14 @@ class FakeSession(Resource):
class API_Sessions(Resource):
+ """
+ Top resource for the API v1
+ """
def getChild(self, name, request):
return FakeSession(name)
-class OpenSSLServerContextFactory:
+class OpenSSLServerContextFactory(object):
def getContext(self):
"""