Esempio n. 1
0
    def testIntialize(self):
        """Test the initialize functionality."""
        file_entry = os_file_entry.OSFileEntry(self._resolver_context,
                                               self._file_system,
                                               self._os_path_spec)

        self.assertNotEqual(file_entry, None)
Esempio n. 2
0
    def testIntialize(self):
        """Test the __init__ function."""
        file_entry = os_file_entry.OSFileEntry(self._resolver_context,
                                               self._file_system,
                                               self._os_path_spec)

        self.assertIsNotNone(file_entry)
Esempio n. 3
0
    def testAccessTime(self):
        """Test the access_time property."""
        file_entry = os_file_entry.OSFileEntry(self._resolver_context,
                                               self._file_system,
                                               self._os_path_spec)

        self.assertIsNotNone(file_entry)
        self.assertIsNotNone(file_entry.access_time)
Esempio n. 4
0
    def testName(self):
        """Test the name property."""
        file_entry = os_file_entry.OSFileEntry(self._resolver_context,
                                               self._file_system,
                                               self._os_path_spec)

        self.assertIsNotNone(file_entry)
        self.assertEqual(file_entry.name, 'testdir_os')
Esempio n. 5
0
    def testModificationTime(self):
        """Test the modification_time property."""
        file_entry = os_file_entry.OSFileEntry(self._resolver_context,
                                               self._file_system,
                                               self._os_path_spec)

        self.assertIsNotNone(file_entry)
        self.assertIsNotNone(file_entry.modification_time)
Esempio n. 6
0
    def testChangeTime(self):
        """Test the change_time property."""
        file_entry = os_file_entry.OSFileEntry(self._resolver_context,
                                               self._file_system,
                                               self._os_path_spec)

        self.assertIsNotNone(file_entry)
        # Not all operating systems provide a change time.
        _ = file_entry.change_time
Esempio n. 7
0
    def testSize(self):
        """Test the size property."""
        file_entry = os_file_entry.OSFileEntry(self._resolver_context,
                                               self._file_system,
                                               self._os_path_spec)

        self.assertIsNotNone(file_entry)
        # The size of a directory differs per operating system.
        _ = file_entry.size
Esempio n. 8
0
  def GetFileEntryByPathSpec(self, path_spec):
    """Retrieves a file entry for a path specification.

    Args:
      path_spec (PathSpec): a path specification.

    Returns:
      OSFileEntry: a file entry or None if not available.
    """
    if not self.FileEntryExistsByPathSpec(path_spec):
      return None
    return os_file_entry.OSFileEntry(self._resolver_context, self, path_spec)
Esempio n. 9
0
    def GetFileEntryByPathSpec(self, path_spec):
        """Retrieves a file entry for a path specification.

    Args:
      path_spec: a path specification (instance of path.PathSpec).

    Returns:
      A file entry (instance of vfs.FileEntry) or None.
    """
        if not self.FileEntryExistsByPathSpec(path_spec):
            return
        return os_file_entry.OSFileEntry(self._resolver_context, self,
                                         path_spec)