コード例 #1
0
 def test_current_quarter(self):
     auth = Login(db)
     student = auth.get_user("KevinHowe", "Dv97BZ2j")
     add_course_controller = AddCourseController(db, student)
     course_in_current_quarter = add_course_controller.check_current_quarter(
         5)
     self.assertEqual(course_in_current_quarter, False)
コード例 #2
0
 def test_time_conflict(self):
     auth = Login(db)
     student = auth.get_user("KevinHowe", "Dv97BZ2j")
     add_course_controller = AddCourseController(db, student)
     time_conflict1 = add_course_controller.time_conflict(30)
     self.assertEqual(time_conflict1, True)
     time_conflict2 = add_course_controller.time_conflict(19)
     self.assertEqual(time_conflict2, True)
コード例 #3
0
 def test_max_enrollment_reached(self):
     auth = Login(db)
     student = auth.get_user("KevinHowe", "Dv97BZ2j")
     add_course_controller = AddCourseController(db, student)
     add_course_controller.add_course(16)
     less_than_max_enrollment = add_course_controller.less_than_enrollment_limit(
         16)
     self.assertEqual(less_than_max_enrollment, False)
     drop_course_controller = DropCourseController(db, student)
     drop_course_controller.drop_course(16)
コード例 #4
0
 def test_add_course(self):
     auth = Login(db)
     student = auth.get_user("KevinHowe", "Dv97BZ2j")
     add_course_controller = AddCourseController(db, student)
     add_course_controller.add_course(7)
     query = "SELECT * FROM student_course "
     main_query = "WHERE course_id = {} AND UCID = {}"
     query += main_query.format(7, student.get_id())
     result = db.execute_query(query)
     self.assertEqual(len(result), 1)
コード例 #5
0
 def test_overload(self):
     auth = Login(db)
     student1 = auth.get_user("CalvinAndrews", "4l3PwMes")
     add_course_controller = AddCourseController(db, student1)
     overload = add_course_controller.overload_courses()
     self.assertEqual(overload, True)
     student2 = auth.get_user("JimmyDelacruz", "e8Ay8Qw7")
     add_course_controller = AddCourseController(db, student2)
     overload = add_course_controller.overload_courses()
     self.assertEqual(overload, False)
コード例 #6
0
 def test_course_already_added(self):
     auth = Login(db)
     student = auth.get_user("KevinHowe", "Dv97BZ2j")
     add_course_controller = AddCourseController(db, student)
     course_already_added = add_course_controller.course_already_added(7)
     self.assertEqual(course_already_added, True)
コード例 #7
0
 def test_has_restriction(self):
     auth = Login(db)
     student = auth.get_user("TroyBell", "9SR30UAy")
     add_course_controller = AddCourseController(db, student)
     has_restriction = add_course_controller.has_restriction()
     self.assertEqual(has_restriction, True)