Changeset 10043 for main/waeup.kofa/trunk
- Timestamp:
- 22 Mar 2013, 06:28:08 (12 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
r10042 r10043 10 10 from waeup.kofa.interfaces import IExtFileStore, IFileStoreNameChooser 11 11 from waeup.kofa.testing import FunctionalLayer, FunctionalTestCase 12 from waeup.kofa.students.payments import StudentOnlinePayment 12 13 from waeup.kofa.students.tests.test_browser import StudentsFullSetup 13 14 from waeup.kofa.students.studylevel import StudentStudyLevel, CourseTicket … … 268 269 xmlout = self.XMLRPC_post(REQUEST_XML) 269 270 self.assertTrue(xmlout.startswith(RESPONSE_XML)) 271 272 def test_get_paid_sessions(self): 273 server = ServerProxy('http://mgr:mgrpw@localhost/app') 274 self.setup_student(self.student) 275 payment = StudentOnlinePayment() 276 payment.p_id = 'my-id' 277 payment.p_session = 2009 278 payment.amount_auth = 12.12 279 payment.p_state = u'paid' 280 self.student['payments']['my-payment'] = payment 281 result = server.get_paid_sessions('123') 282 self.assertEqual(result, {'2009': 12.12}) 283 REQUEST_XML="""\ 284 <?xml version="1.0"?> 285 <methodCall> 286 <methodName>get_paid_sessions</methodName> 287 <params> 288 <param> 289 <value><string>K1000000</string></value> 290 </param> 291 </params> 292 </methodCall>""" 293 RESPONSE_XML="""\ 294 <?xml version='1.0'?> 295 <methodResponse> 296 <params> 297 <param> 298 <value><struct> 299 <member> 300 <name>2009</name> 301 <value><double>12.12</double></value> 302 </member> 303 </struct></value> 304 </param> 305 </params> 306 </methodResponse> 307 """ 308 xmlout = self.XMLRPC_post(REQUEST_XML) 309 self.assertEqual(xmlout, RESPONSE_XML) 310 return -
main/waeup.kofa/trunk/src/waeup/kofa/students/webservices.py
r10042 r10043 80 80 @grok.require('waeup.xmlrpc') 81 81 def get_courses_by_session(self, identifier=None, session=None): 82 """ What COURSES are registered by student X in session Y?82 """1. What COURSES are registered by student X in session Y? 83 83 84 84 """ … … 108 108 @grok.require('waeup.xmlrpc') 109 109 def get_students_by_course(self, course=None, session=None): 110 """ What STUDENTS registered (student id / matric no)110 """2. What STUDENTS registered (student id / matric no) 111 111 for course Z in session Y? 112 112 113 (a) Authorized by course adviser.114 (b) Not authorized by course adviser.115 113 """ 116 114 try: … … 141 139 @grok.require('waeup.xmlrpc') 142 140 def get_student_info(self, identifier=None): 143 """ Who is the student with matriculation number / student id?141 """3a. Who is the student with matriculation number / student id 144 142 145 143 """ … … 153 151 @grok.require('waeup.xmlrpc') 154 152 def get_student_passport(self, identifier=None): 155 """ Get passport picture of student with156 matriculation number / student id ?153 """3b. Get passport picture of student with 154 matriculation number / student id. 157 155 158 156 """ … … 164 162 student, attr='passport.jpg') 165 163 return xmlrpclib.Binary(img.read()) 164 165 @grok.require('waeup.xmlrpc') 166 def get_paid_sessions(self, identifier=None): 167 """6. Get list of SESSIONS school fees paid by student X. 168 169 """ 170 students = self.context['students'] 171 student = get_student(students, identifier) 172 if student is None: 173 return None 174 payments_dict = {} 175 for ticket in student['payments'].values(): 176 if ticket.p_state == 'paid' and \ 177 ticket.p_category == 'schoolfee': 178 payments_dict[str(ticket.p_session)] = ticket.amount_auth 179 if not payments_dict: 180 return None 181 return payments_dict
Note: See TracChangeset for help on using the changeset viewer.