Ignore:
Timestamp:
30 Aug 2019, 07:06:51 (5 years ago)
Author:
Henrik Bettermann
Message:

DCOEM students don't pay acceptance fee.

Location:
main/waeup.uniben/trunk/src/waeup/uniben/students/tests
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.uniben/trunk/src/waeup/uniben/students/tests/test_browser.py

    r15403 r15574  
    4545
    4646SAMPLE_FPM = os.path.join(os.path.dirname(__file__), 'sample.fpm')
     47SAMPLE_IMAGE = os.path.join(os.path.dirname(__file__), 'test_image.jpg')
    4748
    4849class OfficerUITests(StudentsFullSetup):
     
    11671168        self.assertEqual(self.student['payments'].values()[2].amount_auth, 987.0)
    11681169        return
     1170
     1171    def test_student_clearance(self):
     1172        # create some passport file for `student`
     1173        storage = getUtility(IExtFileStore)
     1174        image_path = os.path.join(os.path.dirname(__file__), 'test_image.jpg')
     1175        self.image_contents = open(image_path, 'rb').read()
     1176        file_id = IFileStoreNameChooser(self.student).chooseName(
     1177            attr='passport.jpg')
     1178        storage.createFile(file_id, StringIO(self.image_contents))
     1179        IWorkflowInfo(self.student).fireTransition('admit')
     1180        self.browser.open(self.login_path)
     1181        self.browser.getControl(name="form.login").value = self.student_id
     1182        self.browser.getControl(name="form.password").value = 'spwd'
     1183        self.browser.getControl("Login").click()
     1184        self.assertMatches(
     1185            '...You logged in...', self.browser.contents)
     1186        self.browser.getLink("Base Data").click()
     1187        self.browser.getLink("Download admission letter").click()
     1188        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     1189        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
     1190        path = os.path.join(samples_dir(), 'admission_slip.pdf')
     1191        open(path, 'wb').write(self.browser.contents)
     1192        print "Sample PDF admission_slip.pdf written to %s" % path
     1193        self.browser.open(self.student_path + '/start_clearance')
     1194        # Regular students have to enter an access code
     1195        self.browser.getControl("Start clearance now").click()
     1196        self.assertTrue('Activation code is invalid' in self.browser.contents)
     1197        # DCOEM students can start clearance without access code
     1198        self.app['faculties']['fac1'].code = 'DCOEM'
     1199        self.browser.open(self.student_path + '/start_clearance')
     1200        self.browser.getControl("Start clearance now").click()
     1201        self.assertMatches('...Clearance process has been started...',
     1202                           self.browser.contents)
Note: See TracChangeset for help on using the changeset viewer.