Index: main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py
===================================================================
--- main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py	(revision 9433)
+++ main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py	(revision 9504)
@@ -298,2 +298,76 @@
         self.assertEqual(error, u'Previous session payment not yet implemented.')
         return
+
+    def test_student_course_registration(self):
+
+        # Add more courses
+        self.course2 = createObject('waeup.Course')
+        self.course2.code = 'COURSE2'
+        self.course2.semester = 2
+        self.course2.credits = 10
+        self.course2.passmark = 40
+        self.app['faculties']['fac1']['dep1'].courses.addCourse(
+            self.course2)
+        self.app['faculties']['fac1']['dep1'].certificates['CERT1'].addCertCourse(
+            self.course2, level=100)
+        self.course3 = createObject('waeup.Course')
+        self.course3.code = 'COURSE3'
+        self.course3.semester = 3
+        self.course3.credits = 10
+        self.course3.passmark = 40
+        self.app['faculties']['fac1']['dep1'].courses.addCourse(
+            self.course3)
+        self.app['faculties']['fac1']['dep1'].certificates['CERT1'].addCertCourse(
+            self.course3, level=100)
+
+        # Login as student
+        self.browser.open(self.login_path)
+        IWorkflowState(self.student).setState('school fee paid')
+        self.browser.open(self.login_path)
+        self.browser.getControl(name="form.login").value = self.student_id
+        self.browser.getControl(name="form.password").value = 'spwd'
+        self.browser.getControl("Login").click()
+        # Students can add the current study level
+        self.browser.getLink("Study Course").click()
+        self.browser.getLink("Add course list").click()
+        self.assertMatches('...Add current level 100 (Year 1)...',
+                           self.browser.contents)
+        self.browser.getControl("Create course list now").click()
+        # Student has not paid second instalment, therefore a level
+        # with two course ticket was created (semester 1 and combined)
+        self.assertEqual(self.student['studycourse']['100'].number_of_tickets, 2)
+        self.browser.getLink("100").click()
+        self.browser.getLink("Edit course list").click()
+        self.browser.getControl("Add course ticket").click()
+        # Student can't add second semester course
+        self.assertTrue('<option value="COURSE1">' in self.browser.contents)
+        self.assertTrue('<option value="COURSE3">' in self.browser.contents)
+        self.assertFalse('<option value="COURSE2">' in self.browser.contents)
+
+        # Let's remove level and see what happens after 2nd instalment payment
+        del(self.student['studycourse']['100'])
+        payment2 = createObject('waeup.StudentOnlinePayment')
+        payment2.p_category = u'schoolfee_2'
+        payment2.p_session = self.student.current_session
+        self.student['payments']['anykey'] = payment2
+        self.browser.open(self.studycourse_path)
+        self.browser.getLink("Add course list").click()
+        self.browser.getControl("Create course list now").click()
+        # Still only 2 tickets have been created since payment ticket
+        # was not paid
+        self.assertEqual(self.student['studycourse']['100'].number_of_tickets, 2)
+        payment2.p_state = u'paid'
+        del(self.student['studycourse']['100'])
+        self.browser.open(self.studycourse_path)
+        self.browser.getLink("Add course list").click()
+        self.browser.getControl("Create course list now").click()
+        # Now 2nd semester course has been added
+        self.assertEqual(self.student['studycourse']['100'].number_of_tickets, 3)
+        # Student can add second semester course
+        self.browser.getLink("100").click()
+        self.browser.getLink("Edit course list").click()
+        self.browser.getControl("Add course ticket").click()
+        self.assertTrue('<option value="COURSE1">' in self.browser.contents)
+        self.assertTrue('<option value="COURSE2">' in self.browser.contents)
+        self.assertTrue('<option value="COURSE3">' in self.browser.contents)
+        return
