Changeset 10521
- Timestamp:
- 21 Aug 2013, 20:52:03 (11 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_webservices.py
r10503 r10521 39 39 self.assertEqual(result, None) 40 40 return 41 42 def test_get_moodle_data(self): 43 # make sure we can get applicant infos providing valid creds 44 server = ServerProxy('http://mgr:mgrpw@localhost/app') 45 self.setup_applicant(self.applicant) 46 apl_id = self.applicant.applicant_id 47 result = server.get_applicant_moodle_data(apl_id) 48 self.assertEqual( 49 result, { 50 'lastname': 'Bubble', 51 'email': 'bob@sample.com', 52 'firstname': 'Bob', 53 } 54 ) 55 return 56 -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/webservices.py
r10504 r10521 17 17 ## 18 18 import grok 19 from hurry.query.query import Query 20 from hurry.query import Eq 19 21 from zope.component import getUtility 20 22 from zope.pluggableauth.interfaces import IAuthenticatorPlugin … … 52 54 type=principal.user_type, 53 55 description=principal.description) 56 57 @grok.require('waeup.xmlrpc') 58 def get_applicant_moodle_data(self, identifier=None): 59 """Returns applicant data to update user data and enroll user 60 in Moodle courses. 61 62 """ 63 results = Query().searchResults( 64 Eq(('applicants_catalog', 'applicant_id'), identifier)) 65 if not results: 66 return None 67 applicant = list(results)[0] 68 return dict(email=applicant.email, 69 firstname=applicant.firstname, 70 lastname=applicant.lastname, 71 ) -
main/waeup.kofa/trunk/src/waeup/kofa/students/webservices.py
r10516 r10521 216 216 @grok.require('waeup.xmlrpc') 217 217 def get_student_moodle_data(self, identifier=None): 218 """Data which will be used for web service requests to Moodle. 218 """Returns student data to update user data and enroll user 219 in Moodle courses. 219 220 220 221 """
Note: See TracChangeset for help on using the changeset viewer.