Ignore:
Timestamp:
26 Aug 2013, 13:04:51 (11 years ago)
Author:
uli
Message:

pep8.

File:
1 edited

Legend:

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

    r10526 r10535  
    1 3# Tests for waeup.cas.authentictors
     1# Tests for waeup.cas.authentictors
    22import os
    33import threading
     
    8888        url='http://localhost:6666/',
    8989        marker='^SCHOOL1-',
    90         moodle_url = 'http://localhost:7777/',
     90        moodle_url='http://localhost:7777/',
    9191        )
    9292    )
     93
    9394
    9495class KofaAuthenticatorTests(unittest.TestCase):
     
    132133        assert app.db_connection_string == 'sqlite:///:memory:'
    133134        assert isinstance(app.auth, KofaAuthenticator)
     135
    134136
    135137class KofaMoodleAuthenticatorTests(unittest.TestCase):
     
    148150            {'url': 'http://xmlrpcuser1:xmlrpcuser1@localhost:8080/app1/',
    149151             'marker': '^K',
    150              'moodle_url': 'http://localhost/moodle/webservice/xmlrpc/server.php?wstoken=de1e1cbacf91ec6290bb6f6339122e7d',
     152             'moodle_url': ('http://localhost/moodle/webservice/xmlrpc'
     153                            '/server.php?wstoken=de1e1cbacf91ec6290bb6'
     154                            'f6339122e7d'),
    151155            },
    152156          }
     
    214218                        )
    215219
     220
    216221class FakeMoodleServer(SimpleXMLRPCServer):
    217222    # A fake Moodle server that provides only XMLRPC methods
     
    242247            raise xmlrpclib.Fault('faultCode', 'core_user_get_users failed')
    243248        if arg[0]['value'] == 'SCHOOL1-fault3':
    244             return {'users':[{'id':'SCHOOL1-fault3'}]}
     249            return {'users': [{'id': 'SCHOOL1-fault3'}]}
    245250        if arg[0]['value'] in ('SCHOOL1-fault4', 'SCHOOL1-fault5'):
    246             return {'users':[{'id': 123}]}
     251            return {'users': [{'id': 123}]}
    247252        return {'users': []}
    248253
     
    252257            raise xmlrpclib.Fault('faultCode', 'core_user_update_users failed')
    253258        return None
     259
    254260
    255261class KofaAuthenticatorsIntegrationTests(unittest.TestCase):
     
    271277        # set up a fake moodle server
    272278        cls.moodle_server = FakeMoodleServer(('localhost', 7777))
    273         cls.moodle_th = threading.Thread(target=cls.moodle_server.serve_forever)
     279        cls.moodle_th = threading.Thread(
     280            target=cls.moodle_server.serve_forever)
    274281        cls.moodle_th.daemon = True
    275282        cls.moodle_th.start()
     
    319326        result = proxy.core_user_create_users(
    320327            [{'username': 'any name'}])
    321         assert result ==  [{'id': 37, 'username': 'any name'}]
     328        assert result == [{'id': 37, 'username': 'any name'}]
    322329        self.assertRaises(
    323330            xmlrpclib.Fault, proxy.core_user_create_users,
     
    354361        result1s = auth.check_credentials('SCHOOL1-bird', 'bebop')
    355362        assert result1s == (True, '')
    356         result1a  = auth.check_credentials('SCHOOL1-pig', 'pog')
     363        result1a = auth.check_credentials('SCHOOL1-pig', 'pog')
    357364        assert result1a == (True, '')
    358365        # user does not exist
Note: See TracChangeset for help on using the changeset viewer.