Exemplo n.º 1
0
	def test_getNewTempFolder(self):
		'''Test the getNewTempFolder method'''
		
		# test without any input
		firstFolderPath = tempFolderManager.getNewTempFolder()
		self.assertTrue(firstFolderPath is not None, 'Called with no options getNewTempFolder gave back None')
		self.assertTrue(os.path.isdir(firstFolderPath), 'Called with no options getNewTempFolder returned a string that was not a path to an existing folder: ' + str(firstFolderPath))
		self.assertTrue(tempFolderManager.getManagedPathForPath(firstFolderPath) is not None, 'Called with no options getNewTempFolder returned a path that was not in any managed path (according to getManagedPathForPath): ' + firstFolderPath)
		
		# test with the parent folder option
		secondParentFolder = tempfile.mkdtemp(dir='/tmp')
		secondFolderPath = tempFolderManager.getNewTempFolder(parentFolder=secondParentFolder)
		self.assertTrue(secondFolderPath is not None, 'Called with a parent folder getNewTempFolder gave back None')
		self.assertTrue(os.path.isdir(secondFolderPath), 'Called with a parent folder getNewTempFolder returned a string that was not a path to an existing folder: ' + str(secondFolderPath))
		self.assertTrue(secondFolderPath.startswith(pathHelpers.normalizePath(secondParentFolder, followSymlink=True)), 'Called with a parent folder (%s) getNewTempFolder returned a path not in the parent folder: %s' % (secondParentFolder, secondFolderPath))
		self.assertTrue(tempFolderManager.getManagedPathForPath(secondFolderPath) is not None, 'Called with a parent folder getNewTempFolder returned a path that was not in any managed path (according to getManagedPathForPath): ' + secondFolderPath)
		
		# test with the prefix option
		prefixOption = "thisIsATest"
		thirdFolderPath = tempFolderManager.getNewTempFolder(prefix=prefixOption)
		self.assertTrue(thirdFolderPath is not None, 'Called with the prefix option (%s) getNewTempFolder gave back None' % prefixOption)
		self.assertTrue(os.path.isdir(thirdFolderPath), 'Called with the prefix option (%s) getNewTempFolder returned a string that was not a path to an existing folder: %s' % (prefixOption, str(thirdFolderPath)))
		self.assertTrue(os.path.basename(thirdFolderPath).startswith(prefixOption), 'Called with the prefix option (%s) getNewTempFolder returned a path not in the parent folder: %s' % (prefixOption, thirdFolderPath))
		self.assertTrue(tempFolderManager.getManagedPathForPath(secondFolderPath) is not None, 'Called with the prefix option (%s) getNewTempFolder returned a path that was not in any managed path (according to getManagedPathForPath): %s' % (prefixOption, thirdFolderPath))
		
		# call cleanupAtExit to clear everything
		tempFolderManager.cleanupForExit()
		
		# verify that the folders dissapeared
		self.assertFalse(os.path.exists(firstFolderPath), 'After being created with getNewTempFolder using no options the folder path was not cleaned properly by cleanupForExit: ' + firstFolderPath)
		self.assertFalse(os.path.exists(secondFolderPath), 'After being created with getNewTempFolder using the parent folder the folder optionthe path was not cleaned properly by cleanupForExit: ' + secondFolderPath)
		self.assertFalse(os.path.exists(thirdFolderPath), 'After being created with getNewTempFolder using the prefix option (%s) the folder path was not cleaned properly by cleanupForExit: %s' % (prefixOption, thirdFolderPath))
		
		# remove the tempdir we made for the parent folder test
		shutil.rmtree(secondParentFolder)
Exemplo n.º 2
0
	def test_singleSourceSetup(self):
		'''Test setting up a single source folder'''
		
		# setup the cache folder so that we can do tests
		cacheFolderPath = tempFolderManager.getNewTempFolder()
		cacheController.setCacheFolder(cacheFolderPath)
		
		sourceFolderPath = tempFolderManager.getNewTempFolder()
		
		# sanity check that it was not already somehow the source folders already
		self.assertFalse(sourceFolderPath in cacheController.sourceFolders, 'The new sourceFolder was found in the sourceFodlers variable too soon')
		self.assertNotEqual(sourceFolderPath, cacheController.writeableCacheFolder, 'The new sourceFolder should not be the selected cache folder')
		
		# check that adding the source folder results in it being actually added
		cacheController.addSourceFolders(sourceFolderPath)
		self.assertTrue(sourceFolderPath in cacheController.sourceFolders, 'After being added with addSourceFolders the test source path was not in the sourceFolders vaiable')
		self.assertTrue(sourceFolderPath in cacheController.getSourceFolders(), 'After being added with addSourceFolders the test source path was not in the getSourceFolders output')
		
		# check that this has not affected the cache folder setting
		self.assertEqual(cacheFolderPath, cacheController.getCacheFolder(), 'After adding a source folder the cache folder should not change')
		
		# remove the source folder, and check to make sure it is removed
		cacheController.removeSourceFolders(sourceFolderPath)
		self.assertFalse(sourceFolderPath in cacheController.sourceFolders, 'After calling removeSourceFolder the source folder was still in the sourceFolders list')
		
		# cleanup
		cacheController.removeCacheFolder()
		cacheController.removeSourceFolders(cacheFolderPath)
		tempFolderManager.cleanupItem(cacheFolderPath)
		tempFolderManager.cleanupItem(sourceFolderPath)
