- Timestamp:
- 7 Nov 2012, 08:27:23 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r9563 r9565 1406 1406 self.assertTrue(self.student_id in self.browser.contents) 1407 1407 1408 def test_handle_courses_by_lecturer(self): 1409 # Create course lecturer 1410 self.app['users'].addUser('mrslecturer', 'mrslecturersecret') 1411 self.app['users']['mrslecturer'].email = 'mrslecturer@foo.ng' 1412 self.app['users']['mrslecturer'].title = u'Mercedes Benz' 1413 # Assign local Courselecturer100 role for a certificate 1414 course = self.app['faculties']['fac1']['dep1'].courses['COURSE1'] 1415 prmlocal = IPrincipalRoleManager(course) 1416 prmlocal.assignRoleToPrincipal('waeup.local.Lecturer', 'mrslecturer') 1417 # Login as lecturer 1418 self.browser.open(self.login_path) 1419 self.browser.getControl(name="form.login").value = 'mrslecturer' 1420 self.browser.getControl(name="form.password").value = 'mrslecturersecret' 1421 self.browser.getControl("Login").click() 1422 self.assertMatches('...You logged in...', self.browser.contents) 1423 # CO can see her roles 1424 self.browser.getLink("My Roles").click() 1425 self.assertMatches( 1426 '...<div>Academics Officer (view only)</div>...', 1427 self.browser.contents) 1428 # But not her local role ... 1429 self.assertFalse('Lecturer' in self.browser.contents) 1430 # ... because we forgot to notify the course that the local role 1431 # has changed 1432 notify(LocalRoleSetEvent( 1433 course, 'waeup.local.Lecturer', 'mrslecturer', granted=True)) 1434 self.browser.open('http://localhost/app/users/mrslecturer/my_roles') 1435 self.assertTrue('Lecturer' in self.browser.contents) 1436 self.assertMatches( 1437 '...<a href="http://localhost/app/faculties/fac1/dep1/courses/COURSE1">...', 1438 self.browser.contents) 1439 # The lecturer can go to her course 1440 self.browser.getLink( 1441 "http://localhost/app/faculties/fac1/dep1/courses/COURSE1").click() 1442 # and view the list of students 1443 self.browser.getLink("Show students").click() 1444 self.assertTrue('<th>Fullname</th>' in self.browser.contents) 1445 # No student in course so far 1446 self.assertFalse(self.student_id in self.browser.contents) 1447 studylevel = createObject(u'waeup.StudentStudyLevel') 1448 studylevel.level = 100 1449 self.student['studycourse'].addStudentStudyLevel( 1450 self.certificate, studylevel) 1451 # Now the student has registered the course and can 1452 # be seen by the lecturer. 1453 self.assertFalse(self.student_id in self.browser.contents) 1454 # XXX: So far the lecturer can neither access ths student ... 1455 self.assertRaises( 1456 Unauthorized, self.browser.open, self.student_path) 1457 # ... nor the respective course ticket since a 1458 # CourseTicketPrincipalRoleManager does not yet exist. 1459 self.assertTrue('COURSE1' in self.student['studycourse']['100'].keys()) 1460 course_ticket_path = self.student_path + '/studycourse/100/COURSE1' 1461 self.assertRaises( 1462 Unauthorized, self.browser.open, course_ticket_path) 1463 1408 1464 def test_change_current_mode(self): 1409 1465 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
Note: See TracChangeset for help on using the changeset viewer.