Beispiel #1
0
    def testInitialize(self):
        """Tests the path specification initialization."""
        path_spec = vmdk_path_spec.VMDKPathSpec(parent=self._path_spec)

        self.assertIsNotNone(path_spec)

        with self.assertRaises(ValueError):
            vmdk_path_spec.VMDKPathSpec(parent=None)

        with self.assertRaises(ValueError):
            vmdk_path_spec.VMDKPathSpec(parent=self._path_spec, bogus='BOGUS')
Beispiel #2
0
 def setUp(self):
     """Sets up the needed objects used throughout the test."""
     super(VMDKFileTest, self).setUp()
     test_file = self._GetTestFilePath([u'image.vmdk'])
     self._os_path_spec = os_path_spec.OSPathSpec(location=test_file)
     self._vmdk_path_spec = vmdk_path_spec.VMDKPathSpec(
         parent=self._os_path_spec)
Beispiel #3
0
 def setUp(self):
   """Sets up the needed objects used throughout the test."""
   super(VMDKFileTest, self).setUp()
   test_file = os.path.join(u'test_data', u'image.vmdk')
   self._os_path_spec = os_path_spec.OSPathSpec(location=test_file)
   self._vmdk_path_spec = vmdk_path_spec.VMDKPathSpec(
       parent=self._os_path_spec)
Beispiel #4
0
    def testComparable(self):
        """Tests the path specification comparable property."""
        path_spec = vmdk_path_spec.VMDKPathSpec(parent=self._path_spec)

        self.assertIsNotNone(path_spec)

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

        self.assertEqual(path_spec.comparable, expected_comparable)
Beispiel #5
0
    def testOpenCloseLocation(self):
        """Test the open and close functionality using a location."""
        self._TestOpenCloseLocation(self._vmdk_path_spec)

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

        with self.assertRaises(errors.PathSpecError):
            self._TestOpenCloseLocation(path_spec)