Exemple #1
0
 def test_add_repeated_course(self):
     print(
         'test add a course that already exists to system with all valid input'
     )
     existingC = system.make_new_course("3", "blah", "80", "COMP2511")
     assert len(system.get_courses()) == 3  # system has 2 course already
     newC = system.make_new_course("3", "blah", "50", "COMP2521")
     assert len(system.get_courses()) == 3  # system has 2 course already
Exemple #2
0
 def test_empty_course_id(self):
     print('test make course with empty course id')
     with pytest.raises(Exception) as error:
         newCourse = system.make_new_course("1", "blah", "50", "")
         assert "Specify a valid course id!"
         assert len(
             system.get_courses()) == 1  # system already has 1 course
Exemple #3
0
 def test_empty_grade(self):
     print('test make course with empty grade')
     with pytest.raises(Exception) as error:
         newCourse = system.make_new_course("1", "blah", "", "COMP2521")
         assert "Specify a valid grade!"
         assert len(
             system.get_courses()) == 1  # system already has 1 course
Exemple #4
0
 def test_empty_difficulty(self):
     print('test make course with empty difficulty')
     with pytest.raises(Exception) as error:
         newCourse = system.make_new_course("", "blah", "50", "COMP2521")
         assert "Specify a valid difficulty!"
         assert len(
             system.get_courses()) == 1  # system already has 1 course
Exemple #5
0
 def test_invalid_grade(self):
     print('test invalid grade')
     with pytest.raises(Exception) as error:
         c1 = system.make_new_course("2", "blah", "agrkeh2014423",
                                     "COMP2521")
         assert "Grade must be an integer!"
         assert len(
             system.get_courses()) == 1  # system already has 1 course
         c2 = system.make_new_course("3", "blah", "auhgfd", "COMP2521")
         assert "Grade must be an integer!"
         assert len(
             system.get_courses()) == 1  # system already has 1 course
         c3 = system.make_new_course("3", "blah", "-1", "COMP2521")
         assert "Grade must be between 0 and 5 inclusive!"
         assert len(
             system.get_courses()) == 1  # system already has 1 course
         c4 = system.make_new_course("3", "blah", "6", "COMP2521")
         assert "Grade must be between 0 and 5 inclusive!"
         assert len(
             system.get_courses()) == 1  # system already has 1 course
Exemple #6
0
 def test_invalid_difficulty(self):
     print('test invalid difficulty')
     with pytest.raises(Exception) as error:
         c1 = system.make_new_course("agsdkgue91028", "blah", "50",
                                     "COMP2521")
         assert "Difficulty must be an integer!"
         assert len(
             system.get_open_sems()) == 1  # system already has 1 course
         c2 = system.make_new_course("jhkwblah", "blah", "50", "COMP2521")
         assert "Difficulty must be an integer!"
         assert len(
             system.get_courses()) == 1  # system already has 1 course
         c3 = system.make_new_course("-1", "blah", "50", "COMP2521")
         assert "Difficulty must be an integer!"
         assert len(
             system.get_courses()) == 1  # system already has 1 course
         c4 = system.make_new_course("6", "blah", "50", "COMP2521")
         assert "Difficulty must be an integer!"
         assert len(
             system.get_courses()) == 1  # system already has 1 course
Exemple #7
0
 def test_all_valid_input(self):
     print('test add a new course to system with all valid input')
     newC = system.make_new_course("3", "blah", "80", "COMP2521")
     assert len(system.get_courses()) == 2  # system has 1 course already