'L{static.DirectoryLister} is able to detect mimetype and encoding of
listed files.'

def test_mimeTypeAndEncodings(self):

    path = FilePath(self.mktemp())
    path.makedirs()
    path.child('file1.txt').setContent('file1')
    path.child('file2.py').setContent('python')
    path.child('file3.conf.gz').setContent('conf    compressed')
    path.child('file4.diff.bz2').setContent('diff    compressed')
    directory = os.listdir(path.path)
    directory.sort()
    contentTypes = {'.txt': 'text/plain', '.py': 'text/python', '.conf': 'text/configuration', '.diff': 'text/diff'}
    lister = static.DirectoryLister(path.path, contentTypes=contentTypes)
    (dirs, files) = lister._getFilesAndDirectories(directory)
    self.assertEqual(dirs, [])
    self.assertEqual(files, [{'encoding': '', 'href': 'file1.txt', 'size': '5B', 'text': 'file1.txt', 'type': '[text/plain]'}, {'encoding': '', 'href': 'file2.py', 'size': '6B', 'text': 'file2.py', 'type': '[text/python]'}, {'encoding': '[gzip]', 'href': 'file3.conf.gz', 'size': '15B', 'text': 'file3.conf.gz', 'type': '[text/configuration]'}, {'encoding': '[bzip2]', 'href': 'file4.diff.bz2', 'size': '15B', 'text': 'file4.diff.bz2', 'type': '[text/diff]'}])
