Changeset 17856 for main/waeup.kofa/trunk/src
- Timestamp:
- 19 Jul 2024, 18:16:04 (4 months 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
r17847 r17856 654 654 {'entry_mode': None, 'reg_number': '123', 'display_item': None, 655 655 'firstname': 'Anna', 'payment_date': 'None#', 656 'p_combi': [], 656 657 'middlename': None, 'student_id': 'K1000000', 'p_id': 657 658 'my-id1', 'certcode': 'CERT1', 'entry_session': 2004, 658 659 'creation_date': str('%s#' % to_timezone(payment1.creation_date, tz)), 660 'p_level': None, 659 661 'state': 'created', 'current_session': 2004, 660 662 'faccode': 'fac1', 'lastname': 'Tester', … … 664 666 {'entry_mode': None, 'reg_number': '123', 'display_item': None, 665 667 'firstname': 'Anna', 'payment_date': 'None#', 668 'p_combi': [], 666 669 'middlename': None, 'student_id': 'K1000000', 667 670 'p_id': 'my-id2', 'certcode': 'CERT1', 'entry_session': 2004, 668 671 'creation_date': str('%s#' % to_timezone(payment2.creation_date, tz)), 672 'p_level': None, 669 673 'state': 'created', 'current_session': 2004, 'faccode': 'fac1', 670 674 'lastname': 'Tester', 'p_category': 'clearance', … … 700 704 <value><nil/></value></member> 701 705 <member> 706 <name>creation_date</name> 707 <value><string>%s</string></value> 708 </member> 709 <member> 710 <name>p_level</name> 711 <value><nil/></value></member> 712 <member> 713 <name>p_category</name> 714 <value><string>schoolfee</string></value> 715 </member> 716 <member> 717 <name>amount_auth</name> 718 <value><double>12.12</double></value> 719 </member> 720 <member> 702 721 <name>reg_number</name> 703 722 <value><string>123</string></value> 704 723 </member> 705 724 <member> 725 <name>payment_date</name> 726 <value><string>None#</string></value> 727 </member> 728 <member> 729 <name>p_combi</name> 730 <value><array><data> 731 </data></array></value> 732 </member> 733 <member> 734 <name>student_id</name> 735 <value><string>K1000000</string></value> 736 </member> 737 <member> 738 <name>entry_session</name> 739 <value><int>2004</int></value> 740 </member> 741 <member> 742 <name>state</name> 743 <value><string>created</string></value> 744 </member> 745 <member> 746 <name>p_session</name> 747 <value><int>2012</int></value> 748 </member> 749 <member> 750 <name>matric_number</name> 751 <value><string>234</string></value> 752 </member> 753 <member> 754 <name>firstname</name> 755 <value><string>Anna</string></value> 756 </member> 757 <member> 758 <name>middlename</name> 759 <value><nil/></value></member> 760 <member> 761 <name>lastname</name> 762 <value><string>Tester</string></value> 763 </member> 764 <member> 765 <name>certcode</name> 766 <value><string>CERT1</string></value> 767 </member> 768 <member> 769 <name>depcode</name> 770 <value><string>dep1</string></value> 771 </member> 772 <member> 706 773 <name>display_item</name> 707 774 <value><nil/></value></member> 708 775 <member> 776 <name>p_id</name> 777 <value><string>my-id1</string></value> 778 </member> 779 <member> 780 <name>faccode</name> 781 <value><string>fac1</string></value> 782 </member> 783 <member> 784 <name>current_session</name> 785 <value><int>2004</int></value> 786 </member> 787 <member> 788 <name>p_state</name> 789 <value><string>paid</string></value> 790 </member> 791 </struct></value> 792 <value><struct> 793 <member> 794 <name>entry_mode</name> 795 <value><nil/></value></member> 796 <member> 797 <name>creation_date</name> 798 <value><string>%s</string></value> 799 </member> 800 <member> 801 <name>p_level</name> 802 <value><nil/></value></member> 803 <member> 804 <name>p_category</name> 805 <value><string>clearance</string></value> 806 </member> 807 <member> 808 <name>amount_auth</name> 809 <value><double>12.12</double></value> 810 </member> 811 <member> 812 <name>reg_number</name> 813 <value><string>123</string></value> 814 </member> 815 <member> 816 <name>payment_date</name> 817 <value><string>None#</string></value> 818 </member> 819 <member> 820 <name>p_combi</name> 821 <value><array><data> 822 </data></array></value> 823 </member> 824 <member> 825 <name>student_id</name> 826 <value><string>K1000000</string></value> 827 </member> 828 <member> 829 <name>entry_session</name> 830 <value><int>2004</int></value> 831 </member> 832 <member> 833 <name>state</name> 834 <value><string>created</string></value> 835 </member> 836 <member> 837 <name>p_session</name> 838 <value><int>2012</int></value> 839 </member> 840 <member> 841 <name>matric_number</name> 842 <value><string>234</string></value> 843 </member> 844 <member> 709 845 <name>firstname</name> 710 846 <value><string>Anna</string></value> 711 847 </member> 712 848 <member> 713 <name>payment_date</name>714 <value><string>None#</string></value>715 </member>716 <member>717 849 <name>middlename</name> 718 850 <value><nil/></value></member> 719 851 <member> 720 <name>student_id</name> 721 <value><string>K1000000</string></value> 722 </member> 723 <member> 724 <name>p_id</name> 725 <value><string>my-id1</string></value> 852 <name>lastname</name> 853 <value><string>Tester</string></value> 726 854 </member> 727 855 <member> … … 730 858 </member> 731 859 <member> 732 <name>creation_date</name> 733 <value><string>%s</string></value> 734 </member> 735 <member> 736 <name>matric_number</name> 737 <value><string>234</string></value> 738 </member> 739 <member> 740 <name>state</name> 741 <value><string>created</string></value> 742 </member> 743 <member> 744 <name>lastname</name> 745 <value><string>Tester</string></value> 860 <name>depcode</name> 861 <value><string>dep1</string></value> 862 </member> 863 <member> 864 <name>display_item</name> 865 <value><nil/></value></member> 866 <member> 867 <name>p_id</name> 868 <value><string>my-id2</string></value> 869 </member> 870 <member> 871 <name>faccode</name> 872 <value><string>fac1</string></value> 746 873 </member> 747 874 <member> … … 750 877 </member> 751 878 <member> 752 <name>faccode</name>753 <value><string>fac1</string></value>754 </member>755 <member>756 <name>entry_session</name>757 <value><int>2004</int></value>758 </member>759 <member>760 <name>p_category</name>761 <value><string>schoolfee</string></value>762 </member>763 <member>764 <name>amount_auth</name>765 <value><double>12.12</double></value>766 </member>767 <member>768 <name>p_session</name>769 <value><int>2012</int></value>770 </member>771 <member>772 879 <name>p_state</name> 773 880 <value><string>paid</string></value> 774 </member>775 <member>776 <name>depcode</name>777 <value><string>dep1</string></value>778 </member>779 </struct></value>780 <value><struct>781 <member>782 <name>entry_mode</name>783 <value><nil/></value></member>784 <member>785 <name>reg_number</name>786 <value><string>123</string></value>787 </member>788 <member>789 <name>display_item</name>790 <value><nil/></value></member>791 <member>792 <name>firstname</name>793 <value><string>Anna</string></value>794 </member>795 <member>796 <name>payment_date</name>797 <value><string>None#</string></value>798 </member>799 <member>800 <name>middlename</name>801 <value><nil/></value></member>802 <member>803 <name>student_id</name>804 <value><string>K1000000</string></value>805 </member>806 <member>807 <name>p_id</name>808 <value><string>my-id2</string></value>809 </member>810 <member>811 <name>certcode</name>812 <value><string>CERT1</string></value>813 </member>814 <member>815 <name>creation_date</name>816 <value><string>%s</string></value>817 </member>818 <member>819 <name>matric_number</name>820 <value><string>234</string></value>821 </member>822 <member>823 <name>state</name>824 <value><string>created</string></value>825 </member>826 <member>827 <name>lastname</name>828 <value><string>Tester</string></value>829 </member>830 <member>831 <name>current_session</name>832 <value><int>2004</int></value>833 </member>834 <member>835 <name>faccode</name>836 <value><string>fac1</string></value>837 </member>838 <member>839 <name>entry_session</name>840 <value><int>2004</int></value>841 </member>842 <member>843 <name>p_category</name>844 <value><string>clearance</string></value>845 </member>846 <member>847 <name>amount_auth</name>848 <value><double>12.12</double></value>849 </member>850 <member>851 <name>p_session</name>852 <value><int>2012</int></value>853 </member>854 <member>855 <name>p_state</name>856 <value><string>paid</string></value>857 </member>858 <member>859 <name>depcode</name>860 <value><string>dep1</string></value>861 881 </member> 862 882 </struct></value> … … 873 893 return 874 894 875 def test_get_payment(self):876 payment1 = StudentOnlinePayment()877 payment1.p_id = 'my-id1'878 payment1.p_session = 2012879 payment1.amount_auth = 12.12880 payment1.p_state = u'failed'881 payment1.p_category = u'schoolfee'882 payment1.r_company = u'xyz'883 self.student['payments']['my-payment1'] = payment1884 server = ServerProxy('http://mgr:mgrpw@localhost/app', allow_none=True)885 results = server.get_payment()886 self.assertEqual(results, None)887 results = server.get_payment('nonsense')888 self.assertEqual(results, None)889 results = server.get_payment('my-id1')890 self.assertEqual(891 results,892 {'display_item': None,893 'p_id': 'my-id1',894 'p_category': 'schoolfee',895 'amount_auth': 12.12, 'p_session': 2012,896 'p_state': 'failed',897 'r_company': 'xyz',898 'fullname': 'Anna Tester',899 'id': 'K1000000',900 'matric_number': '234'}901 )902 903 REQUEST_XML = """\904 <?xml version="1.0"?>905 <methodCall>906 <methodName>get_payment</methodName>907 <params>908 <param>909 <value><string>my-id1</string></value>910 </param>911 </params>912 </methodCall>"""913 RESPONSE_XML = """\914 <?xml version='1.0'?>915 <methodResponse>895 def test_get_payment(self): 896 payment1 = StudentOnlinePayment() 897 payment1.p_id = 'my-id1' 898 payment1.p_session = 2012 899 payment1.amount_auth = 12.12 900 payment1.p_state = u'failed' 901 payment1.p_category = u'schoolfee' 902 payment1.r_company = u'xyz' 903 self.student['payments']['my-payment1'] = payment1 904 server = ServerProxy('http://mgr:mgrpw@localhost/app', allow_none=True) 905 results = server.get_payment() 906 self.assertEqual(results, None) 907 results = server.get_payment('nonsense') 908 self.assertEqual(results, None) 909 results = server.get_payment('my-id1') 910 self.assertEqual( 911 results, 912 {'display_item': None, 913 'p_id': 'my-id1', 914 'p_category': 'schoolfee', 915 'amount_auth': 12.12, 'p_session': 2012, 916 'p_state': 'failed', 917 'r_company': 'xyz', 918 'fullname': 'Anna Tester', 919 'id': 'K1000000', 920 'matric_number': '234'} 921 ) 922 923 REQUEST_XML = """\ 924 <?xml version="1.0"?> 925 <methodCall> 926 <methodName>get_payment</methodName> 927 <params> 928 <param> 929 <value><string>my-id1</string></value> 930 </param> 931 </params> 932 </methodCall>""" 933 RESPONSE_XML = """\ 934 <?xml version='1.0'?> 935 <methodResponse> 916 936 <params> 917 937 <param> -
main/waeup.kofa/trunk/src/waeup/kofa/students/webservices.py
r17847 r17856 477 477 payment_date=str('%s#' % to_timezone( 478 478 payment.payment_date, tz)), 479 p_level=payment.p_level, 480 p_combi=payment.p_combi, 479 481 ) 480 482 )
Note: See TracChangeset for help on using the changeset viewer.