Exemplo n.º 3
0
	def test_multipleSourceSetup(self):
		'''Test setting up multiple source folders'''
		
		# setup the cache folder so that we can do tests
		cacheFolderPath = tempFolderManager.getNewTempFolder()
		cacheController.setCacheFolder(cacheFolderPath)
		
		firstSourceFolderPath	= tempFolderManager.getNewTempFolder()
		secondSourceFolderPath	= tempFolderManager.getNewTempFolder()
		thirdSourceFolderPath	= tempFolderManager.getNewTempFolder()
		
		# add the first two items and confirm they are there
		cacheController.addSourceFolders([firstSourceFolderPath, secondSourceFolderPath])
		
		self.assertTrue(firstSourceFolderPath in cacheController.sourceFolders, 'After being added with addSourceFolders the first test source path was not in the sourceFolders vaiable')
		self.assertTrue(firstSourceFolderPath in cacheController.getSourceFolders(), 'After being added with addSourceFolders the first test source path was not in the getSourceFolders output')
		
		self.assertTrue(secondSourceFolderPath in cacheController.sourceFolders, 'After being added with addSourceFolders the second test source path was not in the sourceFolders vaiable')
		self.assertTrue(secondSourceFolderPath in cacheController.getSourceFolders(), 'After being added with addSourceFolders the second test source path was not in the getSourceFolders output')
		
		# add the third item, verifying that all three are there
		cacheController.addSourceFolders(thirdSourceFolderPath)
		
		self.assertTrue(firstSourceFolderPath in cacheController.sourceFolders, 'After adding the third source item with addSourceFolders the first test source path was not in the sourceFolders vaiable')
		self.assertTrue(firstSourceFolderPath in cacheController.getSourceFolders(), 'After adding the third source item with addSourceFolders the first test source path was not in the getSourceFolders output')
		
		self.assertTrue(secondSourceFolderPath in cacheController.sourceFolders, 'After adding the third source item with addSourceFolders the second test source path was not in the sourceFolders vaiable')
		self.assertTrue(secondSourceFolderPath in cacheController.getSourceFolders(), 'After adding the third source item with addSourceFolders the second test source path was not in the getSourceFolders output')
		
		self.assertTrue(thirdSourceFolderPath in cacheController.sourceFolders, 'After adding the third source item with addSourceFolders the third test source path was not in the sourceFolders vaiable')
		self.assertTrue(thirdSourceFolderPath in cacheController.getSourceFolders(), 'After adding the third source item with addSourceFolders the third test source path was not in the getSourceFolders output')
		
		# remove the second item, and verify that it is removed, and the other two still there
		cacheController.removeSourceFolders(secondSourceFolderPath)
		
		self.assertFalse(secondSourceFolderPath in cacheController.sourceFolders, 'After removing the second source item with removeSourceFolders the second test source path was still in the sourceFolders vaiable')
		self.assertFalse(secondSourceFolderPath in cacheController.getSourceFolders(), 'After removing the second source item with removeSourceFolders the second test source path was still in the getSourceFolders output')
				
		self.assertTrue(firstSourceFolderPath in cacheController.sourceFolders, 'After removing the second source item with removeSourceFolders the first test source path was not in the sourceFolders vaiable')
		self.assertTrue(firstSourceFolderPath in cacheController.getSourceFolders(), 'After removing the second source item with removeSourceFolders the first test source path was not in the getSourceFolders output')
		
		self.assertTrue(thirdSourceFolderPath in cacheController.sourceFolders, 'After removing the second source item with removeSourceFolders the third test source path was not in the sourceFolders vaiable')
		self.assertTrue(thirdSourceFolderPath in cacheController.getSourceFolders(), 'After removing the second source item with removeSourceFolders the third test source path was not in the getSourceFolders output')
		
		# remove the two remaining items and verify that they are gone
		cacheController.removeSourceFolders([firstSourceFolderPath, thirdSourceFolderPath])
		
		self.assertFalse(firstSourceFolderPath in cacheController.sourceFolders, 'After removing the first and third source item with removeSourceFolders the first test source path was still in the sourceFolders vaiable')
		self.assertFalse(secondSourceFolderPath in cacheController.sourceFolders, 'After removing the first and third source item with removeSourceFolders the second test source path was still in the sourceFolders vaiable')
		self.assertFalse(thirdSourceFolderPath in cacheController.sourceFolders, 'After removing the first and third source item with removeSourceFolders the third test source path was still in the sourceFolders vaiable')
		
		# cleanup
		cacheController.removeCacheFolder()
		cacheController.removeSourceFolders(cacheFolderPath)
		tempFolderManager.cleanupItem(cacheFolderPath)
		
		tempFolderManager.cleanupItem(firstSourceFolderPath)
		tempFolderManager.cleanupItem(secondSourceFolderPath)
		tempFolderManager.cleanupItem(thirdSourceFolderPath)
Exemplo n.º 4
0
	def test_noPermissions(self):
		'''Items should be cleaned up, even if their permissions don't allow it'''
		
		# create and test an unwriteable folder
		unwriteableFolder = tempFolderManager.getNewTempFolder()
		os.chmod(unwriteableFolder, 0)
		tempFolderManager.cleanupItem(unwriteableFolder)
		self.assertFalse(os.path.exists(unwriteableFolder), 'After cleanupForExit the unwriteable folder should have been cleaned away')
		
		# create and test an unwriteable file
		testFolder = tempFolderManager.getNewTempFolder()
		open(os.path.join(testFolder, 'unwriteableFile'), 'w').close()
		os.chmod(os.path.join(testFolder, 'unwriteableFile'), 0)
		tempFolderManager.cleanupItem(testFolder)
		self.assertFalse(os.path.exists(os.path.join(testFolder, 'unwriteableFile')), 'After cleanupForExit the unwriteable file should have been cleaned away')
Exemplo n.º 5
0
    def test_stderr(self):
        '''Make sure that stderr is being properly returned'''

        # setup a folder to then test on (so things are predictable)
        outerFolder = tempFolderManager.getNewTempFolder()
        testFile = open(os.path.join(outerFolder, "testItem"), "w")
        testFile.close()

        command = ["/bin/ls " + outerFolder + " 1>&2"]
        process = managedSubprocess(command, shell=True)

        self.assertTrue(
            hasattr(process, 'stderr') and process.stderr is not None,
            'managedSubprocess did not have a stderr item when it should have')
        result = process.stderr.read()
        expectedResult = "testItem\n"
        self.assertTrue(
            isinstance(process.stderrLen, int),
            'managedSubprocess should have had an integer value for stderrLen, rather it had: '
            + str(process.stderrLen))
        self.assertEqual(
            len(expectedResult), process.stderrLen,
            'managedSubprocess should have had a length of %i for stdoutLen, rather it had a length of %i: %s'
            % (len(expectedResult), process.stderrLen, result))
        self.assertEqual(
            result, expectedResult,
            'managedSubprocess did not return the correct stderr for process "%s". Got "%s" rather than "%s"'
            % (" ".join(command), result, expectedResult))
Exemplo n.º 6
0
    def test_singleSourceSetup(self):
        '''Test setting up a single source folder'''

        # setup the cache folder so that we can do tests
        cacheFolderPath = tempFolderManager.getNewTempFolder()
        cacheController.setCacheFolder(cacheFolderPath)

        sourceFolderPath = tempFolderManager.getNewTempFolder()

        # sanity check that it was not already somehow the source folders already
        self.assertFalse(
            sourceFolderPath in cacheController.sourceFolders,
            'The new sourceFolder was found in the sourceFodlers variable too soon'
        )
        self.assertNotEqual(
            sourceFolderPath, cacheController.writeableCacheFolder,
            'The new sourceFolder should not be the selected cache folder')

        # check that adding the source folder results in it being actually added
        cacheController.addSourceFolders(sourceFolderPath)
        self.assertTrue(
            sourceFolderPath in cacheController.sourceFolders,
            'After being added with addSourceFolders the test source path was not in the sourceFolders vaiable'
        )
        self.assertTrue(
            sourceFolderPath in cacheController.getSourceFolders(),
            'After being added with addSourceFolders the test source path was not in the getSourceFolders output'
        )

        # check that this has not affected the cache folder setting
        self.assertEqual(
            cacheFolderPath, cacheController.getCacheFolder(),
            'After adding a source folder the cache folder should not change')

        # remove the source folder, and check to make sure it is removed
        cacheController.removeSourceFolders(sourceFolderPath)
        self.assertFalse(
            sourceFolderPath in cacheController.sourceFolders,
            'After calling removeSourceFolder the source folder was still in the sourceFolders list'
        )

        # cleanup
        cacheController.removeCacheFolder()
        cacheController.removeSourceFolders(cacheFolderPath)
        tempFolderManager.cleanupItem(cacheFolderPath)
        tempFolderManager.cleanupItem(sourceFolderPath)
