'Test that TSK can correctly encode NTFS features.'

def testTSKNTFSHandling(self):

    path = os.path.join(self.base_path, 'ntfs_img.dd')
    path2 = 'test    directory'
    ps2 = rdf_paths.PathSpec(path=path2, pathtype=rdf_paths.PathSpec.PathType.TSK)
    ps = rdf_paths.PathSpec(path=path, pathtype=rdf_paths.PathSpec.PathType.OS, offset=(63 * 512))
    ps.Append(ps2)
    fd = vfs.VFSOpen(ps)
    path = path.replace('\\', '/')
    listing = []
    pathspecs = []
    for f in fd.ListFiles():
        self.assertEqual(f.pathspec.path_options, rdf_paths.PathSpec.Options.CASE_LITERAL)
        pathspec = f.pathspec.nested_path
        self.assertEqual(pathspec.path_options, rdf_paths.PathSpec.Options.CASE_LITERAL)
        pathspecs.append(f.pathspec)
        listing.append((pathspec.inode, pathspec.ntfs_type, pathspec.ntfs_id))
    tsk_fs_attr_type = rdf_paths.PathSpec.tsk_fs_attr_type
    ref = [(65, tsk_fs_attr_type.TSK_FS_ATTR_TYPE_DEFAULT, 0), (65, tsk_fs_attr_type.TSK_FS_ATTR_TYPE_NTFS_DATA, 4), (66, tsk_fs_attr_type.TSK_FS_ATTR_TYPE_DEFAULT, 0), (67, tsk_fs_attr_type.TSK_FS_ATTR_TYPE_DEFAULT, 0)]
    self.assertEqual(listing, ref)
    self.assertEqual(pathspecs[0].nested_path.path, '/Test    Directory/notes.txt')
    fd = vfs.VFSOpen(pathspecs[0])
    self.assertEqual(fd.read(1000), 'Hello    world\n')
    s = fd.Stat()
    self.assertEqual(s.pathspec.nested_path.inode, 65)
    self.assertEqual(s.pathspec.nested_path.ntfs_type, 1)
    self.assertEqual(s.pathspec.nested_path.ntfs_id, 0)
    self.assertEqual(pathspecs[1].nested_path.path, '/Test    Directory/notes.txt')
    self.assertEqual(pathspecs[1].nested_path.stream_name, 'ads')
    aff4_urn = pathspecs[1].AFF4Path(rdf_client.ClientURN('C.1234567812345678'))
    self.assertEqual(aff4_urn.Basename(), 'notes.txt:ads')
    fd = vfs.VFSOpen(pathspecs[1])
    self.assertEqual(fd.read(1000), 'I    am    a    real    ADS\n')
    s = fd.Stat()
    self.assertEqual(s.pathspec.nested_path.inode, 65)
    self.assertEqual(s.pathspec.nested_path.ntfs_type, 128)
    self.assertEqual(s.pathspec.nested_path.ntfs_id, 4)
