Changeset 10535 for main/waeup.cas/trunk/waeup/cas/tests
- Timestamp:
- 26 Aug 2013, 13:04:51 (11 years ago)
- 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.authentictors1 # Tests for waeup.cas.authentictors 2 2 import os 3 3 import threading … … 88 88 url='http://localhost:6666/', 89 89 marker='^SCHOOL1-', 90 moodle_url ='http://localhost:7777/',90 moodle_url='http://localhost:7777/', 91 91 ) 92 92 ) 93 93 94 94 95 class KofaAuthenticatorTests(unittest.TestCase): … … 132 133 assert app.db_connection_string == 'sqlite:///:memory:' 133 134 assert isinstance(app.auth, KofaAuthenticator) 135 134 136 135 137 class KofaMoodleAuthenticatorTests(unittest.TestCase): … … 148 150 {'url': 'http://xmlrpcuser1:xmlrpcuser1@localhost:8080/app1/', 149 151 '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'), 151 155 }, 152 156 } … … 214 218 ) 215 219 220 216 221 class FakeMoodleServer(SimpleXMLRPCServer): 217 222 # A fake Moodle server that provides only XMLRPC methods … … 242 247 raise xmlrpclib.Fault('faultCode', 'core_user_get_users failed') 243 248 if arg[0]['value'] == 'SCHOOL1-fault3': 244 return {'users': [{'id':'SCHOOL1-fault3'}]}249 return {'users': [{'id': 'SCHOOL1-fault3'}]} 245 250 if arg[0]['value'] in ('SCHOOL1-fault4', 'SCHOOL1-fault5'): 246 return {'users': [{'id': 123}]}251 return {'users': [{'id': 123}]} 247 252 return {'users': []} 248 253 … … 252 257 raise xmlrpclib.Fault('faultCode', 'core_user_update_users failed') 253 258 return None 259 254 260 255 261 class KofaAuthenticatorsIntegrationTests(unittest.TestCase): … … 271 277 # set up a fake moodle server 272 278 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) 274 281 cls.moodle_th.daemon = True 275 282 cls.moodle_th.start() … … 319 326 result = proxy.core_user_create_users( 320 327 [{'username': 'any name'}]) 321 assert result == 328 assert result == [{'id': 37, 'username': 'any name'}] 322 329 self.assertRaises( 323 330 xmlrpclib.Fault, proxy.core_user_create_users, … … 354 361 result1s = auth.check_credentials('SCHOOL1-bird', 'bebop') 355 362 assert result1s == (True, '') 356 result1a 363 result1a = auth.check_credentials('SCHOOL1-pig', 'pog') 357 364 assert result1a == (True, '') 358 365 # user does not exist
Note: See TracChangeset for help on using the changeset viewer.