Exemplo n.º 7
0
	def setUp(self):
		# setup a folder to hold our temporary items
		self.sampleFolder = tempFolderManager.getNewTempFolder()
		
		# sample file consisting of the letter 'a' four hundred times
		myFile = open(os.path.join(self.sampleFolder, 'aFile'), 'w')
		myFile.write("a" * 400)
		myFile.close()
		self.sampleFiles.append({
			'filePath' : os.path.join(self.sampleFolder, 'aFile'),
			'description' : 'a file containing the letter "a" 400 times',
			'sha1' : 'f475597b627a4d580ec1619a94c7afb9cc75abe4',
			'md5' : 'f4347bb35af679911623327c74b7d732'
		})
		
		# an empty file
		open(os.path.join(self.sampleFolder, 'emptyFile'), 'w').close()
		self.sampleFiles.append({
			'filePath' : os.path.join(self.sampleFolder, 'emptyFile'),
			'description' : 'an empty file',
			'sha1' : 'da39a3ee5e6b4b0d3255bfef95601890afd80709',
			'md5' : 'd41d8cd98f00b204e9800998ecf8427e'
		})
		
		# a subfolder
		os.mkdir(os.path.join(self.sampleFolder, 'simpleSubfolder'))
		self.sampleFiles.append({
			'filePath' : os.path.join(self.sampleFolder, 'simpleSubfolder'),
			'description' : 'a folder containing a single file',
			'sha1' : '004073ec84557678eb540cbefdacbbd932a7dd98',
			'md5' : '353c93582c0b3443f37fad4d498a58f1'
		})
		
		# file with spaces and symbols in the name, and the word "firetruck" 15 times
		myFile = open(os.path.join(self.sampleFolder, 'simpleSubfolder', 's % # ! \'*'), 'w')
		myFile.write("firetruck" * 150)
		myFile.close()
		self.sampleFiles.append({
			'filePath' : os.path.join(self.sampleFolder, 'simpleSubfolder', 's % # ! \'*'),
			'description' : 'file with spaces and symbols in the name',
			'sha1' : '02df49b807e866b7e5aa6fa93e8955f1b3bf4412',
			'md5' : '756078a54cb863d9ce834c857b836e8b'
		})
		
		# folder with a symlink in it
		os.mkdir(os.path.join(self.sampleFolder, 'folderContainingSymlink'))
		os.symlink('badSymlinkTarget', os.path.join(self.sampleFolder, 'folderContainingSymlink', 'badSymlink'))
		self.sampleFiles.append({
			'filePath' : os.path.join(self.sampleFolder, 'folderContainingSymlink'),
			'description' : 'symlink to the folder simpleSubfolder',
			'sha1' : '0750b25b8e0b817fb886166b6a9246db6e715914',
			'md5' : '63f025923ee362d59c81ecdd9e89a650'
		})
Exemplo n.º 8
0
    def test_noPermissions(self):
        '''Items should be cleaned up, even if their permissions don't allow it'''

        # create and test an unwriteable folder
        unwriteableFolder = tempFolderManager.getNewTempFolder()
        os.chmod(unwriteableFolder, 0)
        tempFolderManager.cleanupItem(unwriteableFolder)
        self.assertFalse(
            os.path.exists(unwriteableFolder),
            'After cleanupForExit the unwriteable folder should have been cleaned away'
        )

        # create and test an unwriteable file
        testFolder = tempFolderManager.getNewTempFolder()
        open(os.path.join(testFolder, 'unwriteableFile'), 'w').close()
        os.chmod(os.path.join(testFolder, 'unwriteableFile'), 0)
        tempFolderManager.cleanupItem(testFolder)
        self.assertFalse(
            os.path.exists(os.path.join(testFolder, 'unwriteableFile')),
            'After cleanupForExit the unwriteable file should have been cleaned away'
        )
Exemplo n.º 9
0
	def test_cacheSetup_negative(self):
		'''Test that the cacheSetup method errors out when it is supposed to'''
		
		# absolutely bad input
		self.assertRaises(ValueError, cacheController.setCacheFolder, None)
		self.assertRaises(ValueError, cacheController.setCacheFolder, [])
		self.assertRaises(ValueError, cacheController.setCacheFolder, '/bin/ls') # Not a folder
		
		if os.getuid() != 0: # this test is meaningless for root
		
			# a folder that is not writeable
			unwriteableFolder = tempFolderManager.getNewTempFolder()
			os.chmod(unwriteableFolder, 0)
			self.assertRaises(ValueError, cacheController.setCacheFolder, unwriteableFolder)
Exemplo n.º 10
0
    def test_cacheSetup(self):
        '''Test setting up cache folder'''

        cacheFolderPath = tempFolderManager.getNewTempFolder()

        # sanity check that it was not already somehow the cache and source folders already
        self.assertNotEqual(
            cacheFolderPath, cacheController.writeableCacheFolder,
            'The cache folder to be used for testing was already set: ' +
            str(cacheFolderPath))
        self.assertFalse(
            cacheFolderPath in cacheController.sourceFolders,
            'The new cache folder was somehow already in the source folder set: '
            + str(cacheFolderPath))

        # check that adding a folder adds it to the inside
        cacheController.setCacheFolder(cacheFolderPath)
        self.assertEqual(
            cacheFolderPath, cacheController.writeableCacheFolder,
            'Using setCacheFolder did not result in the cache folder being set in the class'
        )
        self.assertEqual(
            cacheFolderPath, cacheController.getCacheFolder(),
            'Using setCacheFolder did not result in the item the ouput of getCacheFolder: '
            + str(cacheController.getCacheFolder()))

        # check that this got added to the sourceFolders as well
        self.assertTrue(
            cacheFolderPath in cacheController.sourceFolders,
            'When selecting a cacheFolder it should automatically be added to the sourcefolder list, but was not'
        )
        self.assertTrue(
            cacheFolderPath in cacheController.getSourceFolders(),
            'When selecting a cacheFolder it should automatically be added to the getSourceFolders output, but was not'
        )

        # remove the setting, and test to see that it is removed from everywhere
        cacheController.removeCacheFolder()
        self.assertEqual(
            cacheController.writeableCacheFolder, None,
            'After calling removeCacheFolder the cache folder variable was still set'
        )
        self.assertRaises(RuntimeWarning, cacheController.getCacheFolder)

        self.assertFalse(
            cacheFolderPath in cacheController.sourceFolders,
            'After calling removeCacheFolder the cache folder should not be in the sourceFolders list'
        )
