Changeset 12503 for main/kofacustom.nigeria/trunk/src
- Timestamp:
- 21 Jan 2015, 10:55:14 (10 years ago)
- Location:
- main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/interfaces.py
r12416 r12503 17 17 ## 18 18 from zope import schema 19 from zope.interface import Attribute 19 from zope.interface import Attribute, invariant, Invalid 20 20 from waeup.kofa.schema import TextLineChoice 21 21 from waeup.kofa.interfaces import SimpleKofaVocabulary, academic_sessions_vocab … … 246 246 ) 247 247 248 @invariant 249 def check_lga_nationality(student): 250 if student.nationality != 'NG' and student.lga not in ('foreigner', None): 251 raise Invalid(_('Nationalty and LGA are contradictory.')) 252 if student.nationality == 'NG' and student.lga == 'foreigner': 253 raise Invalid(_('Nationalty and LGA are contradictory.')) 254 248 255 249 256 class INigeriaPGStudentClearance(INigeriaUGStudentClearance): -
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/tests/test_browser.py
r12417 r12503 343 343 self.assertTrue( 344 344 'Your personal data record is outdated.' in self.browser.contents) 345 346 def test_lga_nationality(self): 347 self.student.nationality = u'DE' 348 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 349 self.browser.open(self.manage_clearance_path) 350 self.browser.getControl(name="form.lga").value = ['abia_aba_north'] 351 self.browser.getControl("Save").click() 352 self.assertTrue( 353 'Nationalty and LGA are contradictory.' in self.browser.contents) 354 self.browser.getControl(name="form.nationality").value = ['NG'] 355 self.browser.getControl("Save").click() 356 self.assertTrue( 357 'Form has been saved' in self.browser.contents)
Note: See TracChangeset for help on using the changeset viewer.