示例#1
0
 def testAddFilesystem(self):
     Filesystem1 = Filesystem('FS1')
     Filesystem2 = Filesystem('FS2')
     Filesystem3 = Filesystem('FS3')
     assert self.FS.addFilesystem(Filesystem1) == Filesystem1
     assert self.FS.addFilesystem(Filesystem1) == None
     assert self.FS.addFilesystem(Filesystem2) == Filesystem2
     assert self.FS.addFilesystem(Filesystem('FS2')) == None
     assert self.FS.addFilesystem(Filesystem3) == Filesystem3
示例#2
0
 def testRemoveFilesystem(self):
     Filesystem1 = Filesystem('FS1')
     Filesystem2 = Filesystem('FS2')
     Filesystem3 = Filesystem('FS3')
     self.FS.addFilesystem(Filesystem1)
     self.FS.addFilesystem(Filesystem2)
     assert self.FS.removeFilesystem(Filesystem1) == Filesystem1
     assert self.FS.removeFilesystem(Filesystem1) == None
     assert self.FS.removeFilesystem(Filesystem('FS3')) == None
     assert self.FS.removeFilesystem(Filesystem('FS2')) == Filesystem2
示例#3
0
    def testLoadFilesystems(self):
        self.Tools = Tools()
        self.Tools.createRootDir()
        self.Tools.createFilesystemXML()
        self.FS = Filesystems(self.Tools.filetypesXML)

        Ext3FS = self.FS.getFilesystem(Filesystem('ext3'))
        NTFSFS = self.FS.getFilesystem(Filesystem('ntfs'))
        Filesystem3 = Filesystem('FS3')

        assert self.FS.addFilesystem(Ext3FS) == None
        assert self.FS.addFilesystem(Filesystem('ntfs')) == None
        assert self.FS.addFilesystem(Filesystem3) == Filesystem3

        assert self.FS.getFilesystem(Filesystem3) == Filesystem3
        assert self.FS.getFilesystem(NTFSFS) == NTFSFS
        assert self.FS.getFilesystem(Ext3FS) == Ext3FS

        assert self.FS.removeFilesystem(NTFSFS) == NTFSFS
        assert self.FS.removeFilesystem(NTFSFS) == None
        assert self.FS.removeFilesystem(Ext3FS) == Ext3FS
        assert self.FS.removeFilesystem(Ext3FS) == None

        self.Tools.removeTempFiles()
示例#4
0
 def setUp(self):
     self.filesystem = Filesystem("FileSystem")
示例#5
0
class testFilesystem:
    """
    Test Filesystem Class
    """
    def setUp(self):
        self.filesystem = Filesystem("FileSystem")

    def testAddChar(self):
        InvalidCharacter1 = InvChar("Description", "002B", "plus")
        InvalidCharacter2 = InvChar("NewDescription", "002B", "plus")
        InvalidCharacter3 = InvChar("Description", "002F", "or")
        assert self.filesystem.addChar(InvalidCharacter1) == InvalidCharacter1
        assert self.filesystem.addChar(InvalidCharacter1) == None
        assert self.filesystem.addChar(InvalidCharacter2) == None
        assert self.filesystem.addChar(InvalidCharacter3) == InvalidCharacter3

    def testGetChar(self):
        assert self.filesystem.chars == []
        InvalidCharacter1 = InvChar("Description", "002B", "plus")
        InvalidCharacter2 = InvChar("NewDescription", "0026", "and")
        self.filesystem.addChar(InvalidCharacter1)
        self.filesystem.addChar(InvalidCharacter2)
        assert self.filesystem.getChar(InvalidCharacter1) == InvalidCharacter1
        assert self.filesystem.getChar(InvChar("Description", "002B",
                                               "ERROR")) == None
        assert self.filesystem.getChar(InvalidCharacter2) == InvalidCharacter2
        assert self.filesystem.getChar(InvChar("Description", "0000",
                                               "and")) == None

    def testRemoveChar(self):
        InvalidCharacter1 = InvChar("Description", "002B", "plus")
        InvalidCharacter2 = InvChar("NewDescription", "0026", "and")
        InvalidCharacter3 = InvChar("Description", "002F", "or")
        self.filesystem.addChar(InvalidCharacter1)
        self.filesystem.addChar(InvalidCharacter2)
        assert self.filesystem.removeChar(
            InvalidCharacter1) == InvalidCharacter1
        assert self.filesystem.removeChar(InvalidCharacter1) == None
        assert self.filesystem.removeChar(InvChar("Description", "002F",
                                                  "or")) == None
        assert self.filesystem.removeChar(
            InvChar("NewDescription", "0026", "and")) == InvalidCharacter2

    def testValidateString(self):
        InvalidCharacter1 = InvChar("Description", "002B", "plus")
        InvalidCharacter2 = InvChar("NewDescription", "0026", "and")
        InvalidCharacter3 = InvChar("Description", "002F", "or")
        self.filesystem.addChar(InvalidCharacter1)
        self.filesystem.addChar(InvalidCharacter2)
        self.filesystem.addChar(InvalidCharacter3)
        assert self.filesystem.validateString("test+test") == "testplustest"
        assert self.filesystem.validateString(
            "+test/test&test") == "plustestortestandtest"
