Exemple #1
0
 def test_create_with_mkisofs(self, mock_call):
     """Creation of an ISO with mkisofs (default)."""
     helpers['mkisofs']._installed = True
     ISO.create_file(path=self.foo_iso, files=[self.input_ovf])
     mock_call.assert_called_with(
         ['-output', self.foo_iso, '-full-iso9660-filenames',
          '-iso-level', '2', '-allow-lowercase', '-r', self.input_ovf])
Exemple #2
0
 def test_create_with_mkisofs(self, mock_call):
     """Creation of an ISO with mkisofs (default)."""
     helpers['mkisofs']._installed = True
     ISO.create_file(path=self.foo_iso, files=[self.input_ovf])
     mock_call.assert_called_with(
         ['-output', self.foo_iso, '-full-iso9660-filenames',
          '-iso-level', '2', '-allow-lowercase', '-r', self.input_ovf])
Exemple #3
0
 def test_create_with_genisoimage(self, mock_call):
     """Creation of an ISO with genisoimage if mkisofs is unavailable."""
     helpers['mkisofs']._installed = False
     helpers['genisoimage']._installed = True
     ISO.create_file(path=self.foo_iso, files=[self.input_ovf])
     mock_call.assert_called_with(
         ['-output', self.foo_iso, '-full-iso9660-filenames',
          '-iso-level', '2', '-allow-lowercase', '-r', self.input_ovf])
Exemple #4
0
 def test_create_with_genisoimage(self, mock_call):
     """Creation of an ISO with genisoimage if mkisofs is unavailable."""
     helpers['mkisofs']._installed = False
     helpers['genisoimage']._installed = True
     ISO.create_file(path=self.foo_iso, files=[self.input_ovf])
     mock_call.assert_called_with(
         ['-output', self.foo_iso, '-full-iso9660-filenames',
          '-iso-level', '2', '-allow-lowercase', '-r', self.input_ovf])
Exemple #5
0
    def test_create_with_files_non_rockridge(self):
        """Creation of a non-rock-ridge ISO with specific file contents."""
        disk_path = os.path.join(self.temp_dir, "out.iso")
        ISO.create_file(disk_path, files=[self.input_ovf], disk_subformat="")
        iso = ISO(disk_path)
        if helpers['isoinfo']:
            self.assertEqual(iso.disk_subformat, "")
            self.assertEqual(iso.files,
                             [os.path.basename(self.input_ovf)])
        else:
            helpers['isoinfo']._installed = True
            with mock.patch.object(helpers['isoinfo'], "call",
                                   return_value="No SUSP/Rock Ridge present"):
                self.assertEqual(iso.disk_subformat, "")

            with mock.patch.object(helpers['isoinfo'], "call",
                                   return_value="""
Setting input-charset to 'UTF-8' from locale.
/{0};1
""".format(os.path.basename(self.input_ovf).upper())):
                self.assertEqual(iso.files,
                                 [os.path.basename(self.input_ovf)])
Exemple #6
0
    def test_create_with_files_non_rockridge(self):
        """Creation of a non-rock-ridge ISO with specific file contents."""
        disk_path = os.path.join(self.temp_dir, "out.iso")
        ISO.create_file(disk_path, files=[self.input_ovf], disk_subformat="")
        iso = ISO(disk_path)
        if helpers['isoinfo']:
            self.assertEqual(iso.disk_subformat, "")
            self.assertEqual(iso.files,
                             [os.path.basename(self.input_ovf)])
        else:
            helpers['isoinfo']._installed = True
            with mock.patch.object(helpers['isoinfo'], "call",
                                   return_value="No SUSP/Rock Ridge present"):
                self.assertEqual(iso.disk_subformat, "")

            with mock.patch.object(helpers['isoinfo'], "call",
                                   return_value="""
Setting input-charset to 'UTF-8' from locale.
/{0};1
""".format(os.path.basename(self.input_ovf).upper())):
                self.assertEqual(iso.files,
                                 [os.path.basename(self.input_ovf)])
Exemple #7
0
    def test_create_with_files(self):
        """Creation of a ISO with specific file contents."""
        disk_path = os.path.join(self.temp_dir, "out.iso")
        ISO.create_file(disk_path, files=[self.input_ovf])
        iso = ISO(disk_path)
        if helpers['isoinfo']:
            # Our default create format is rockridge
            self.assertEqual(iso.disk_subformat, "rockridge")
            self.assertEqual(iso.files,
                             [os.path.basename(self.input_ovf)])
        else:
            helpers['isoinfo']._installed = True

            with mock.patch.object(helpers['isoinfo'], "call",
                                   return_value="Rock Ridge extensions found"):
                self.assertEqual(iso.disk_subformat, "rockridge")

            with mock.patch.object(helpers['isoinfo'], "call",
                                   return_value="""
Setting input-charset to 'UTF-8' from locale.
/{0}
""".format(os.path.basename(self.input_ovf))):
                self.assertEqual(iso.files,
                                 [os.path.basename(self.input_ovf)])
Exemple #8
0
    def test_create_with_files(self):
        """Creation of a ISO with specific file contents."""
        disk_path = os.path.join(self.temp_dir, "out.iso")
        ISO.create_file(disk_path, files=[self.input_ovf])
        iso = ISO(disk_path)
        if helpers['isoinfo']:
            # Our default create format is rockridge
            self.assertEqual(iso.disk_subformat, "rockridge")
            self.assertEqual(iso.files,
                             [os.path.basename(self.input_ovf)])
        else:
            helpers['isoinfo']._installed = True

            with mock.patch.object(helpers['isoinfo'], "call",
                                   return_value="Rock Ridge extensions found"):
                self.assertEqual(iso.disk_subformat, "rockridge")

            with mock.patch.object(helpers['isoinfo'], "call",
                                   return_value="""
Setting input-charset to 'UTF-8' from locale.
/{0}
""".format(os.path.basename(self.input_ovf))):
                self.assertEqual(iso.files,
                                 [os.path.basename(self.input_ovf)])