Changeset 12091 for main/waeup.ikoba/trunk
- Timestamp:
- 29 Nov 2014, 12:39:00 (10 years ago)
- Location:
- main/waeup.ikoba/trunk/src/waeup/ikoba
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/trunk/src/waeup/ikoba/app.py
r12089 r12091 87 87 """ 88 88 # lock.acquire() # lock data 89 new_id = u' d%s' % (self._curr_app_id)89 new_id = u'a%s' % (self._curr_app_id) 90 90 self._curr_app_id += 1 91 91 # self._p_changed = True -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser.py
r12090 r12091 36 36 IContactForm, IObjectHistory, IIkobaObject, IIkobaUtils, 37 37 IPasswordValidator, IUserAccount, 38 VERIFIED, REJECTED, EXPIRED )38 VERIFIED, REJECTED, EXPIRED, APPROVED) 39 39 from waeup.ikoba.browser.layout import ( 40 40 IkobaPage, IkobaEditFormPage, IkobaAddFormPage, IkobaDisplayFormPage, … … 70 70 view.flash(_('Form has been saved.')) 71 71 if fields_string: 72 view.context.writeLogMessage(view, 'saved: %s' % fields_string) 72 view.context.writeLogMessage( 73 view, 'saved %s: %s' % (view.context.__name__, fields_string)) 73 74 return 74 75 … … 938 939 """ 939 940 grok.context(ICustomerDocumentsContainer) 940 grok.name(' overview_slip.pdf')941 grok.name('documents_overview_slip.pdf') 941 942 grok.require('waeup.viewCustomer') 942 943 prefix = 'form' … … 1047 1048 """ Page to manage the customer applications 1048 1049 1049 This manage form page is for both customers and customersofficers.1050 This manage form page is for both customers and officers. 1050 1051 """ 1051 1052 grok.context(IApplicationsContainer) … … 1251 1252 """ 1252 1253 grok.context(IApplicationsContainer) 1253 grok.name(' overview_slip.pdf')1254 grok.name('applications_overview_slip.pdf') 1254 1255 grok.require('waeup.viewCustomer') 1255 1256 prefix = 'form' -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/permissions.py
r12090 r12091 73 73 grok.title(u'Customer Record Owner') 74 74 grok.permissions('waeup.handleCustomer', 'waeup.uploadCustomerFile', 75 'waeup.viewCustomer', 'waeup.editCustomerDocuments') 75 'waeup.viewCustomer', 'waeup.editCustomerDocuments', 76 'waeup.editApplications') 76 77 77 78 -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py
r12069 r12091 107 107 document.title = u'My first document' 108 108 self.customer['documents'].addDocument(document) 109 application = createObject('waeup.SampleApplication') 110 application.title = u'My first application' 111 self.customer['applications'].addApplication(application) 109 112 110 113 # Set password … … 121 124 self.history_path = self.customer_path + '/history' 122 125 self.documents_path = self.customer_path + '/documents' 126 self.applications_path = self.customer_path + '/applications' 123 127 124 128 self.app['configuration'].carry_over = True … … 849 853 self.assertTrue( 850 854 'INFO - zope.mgr - customers.browser.DocumentManageFormPage ' 851 '- K1000000 - saved : title'855 '- K1000000 - saved d102: title' 852 856 in logcontent) 853 854 857 self.assertTrue( 855 858 'INFO - zope.mgr - customers.browser.DocumentAddFormPage ' 856 859 '- K1000000 - added: PDF Document %s' 857 860 % document.document_id in logcontent) 858 859 861 self.assertTrue( 860 862 'INFO - zope.mgr - customers.browser.DocumentsManageFormPage ' … … 1030 1032 self.assertEqual(self.browser.headers['Status'], '200 Ok') 1031 1033 self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf') 1032 path = os.path.join(samples_dir(), ' overview_slip.pdf')1034 path = os.path.join(samples_dir(), 'documents_overview_slip.pdf') 1033 1035 open(path, 'wb').write(self.browser.contents) 1034 1036 print "Sample PDF overview_slip.pdf written to %s" % path … … 1041 1043 open(path, 'wb').write(self.browser.contents) 1042 1044 print "Sample document_slip.pdf written to %s" % path 1045 1046 1047 class ApplicationUITests(CustomersFullSetup): 1048 # Tests for CustomerSampleApplication relates views and pages 1049 1050 def test_manage_application(self): 1051 # Managers can access the pages of customer applicationsconter 1052 # and can perform actions 1053 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 1054 self.browser.open(self.customer_path) 1055 self.assertEqual(self.browser.headers['Status'], '200 Ok') 1056 self.assertEqual(self.browser.url, self.customer_path) 1057 self.browser.open(self.customer_path) 1058 self.browser.getLink("Applications").click() 1059 self.browser.getLink("Add application").click() 1060 self.browser.getControl(name="apptype").value = ['SampleApplication'] 1061 self.browser.getControl("Create application").click() 1062 self.assertTrue('Sample Application created.' in self.browser.contents) 1063 application = self.customer['applications']['a102'] 1064 1065 # Application can be edited 1066 self.browser.getLink("a102").click() 1067 self.browser.getLink("Manage").click() 1068 self.browser.getControl(name="form.title").value = 'My second app' 1069 self.browser.getControl("Save").click() 1070 self.assertTrue('Form has been saved.' in self.browser.contents) 1071 self.browser.getLink("View").click() 1072 self.assertEqual(self.browser.url, self.applications_path + '/a102/index') 1073 1074 # Transitions can be performed 1075 self.browser.getLink("Transition").click() 1076 self.browser.getControl(name="transition").value = ['submit'] 1077 self.browser.getControl("Save").click() 1078 self.browser.getControl(name="transition").value = ['approve'] 1079 self.browser.getControl("Save").click() 1080 self.assertEqual(application.state, 'approved') 1081 1082 # Applications can be removed 1083 self.browser.getLink("Applications").click() 1084 ctrl = self.browser.getControl(name='val_id') 1085 ctrl.getControl(value=application.application_id).selected = True 1086 self.browser.getControl("Remove selected", index=0).click() 1087 self.assertTrue('Successfully removed' in self.browser.contents) 1088 1089 # All actions are being logged 1090 logfile = os.path.join( 1091 self.app['datacenter'].storage, 'logs', 'customers.log') 1092 logcontent = open(logfile).read() 1093 self.assertTrue( 1094 'INFO - zope.mgr - customers.browser.ApplicationManageFormPage ' 1095 '- K1000000 - saved a102: title' 1096 in logcontent) 1097 self.assertTrue( 1098 'INFO - zope.mgr - customers.browser.ApplicationAddFormPage ' 1099 '- K1000000 - added: Sample Application %s' 1100 % application.application_id in logcontent) 1101 self.assertTrue( 1102 'INFO - zope.mgr - customers.browser.ApplicationsManageFormPage ' 1103 '- K1000000 - removed: %s' 1104 % application.application_id in logcontent) 1105 1106 def test_edit_sample_application(self): 1107 # Customers can manage applications under certain conditions 1108 self.browser.open(self.login_path) 1109 self.browser.getControl(name="form.login").value = self.customer_id 1110 self.browser.getControl(name="form.password").value = 'cpwd' 1111 self.browser.getControl("Login").click() 1112 self.assertMatches( 1113 '...You logged in...', self.browser.contents) 1114 self.browser.getLink("Applications").click() 1115 self.browser.getLink("Add application").click() 1116 self.browser.getControl(name="apptype").value = ['SampleApplication'] 1117 self.browser.getControl("Create application").click() 1118 self.assertTrue('Sample Application created.' in self.browser.contents) 1119 application = self.customer['applications']['a102'] 1120 1121 # Application can be edited ... 1122 self.browser.getLink("a102").click() 1123 self.browser.open(self.applications_path + '/a102/edit') 1124 #self.browser.getLink("Edit").click() 1125 self.assertTrue('The requested form is locked' in self.browser.contents) 1126 # Customer is in wrong state 1127 IWorkflowState(self.customer).setState(APPROVED) 1128 self.browser.open(self.applications_path + '/a102/edit') 1129 self.browser.getControl(name="form.title").value = 'My second app' 1130 self.browser.getControl("Save").click() 1131 self.assertEqual(application.title, 'My second app') 1132 self.assertTrue('Form has been saved.' in self.browser.contents) 1133 self.browser.getLink("View").click() 1134 self.assertEqual(self.browser.url, self.applications_path + '/a102/index') 1135 # Customer can submit the form. The form is also saved. 1136 self.browser.getLink("Edit").click() 1137 self.browser.getControl(name="form.title").value = 'My third app' 1138 self.browser.getControl("Final Submit").click() 1139 self.assertEqual(application.title, 'My third app') 1140 self.assertEqual(application.state, 'submitted') 1141 self.assertTrue('Application State: submitted for approval' in self.browser.contents) 1142 # Customer can't edit the application once it has been submitted 1143 self.browser.open(self.applications_path + '/a102/edit') 1144 self.assertTrue('The requested form is locked' in self.browser.contents) 1145 1146 def test_view_slips(self): 1147 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 1148 # Officers can open the application overview 1149 self.browser.open(self.customer_path + '/applications') 1150 self.browser.getLink("Download applications overview").click() 1151 self.assertEqual(self.browser.headers['Status'], '200 Ok') 1152 self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf') 1153 path = os.path.join(samples_dir(), 'applications_overview_slip.pdf') 1154 open(path, 'wb').write(self.browser.contents) 1155 print "Sample PDF overview_slip.pdf written to %s" % path 1156 # Officers can open application slips 1157 self.browser.open(self.customer_path + '/applications/a101') 1158 self.browser.getLink("Download application slip").click() 1159 self.assertEqual(self.browser.headers['Status'], '200 Ok') 1160 self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf') 1161 path = os.path.join(samples_dir(), 'application_slip.pdf') 1162 open(path, 'wb').write(self.browser.contents) 1163 print "Sample application_slip.pdf written to %s" % path 1164 -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/utils.py
r12090 r12091 289 289 APPMANAGE_CUSTOMER_STATES = DOCMANAGE_CUSTOMER_STATES 290 290 291 APPMANAGE_APPLICATION_STATES = ( )291 APPMANAGE_APPLICATION_STATES = (CREATED,) 292 292 293 293 SKIP_UPLOAD_VIEWLETS = () … … 378 378 if show_history: 379 379 if getattr(view.context, 'history', None): 380 hist_translation = trans(_('Document Workflow History'), portal_language) 380 hist_translation = trans(_('${a} Workflow History', 381 mapping = {'a':view.context.translated_class_name}), 382 portal_language) 381 383 data.append(Paragraph(hist_translation, HEADING_STYLE)) 382 384 data.extend(creator.fromStringList(view.context.history.messages)) -
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/viewlets.py
r12090 r12091 316 316 icon = 'actionicon_pdf.png' 317 317 text = _('Download documents overview') 318 target = ' overview_slip.pdf'318 target = 'documents_overview_slip.pdf' 319 319 320 320 … … 390 390 icon = 'actionicon_pdf.png' 391 391 text = _('Download applications overview') 392 target = ' overview_slip.pdf'392 target = 'applications_overview_slip.pdf' 393 393 394 394
Note: See TracChangeset for help on using the changeset viewer.