- Timestamp:
- 4 Sep 2012, 11:18:20 (12 years ago)
- Location:
- main/waeup.fceokene/trunk/src/waeup/fceokene/students
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.fceokene/trunk/src/waeup/fceokene/students/browser.py
r8913 r9156 18 18 import grok 19 19 from zope.i18n import translate 20 from hurry.workflow.interfaces import IWorkflowInfo 21 from waeup.kofa.interfaces import ADMITTED 22 from waeup.kofa.interfaces import MessageFactory as _ 20 23 from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget 24 from waeup.kofa.students.browser import StartClearancePage 21 25 from kofacustom.nigeria.students.browser import ( 22 26 NigeriaOnlinePaymentDisplayFormPage, … … 49 53 form_fields['creation_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') 50 54 form_fields['payment_date'].custom_widget = FriendlyDatetimeDisplayWidget('le') 55 56 class CustomStartClearancePage(StartClearancePage): 57 58 grok.template('startclearance') 59 60 def update(self, SUBMIT=None): 61 if not self.context.state == ADMITTED: 62 self.flash(_("Wrong state")) 63 self.redirect(self.url(self.context)) 64 return 65 if not self.portrait_uploaded: 66 self.flash(_("No portrait uploaded.")) 67 self.redirect(self.url(self.context, 'change_portrait')) 68 return 69 if not self.all_required_fields_filled: 70 self.flash(_("Not all required fields filled.")) 71 self.redirect(self.url(self.context, 'edit_base')) 72 return 73 if SUBMIT is None: 74 return 75 IWorkflowInfo(self.context).fireTransition('start_clearance') 76 self.flash(_('Clearance process has been started.')) 77 self.redirect(self.url(self.context,'cedit')) 78 return -
main/waeup.fceokene/trunk/src/waeup/fceokene/students/tests/test_browser.py
r9153 r9156 20 20 import tempfile 21 21 from StringIO import StringIO 22 from hurry.workflow.interfaces import IWorkflowState 22 from hurry.workflow.interfaces import IWorkflowState, IWorkflowInfo 23 23 from zope.component.hooks import setSite, clearSite 24 24 from zope.component import getUtility, createObject 25 25 from zope.interface import verify 26 26 from waeup.kofa.app import University 27 from waeup.kofa.students.tests.test_browser import StudentsFullSetup 27 from waeup.kofa.students.tests.test_browser import ( 28 StudentsFullSetup, SAMPLE_IMAGE) 28 29 from waeup.kofa.testing import FunctionalTestCase 29 30 from waeup.kofa.interfaces import ( … … 247 248 self.assertEqual(error, u'Previous session payment not yet implemented.') 248 249 return 250 251 def test_student_start_clearance(self): 252 self.browser.open(self.login_path) 253 self.browser.getControl(name="form.login").value = self.student_id 254 self.browser.getControl(name="form.password").value = 'spwd' 255 self.browser.getControl("Login").click() 256 257 IWorkflowInfo(self.student).fireTransition('admit') 258 self.browser.open(self.student_path + '/change_portrait') 259 image = open(SAMPLE_IMAGE, 'rb') 260 ctrl = self.browser.getControl(name='passportuploadedit') 261 file_ctrl = ctrl.mech_control 262 file_ctrl.add_file(image, filename='my_photo.jpg') 263 self.browser.getControl( 264 name='upload_passportuploadedit').click() 265 self.browser.open(self.student_path + '/start_clearance') 266 # In Okene the students can just start clearance without entering 267 # an activation code. 268 self.browser.getControl("Start clearance now").click() 269 self.assertMatches('...Clearance process has been started...', 270 self.browser.contents)
Note: See TracChangeset for help on using the changeset viewer.