Changeset 10508 for main/waeup.kofa/trunk/src/waeup/kofa/students
- Timestamp:
- 19 Aug 2013, 08:06:37 (11 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_webservices.py
r10505 r10508 331 331 ) 332 332 return 333 334 def test_get_moodle_data(self): 335 server = ServerProxy('http://mgr:mgrpw@localhost/app') 336 self.setup_student(self.student) 337 result = server.get_moodle_data(self.student.student_id) 338 self.assertEqual(result, 339 {'lastname': 'Tester', 'email': 'aa@aa.ng', 'firstname': 'Anna'}) 340 REQUEST_XML = """\ 341 <?xml version="1.0"?> 342 <methodCall> 343 <methodName>get_moodle_data</methodName> 344 <params> 345 <param> 346 <value><string>K1000000</string></value> 347 </param> 348 </params> 349 </methodCall>""" 350 RESPONSE_XML = """\ 351 <?xml version='1.0'?> 352 <methodResponse> 353 <params> 354 <param> 355 <value><struct> 356 <member> 357 <name>lastname</name> 358 <value><string>Tester</string></value> 359 </member> 360 <member> 361 <name>email</name> 362 <value><string>aa@aa.ng</string></value> 363 </member> 364 <member> 365 <name>firstname</name> 366 <value><string>Anna</string></value> 367 </member> 368 </struct></value> 369 </param> 370 </params> 371 </methodResponse> 372 """ 373 xmlout = self.XMLRPC_post(REQUEST_XML) 374 self.assertEqual(xmlout, RESPONSE_XML) 375 return -
main/waeup.kofa/trunk/src/waeup/kofa/students/webservices.py
r10505 r10508 213 213 type=principal.user_type, 214 214 description=principal.description) 215 216 @grok.require('waeup.xmlrpc') 217 def get_moodle_data(self, identifier=None): 218 """Data which will be used for web service requests to Moodle. 219 220 """ 221 students = self.context['students'] 222 student = get_student(students, identifier) 223 if student is None: 224 return None 225 return dict(email=student.email, 226 firstname=student.firstname, 227 lastname=student.lastname, 228 )
Note: See TracChangeset for help on using the changeset viewer.