Exemplo n.º 11
0
    def test_cacheSetup_negative(self):
        '''Test that the cacheSetup method errors out when it is supposed to'''

        # absolutely bad input
        self.assertRaises(ValueError, cacheController.setCacheFolder, None)
        self.assertRaises(ValueError, cacheController.setCacheFolder, [])
        self.assertRaises(ValueError, cacheController.setCacheFolder,
                          '/bin/ls')  # Not a folder

        if os.getuid() != 0:  # this test is meaningless for root

            # a folder that is not writeable
            unwriteableFolder = tempFolderManager.getNewTempFolder()
            os.chmod(unwriteableFolder, 0)
            self.assertRaises(ValueError, cacheController.setCacheFolder,
                              unwriteableFolder)
Exemplo n.º 12
0
	def test_stderr(self):
		'''Make sure that stderr is being properly returned'''
		
		# setup a folder to then test on (so things are predictable)
		outerFolder = tempFolderManager.getNewTempFolder()
		testFile = open(os.path.join(outerFolder, "testItem"), "w")
		testFile.close()
		
		command = ["/bin/ls " + outerFolder + " 1>&2"]
		process = managedSubprocess(command, shell=True)
		
		self.assertTrue(hasattr(process, 'stderr') and process.stderr is not None, 'managedSubprocess did not have a stderr item when it should have')
		result = process.stderr.read()
		expectedResult = "testItem\n"
		self.assertTrue(isinstance(process.stderrLen, int), 'managedSubprocess should have had an integer value for stderrLen, rather it had: ' + str(process.stderrLen))
		self.assertEqual(len(expectedResult), process.stderrLen, 'managedSubprocess should have had a length of %i for stdoutLen, rather it had a length of %i: %s' % (len(expectedResult), process.stderrLen, result))
		self.assertEqual(result, expectedResult, 'managedSubprocess did not return the correct stderr for process "%s". Got "%s" rather than "%s"' % (" ".join(command), result, expectedResult))
Exemplo n.º 13
0
	def test_cacheSetup(self):
		'''Test setting up cache folder'''
		
		cacheFolderPath = tempFolderManager.getNewTempFolder()
		
		# sanity check that it was not already somehow the cache and source folders already
		self.assertNotEqual(cacheFolderPath, cacheController.writeableCacheFolder, 'The cache folder to be used for testing was already set: ' + str(cacheFolderPath))
		self.assertFalse(cacheFolderPath in cacheController.sourceFolders, 'The new cache folder was somehow already in the source folder set: ' + str(cacheFolderPath))
		
		# check that adding a folder adds it to the inside 
		cacheController.setCacheFolder(cacheFolderPath)
		self.assertEqual(cacheFolderPath, cacheController.writeableCacheFolder, 'Using setCacheFolder did not result in the cache folder being set in the class')
		self.assertEqual(cacheFolderPath, cacheController.getCacheFolder(), 'Using setCacheFolder did not result in the item the ouput of getCacheFolder: ' + str(cacheController.getCacheFolder()))
		
		# check that this got added to the sourceFolders as well
		self.assertTrue(cacheFolderPath in cacheController.sourceFolders, 'When selecting a cacheFolder it should automatically be added to the sourcefolder list, but was not')
		self.assertTrue(cacheFolderPath in cacheController.getSourceFolders(), 'When selecting a cacheFolder it should automatically be added to the getSourceFolders output, but was not')
		
		# remove the setting, and test to see that it is removed from everywhere
		cacheController.removeCacheFolder()
		self.assertEqual(cacheController.writeableCacheFolder, None, 'After calling removeCacheFolder the cache folder variable was still set')
		self.assertRaises(RuntimeWarning, cacheController.getCacheFolder)
		
		self.assertFalse(cacheFolderPath in cacheController.sourceFolders, 'After calling removeCacheFolder the cache folder should not be in the sourceFolders list')
