Ignore:
Timestamp:
8 Aug 2013, 10:09:00 (11 years ago)
Author:
uli
Message:

Check backend values when initializing Kofa authenticator.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.cas/trunk/waeup/cas/tests/test_authenticators.py

    r10474 r10475  
    6262    inst1 = dict(
    6363        url = 'http://localhost:6666/app',
    64         marker = '^M[0-9]+',
     64        marker = '^M[0-9]+$',
    6565        )
    6666    )
     
    7676        # all options have sensible defaults
    7777        auth = KofaAuthenticator()
    78         assert auth.backends is None
     78        assert auth.backends == {}
    7979
    8080    def test_options(self):
    8181        # we can pass options
    82         auth = KofaAuthenticator(auth_backends=BACKENDS)
     82        auth = KofaAuthenticator(auth_backends=str(BACKENDS))
    8383        assert auth.backends == BACKENDS
     84        auth = KofaAuthenticator(auth_backends='{"foo": {"url": "bar"}}')
     85        assert auth.backends['foo']['marker'] == '.+'
     86        self.assertRaises(
     87            ValueError, KofaAuthenticator, auth_backends='not-a-py-expr')
     88        self.assertRaises(
     89            ValueError, KofaAuthenticator, auth_backends='"Not a dict"')
     90        self.assertRaises(
     91            ValueError, KofaAuthenticator,
     92            auth_backends='{"foo": "not-a-dict"}')
     93        self.assertRaises(
     94            ValueError, KofaAuthenticator,
     95            auth_backends='{"foo": {"no-url-key": "bar"}}')
     96        self.assertRaises(
     97            ValueError, KofaAuthenticator,
     98            auth_backends='{"foo": {"url": "bar", "marker": "inv_re)"}}')
    8499
    85100    def test_paste_deploy_options(self):
Note: See TracChangeset for help on using the changeset viewer.