Esempio n. 1
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)
Esempio 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)
Esempio n. 3
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'
        )
Esempio n. 4
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)
Esempio n. 5
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')
Esempio n. 6
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)