Exemplo n.º 14
0
    def test_multipleSourceSetup(self):
        '''Test setting up multiple source folders'''

        # setup the cache folder so that we can do tests
        cacheFolderPath = tempFolderManager.getNewTempFolder()
        cacheController.setCacheFolder(cacheFolderPath)

        firstSourceFolderPath = tempFolderManager.getNewTempFolder()
        secondSourceFolderPath = tempFolderManager.getNewTempFolder()
        thirdSourceFolderPath = tempFolderManager.getNewTempFolder()

        # add the first two items and confirm they are there
        cacheController.addSourceFolders(
            [firstSourceFolderPath, secondSourceFolderPath])

        self.assertTrue(
            firstSourceFolderPath in cacheController.sourceFolders,
            'After being added with addSourceFolders the first test source path was not in the sourceFolders vaiable'
        )
        self.assertTrue(
            firstSourceFolderPath in cacheController.getSourceFolders(),
            'After being added with addSourceFolders the first test source path was not in the getSourceFolders output'
        )

        self.assertTrue(
            secondSourceFolderPath in cacheController.sourceFolders,
            'After being added with addSourceFolders the second test source path was not in the sourceFolders vaiable'
        )
        self.assertTrue(
            secondSourceFolderPath in cacheController.getSourceFolders(),
            'After being added with addSourceFolders the second test source path was not in the getSourceFolders output'
        )

        # add the third item, verifying that all three are there
        cacheController.addSourceFolders(thirdSourceFolderPath)

        self.assertTrue(
            firstSourceFolderPath in cacheController.sourceFolders,
            'After adding the third source item with addSourceFolders the first test source path was not in the sourceFolders vaiable'
        )
        self.assertTrue(
            firstSourceFolderPath in cacheController.getSourceFolders(),
            'After adding the third source item with addSourceFolders the first test source path was not in the getSourceFolders output'
        )

        self.assertTrue(
            secondSourceFolderPath in cacheController.sourceFolders,
            'After adding the third source item with addSourceFolders the second test source path was not in the sourceFolders vaiable'
        )
        self.assertTrue(
            secondSourceFolderPath in cacheController.getSourceFolders(),
            'After adding the third source item with addSourceFolders the second test source path was not in the getSourceFolders output'
        )

        self.assertTrue(
            thirdSourceFolderPath in cacheController.sourceFolders,
            'After adding the third source item with addSourceFolders the third test source path was not in the sourceFolders vaiable'
        )
        self.assertTrue(
            thirdSourceFolderPath in cacheController.getSourceFolders(),
            'After adding the third source item with addSourceFolders the third test source path was not in the getSourceFolders output'
        )

        # remove the second item, and verify that it is removed, and the other two still there
        cacheController.removeSourceFolders(secondSourceFolderPath)

        self.assertFalse(
            secondSourceFolderPath in cacheController.sourceFolders,
            'After removing the second source item with removeSourceFolders the second test source path was still in the sourceFolders vaiable'
        )
        self.assertFalse(
            secondSourceFolderPath in cacheController.getSourceFolders(),
            'After removing the second source item with removeSourceFolders the second test source path was still in the getSourceFolders output'
        )

        self.assertTrue(
            firstSourceFolderPath in cacheController.sourceFolders,
            'After removing the second source item with removeSourceFolders the first test source path was not in the sourceFolders vaiable'
        )
        self.assertTrue(
            firstSourceFolderPath in cacheController.getSourceFolders(),
            'After removing the second source item with removeSourceFolders the first test source path was not in the getSourceFolders output'
        )

        self.assertTrue(
            thirdSourceFolderPath in cacheController.sourceFolders,
            'After removing the second source item with removeSourceFolders the third test source path was not in the sourceFolders vaiable'
        )
        self.assertTrue(
            thirdSourceFolderPath in cacheController.getSourceFolders(),
            'After removing the second source item with removeSourceFolders the third test source path was not in the getSourceFolders output'
        )

        # remove the two remaining items and verify that they are gone
        cacheController.removeSourceFolders(
            [firstSourceFolderPath, thirdSourceFolderPath])

        self.assertFalse(
            firstSourceFolderPath in cacheController.sourceFolders,
            'After removing the first and third source item with removeSourceFolders the first test source path was still in the sourceFolders vaiable'
        )
        self.assertFalse(
            secondSourceFolderPath in cacheController.sourceFolders,
            'After removing the first and third source item with removeSourceFolders the second test source path was still in the sourceFolders vaiable'
        )
        self.assertFalse(
            thirdSourceFolderPath in cacheController.sourceFolders,
            'After removing the first and third source item with removeSourceFolders the third test source path was still in the sourceFolders vaiable'
        )

        # cleanup
        cacheController.removeCacheFolder()
        cacheController.removeSourceFolders(cacheFolderPath)
        tempFolderManager.cleanupItem(cacheFolderPath)

        tempFolderManager.cleanupItem(firstSourceFolderPath)
        tempFolderManager.cleanupItem(secondSourceFolderPath)
        tempFolderManager.cleanupItem(thirdSourceFolderPath)
Exemplo n.º 15
0
    def test_getNewTempFolder(self):
        '''Test the getNewTempFolder method'''

        # test without any input
        firstFolderPath = tempFolderManager.getNewTempFolder()
        self.assertTrue(
            firstFolderPath is not None,
            'Called with no options getNewTempFolder gave back None')
        self.assertTrue(
            os.path.isdir(firstFolderPath),
            'Called with no options getNewTempFolder returned a string that was not a path to an existing folder: '
            + str(firstFolderPath))
        self.assertTrue(
            tempFolderManager.getManagedPathForPath(firstFolderPath)
            is not None,
            'Called with no options getNewTempFolder returned a path that was not in any managed path (according to getManagedPathForPath): '
            + firstFolderPath)

        # test with the parent folder option
        secondParentFolder = tempfile.mkdtemp(dir='/tmp')
        secondFolderPath = tempFolderManager.getNewTempFolder(
            parentFolder=secondParentFolder)
        self.assertTrue(
            secondFolderPath is not None,
            'Called with a parent folder getNewTempFolder gave back None')
        self.assertTrue(
            os.path.isdir(secondFolderPath),
            'Called with a parent folder getNewTempFolder returned a string that was not a path to an existing folder: '
            + str(secondFolderPath))
        self.assertTrue(
            secondFolderPath.startswith(
                pathHelpers.normalizePath(secondParentFolder,
                                          followSymlink=True)),
            'Called with a parent folder (%s) getNewTempFolder returned a path not in the parent folder: %s'
            % (secondParentFolder, secondFolderPath))
        self.assertTrue(
            tempFolderManager.getManagedPathForPath(secondFolderPath)
            is not None,
            'Called with a parent folder getNewTempFolder returned a path that was not in any managed path (according to getManagedPathForPath): '
            + secondFolderPath)

        # test with the prefix option
        prefixOption = "thisIsATest"
        thirdFolderPath = tempFolderManager.getNewTempFolder(
            prefix=prefixOption)
        self.assertTrue(
            thirdFolderPath is not None,
            'Called with the prefix option (%s) getNewTempFolder gave back None'
            % prefixOption)
        self.assertTrue(
            os.path.isdir(thirdFolderPath),
            'Called with the prefix option (%s) getNewTempFolder returned a string that was not a path to an existing folder: %s'
            % (prefixOption, str(thirdFolderPath)))
        self.assertTrue(
            os.path.basename(thirdFolderPath).startswith(prefixOption),
            'Called with the prefix option (%s) getNewTempFolder returned a path not in the parent folder: %s'
            % (prefixOption, thirdFolderPath))
        self.assertTrue(
            tempFolderManager.getManagedPathForPath(secondFolderPath)
            is not None,
            'Called with the prefix option (%s) getNewTempFolder returned a path that was not in any managed path (according to getManagedPathForPath): %s'
            % (prefixOption, thirdFolderPath))

        # call cleanupAtExit to clear everything
        tempFolderManager.cleanupForExit()

        # verify that the folders dissapeared
        self.assertFalse(
            os.path.exists(firstFolderPath),
            'After being created with getNewTempFolder using no options the folder path was not cleaned properly by cleanupForExit: '
            + firstFolderPath)
        self.assertFalse(
            os.path.exists(secondFolderPath),
            'After being created with getNewTempFolder using the parent folder the folder optionthe path was not cleaned properly by cleanupForExit: '
            + secondFolderPath)
        self.assertFalse(
            os.path.exists(thirdFolderPath),
            'After being created with getNewTempFolder using the prefix option (%s) the folder path was not cleaned properly by cleanupForExit: %s'
            % (prefixOption, thirdFolderPath))

        # remove the tempdir we made for the parent folder test
        shutil.rmtree(secondParentFolder)
