Ignore:
Timestamp:
7 Aug 2013, 10:21:49 (11 years ago)
Author:
Henrik Bettermann
Message:

Add test for transcript request processing.

File:
1 edited

Legend:

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

    r10463 r10464  
    19241924        print "Sample PDF transcript.pdf written to %s" % path
    19251925
     1926    def test_process_transcript_request(self):
     1927        IWorkflowState(self.student).setState('transcript requested')
     1928        self.student.transcript_comment = (
     1929            u'On 07/08/2013 08:59:54 UTC K1000000 wrote:\n\nComment line 1 \n'
     1930            'Comment line2\n\nDispatch Address:\nAddress line 1 \n'
     1931            'Address line2\n\n')
     1932        # Create transcript officer
     1933        self.app['users'].addUser('mrtranscript', 'mrtranscriptsecret')
     1934        self.app['users']['mrtranscript'].email = 'mrtranscript@foo.ng'
     1935        self.app['users']['mrtranscript'].title = 'Ruth Gordon'
     1936        prmglobal = IPrincipalRoleManager(self.app)
     1937        prmglobal.assignRoleToPrincipal('waeup.TranscriptOfficer', 'mrtranscript')
     1938        # Login as transcript officer
     1939        self.browser.open(self.login_path)
     1940        self.browser.getControl(name="form.login").value = 'mrtranscript'
     1941        self.browser.getControl(name="form.password").value = 'mrtranscriptsecret'
     1942        self.browser.getControl("Login").click()
     1943        self.assertMatches('...You logged in...', self.browser.contents)
     1944        # Officer can see his roles
     1945        self.browser.getLink("My Roles").click()
     1946        self.assertMatches(
     1947            '...<div>Transcript Officer</div>...',
     1948            self.browser.contents)
     1949        self.browser.open(self.student_path)
     1950        self.browser.getLink("Manage transcript request").click()
     1951        self.assertTrue(' UTC K1000000 wrote:<br><br>Comment line 1 <br>'
     1952        'Comment line2<br><br>Dispatch Address:<br>Address line 1 <br>'
     1953        'Address line2<br><br></p>' in self.browser.contents)
     1954        self.browser.getControl(name="comment").value = (
     1955            'Hello,\nYour transcript has been sent to the address provided.')
     1956        self.browser.getControl("Save comment and mark as processed").click()
     1957        self.assertTrue(
     1958            'UTC mrtranscript wrote:\n\nHello,\nYour transcript has '
     1959            'been sent to the address provided.\n\n'
     1960            in self.student.transcript_comment)
     1961        # The comment has been logged
     1962        logfile = os.path.join(
     1963            self.app['datacenter'].storage, 'logs', 'students.log')
     1964        logcontent = open(logfile).read()
     1965        self.assertTrue(
     1966            'mrtranscript - students.browser.StudentTranscriptRequestProcessFormPage - '
     1967            'K1000000 - comment: Hello,<br>'
     1968            'Your transcript has been sent to the address provided'
     1969            in logcontent)
     1970
    19261971class StudentUITests(StudentsFullSetup):
    19271972    # Tests for Student class views and pages
     
    28842929            'K1000000 - comment: Comment line 1 <br>Comment line2\n'
    28852930            in logcontent)
    2886        
    28872931
    28882932class StudentRequestPWTests(StudentsFullSetup):
Note: See TracChangeset for help on using the changeset viewer.