Changeset 13908 for main/waeup.kofa/trunk/src/waeup/kofa/students
- Timestamp:
- 10 Jun 2016, 08:15:54 (8 years ago)
- 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 3209 3209 code=(self.context.code, self.context.code) 3210 3210 ) 3211 result= [[_('Matric No.'),3211 header = [[_('Matric No.'), 3212 3212 _('Reg. No.'), 3213 3213 _('Fullname'), … … 3216 3216 _('Level'), 3217 3217 _('Score') ],] 3218 tickets = [] 3218 3219 for ticket in list(coursetickets): 3219 3220 row = [ticket.student.matric_number, … … 3224 3225 ticket.level, 3225 3226 ticket.score] 3226 result.append(row)3227 return result3227 tickets.append(row) 3228 return header + sorted(tickets, key=lambda value: value[0]) 3228 3229 3229 3230 def render(self): -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r13904 r13908 1821 1821 prmlocal = IPrincipalRoleManager(course) 1822 1822 prmlocal.assignRoleToPrincipal('waeup.local.Lecturer', 'mrslecturer') 1823 notify(LocalRoleSetEvent( 1824 course, 'waeup.local.Lecturer', 'mrslecturer', granted=True)) 1823 1825 # Login as lecturer. 1824 1826 self.browser.open(self.login_path) 1825 1827 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' 1827 1830 self.browser.getControl("Login").click() 1828 1831 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. 1830 1835 self.browser.getLink("My Roles").click() 1831 1836 self.assertMatches( 1832 1837 '...<div>Academics Officer (view only)</div>...', 1833 1838 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 role1837 # 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)1842 1839 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">...', 1844 1842 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) 1845 1848 # 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() 1848 1850 # Lecturers can neither filter students ... 1849 1851 self.assertRaises( … … 1861 1863 # Course results can be batch edited via the edit_courses view. 1862 1864 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") 1864 1867 self.browser.getLink("Update scores").click() 1865 1868 self.assertTrue('Score editing disabled' in self.browser.contents) 1866 1869 self.app['faculties']['fac1']['dep1'].score_editing_disabled = False 1867 1870 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) 1869 1873 self.app['configuration'].current_academic_session = 2004 1870 1874 self.browser.getLink("Update scores").click() … … 1875 1879 # Student must be in state 'courses validated'. 1876 1880 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') 1878 1883 self.assertTrue( 1879 1884 'input type="text" name="scores"' in self.browser.contents) … … 1888 1893 logcontent = open(logfile).read() 1889 1894 self.assertTrue('mrslecturer - students.browser.EditScoresPage - ' 1890 1895 'K1000000 100/COURSE1 score updated (55)' in logcontent) 1891 1896 # Non-integer scores won't be accepted. 1892 1897 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') 1894 1900 self.assertTrue('value="55" />' in self.browser.contents) 1895 1901 self.browser.getControl(name="scores", index=0).value = 'abc' … … 1899 1905 # Scores can be removed. 1900 1906 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') 1902 1909 self.browser.getControl(name="scores", index=0).value = '' 1903 1910 self.browser.getControl("Update scores").click() … … 1906 1913 logcontent = open(logfile).read() 1907 1914 self.assertTrue('mrslecturer - students.browser.EditScoresPage - ' 1908 1915 'K1000000 100/COURSE1 score updated (None)' in logcontent) 1909 1916 # A course ticket slip can be downloaded 1910 1917 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') 1912 1920 self.assertEqual(self.browser.headers['Status'], '200 Ok') 1913 1921 self.assertEqual(self.browser.headers['Content-Type'], … … 1916 1924 open(path, 'wb').write(self.browser.contents) 1917 1925 print "Sample PDF coursetickets.pdf written to %s" % path 1918 1919 1926 1920 1927 def test_change_current_mode(self):
Note: See TracChangeset for help on using the changeset viewer.