summaryrefslogtreecommitdiff
path: root/src/leap/crypto/tests
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap/crypto/tests')
-rwxr-xr-xsrc/leap/crypto/tests/fake_provider.py29
-rw-r--r--src/leap/crypto/tests/test.txt1
-rw-r--r--src/leap/crypto/tests/test_srpregister.py2
3 files changed, 29 insertions, 3 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):
"""
diff --git a/src/leap/crypto/tests/test.txt b/src/leap/crypto/tests/test.txt
deleted file mode 100644
index d6406617..00000000
--- a/src/leap/crypto/tests/test.txt
+++ /dev/null
@@ -1 +0,0 @@
-OK!
diff --git a/src/leap/crypto/tests/test_srpregister.py b/src/leap/crypto/tests/test_srpregister.py
index a59f71cb..5ba7306f 100644
--- a/src/leap/crypto/tests/test_srpregister.py
+++ b/src/leap/crypto/tests/test_srpregister.py
@@ -20,7 +20,7 @@ Tests for:
* leap/crypto/srpauth.py
"""
try:
- import unittest
+ import unittest2 as unittest
except ImportError:
import unittest
import os