Changeset 8727 for main


Ignore:
Timestamp:
15 Jun 2012, 06:18:42 (13 years ago)
Author:
Henrik Bettermann
Message:

Add test to check if AppCatCertificateSource? is really used to validate course1 and course2 values.

Location:
main/waeup.uniben/trunk/src/waeup/uniben/applicants
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.uniben/trunk/src/waeup/uniben/applicants/interfaces.py

    r8668 r8727  
    302302        )
    303303
    304 class ICustomApplicant(IUGApplicant,IPGApplicant):
     304class ICustomApplicant(IUGApplicant, IPGApplicant):
    305305    """An interface for both types of applicants.
    306306
     307    Attention: The IPGApplicant field seetings will be overwritten
     308    by IPGApplicant field settings. If a field is defined
     309    in both interfaces zope.schema validates only against the
     310    constraints in IUGApplicant. This does not affect the forms
     311    since they are build on either IUGApplicant or IPGApplicant.
    307312    """
    308313
     
    317322
    318323class IUGApplicantEdit(IUGApplicant):
    319     """An undergraduate applicant interface for editing.
     324    """An undergraduate applicant interface for edit forms.
    320325
    321326    Here we can repeat the fields from base data and set the
  • main/waeup.uniben/trunk/src/waeup/uniben/applicants/tests.py

    r8668 r8727  
    2525from zope.intid.interfaces import IIntIds
    2626from zope.interface.verify import verifyClass, verifyObject
     27from zope.schema.interfaces import ConstraintNotSatisfied
    2728from zope.component.hooks import setSite, clearSite
    2829from zope.component import createObject, getUtility
     
    149150
    150151    def test_manage_and_view_applicant(self):
    151         # Managers can manage pg applicants
     152        # Managers can manage pg applicants.
    152153        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    153         # The IPGApplicant interface is really used in all pages
     154        # The IPGApplicant interface is really used in all pages.
    154155        self.browser.open(self.pgapplicant_path)
    155156        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     
    164165        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    165166        # If we view the applicant in the ug container,
    166         # the employer field doesn't appear
     167        # the employer field doesn't appear.
    167168        self.browser.open(self.ugapplicant_path)
    168169        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     
    170171        self.browser.open(self.ugapplicant_path + '/manage')
    171172        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    172         # We can save the applicant
     173        # We can save the applicant.
    173174        self.fill_correct_values()
    174175        self.browser.getControl(name="form.course1").value = ['CERT1']
     
    181182        self.browser.open(self.ugapplicant_path + '/application_slip.pdf')
    182183        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     184        return
     185
     186    def test_set_wrong_course1(self):
     187        self.ugapplicant.course1 = self.certificate
     188        self.assertRaises(
     189            ConstraintNotSatisfied,
     190            setattr, self.ugapplicant, 'course1', self.certificate2)
     191        self.pgapplicant.course1 = self.certificate2
     192        self.assertRaises(
     193            ConstraintNotSatisfied,
     194            setattr, self.pgapplicant, 'course1', self.certificate)
    183195        return
    184196
Note: See TracChangeset for help on using the changeset viewer.