Ignore:
Timestamp:
21 Jan 2015, 10:55:14 (10 years ago)
Author:
Henrik Bettermann
Message:

Ensure that lga and nationality are not contradictory.

Location:
main/kofacustom.nigeria/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.nigeria/trunk/CHANGES.txt

    r11914 r12503  
    441.2 (unreleased)
    55================
     6
     7- Ensure that lga and nationality are not contradictory.
    68
    79- Be prepared for https webservice requests.
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/interfaces.py

    r12416 r12503  
    1717##
    1818from zope import schema
    19 from zope.interface import Attribute
     19from zope.interface import Attribute, invariant, Invalid
    2020from waeup.kofa.schema import TextLineChoice
    2121from waeup.kofa.interfaces import SimpleKofaVocabulary, academic_sessions_vocab
     
    246246        )
    247247
     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
    248255
    249256class INigeriaPGStudentClearance(INigeriaUGStudentClearance):
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/tests/test_browser.py

    r12417 r12503  
    343343        self.assertTrue(
    344344            '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.