Ignore:
Timestamp:
11 Aug 2020, 09:15:16 (4 years ago)
Author:
Henrik Bettermann
Message:

Implement webservice get_payment.

File:
1 edited

Legend:

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

    r16192 r16193  
    799799                                   )
    800800        self.assertEqual(xmlout, response)
     801        return
     802
     803    def test_get_payment(self):
     804        payment1 = StudentOnlinePayment()
     805        payment1.p_id = 'my-id1'
     806        payment1.p_session = 2012
     807        payment1.amount_auth = 12.12
     808        payment1.p_state = u'failed'
     809        payment1.p_category = u'schoolfee'
     810        payment1.r_company = u'xyz'
     811        self.student['payments']['my-payment1'] = payment1
     812        server = ServerProxy('http://mgr:mgrpw@localhost/app', allow_none=True)
     813        results = server.get_payment()
     814        self.assertEqual(results, None)
     815        results = server.get_payment('nonsense')
     816        self.assertEqual(results, None)
     817        results = server.get_payment('my-id1')
     818        self.assertEqual(
     819            results,
     820                {'display_item': None,
     821                'p_id': 'my-id1',
     822                'p_category': 'schoolfee',
     823                'amount_auth': 12.12, 'p_session': 2012,
     824                'p_state': 'failed',
     825                'r_company': 'xyz',
     826                'fullname': 'Anna Tester',
     827                'id': 'K1000000',
     828                'matric_number': '234'}
     829                )
     830
     831        REQUEST_XML = """\
     832<?xml version="1.0"?>
     833<methodCall>
     834<methodName>get_payment</methodName>
     835<params>
     836<param>
     837<value><string>my-id1</string></value>
     838</param>
     839</params>
     840</methodCall>"""
     841        RESPONSE_XML = """\
     842<?xml version='1.0'?>
     843<methodResponse>
     844<params>
     845<param>
     846<value><struct>
     847<member>
     848<name>display_item</name>
     849<value><nil/></value></member>
     850<member>
     851<name>amount_auth</name>
     852<value><double>12.12</double></value>
     853</member>
     854<member>
     855<name>p_id</name>
     856<value><string>my-id1</string></value>
     857</member>
     858<member>
     859<name>r_company</name>
     860<value><string>xyz</string></value>
     861</member>
     862<member>
     863<name>matric_number</name>
     864<value><string>234</string></value>
     865</member>
     866<member>
     867<name>p_category</name>
     868<value><string>schoolfee</string></value>
     869</member>
     870<member>
     871<name>fullname</name>
     872<value><string>Anna Tester</string></value>
     873</member>
     874<member>
     875<name>p_state</name>
     876<value><string>failed</string></value>
     877</member>
     878<member>
     879<name>p_session</name>
     880<value><int>2012</int></value>
     881</member>
     882<member>
     883<name>id</name>
     884<value><string>K1000000</string></value>
     885</member>
     886</struct></value>
     887</param>
     888</params>
     889</methodResponse>
     890"""
     891        xmlout = self.XMLRPC_post(REQUEST_XML)
     892        self.assertEqual(xmlout, RESPONSE_XML)
    801893        return
    802894
Note: See TracChangeset for help on using the changeset viewer.