Changeset 10502 for main/waeup.kofa/trunk
- Timestamp:
- 16 Aug 2013, 17:05:17 (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
r10501 r10502 4 4 from cStringIO import StringIO 5 5 from zope.app.testing.xmlrpc import ServerProxy 6 from zope.component import createObject, getUtility 7 from zope.component.hooks import setSite 8 from zope.testbrowser.testing import Browser 9 from waeup.kofa.app import University 6 from zope.component import getUtility 10 7 from waeup.kofa.interfaces import IExtFileStore, IFileStoreNameChooser 11 from waeup.kofa.testing import FunctionalLayer , FunctionalTestCase8 from waeup.kofa.testing import FunctionalLayer 12 9 from waeup.kofa.students.payments import StudentOnlinePayment 13 10 from waeup.kofa.students.tests.test_browser import StudentsFullSetup 14 11 from waeup.kofa.students.studylevel import StudentStudyLevel, CourseTicket 12 15 13 16 14 class XMLRPCTests(StudentsFullSetup): … … 69 67 self.assertEqual(result, 'K1000000') 70 68 self.assertEqual(self.student_id, result) 71 REQUEST_XML ="""\69 REQUEST_XML = """\ 72 70 <?xml version="1.0"?> 73 71 <methodCall> … … 79 77 </params> 80 78 </methodCall>""" 81 RESPONSE_XML ="""\79 RESPONSE_XML = """\ 82 80 <?xml version='1.0'?> 83 81 <methodResponse> … … 132 130 result = server.get_courses_by_session('Nonsense') 133 131 self.assertEqual(result, None) 134 REQUEST_XML ="""\132 REQUEST_XML = """\ 135 133 <?xml version="1.0"?> 136 134 <methodCall> … … 142 140 </params> 143 141 </methodCall>""" 144 RESPONSE_XML ="""\142 RESPONSE_XML = """\ 145 143 <?xml version='1.0'?> 146 144 <methodResponse> … … 171 169 self.assertEqual(result, None) 172 170 result = server.get_students_by_course('CRS1', '2012') 173 self.assertEqual(result, [['K1000000', '234', 'my adviser', 0], ])171 self.assertEqual(result, [['K1000000', '234', 'my adviser', 0], ]) 174 172 result = server.get_students_by_course('CRS1') 175 self.assertEqual(result, [['K1000000', '234', 'my adviser', 0], ])173 self.assertEqual(result, [['K1000000', '234', 'my adviser', 0], ]) 176 174 payment = StudentOnlinePayment() 177 175 payment.p_id = 'my-id' … … 181 179 self.student['payments']['my-payment'] = payment 182 180 result = server.get_students_by_course('CRS1') 183 self.assertEqual(result, [['K1000000', '234', 'my adviser', 12.12], ])184 REQUEST_XML ="""\181 self.assertEqual(result, [['K1000000', '234', 'my adviser', 12.12], ]) 182 REQUEST_XML = """\ 185 183 <?xml version="1.0"?> 186 184 <methodCall> … … 193 191 </params> 194 192 </methodCall>""" 195 RESPONSE_XML ="""\193 RESPONSE_XML = """\ 196 194 <?xml version='1.0'?> 197 195 <methodResponse> … … 220 218 self.assertEqual(result, 221 219 ['Anna Tester', 'CERT1', '1234', 'aa@aa.ng']) 222 REQUEST_XML ="""\220 REQUEST_XML = """\ 223 221 <?xml version="1.0"?> 224 222 <methodCall> … … 230 228 </params> 231 229 </methodCall>""" 232 RESPONSE_XML ="""\230 RESPONSE_XML = """\ 233 231 <?xml version='1.0'?> 234 232 <methodResponse> … … 258 256 binary = img.read() 259 257 self.assertEqual(binary, result) 260 REQUEST_XML ="""\258 REQUEST_XML = """\ 261 259 <?xml version="1.0"?> 262 260 <methodCall> … … 268 266 </params> 269 267 </methodCall>""" 270 RESPONSE_XML ="""\268 RESPONSE_XML = """\ 271 269 <?xml version='1.0'?> 272 270 <methodResponse> … … 290 288 result = server.get_paid_sessions('123') 291 289 self.assertEqual(result, {'2009': 12.12}) 292 REQUEST_XML ="""\290 REQUEST_XML = """\ 293 291 <?xml version="1.0"?> 294 292 <methodCall> … … 300 298 </params> 301 299 </methodCall>""" 302 RESPONSE_XML ="""\300 RESPONSE_XML = """\ 303 301 <?xml version='1.0'?> 304 302 <methodResponse> -
main/waeup.kofa/trunk/src/waeup/kofa/students/webservices.py
r10489 r10502 16 16 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 17 ## 18 19 18 import grok 20 19 import xmlrpclib … … 22 21 from zope.catalog.interfaces import ICatalog 23 22 from waeup.kofa.interfaces import IUniversity, IExtFileStore 24 23 25 24 26 25 def get_student(students, identifier): … … 53 52 # grok.permissions('waeup.xmlrpc',) 54 53 54 55 55 class StudentsXMLRPC(grok.XMLRPC): 56 56 """Student related XMLRPC webservices.
Note: See TracChangeset for help on using the changeset viewer.