Exemplo n.º 16
0
    def setUp(self):
        # setup a folder to hold our temporary items
        self.sampleFolder = tempFolderManager.getNewTempFolder()

        # sample file consisting of the letter 'a' four hundred times
        myFile = open(os.path.join(self.sampleFolder, 'aFile'), 'w')
        myFile.write("a" * 400)
        myFile.close()
        self.sampleFiles.append({
            'filePath':
            os.path.join(self.sampleFolder, 'aFile'),
            'description':
            'a file containing the letter "a" 400 times',
            'sha1':
            'f475597b627a4d580ec1619a94c7afb9cc75abe4',
            'md5':
            'f4347bb35af679911623327c74b7d732'
        })

        # an empty file
        open(os.path.join(self.sampleFolder, 'emptyFile'), 'w').close()
        self.sampleFiles.append({
            'filePath':
            os.path.join(self.sampleFolder, 'emptyFile'),
            'description':
            'an empty file',
            'sha1':
            'da39a3ee5e6b4b0d3255bfef95601890afd80709',
            'md5':
            'd41d8cd98f00b204e9800998ecf8427e'
        })

        # a subfolder
        os.mkdir(os.path.join(self.sampleFolder, 'simpleSubfolder'))
        self.sampleFiles.append({
            'filePath':
            os.path.join(self.sampleFolder, 'simpleSubfolder'),
            'description':
            'a folder containing a single file',
            'sha1':
            '004073ec84557678eb540cbefdacbbd932a7dd98',
            'md5':
            '353c93582c0b3443f37fad4d498a58f1'
        })

        # file with spaces and symbols in the name, and the word "firetruck" 15 times
        myFile = open(
            os.path.join(self.sampleFolder, 'simpleSubfolder', 's % # ! \'*'),
            'w')
        myFile.write("firetruck" * 150)
        myFile.close()
        self.sampleFiles.append({
            'filePath':
            os.path.join(self.sampleFolder, 'simpleSubfolder', 's % # ! \'*'),
            'description':
            'file with spaces and symbols in the name',
            'sha1':
            '02df49b807e866b7e5aa6fa93e8955f1b3bf4412',
            'md5':
            '756078a54cb863d9ce834c857b836e8b'
        })

        # folder with a symlink in it
        os.mkdir(os.path.join(self.sampleFolder, 'folderContainingSymlink'))
        os.symlink(
            'badSymlinkTarget',
            os.path.join(self.sampleFolder, 'folderContainingSymlink',
                         'badSymlink'))
        self.sampleFiles.append({
            'filePath':
            os.path.join(self.sampleFolder, 'folderContainingSymlink'),
            'description':
            'symlink to the folder simpleSubfolder',
            'sha1':
            '0750b25b8e0b817fb886166b6a9246db6e715914',
            'md5':
            '63f025923ee362d59c81ecdd9e89a650'
        })
