예제 #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)
예제 #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)
예제 #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)
예제 #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')
예제 #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)
예제 #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
예제 #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
예제 #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)
예제 #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)