- Timestamp:
- 20 Aug 2013, 13:25:54 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.cas/trunk/waeup/cas/tests/test_authenticators.py
r10512 r10513 214 214 self._core_user_update_users, 'core_user_update_users') 215 215 216 def _core_user_create_users(self, list_of_dicts):216 def _core_user_create_users(self, arg): 217 217 # fake Moodle core_user_create_users method. 218 if arg[0]['username'] == 'fault': 219 raise xmlrpclib.Fault('faultCode', 'faultString') 218 220 return None 219 221 220 def _core_user_get_users(self, list_of_dicts):222 def _core_user_get_users(self, arg): 221 223 # fake Moodle core_user_get_users method. 224 if arg[0]['value'] == 'fault': 225 raise xmlrpclib.Fault('faultCode', 'faultString') 222 226 return {'users':[{'id':'any id'}]} 223 227 224 def _core_user_update_users(self, list_of_dicts):228 def _core_user_update_users(self, arg): 225 229 # fake Moodle core_user_update_users method. 230 if arg[0]['id'] == 'fail': 231 raise xmlrpclib.Fault('faultCode', 'faultString') 226 232 return None 227 233 … … 280 286 return 281 287 282 def test_ moodle_works(self):288 def test_fake_moodle_works(self): 283 289 # make sure the local fake moodle works 284 290 proxy = xmlrpclib.ServerProxy("http://localhost:7777", allow_none=True) 285 result = proxy.core_user_create_users([]) 291 # test core_user_create_users 292 result = proxy.core_user_create_users( 293 [{'username': 'any name'}]) 286 294 assert result == None 287 result = proxy.core_user_get_users([]) 295 self.assertRaises( 296 xmlrpclib.Fault, proxy.core_user_create_users, 297 [{'username': 'fault'}]) 298 # test core_user_get_users 299 result = proxy.core_user_get_users( 300 [{'key': 'username', 'value': 'any name'}]) 288 301 assert result == {'users':[{'id':'any id'}]} 289 result = proxy.core_user_update_users([]) 302 self.assertRaises( 303 xmlrpclib.Fault, proxy.core_user_get_users, 304 [{'key': 'username', 'value': 'fault'}]) 305 # test core_user_update_users 306 result = proxy.core_user_update_users( 307 [{'id': 'any id'}]) 290 308 assert result == None 309 self.assertRaises( 310 xmlrpclib.Fault, proxy.core_user_update_users, 311 [{'id': 'fail'}]) 291 312 return 292 313
Note: See TracChangeset for help on using the changeset viewer.