示例#6
0
 def setUp( self ) :
     self.filesystem = Filesystem( "FileSystem" )
示例#7
0
class testFilesystem :
    """
    Test Filesystem Class
    """
    def setUp( self ) :
        self.filesystem = Filesystem( "FileSystem" )
        
    def testAddChar( self ) :
        InvalidCharacter1 = InvChar( "Description", "002B", "plus" )
        InvalidCharacter2 = InvChar( "NewDescription", "002B", "plus" )
        InvalidCharacter3 = InvChar( "Description", "002F", "or" )
        assert self.filesystem.addChar( InvalidCharacter1 ) == InvalidCharacter1
        assert self.filesystem.addChar( InvalidCharacter1 ) == None
        assert self.filesystem.addChar( InvalidCharacter2 ) == None
        assert self.filesystem.addChar( InvalidCharacter3 ) == InvalidCharacter3
        
    def testGetChar( self ) :
        assert self.filesystem.chars == []
        InvalidCharacter1 = InvChar( "Description", "002B", "plus" )
        InvalidCharacter2 = InvChar( "NewDescription", "0026", "and" )
        self.filesystem.addChar( InvalidCharacter1 )
        self.filesystem.addChar( InvalidCharacter2 )
        assert self.filesystem.getChar( InvalidCharacter1 ) == InvalidCharacter1
        assert self.filesystem.getChar( InvChar( "Description", "002B", "ERROR" )) == None
        assert self.filesystem.getChar( InvalidCharacter2 ) == InvalidCharacter2
        assert self.filesystem.getChar( InvChar( "Description", "0000", "and" )) == None
        
    def testRemoveChar( self ) :
        InvalidCharacter1 = InvChar( "Description", "002B", "plus" )
        InvalidCharacter2 = InvChar( "NewDescription", "0026", "and" )
        InvalidCharacter3 = InvChar( "Description", "002F", "or" )
        self.filesystem.addChar( InvalidCharacter1 )
        self.filesystem.addChar( InvalidCharacter2 )
        assert self.filesystem.removeChar( InvalidCharacter1 ) == InvalidCharacter1
        assert self.filesystem.removeChar( InvalidCharacter1 ) == None
        assert self.filesystem.removeChar( InvChar( "Description", "002F", "or" ) ) == None
        assert self.filesystem.removeChar( InvChar( "NewDescription", "0026", "and" ) ) == InvalidCharacter2
        
    def testValidateString( self ) :
        InvalidCharacter1 = InvChar( "Description", "002B", "plus" )
        InvalidCharacter2 = InvChar( "NewDescription", "0026", "and" )
        InvalidCharacter3 = InvChar( "Description", "002F", "or" )
        self.filesystem.addChar( InvalidCharacter1 )
        self.filesystem.addChar( InvalidCharacter2 )
        self.filesystem.addChar( InvalidCharacter3 )
        assert self.filesystem.validateString( "test+test" ) == "testplustest"
        assert self.filesystem.validateString( "+test/test&test" ) == "plustestortestandtest"