Exemplo n.º 17
0
	def setUp(self):
		'''Create folders for the cache folder and 2 source folders'''
		self.cacheFolderPath		= tempFolderManager.getNewTempFolder()
		
		cacheController.setCacheFolder(self.cacheFolderPath)
		
		self.firstSourceFolderPath	= tempFolderManager.getNewTempFolder()
		self.secondSourceFolderPath	= tempFolderManager.getNewTempFolder()
		cacheController.addSourceFolders([self.firstSourceFolderPath, self.secondSourceFolderPath])
		
		# ToDo: think about making sure we have an absolutely clean setup
		
		# file with a known name and checksum, with the checksum in the path
		checksumFilePath = os.path.join(self.firstSourceFolderPath, 'aFile sha1-f475597b627a4d580ec1619a94c7afb9cc75abe4.txt')
		testFile = open(checksumFilePath, 'w')
		testFile.write("a" * 400) # sha1 checksum: f475597b627a4d580ec1619a94c7afb9cc75abe4
		testFile.close()
		
		# file with a known name and checksum, with the checksum in the path, inside a subfolder
		checksumInSubfolderFilePath = os.path.join(self.firstSourceFolderPath, 'subfolder', 'bFile sha1-8bc1e4c5d467c10555dae3c4ea04471b856b23bc.txt')
		os.mkdir(os.path.join(self.firstSourceFolderPath, 'subfolder'))
		testFile = open(checksumInSubfolderFilePath, 'w')
		testFile.write("b" * 150) # sha1 checksum: 8bc1e4c5d467c10555dae3c4ea04471b856b23bc
		testFile.close()
		
		# file with a known name and checksum, without the checksum in the path
		nameFilePath = os.path.join(self.firstSourceFolderPath, 'cFile.txt')
		testFile = open(nameFilePath, 'w')
		testFile.write("c" * 300) # sha1 checksum: bc5b916598902018a023717425314bee88ff7fe9
		testFile.close()
		
		# file with a known name and checksum in a subfolder, without the checksum in the path
		nameInSubfolderFilePath = os.path.join(self.firstSourceFolderPath, 'subfolder', 'dFile.txt')
		testFile = open(nameInSubfolderFilePath, 'w')
		testFile.write("d" * 180) # sha1 checksum: b07eaa471ef7af455e1079a59135b1ebac44a72e
		testFile.close()
		
		# file with a known name in the second folder
		nameInSecondSourceFolderFilePath = os.path.join(self.secondSourceFolderPath, 'eFile.txt')
		testFile = open(nameInSecondSourceFolderFilePath, 'w')
		testFile.write("E" * 40) # sha1 checksum: 981ee57582ef1b95fb2f87982280a6dd01f46cc8
		testFile.close()
		
		# create two files, with the same name but different checksums, one in a subfolder
		outerDifferentChecksumFilePath = os.path.join(self.secondSourceFolderPath, 'fFile.txt')
		testFile = open(outerDifferentChecksumFilePath, 'w')
		testFile.write("f" * 80) # sha1 checksum: c8280ce5bfab50ffac50bbca5e22540335708ad9
		testFile.close()
		
		os.mkdir(os.path.join(self.secondSourceFolderPath, 'fFileFolder'))
		innerDifferentChecksumFilePath = os.path.join(self.secondSourceFolderPath, 'fFileFolder', 'fFile.txt')
		testFile = open(innerDifferentChecksumFilePath, 'w')
		testFile.write("f" * 40) # sha1 checksum: e0bbc5c28208d8909a27a5890216e24da6eb8cd3
		testFile.close()
		
		# two files with the same contents and name, but one inside a folder, and one at the root
		outerSameChecksumFilePath = os.path.join(self.secondSourceFolderPath, 'gFile.txt')
		testFile = open(outerSameChecksumFilePath, 'w')
		testFile.write("g" * 177) # sha1 checksum: 9315056a35b92557f3180c7c53d33c80dca7095e
		testFile.close()
		
		os.mkdir(os.path.join(self.secondSourceFolderPath, 'gFileFolder'))
		innerSameChecksumFilePath = os.path.join(self.secondSourceFolderPath, 'gFileFolder', 'gFile.txt')
		testFile = open(innerSameChecksumFilePath, 'w')
		testFile.write("g" * 177) # sha1 checksum: 9315056a35b92557f3180c7c53d33c80dca7095e
		testFile.close()
		
		# ToDo: absolute path
		# ToDo: absolute path crossing a symlink
		
		self.testMaterials = [
			# this should be in the format:
			# filename	- 	checksumType	-	checksumValue	-	desiredOutput	-	errorMessage
			
			# find file by checksum
			{'fileName':'aFile.txt', 'checksumType':'sha1', 'checksumValue':'f475597b627a4d580ec1619a94c7afb9cc75abe4', 'filePath':checksumFilePath, 'errorMessage':'findItem could not find the aFile by checksum'},
			
			# find a file in a folder by checksum
			{'fileName':'bFile.txt', 'checksumType':'sha1', 'checksumValue':'8bc1e4c5d467c10555dae3c4ea04471b856b23bc', 'filePath':checksumInSubfolderFilePath, 'errorMessage':'findItem could not find the bFile inside a subfolder by checksum'},
			
			# find a file by the name, indluding extension
			{'fileName':'cFile.txt', 'checksumType':'sha1', 'checksumValue':'bc5b916598902018a023717425314bee88ff7fe9', 'filePath':nameFilePath, 'errorMessage':'findItem could not find the cFile by the name, indluding extension'},
			
			# find a file by the name, minus the extension
			{'fileName':'cFile', 'checksumType':'sha1', 'checksumValue':'bc5b916598902018a023717425314bee88ff7fe9', 'filePath':nameFilePath, 'errorMessage':'findItem could not find the cFile by the name, minus the extension'},
			
			# find a file by the name, with a bad extension
			{'fileName':'cFile.bad', 'checksumType':'sha1', 'checksumValue':'bc5b916598902018a023717425314bee88ff7fe9', 'filePath':nameFilePath, 'errorMessage':'findItem could not find the cFile by the name, with a bad extension'},
			
			# find a file in a subfolder by the name, indluding extension
			{'fileName':'dFile.txt', 'checksumType':'sha1', 'checksumValue':'b07eaa471ef7af455e1079a59135b1ebac44a72e', 'filePath':nameInSubfolderFilePath, 'errorMessage':'findItem could not find the dFile in a subfolder by the name, indluding extension'},
			
			# find a file in a subfolder by the name, minus the extension
			{'fileName':'dFile', 'checksumType':'sha1', 'checksumValue':'b07eaa471ef7af455e1079a59135b1ebac44a72e', 'filePath':nameInSubfolderFilePath, 'errorMessage':'findItem could not find the dFile in a subfolder by the name, minus the extension'},
			
			# find a file in the second source folder by the name, minus the extension
			{'fileName':'eFile', 'checksumType':'sha1', 'checksumValue':'981ee57582ef1b95fb2f87982280a6dd01f46cc8', 'filePath':nameInSecondSourceFolderFilePath, 'errorMessage':'findItem could not find the eFile in the second source folder by name without checksume'},
			
			# find the inner source file when there is one in the root with the same name but a differnt checksum
			{'fileName':'fFile', 'checksumType':'sha1', 'checksumValue':'e0bbc5c28208d8909a27a5890216e24da6eb8cd3', 'filePath':innerDifferentChecksumFilePath, 'errorMessage':'findItem could not find the inner fFile by checksum'},
			
			# find the outer source
			{'fileName':'fFile', 'checksumType':'sha1', 'checksumValue':'c8280ce5bfab50ffac50bbca5e22540335708ad9', 'filePath':outerDifferentChecksumFilePath, 'errorMessage':'findItem could not find the outer fFile by checksum'},
			
			# find the inner source file by looking for it by a relative path
			{'fileName':'gFileFolder/gFile.txt', 'checksumType':'sha1', 'checksumValue':'9315056a35b92557f3180c7c53d33c80dca7095e', 'filePath':innerSameChecksumFilePath, 'errorMessage':'findItem could not find the inner gFile by relative path'},
			
			# make sure that the outer file is found when not giving the relative path
			{'fileName':'gFile.txt', 'checksumType':'sha1', 'checksumValue':'9315056a35b92557f3180c7c53d33c80dca7095e', 'filePath':outerSameChecksumFilePath, 'errorMessage':'findItem could not find the outer gFile by name/checksum'},
		]
