示例#1
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)
示例#2
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)
示例#3
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)
示例#4
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)
示例#5
0
 def test_drop_course(self):
     auth = Login(db)
     student = auth.get_user("KevinHowe", "Dv97BZ2j")
     drop_course_controller = DropCourseController(db, student)
     drop_course_controller.drop_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), 0)
示例#6
0
 def test_update_password(self):
     auth = Login(db)
     username = "******"
     password = "******"
     student = auth.get_user(username, password)
     token = auth.get_token(student.get_id())
     student.update_password("f8Ay8Qw7", student.get_id(), db)
     query = "SELECT password FROM credential "
     main_query = "WHERE username = '******' AND token = '{}';"
     query += main_query.format(username, token)
     result = db.execute_query(query)
     self.assertEqual(result[0][0], "f8Ay8Qw7")
示例#7
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)
示例#8
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)
示例#9
0
 def test_view_grades(self):
     auth = Login(db)
     student = auth.get_user("KevinHowe", "Dv97BZ2j")
     output = student.view_grades_and_status(db)
     print(output)