Ignore:
Timestamp:
10 Jun 2016, 08:15:54 (8 years ago)
Author:
Henrik Bettermann
Message:

Add LecturerLandingPage and LecturerCourses ManageLink viewlet.

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

Legend:

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

    r13898 r13908  
    32093209            code=(self.context.code, self.context.code)
    32103210            )
    3211         result = [[_('Matric No.'),
     3211        header = [[_('Matric No.'),
    32123212                   _('Reg. No.'),
    32133213                   _('Fullname'),
     
    32163216                   _('Level'),
    32173217                   _('Score') ],]
     3218        tickets = []
    32183219        for ticket in list(coursetickets):
    32193220            row = [ticket.student.matric_number,
     
    32243225                  ticket.level,
    32253226                  ticket.score]
    3226             result.append(row)
    3227         return result
     3227            tickets.append(row)
     3228        return header + sorted(tickets, key=lambda value: value[0])
    32283229
    32293230    def render(self):
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r13904 r13908  
    18211821        prmlocal = IPrincipalRoleManager(course)
    18221822        prmlocal.assignRoleToPrincipal('waeup.local.Lecturer', 'mrslecturer')
     1823        notify(LocalRoleSetEvent(
     1824            course, 'waeup.local.Lecturer', 'mrslecturer', granted=True))
    18231825        # Login as lecturer.
    18241826        self.browser.open(self.login_path)
    18251827        self.browser.getControl(name="form.login").value = 'mrslecturer'
    1826         self.browser.getControl(name="form.password").value = 'mrslecturersecret'
     1828        self.browser.getControl(
     1829            name="form.password").value = 'mrslecturersecret'
    18271830        self.browser.getControl("Login").click()
    18281831        self.assertMatches('...You logged in...', self.browser.contents)
    1829         # CO can see her roles.
     1832        # Lecturer is on landing page
     1833        self.assertTrue('(<span>COURSE1</span>)' in self.browser.contents)
     1834        # Lecturer can click the 'My Roles' link.
    18301835        self.browser.getLink("My Roles").click()
    18311836        self.assertMatches(
    18321837            '...<div>Academics Officer (view only)</div>...',
    18331838            self.browser.contents)
    1834         # But not her local role ...
    1835         self.assertFalse('Lecturer' in self.browser.contents)
    1836         # ... because we forgot to notify the course that the local role
    1837         # has changed.
    1838         notify(LocalRoleSetEvent(
    1839             course, 'waeup.local.Lecturer', 'mrslecturer', granted=True))
    1840         self.browser.open('http://localhost/app/users/mrslecturer/my_roles')
    1841         self.assertTrue('Lecturer' in self.browser.contents)
    18421839        self.assertMatches(
    1843             '...<a href="http://localhost/app/faculties/fac1/dep1/courses/COURSE1">...',
     1840            '...<a href="http://localhost/app/'
     1841            'faculties/fac1/dep1/courses/COURSE1">...',
    18441842            self.browser.contents)
     1843        self.assertFalse('(<span>COURSE1</span>)' in self.browser.contents)
     1844        # Lecturer can click the 'My Courses' link ...
     1845        self.browser.getLink("My Courses").click()
     1846        # ... and is is back on landing page
     1847        self.assertTrue('(<span>COURSE1</span>)' in self.browser.contents)
    18451848        # The lecturer can go to her course ...
    1846         self.browser.getLink(
    1847             "http://localhost/app/faculties/fac1/dep1/courses/COURSE1").click()
     1849        self.browser.getLink("COURSE1").click()
    18481850        # Lecturers can neither filter students ...
    18491851        self.assertRaises(
     
    18611863        # Course results can be batch edited via the edit_courses view.
    18621864        self.app['faculties']['fac1']['dep1'].score_editing_disabled = True
    1863         self.browser.open("http://localhost/app/faculties/fac1/dep1/courses/COURSE1")
     1865        self.browser.open(
     1866            "http://localhost/app/faculties/fac1/dep1/courses/COURSE1")
    18641867        self.browser.getLink("Update scores").click()
    18651868        self.assertTrue('Score editing disabled' in self.browser.contents)
    18661869        self.app['faculties']['fac1']['dep1'].score_editing_disabled = False
    18671870        self.browser.getLink("Update scores").click()
    1868         self.assertTrue('Current academic session not set' in self.browser.contents)
     1871        self.assertTrue(
     1872            'Current academic session not set' in self.browser.contents)
    18691873        self.app['configuration'].current_academic_session = 2004
    18701874        self.browser.getLink("Update scores").click()
     
    18751879        # Student must be in state 'courses validated'.
    18761880        self.browser.open(
    1877             "http://localhost/app/faculties/fac1/dep1/courses/COURSE1/edit_scores")
     1881            'http://localhost/app/faculties/fac1/'
     1882            'dep1/courses/COURSE1/edit_scores')
    18781883        self.assertTrue(
    18791884            'input type="text" name="scores"' in self.browser.contents)
     
    18881893        logcontent = open(logfile).read()
    18891894        self.assertTrue('mrslecturer - students.browser.EditScoresPage - '
    1890                         'K1000000 100/COURSE1 score updated (55)' in logcontent)
     1895            'K1000000 100/COURSE1 score updated (55)' in logcontent)
    18911896        # Non-integer scores won't be accepted.
    18921897        self.browser.open(
    1893             "http://localhost/app/faculties/fac1/dep1/courses/COURSE1/edit_scores")
     1898            'http://localhost/app/faculties/fac1/'
     1899            'dep1/courses/COURSE1/edit_scores')
    18941900        self.assertTrue('value="55" />' in self.browser.contents)
    18951901        self.browser.getControl(name="scores", index=0).value = 'abc'
     
    18991905        # Scores can be removed.
    19001906        self.browser.open(
    1901             "http://localhost/app/faculties/fac1/dep1/courses/COURSE1/edit_scores")
     1907            'http://localhost/app/faculties/fac1/'
     1908            'dep1/courses/COURSE1/edit_scores')
    19021909        self.browser.getControl(name="scores", index=0).value = ''
    19031910        self.browser.getControl("Update scores").click()
     
    19061913        logcontent = open(logfile).read()
    19071914        self.assertTrue('mrslecturer - students.browser.EditScoresPage - '
    1908                         'K1000000 100/COURSE1 score updated (None)' in logcontent)
     1915            'K1000000 100/COURSE1 score updated (None)' in logcontent)
    19091916        # A course ticket slip can be downloaded
    19101917        self.browser.open(
    1911             "http://localhost/app/faculties/fac1/dep1/courses/COURSE1/coursetickets.pdf")
     1918            'http://localhost/app/faculties/fac1/'
     1919            'dep1/courses/COURSE1/coursetickets.pdf')
    19121920        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    19131921        self.assertEqual(self.browser.headers['Content-Type'],
     
    19161924        open(path, 'wb').write(self.browser.contents)
    19171925        print "Sample PDF coursetickets.pdf written to %s" % path
    1918 
    19191926
    19201927    def test_change_current_mode(self):
Note: See TracChangeset for help on using the changeset viewer.