Ignore:
Timestamp:
22 Mar 2013, 06:28:08 (12 years ago)
Author:
Henrik Bettermann
Message:

Add one more webservice method.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_webservices.py

    r10042 r10043  
    1010from waeup.kofa.interfaces import IExtFileStore, IFileStoreNameChooser
    1111from waeup.kofa.testing import FunctionalLayer, FunctionalTestCase
     12from waeup.kofa.students.payments import StudentOnlinePayment
    1213from waeup.kofa.students.tests.test_browser import StudentsFullSetup
    1314from waeup.kofa.students.studylevel import StudentStudyLevel, CourseTicket
     
    268269        xmlout = self.XMLRPC_post(REQUEST_XML)
    269270        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
Note: See TracChangeset for help on using the changeset viewer.