Exemplo n.º 18
0
    def setUp(self):
        '''Create folders for the cache folder and 2 source folders'''
        self.cacheFolderPath = tempFolderManager.getNewTempFolder()

        cacheController.setCacheFolder(self.cacheFolderPath)

        self.firstSourceFolderPath = tempFolderManager.getNewTempFolder()
        self.secondSourceFolderPath = tempFolderManager.getNewTempFolder()
        cacheController.addSourceFolders(
            [self.firstSourceFolderPath, self.secondSourceFolderPath])

        # ToDo: think about making sure we have an absolutely clean setup

        # file with a known name and checksum, with the checksum in the path
        checksumFilePath = os.path.join(
            self.firstSourceFolderPath,
            'aFile sha1-f475597b627a4d580ec1619a94c7afb9cc75abe4.txt')
        testFile = open(checksumFilePath, 'w')
        testFile.write(
            "a" *
            400)  # sha1 checksum: f475597b627a4d580ec1619a94c7afb9cc75abe4
        testFile.close()

        # file with a known name and checksum, with the checksum in the path, inside a subfolder
        checksumInSubfolderFilePath = os.path.join(
            self.firstSourceFolderPath, 'subfolder',
            'bFile sha1-8bc1e4c5d467c10555dae3c4ea04471b856b23bc.txt')
        os.mkdir(os.path.join(self.firstSourceFolderPath, 'subfolder'))
        testFile = open(checksumInSubfolderFilePath, 'w')
        testFile.write(
            "b" *
            150)  # sha1 checksum: 8bc1e4c5d467c10555dae3c4ea04471b856b23bc
        testFile.close()

        # file with a known name and checksum, without the checksum in the path
        nameFilePath = os.path.join(self.firstSourceFolderPath, 'cFile.txt')
        testFile = open(nameFilePath, 'w')
        testFile.write(
            "c" *
            300)  # sha1 checksum: bc5b916598902018a023717425314bee88ff7fe9
        testFile.close()

        # file with a known name and checksum in a subfolder, without the checksum in the path
        nameInSubfolderFilePath = os.path.join(self.firstSourceFolderPath,
                                               'subfolder', 'dFile.txt')
        testFile = open(nameInSubfolderFilePath, 'w')
        testFile.write(
            "d" *
            180)  # sha1 checksum: b07eaa471ef7af455e1079a59135b1ebac44a72e
        testFile.close()

        # file with a known name in the second folder
        nameInSecondSourceFolderFilePath = os.path.join(
            self.secondSourceFolderPath, 'eFile.txt')
        testFile = open(nameInSecondSourceFolderFilePath, 'w')
        testFile.write(
            "E" *
            40)  # sha1 checksum: 981ee57582ef1b95fb2f87982280a6dd01f46cc8
        testFile.close()

        # create two files, with the same name but different checksums, one in a subfolder
        outerDifferentChecksumFilePath = os.path.join(
            self.secondSourceFolderPath, 'fFile.txt')
        testFile = open(outerDifferentChecksumFilePath, 'w')
        testFile.write(
            "f" *
            80)  # sha1 checksum: c8280ce5bfab50ffac50bbca5e22540335708ad9
        testFile.close()

        os.mkdir(os.path.join(self.secondSourceFolderPath, 'fFileFolder'))
        innerDifferentChecksumFilePath = os.path.join(
            self.secondSourceFolderPath, 'fFileFolder', 'fFile.txt')
        testFile = open(innerDifferentChecksumFilePath, 'w')
        testFile.write(
            "f" *
            40)  # sha1 checksum: e0bbc5c28208d8909a27a5890216e24da6eb8cd3
        testFile.close()

        # two files with the same contents and name, but one inside a folder, and one at the root
        outerSameChecksumFilePath = os.path.join(self.secondSourceFolderPath,
                                                 'gFile.txt')
        testFile = open(outerSameChecksumFilePath, 'w')
        testFile.write(
            "g" *
            177)  # sha1 checksum: 9315056a35b92557f3180c7c53d33c80dca7095e
        testFile.close()

        os.mkdir(os.path.join(self.secondSourceFolderPath, 'gFileFolder'))
        innerSameChecksumFilePath = os.path.join(self.secondSourceFolderPath,
                                                 'gFileFolder', 'gFile.txt')
        testFile = open(innerSameChecksumFilePath, 'w')
        testFile.write(
            "g" *
            177)  # sha1 checksum: 9315056a35b92557f3180c7c53d33c80dca7095e
        testFile.close()

        # ToDo: absolute path
        # ToDo: absolute path crossing a symlink

        self.testMaterials = [
            # this should be in the format:
            # filename	- 	checksumType	-	checksumValue	-	desiredOutput	-	errorMessage

            # find file by checksum
            {
                'fileName': 'aFile.txt',
                'checksumType': 'sha1',
                'checksumValue': 'f475597b627a4d580ec1619a94c7afb9cc75abe4',
                'filePath': checksumFilePath,
                'errorMessage': 'findItem could not find the aFile by checksum'
            },

            # find a file in a folder by checksum
            {
                'fileName':
                'bFile.txt',
                'checksumType':
                'sha1',
                'checksumValue':
                '8bc1e4c5d467c10555dae3c4ea04471b856b23bc',
                'filePath':
                checksumInSubfolderFilePath,
                'errorMessage':
                'findItem could not find the bFile inside a subfolder by checksum'
            },

            # find a file by the name, indluding extension
            {
                'fileName':
                'cFile.txt',
                'checksumType':
                'sha1',
                'checksumValue':
                'bc5b916598902018a023717425314bee88ff7fe9',
                'filePath':
                nameFilePath,
                'errorMessage':
                'findItem could not find the cFile by the name, indluding extension'
            },

            # find a file by the name, minus the extension
            {
                'fileName':
                'cFile',
                'checksumType':
                'sha1',
                'checksumValue':
                'bc5b916598902018a023717425314bee88ff7fe9',
                'filePath':
                nameFilePath,
                'errorMessage':
                'findItem could not find the cFile by the name, minus the extension'
            },

            # find a file by the name, with a bad extension
            {
                'fileName':
                'cFile.bad',
                'checksumType':
                'sha1',
                'checksumValue':
                'bc5b916598902018a023717425314bee88ff7fe9',
                'filePath':
                nameFilePath,
                'errorMessage':
                'findItem could not find the cFile by the name, with a bad extension'
            },

            # find a file in a subfolder by the name, indluding extension
            {
                'fileName':
                'dFile.txt',
                'checksumType':
                'sha1',
                'checksumValue':
                'b07eaa471ef7af455e1079a59135b1ebac44a72e',
                'filePath':
                nameInSubfolderFilePath,
                'errorMessage':
                'findItem could not find the dFile in a subfolder by the name, indluding extension'
            },

            # find a file in a subfolder by the name, minus the extension
            {
                'fileName':
                'dFile',
                'checksumType':
                'sha1',
                'checksumValue':
                'b07eaa471ef7af455e1079a59135b1ebac44a72e',
                'filePath':
                nameInSubfolderFilePath,
                'errorMessage':
                'findItem could not find the dFile in a subfolder by the name, minus the extension'
            },

            # find a file in the second source folder by the name, minus the extension
            {
                'fileName':
                'eFile',
                'checksumType':
                'sha1',
                'checksumValue':
                '981ee57582ef1b95fb2f87982280a6dd01f46cc8',
                'filePath':
                nameInSecondSourceFolderFilePath,
                'errorMessage':
                'findItem could not find the eFile in the second source folder by name without checksume'
            },

            # find the inner source file when there is one in the root with the same name but a differnt checksum
            {
                'fileName':
                'fFile',
                'checksumType':
                'sha1',
                'checksumValue':
                'e0bbc5c28208d8909a27a5890216e24da6eb8cd3',
                'filePath':
                innerDifferentChecksumFilePath,
                'errorMessage':
                'findItem could not find the inner fFile by checksum'
            },

            # find the outer source
            {
                'fileName':
                'fFile',
                'checksumType':
                'sha1',
                'checksumValue':
                'c8280ce5bfab50ffac50bbca5e22540335708ad9',
                'filePath':
                outerDifferentChecksumFilePath,
                'errorMessage':
                'findItem could not find the outer fFile by checksum'
            },

            # find the inner source file by looking for it by a relative path
            {
                'fileName':
                'gFileFolder/gFile.txt',
                'checksumType':
                'sha1',
                'checksumValue':
                '9315056a35b92557f3180c7c53d33c80dca7095e',
                'filePath':
                innerSameChecksumFilePath,
                'errorMessage':
                'findItem could not find the inner gFile by relative path'
            },

            # make sure that the outer file is found when not giving the relative path
            {
                'fileName':
                'gFile.txt',
                'checksumType':
                'sha1',
                'checksumValue':
                '9315056a35b92557f3180c7c53d33c80dca7095e',
                'filePath':
                outerSameChecksumFilePath,
                'errorMessage':
                'findItem could not find the outer gFile by name/checksum'
            },
        ]