Changeset 8848 for main/waeup.kofa/trunk/src/waeup/kofa/mandates
- Timestamp:
- 29 Jun 2012, 11:26:59 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/mandates
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/mandates/mandate.py
r8847 r8848 60 60 if self.expires < datetime.utcnow(): 61 61 msg = _('Mandate expired.') 62 if self.category == 'student_password':62 elif self.category == 'student_password': 63 63 if self._setStudentPassword(): 64 64 msg = _('Password has been successfully set.') -
main/waeup.kofa/trunk/src/waeup/kofa/mandates/tests.py
r8847 r8848 21 21 import tempfile 22 22 import shutil 23 from zope.testbrowser.testing import Browser 23 24 from datetime import datetime, timedelta 24 25 from zope.interface.verify import verifyClass, verifyObject … … 75 76 setSite(app) 76 77 78 self.browser = Browser() 79 self.browser.handleErrors = False 80 77 81 def tearDown(self): 78 82 super(MandatesContainerTestCase, self).tearDown() … … 95 99 msg = mandate.execute() 96 100 self.assertEqual(msg, u'Mandate expired.') 97 # Ad and execute a perfect mandate98 mandate = Mandate( days=0)101 # Add and execute a perfect mandate 102 mandate = Mandate() 99 103 mandate.category = 'student_password' 100 104 mandate.params['student_id'] = student.student_id … … 120 124 self.assertEqual(len(self.app['mandates'].keys()), 1) 121 125 self.assertEqual([i for i in self.app['mandates'].keys()], [u'23456']) 126 127 def test_browser(self): 128 student = createObject('waeup.Student') 129 self.app['students'].addStudent(student) 130 mandate = Mandate() 131 mandate.category = 'student_password' 132 mandate.params['student_id'] = student.student_id 133 mandate.params['password'] = 'mypwd1' 134 self.app['mandates'].addMandate(mandate) 135 self.browser.open('http://localhost/app/mandate?mandate_id=%s' 136 % mandate.mandate_id) 137 # Password has been set. 138 self.assertTrue('Password has been successfully set.' 139 in self.browser.contents) 140 self.assertTrue(IUserAccount(student).checkPassword('mypwd1')) 141 # All mandates have been removed. 142 self.assertEqual(len(self.app['mandates'].keys()), 0)
Note: See TracChangeset for help on using the changeset viewer.