Index: /main/waeup.cas/trunk/waeup/cas/tests/test_authenticators.py
===================================================================
--- /main/waeup.cas/trunk/waeup/cas/tests/test_authenticators.py	(revision 10510)
+++ /main/waeup.cas/trunk/waeup/cas/tests/test_authenticators.py	(revision 10511)
@@ -14,5 +14,6 @@
 from waeup.cas.authenticators import (
     get_all_authenticators, get_authenticator, filter_auth_opts,
-    Authenticator, DummyAuthenticator, KofaAuthenticator
+    Authenticator, DummyAuthenticator, KofaAuthenticator,
+    KofaMoodleAuthenticator
     )
 from waeup.cas.server import CASServer
@@ -83,4 +84,11 @@
     )
 
+BACKENDS3 = dict(
+    inst1=dict(
+        url='http://localhost:6666/',
+        marker='^SCHOOL1-',
+        moodle_url = 'http://localhost/moodle',
+        )
+    )
 
 class KofaAuthenticatorTests(unittest.TestCase):
@@ -125,4 +133,24 @@
         assert isinstance(app.auth, KofaAuthenticator)
 
+class KofaMoodleAuthenticatorTests(unittest.TestCase):
+
+    def test_paste_deploy_options(self):
+        # we can set CAS server-related options via paste.deploy config
+        paste_conf = os.path.join(
+            os.path.dirname(__file__), 'sample4.ini')
+        app = loadapp('config:%s' % paste_conf)
+        assert isinstance(app, CASServer)
+        assert app.db_connection_string == 'sqlite:///:memory:'
+        assert isinstance(app.auth, KofaAuthenticator)
+        assert app.auth.name == 'kofa_moodle1'
+        auth_backends = {
+          'kofa_moodle1':
+            {'url': 'http://xmlrpcuser1:xmlrpcuser1@localhost:8080/app1/',
+             'marker': '^K',
+             'moodle_url': 'http://localhost/moodle/webservice/xmlrpc/server.php?wstoken=de1e1cbacf91ec6290bb6f6339122e7d',
+            },
+          }
+        assert app.auth.backends == auth_backends
+
 
 class FakeKofaServer(SimpleXMLRPCServer):
@@ -147,5 +175,10 @@
         if username == 'bird' and password == 'bebop':
             return {'id': 'bird', 'email': 'bird@gods.net',
-                    'description': 'Mr. Charles Parker'}
+                    'description': 'Mr. Charles Parker',
+                    'type': 'student'}
+        if username == 'pig' and password == 'pog':
+            return {'id': 'pig', 'email': 'pig@gods.net',
+                    'description': 'Mr. Ray Charles',
+                    'type': 'applicant'}
         return None
 
@@ -179,10 +212,12 @@
             'description': 'Mr. Charles Parker',
             'email': 'bird@gods.net',
-            'id': 'bird'}
-        result = proxy.check_applicant_credentials('bird', 'bebop')
+            'id': 'bird',
+            'type': 'student'}
+        result = proxy.check_applicant_credentials('pig', 'pog')
         assert result == {
-            'description': 'Mr. Charles Parker',
-            'email': 'bird@gods.net',
-            'id': 'bird'}
+            'description': 'Mr. Ray Charles',
+            'email': 'pig@gods.net',
+            'id': 'pig',
+            'type': 'applicant'}
         return
 
@@ -196,2 +231,3 @@
         result3 = auth.check_credentials('SCHOOL2-bar', 'baz')
         assert result3 == (False, 'Invalid username or password.')
+
