Ignore:
Timestamp:
9 Feb 2018, 09:17:58 (7 years ago)
Author:
Henrik Bettermann
Message:

Display applicant id and error messages in flash message box if student creation has failed.

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

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_applicantcopier.py

    r14934 r14949  
    160160        self.prepare_applicant()
    161161        self.browser.open(self.container_path + '/createallstudents')
    162         self.assertTrue('No student could be created' in self.browser.contents)
     162        self.assertTrue('No record found' in self.browser.contents)
    163163        IWorkflowState(self.applicant).setState('admitted')
    164164        notify(grok.ObjectModifiedEvent(self.applicant))
    165165        self.browser.open(self.container_path + '/createallstudents')
    166         self.assertTrue('No student could be created' in self.browser.contents)
     166        self.assertTrue('No course admitted provided' in self.browser.contents)
    167167        logcontent = open(logfile).read()
    168168        self.assertTrue('No course admitted provided' in logcontent)
     
    173173        self.applicant.date_of_birth = None
    174174        self.browser.open(self.container_path + '/createallstudents')
    175         self.assertTrue('No student could be created' in self.browser.contents)
     175        self.assertTrue('RequiredMissing: date_of_birth' in self.browser.contents)
    176176        logcontent = open(logfile).read()
    177177        self.assertTrue('RequiredMissing: date_of_birth' in logcontent)
     
    194194        notify(grok.ObjectModifiedEvent(self.applicant))
    195195        self.browser.open(self.root_path + '/createallstudents')
    196         self.assertTrue('No student could be created' in self.browser.contents)
     196        self.assertTrue('No course admitted provided' in self.browser.contents)
    197197        logcontent = open(logfile).read()
    198198        self.assertTrue('No course admitted provided' in logcontent)
     
    238238        self.assertTrue('No student could be created.' in self.browser.contents)
    239239        self.browser.open(self.container_path + '/createallstudents')
    240         self.assertTrue('No student could be created' in self.browser.contents)
    241         logfile = os.path.join(self.app['datacenter'].storage, 'logs', 'applicants.log')
    242         logcontent = open(logfile).read()
    243         self.assertTrue('IOError: Application Slip could not be created.' in logcontent)
     240        self.assertTrue(
     241            'IOError: Application Slip could not be created.'
     242            in self.browser.contents)
     243        logfile = os.path.join(
     244            self.app['datacenter'].storage, 'logs', 'applicants.log')
     245        logcontent = open(logfile).read()
     246        self.assertTrue(
     247            'IOError: Application Slip could not be created.' in logcontent)
    244248
    245249    def disabled_test_delay(self):
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py

    r14366 r14949  
    536536        self.assertEqual(self.applicantscontainer.counts[1], 0)
    537537        return
     538
     539    def init_officer(self):
     540        # Create application officer
     541        self.app['users'].addUser('mrappl', 'mrapplsecret')
     542        self.app['users']['mrappl'].email = 'mrappl@foo.ng'
     543        self.app['users']['mrappl'].title = 'Carlo Pitter'
     544        prmglobal = IPrincipalRoleManager(self.app)
     545        prmglobal.assignRoleToPrincipal('waeup.ApplicationsManager', 'mrappl')
     546        # Login as officer
     547        self.browser.open(self.login_path)
     548        self.browser.getControl(name="form.login").value = 'mrappl'
     549        self.browser.getControl(name="form.password").value = 'mrapplsecret'
     550        self.browser.getControl("Login").click()
     551
     552    def test_student_creation_permission(self):
     553        self.init_officer()
     554        self.browser.open(self.container_path + '/manage')
     555        self.browser.getControl("Create students").click()
     556        self.assertTrue('You don\'t have permission to create student records'
     557            in self.browser.contents)
     558        prmglobal = IPrincipalRoleManager(self.app)
     559        prmglobal.assignRoleToPrincipal('waeup.StudentsCreator', 'mrappl')
     560        self.browser.getControl("Create students").click()
     561        self.assertTrue('No applicant selected' in self.browser.contents)
     562
    538563
    539564class ApplicantUITests(ApplicantsFullSetup):
Note: See TracChangeset for help on using the changeset viewer.