Changeset 7218 for main/waeup.sirp/trunk/src
- Timestamp:
- 26 Nov 2011, 21:39:11 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py
r7205 r7218 368 368 return 369 369 370 def test_manage_access_wo_certificate(self): 371 # Managers can access studycourse even if student 372 # doesn't have a certificate 373 student = Student() 374 student.fullname = u'Lazy Student' 375 self.app['students'].addStudent(student) 376 student_id = student.student_id 370 def test_manage_remove_department(self): 371 # Lazy student is studying CERT1 372 lazystudent = Student() 373 lazystudent.fullname = u'Lazy Student' 374 self.app['students'].addStudent(lazystudent) 375 student_id = lazystudent.student_id 377 376 student_path = self.container_path + '/' + student_id 377 lazystudent['studycourse'].certificate = self.certificate 378 notify(grok.ObjectModifiedEvent(lazystudent)) 378 379 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 379 380 self.browser.open(student_path + '/studycourse') 381 self.assertTrue('CERT1' in self.browser.contents) 382 # After some years the department is removed 383 del self.app['faculties']['fac1']['dep1'] 384 # So CERT1 does no longer exist and lazy student's 385 # certificate reference is removed too 386 self.browser.open(student_path + '/studycourse') 380 387 self.assertEqual(self.browser.headers['Status'], '200 Ok') 381 388 self.assertEqual(self.browser.url, student_path + '/studycourse') 389 self.assertFalse('CERT1' in self.browser.contents) 382 390 self.assertMatches('...<div class="widget">Nothing</div>...', 383 391 self.browser.contents) … … 705 713 '...<a href="http://localhost/app/faculties/fac1/dep1">...', 706 714 self.browser.contents) 707 # CO can view the student 715 # CO can view the student ... 708 716 self.browser.open(self.clearance_student_path) 709 717 self.assertEqual(self.browser.headers['Status'], '200 Ok') 710 718 self.assertEqual(self.browser.url, self.clearance_student_path) 719 # ... but not other students 720 other_student = Student() 721 other_student.fullname = u'Dep2 Student' 722 self.app['students'].addStudent(other_student) 723 other_student_path = ( 724 'http://localhost/app/students/%s' % other_student.student_id) 725 self.assertRaises( 726 Unauthorized, self.browser.open, other_student_path) 711 727 # Only in state clearance requested the CO does see the 'Clear' button 728 self.browser.open(self.clearance_student_path) 712 729 self.assertFalse('Clear student' in self.browser.contents) 713 730 IWorkflowInfo(self.student).fireTransition('request_clearance') … … 733 750 self.assertTrue('Student is in the wrong state' 734 751 in self.browser.contents) 752 # The CO can go to his department throug the my_roles page 753 self.browser.open('http://localhost/app/users/mrclear/my_roles') 754 self.browser.getLink("http://localhost/app/faculties/fac1/dep1").click() 755 # and view the list of students 756 self.browser.getLink("Show students").click() 757 self.assertTrue(self.student_id in self.browser.contents) 735 758 736 759 def test_student_change_password(self):
Note: See TracChangeset for help on using the changeset viewer.