Ignore:
Timestamp:
7 Aug 2013, 09:31:47 (11 years ago)
Author:
Henrik Bettermann
Message:

Add browser test for student transcript requests.

File:
1 edited

Legend:

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

    r10449 r10463  
    28282828        self.assertEqual(self.student['studycourse'].current_level, 600)
    28292829
     2830    def test_request_transcript(self):
     2831        IWorkflowState(self.student).setState('graduated')
     2832        self.browser.open(self.login_path)
     2833        self.browser.getControl(name="form.login").value = self.student_id
     2834        self.browser.getControl(name="form.password").value = 'spwd'
     2835        self.browser.getControl("Login").click()
     2836        self.assertMatches(
     2837            '...You logged in...', self.browser.contents)
     2838        # Create payment ticket
     2839        self.browser.open(self.payments_path)
     2840        self.browser.open(self.payments_path + '/addop')
     2841        self.browser.getControl(name="form.p_category").value = ['transcript']
     2842        self.browser.getControl("Create ticket").click()
     2843        ctrl = self.browser.getControl(name='val_id')
     2844        value = ctrl.options[0]
     2845        self.browser.getLink(value).click()
     2846        self.assertMatches('...Amount Authorized...',
     2847                           self.browser.contents)
     2848        self.assertEqual(self.student['payments'][value].amount_auth, 4567.0)
     2849        # Student is the payer of the payment ticket.
     2850        payer = IPayer(self.student['payments'][value])
     2851        self.assertEqual(payer.display_fullname, 'Anna Tester')
     2852        self.assertEqual(payer.id, self.student_id)
     2853        self.assertEqual(payer.faculty, 'fac1')
     2854        self.assertEqual(payer.department, 'dep1')
     2855        # We simulate the approval and fetch the pin
     2856        self.assertEqual(len(self.app['accesscodes']['TSC-0']),0)
     2857        self.browser.open(self.browser.url + '/fake_approve')
     2858        self.assertMatches('...Payment approved...',
     2859                          self.browser.contents)
     2860        pin = self.app['accesscodes']['TSC-0'].keys()[0]
     2861        parts = pin.split('-')[1:]
     2862        tscseries, tscnumber = parts
     2863        # Student can use the pin to send the transcript request
     2864        self.browser.open(self.student_path)
     2865        self.browser.getLink("Request transcript").click()
     2866        self.browser.getControl(name="ac_series").value = tscseries
     2867        self.browser.getControl(name="ac_number").value = tscnumber
     2868        self.browser.getControl(name="comment").value = 'Comment line 1 \nComment line2'
     2869        self.browser.getControl(name="address").value = 'Address line 1 \nAddress line2'
     2870        self.browser.getControl("Request transcript now").click()
     2871        self.assertMatches('...Transcript processing has been started...',
     2872                          self.browser.contents)
     2873        self.assertEqual(self.student.state, 'transcript requested')
     2874        self.assertMatches(
     2875            '... UTC K1000000 wrote:\n\nComment line 1 \n'
     2876            'Comment line2\n\nDispatch Address:\nAddress line 1 \n'
     2877            'Address line2\n\n', self.student.transcript_comment)
     2878        # The comment has been logged
     2879        logfile = os.path.join(
     2880            self.app['datacenter'].storage, 'logs', 'students.log')
     2881        logcontent = open(logfile).read()
     2882        self.assertTrue(
     2883            'K1000000 - students.browser.StudentTranscriptRequestPage - '
     2884            'K1000000 - comment: Comment line 1 <br>Comment line2\n'
     2885            in logcontent)
     2886       
     2887
    28302888class StudentRequestPWTests(StudentsFullSetup):
    28312889    # Tests for student registration
Note: See TracChangeset for help on using the changeset viewer.