예제 #1
0
 def test_getPrerequisiteTree_not_found(self):
     '''
         Test that getPrerequisiteTree raises an exception if root course can't be found
     '''
     d = DescSearches()
     with self.assertRaises(Exception):
         d.getPrerequisiteTree(self.three_courses, "DNE*1234", None)
예제 #2
0
    def test_getPrerequisiteTree(self):
        '''
            Test that getPrerequisiteTree creates correct tree
        '''
        d = DescSearches()
        results = d.getPrerequisiteTree(self.three_courses, "CIS*3250", None)

        self.assertTrue(type(results['prerequisites'][0]['course']) is Course)
        self.assertTrue(results['prerequisites'][0]['course'].fullname() == "CIS*2250")
        self.assertTrue(len(results['prerequisites'][0]['prerequisites']) == 2)
        self.assertTrue(type(results['prerequisites'][0]['prerequisites'][0]['course']) is str)