def test_add_course_already_exists(self): """ 020C - Course Already Exists """ test_course_1 = Course("ACIT2515", "123456", "CIT") test_course_1.add_student("A010000056") test_school = School("Computing and Academic Studies") self.assertEqual(test_school.get_num_courses(), 0, "School must have no courses") test_school.add_course(test_course_1) self.assertEqual(test_school.get_num_courses(), 1, "School must have 1 course") # Add the same course again test_school.add_course(test_course_1) self.assertEqual(test_school.get_num_courses(), 1, "School must still have only 1 course")
def test_add_course(self): """ 020A - Valid Add Course """ test_course_1 = Course("ACIT2515", "123456", "CIT") test_course_1.add_student("A010000056") test_course_2 = Course("COMP1510", "456321", "CST") test_course_2.add_student("A010000056") test_course_2.add_student("A010450012") test_school = School("Computing and Academic Studies") self.assertEqual(test_school.get_num_courses(), 0, "School must have no courses") test_school.add_course(test_course_1) self.assertEqual(test_school.get_num_courses(), 1, "School must have 1 course") test_school.add_course(test_course_2) self.assertEqual(test_school.get_num_courses(), 2, "School must have 2 courses")
def test_remove_non_existent_course(self): """ 040C - Invalid Remove Course Non-Existent """ test_course_1 = Course("ACIT2515", "123456", "CIT") test_course_1.add_student("A010000056") test_course_2 = Course("COMP1510", "456321", "CST") test_course_2.add_student("A010000056") test_course_2.add_student("A010450012") test_school = School("Computing and Academic Studies") test_school.add_course(test_course_1) test_school.add_course(test_course_2) self.assertEqual(test_school.get_num_courses(), 2, "School must have 2 courses") self.assertTrue(test_school.course_exists("ACIT2515")) self.assertTrue(test_school.course_exists("COMP1510")) test_school.remove_course("ACIT1234") self.assertEqual(test_school.get_num_courses(), 2, "School must have 2 courses")