Changeset 12889 for main/waeup.kofa/trunk/src/waeup/kofa/students/tests
- Timestamp:
- 27 Apr 2015, 08:14:31 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r12854 r12889 929 929 cat = queryUtility(ICatalog, name='payments_catalog') 930 930 results = list(cat.searchResults(p_state=('unpaid', 'unpaid'))) 931 self.assert True(len(results), 1)931 self.assertEqual(len(results), 2) 932 932 self.assertTrue(results[0] is self.student['payments'][value]) 933 934 933 # Managers can approve the payment 934 # If, by some reason, the state has already changed, 935 # an access code is created after approval. 936 IWorkflowState(self.student).setState('school fee paid') 935 937 self.assertEqual(len(self.app['accesscodes']['SFE-0']),0) 936 938 self.browser.open(payment_url) … … 951 953 '"zope.mgr",K1000000,%s,schoolfee,40000.0,AP,,,,,,\n' % value 952 954 in logcontent) 953 954 # The authorized amount has been stored in the access code 955 # The authorized amount has been stored in the new access code 955 956 self.assertEqual( 956 957 self.app['accesscodes']['SFE-0'].values()[0].cost,40000.0) … … 969 970 970 971 # Now the first ticket is paid and no more ticket of same type 971 # (with same p_item, p_session and p_category) can be added 972 # (with same p_item, p_session and p_category) can be added. 973 # First we have to reset the workflow state. 974 IWorkflowState(self.student).setState('cleared') 972 975 self.browser.open(self.payments_path) 973 976 self.browser.getLink("Add current session payment ticket").click() … … 1047 1050 self.assertEqual(ac.owner, self.student_id) 1048 1051 self.assertEqual(ac.cost, 4567.0) 1052 return 1053 1054 def test_manage_payments_bypass_ac_creation(self): 1055 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 1056 self.browser.open(self.payments_path) 1057 IWorkflowState(self.student).setState('cleared') 1058 self.browser.getLink("Add current session payment ticket").click() 1059 self.browser.getControl(name="form.p_category").value = ['schoolfee'] 1060 self.browser.getControl("Create ticket").click() 1061 ctrl = self.browser.getControl(name='val_id') 1062 value = ctrl.options[0] 1063 self.browser.getLink(value).click() 1064 payment_url = self.browser.url 1065 logfile = os.path.join( 1066 self.app['datacenter'].storage, 'logs', 'students.log') 1067 # The ticket can be found in the payments_catalog 1068 cat = queryUtility(ICatalog, name='payments_catalog') 1069 results = list(cat.searchResults(p_state=('unpaid', 'unpaid'))) 1070 self.assertTrue(len(results), 1) 1071 self.assertTrue(results[0] is self.student['payments'][value]) 1072 # Managers can approve the payment 1073 self.browser.open(payment_url) 1074 self.browser.getLink("Approve payment").click() 1075 self.assertMatches('...Payment approved...', 1076 self.browser.contents) 1077 # Approval is logged in students.log ... 1078 logcontent = open(logfile).read() 1079 self.assertTrue( 1080 'zope.mgr - students.browser.OnlinePaymentApprovePage ' 1081 '- K1000000 - schoolfee payment approved' 1082 in logcontent) 1083 # ... and in payments.log 1084 logfile = os.path.join( 1085 self.app['datacenter'].storage, 'logs', 'payments.log') 1086 logcontent = open(logfile).read() 1087 self.assertTrue( 1088 '"zope.mgr",K1000000,%s,schoolfee,40000.0,AP,,,,,,\n' % value 1089 in logcontent) 1090 # Student is in state school fee paid, no activation 1091 # code was necessary. 1092 self.assertEqual(self.student.state, 'school fee paid') 1093 self.assertEqual(len(self.app['accesscodes']['SFE-0']),0) 1049 1094 return 1050 1095 … … 2702 2747 self.browser.contents) 2703 2748 2704 # The new SFE-0 pin can be used for starting new session 2705 self.browser.open(self.studycourse_path) 2706 self.browser.getLink('Start new session').click() 2707 pin = self.app['accesscodes']['SFE-0'].keys()[0] 2708 parts = pin.split('-')[1:] 2709 sfeseries, sfenumber = parts 2710 self.browser.getControl(name="ac_series").value = sfeseries 2711 self.browser.getControl(name="ac_number").value = sfenumber 2712 self.browser.getControl("Start now").click() 2713 self.assertMatches('...Session started...', 2714 self.browser.contents) 2749 ## The new SFE-0 pin can be used for starting new session 2750 #self.browser.open(self.studycourse_path) 2751 #self.browser.getLink('Start new session').click() 2752 #pin = self.app['accesscodes']['SFE-0'].keys()[0] 2753 #parts = pin.split('-')[1:] 2754 #sfeseries, sfenumber = parts 2755 #self.browser.getControl(name="ac_series").value = sfeseries 2756 #self.browser.getControl(name="ac_number").value = sfenumber 2757 #self.browser.getControl("Start now").click() 2758 #self.assertMatches('...Session started...', 2759 # self.browser.contents) 2760 2715 2761 self.assertTrue(self.student.state == 'school fee paid') 2716 2762 return … … 2874 2920 self.browser.contents) 2875 2921 2876 # The new SFE-0 pin can be used for starting session 2877 self.browser.open(self.studycourse_path) 2878 self.browser.getLink('Start new session').click() 2879 pin = self.app['accesscodes']['SFE-0'].keys()[0] 2880 parts = pin.split('-')[1:] 2881 sfeseries, sfenumber = parts 2882 self.browser.getControl(name="ac_series").value = sfeseries 2883 self.browser.getControl(name="ac_number").value = sfenumber 2884 self.browser.getControl("Start now").click() 2885 self.assertMatches('...Session started...', 2886 self.browser.contents) 2922 ## The new SFE-0 pin can be used for starting session 2923 #self.browser.open(self.studycourse_path) 2924 #self.browser.getLink('Start new session').click() 2925 #pin = self.app['accesscodes']['SFE-0'].keys()[0] 2926 #parts = pin.split('-')[1:] 2927 #sfeseries, sfenumber = parts 2928 #self.browser.getControl(name="ac_series").value = sfeseries 2929 #self.browser.getControl(name="ac_number").value = sfenumber 2930 #self.browser.getControl("Start now").click() 2931 #self.assertMatches('...Session started...', 2932 # self.browser.contents) 2933 2887 2934 self.assertTrue(self.student.state == 'school fee paid') 2888 2935
Note: See TracChangeset for help on using the changeset viewer.