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)
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)
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)
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)
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)
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)
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)