Example #1
0
    def testInitialize(self):
        """Tests the path specification initialization."""
        path_spec = fvde_path_spec.FVDEPathSpec(parent=self._path_spec)

        self.assertIsNotNone(path_spec)

        with self.assertRaises(ValueError):
            fvde_path_spec.FVDEPathSpec(parent=None)

        with self.assertRaises(ValueError):
            fvde_path_spec.FVDEPathSpec(parent=self._path_spec, bogus='BOGUS')
Example #2
0
    def GetRootFileEntry(self):
        """Retrieves the root file entry.

    Returns:
      FVDEFileEntry: file entry or None.
    """
        path_spec = fvde_path_spec.FVDEPathSpec(parent=self._path_spec.parent)
        return self.GetFileEntryByPathSpec(path_spec)
Example #3
0
    def testComparable(self):
        """Tests the path specification comparable property."""
        path_spec = fvde_path_spec.FVDEPathSpec(parent=self._path_spec)

        self.assertIsNotNone(path_spec)

        expected_comparable = '\n'.join(['type: TEST', 'type: FVDE', ''])

        self.assertEqual(path_spec.comparable, expected_comparable)
Example #4
0
 def setUp(self):
   """Sets up the needed objects used throughout the test."""
   self._resolver_context = context.Context()
   test_file = self._GetTestFilePath(['fvdetest.qcow2'])
   path_spec = os_path_spec.OSPathSpec(location=test_file)
   path_spec = qcow_path_spec.QCOWPathSpec(parent=path_spec)
   path_spec = tsk_partition_path_spec.TSKPartitionPathSpec(
       location='/p1', parent=path_spec)
   self._fvde_path_spec = fvde_path_spec.FVDEPathSpec(parent=path_spec)
   resolver.Resolver.key_chain.SetCredential(
       self._fvde_path_spec, 'password', self._FVDE_PASSWORD)
Example #5
0
  def testOpenCloseLocation(self):
    """Test the open and close functionality using a location."""
    self._TestOpenCloseLocation(self._fvde_path_spec)

    # Try open with a path specification that has no parent.
    path_spec = fvde_path_spec.FVDEPathSpec(
        parent=self._tsk_partition_path_spec)
    path_spec.parent = None

    with self.assertRaises(errors.PathSpecError):
      self._TestOpenCloseLocation(path_spec)
Example #6
0
 def setUp(self):
   """Sets up the needed objects used throughout the test."""
   super(FVDEFileWithPathSpecCredentialsTest, self).setUp()
   test_file = self._GetTestFilePath([u'fvdetest.qcow2'])
   path_spec = os_path_spec.OSPathSpec(location=test_file)
   path_spec = qcow_path_spec.QCOWPathSpec(parent=path_spec)
   self._tsk_partition_path_spec = (
       tsk_partition_path_spec.TSKPartitionPathSpec(
           location=u'/p1', parent=path_spec))
   self._fvde_path_spec = fvde_path_spec.FVDEPathSpec(
       password=self._FVDE_PASSWORD, parent=self._tsk_partition_path_spec)
   resolver.Resolver.key_chain.SetCredential(
       self._fvde_path_spec, u'password', self._FVDE_PASSWORD)
Example #7
0
    def setUp(self):
        """Sets up the needed objects used throughout the test."""
        self._resolver_context = context.Context()
        test_file = os.path.join(u'test_data', u'fvdetest.qcow2')
        path_spec = os_path_spec.OSPathSpec(location=test_file)
        path_spec = qcow_path_spec.QCOWPathSpec(parent=path_spec)
        path_spec = tsk_partition_path_spec.TSKPartitionPathSpec(
            location=u'/p1', parent=path_spec)
        self._fvde_path_spec = fvde_path_spec.FVDEPathSpec(parent=path_spec)
        resolver.Resolver.key_chain.SetCredential(self._fvde_path_spec,
                                                  u'password',
                                                  self._FVDE_PASSWORD)

        self._file_system = fvde_file_system.FVDEFileSystem(
            self._resolver_context)
        self._file_system.Open(self._fvde_path_spec)