Esempio n. 1
0
    def testInitialize(self):
        """Tests the path specification initialization."""
        path_spec = vhdi_path_spec.VHDIPathSpec(parent=self._path_spec)

        self.assertIsNotNone(path_spec)

        with self.assertRaises(ValueError):
            vhdi_path_spec.VHDIPathSpec(parent=None)

        with self.assertRaises(ValueError):
            vhdi_path_spec.VHDIPathSpec(parent=self._path_spec, bogus='BOGUS')
Esempio n. 2
0
 def setUp(self):
     """Sets up the needed objects used throughout the test."""
     super(DifferentialVHDIFileTest, self).setUp()
     test_file = self._GetTestFilePath([u'image-differential.vhd'])
     self._os_path_spec = os_path_spec.OSPathSpec(location=test_file)
     self._vhdi_path_spec = vhdi_path_spec.VHDIPathSpec(
         parent=self._os_path_spec)
Esempio n. 3
0
 def setUp(self):
     """Sets up the needed objects used throughout the test."""
     super(DynamicVHDIFileTest, self).setUp()
     test_file = os.path.join(u'test_data', u'image.vhd')
     self._os_path_spec = os_path_spec.OSPathSpec(location=test_file)
     self._vhdi_path_spec = vhdi_path_spec.VHDIPathSpec(
         parent=self._os_path_spec)
Esempio n. 4
0
    def testComparable(self):
        """Tests the path specification comparable property."""
        path_spec = vhdi_path_spec.VHDIPathSpec(parent=self._path_spec)

        self.assertIsNotNone(path_spec)

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

        self.assertEqual(path_spec.comparable, expected_comparable)
Esempio n. 5
0
  def setUp(self):
    """Sets up the needed objects used throughout the test."""
    super(DynamicVHDIFileTest, self).setUp()
    test_file = self._GetTestFilePath(['image.vhd'])
    self._SkipIfPathNotExists(test_file)

    self._os_path_spec = os_path_spec.OSPathSpec(location=test_file)
    self._vhdi_path_spec = vhdi_path_spec.VHDIPathSpec(
        parent=self._os_path_spec)
Esempio n. 6
0
  def testOpenCloseLocation(self):
    """Test the open and close functionality using a location."""
    self._TestOpenCloseLocation(self._vhdi_path_spec)

    # Try open with a path specification that has no parent.
    path_spec = vhdi_path_spec.VHDIPathSpec(parent=self._os_path_spec)
    path_spec.parent = None

    with self.assertRaises(errors.PathSpecError):
      self._TestOpenCloseLocation(path_spec)
Esempio n. 7
0
  def setUp(self):
    """Sets up the needed objects used throughout the test."""
    super(WindowsVersion2FixedVHDIFileTest, self).setUp()

    test_file = self._GetTestFilePath(['ntfs-fixed.vhdx'])
    self._SkipIfPathNotExists(test_file)

    self._os_path_spec = os_path_spec.OSPathSpec(location=test_file)
    self._vhdi_path_spec = vhdi_path_spec.VHDIPathSpec(
        parent=self._os_path_spec)
    self._partition_path_spec = tsk_partition_path_spec.TSKPartitionPathSpec(
        location='/p1', parent=self._vhdi_path_spec)