def testSubscriptionRouteTable(self): r1f = [ ("R2Events1/ev1", "R2Source1/src1", self.R2) , ("R3Events1/ev1", "R3Source1/src1", self.R3) , ("R2Events/ev1", None, self.R2) , ("R3Events/ev1", None, self.R3) , (None, "R2Source/src1", self.R2) , (None, "R3Source/src1", self.R3) , ("RREvents2/ev1", "RRSource2/src1", self.R2) , ("RREvents3/ev1", "RRSource3/src1", self.R2) ] r1cmp = compareLists(self.R1.getRouteTable(),r1f) assert r1cmp == None, str(r1cmp) r2f = [ ("R1Events/ev1", None, self.R1) , ("R3Events/ev1", None, self.R1) , (None, "R1Source/src1", self.R1) , (None, "R3Source/src1", self.R1) , ("R1Events1/ev1", "R1Source1/src1", self.R1) , ("R3Events1/ev1", "R3Source1/src1", self.R1) , ("RREvents2/ev1", "RRSource2/src1", self.R1) , ("RREvents3/ev1", "RRSource3/src1", self.R3) ] r2cmp = compareLists(self.R2.getRouteTable(),r2f) assert r2cmp == None, str(r2cmp) r3f = [ ("R1Events/ev1", None, self.R1) , ("R2Events/ev1", None, self.R1) , (None, "R1Source/src1", self.R1) , (None, "R2Source/src1", self.R1) , ("R1Events1/ev1", "R1Source1/src1", self.R1) , ("R2Events1/ev1", "R2Source1/src1", self.R1) , ("RREvents3/ev1", "RRSource3/src1", self.R1) ] r3cmp = compareLists(self.R3.getRouteTable(),r3f) assert r3cmp == None, str(r3cmp) return
def testCollectShallow(self): files = CollectFiles(self.testpath,self.testpatt,recursive=False) expected = [ (self.testpath,"TestScanFiles1.txt") , (self.testpath,"TestScanFiles2.txt") ] c = compareLists(files, expected) assert c == None, "Wrong file list: "+repr(c)
def testCollectDirsShallow(self): dirs = CollectDirectoryContents(self.srcPath, baseDir=self.basePath, recursive=False) expected = [ "resources/TestScanDir1" , "resources/TestScanDir2" , "resources/TestScanFilesSubDir" ] c = compareLists(dirs, expected) assert c == None, "Wrong directory list: "+repr(c)
def testCollectRecursive(self): files = CollectFiles(self.testpath,self.testpatt) expected = [ (self.testpath,"TestScanFiles1.txt") , (self.testpath,"TestScanFiles2.txt") , (self.testpath+"TestScanFilesSubDir","TestScanFiles31.txt") , (self.testpath+"TestScanFilesSubDir","TestScanFiles32.txt") ] assert compareLists(files, expected) == None, "Wrong file list: "+repr(files)
def testCollectFilesShallow(self): dirs = CollectDirectoryContents(self.srcPath, baseDir=self.basePath, listDirs=False, listFiles=True, recursive=False) expected = [ "resources/TestDomHelpers.xml" , "resources/TestScanFiles1.txt" , "resources/TestScanFiles2.txt" ] c = compareLists(dirs, expected) assert c == None, "Wrong directory list: "+repr(c)
def testCollectRecursive(self): files = CollectFiles(self.testpath,self.testpatt) expected = [ (self.testpath,"TestScanFiles1.txt") , (self.testpath,"TestScanFiles2.txt") , (self.testpath+"TestScanFilesSubDir","TestScanFiles31.txt") , (self.testpath+"TestScanFilesSubDir","TestScanFiles32.txt") ] c = compareLists(files, expected) assert c == None, "Wrong file list: "+repr(c)
def testCollectDirsRecursiveEmptyBase(self): dirs = CollectDirectoryContents(self.srcPath, baseDir="") expected = [ self.basePath+"/resources/TestScanDir1" , self.basePath+"/resources/TestScanDir1/SubDir1a" , self.basePath+"/resources/TestScanDir1/SubDir1b" , self.basePath+"/resources/TestScanDir2" , self.basePath+"/resources/TestScanDir2/SubDir2" , self.basePath+"/resources/TestScanFilesSubDir" ] c = compareLists(dirs, expected) assert c == None, "Wrong directory list: "+repr(c)
def testCollectFilesRecursiveEmptyBase(self): dirs = CollectDirectoryContents(self.srcPath, baseDir="", listDirs=False, listFiles=True, recursive=True) expected = [ self.basePath+"/resources/TestDomHelpers.xml" , self.basePath+"/resources/TestScanFiles1.txt" , self.basePath+"/resources/TestScanFiles2.txt" , self.basePath+"/resources/TestScanFilesSubDir/TestScanFiles31.txt" , self.basePath+"/resources/TestScanFilesSubDir/TestScanFiles32.txt" ] c = compareLists(dirs, expected) assert c == None, "Wrong directory list: "+repr(c)
def testCollectRecursiveBaseEndswithSep(self): dirs = CollectDirectories(self.srcPath,self.basePath+"/") expected = [ "resources/TestScanDir1" , "resources/TestScanDir1/SubDir1a" , "resources/TestScanDir1/SubDir1b" , "resources/TestScanDir2" , "resources/TestScanDir2/SubDir2" , "resources/TestScanFilesSubDir" ] c = compareLists(dirs, expected) assert c == None, "Wrong directory list: "+repr(c)
def testCollectAllRecursiveBaseEndswithSep(self): dirs = CollectDirectoryContents(self.srcPath, baseDir=self.basePath+"/", listDirs=True, listFiles=True, recursive=True) expected = [ "resources/TestScanDir1" , "resources/TestScanDir1/SubDir1a" , "resources/TestScanDir1/SubDir1b" , "resources/TestScanDir2" , "resources/TestScanDir2/SubDir2" , "resources/TestScanFilesSubDir" , "resources/TestDomHelpers.xml" , "resources/TestScanFiles1.txt" , "resources/TestScanFiles2.txt" , "resources/TestScanFilesSubDir/TestScanFiles31.txt" , "resources/TestScanFilesSubDir/TestScanFiles32.txt" ] c = compareLists(dirs, expected) assert c == None, "Wrong directory list: "+repr(c)