kiwi-el8/test/unit/disk_format_vhd_test.py
Marcus Schäfer febd69ec0f Refactor variable name for root directory
If it is clear the source directory is the root directory of
the image the variable should be named root_dir not source_dir
2016-01-19 11:15:18 +01:00

38 lines
1.1 KiB
Python

from nose.tools import *
from mock import patch
import mock
import nose_helper
from kiwi.exceptions import *
from kiwi.disk_format_vhd import DiskFormatVhd
class TestDiskFormatVhd(object):
def setup(self):
xml_data = mock.Mock()
xml_data.get_name = mock.Mock(
return_value='some-disk-image'
)
self.xml_state = mock.Mock()
self.xml_state.xml_data = xml_data
self.disk_format = DiskFormatVhd(
self.xml_state, 'root_dir', 'target_dir'
)
def test_post_init(self):
self.disk_format.post_init({'option': 'value'})
assert self.disk_format.options == ['-o', 'option', 'value']
@patch('kiwi.disk_format_vhd.Command.run')
def test_create_image_format(self, mock_command):
self.disk_format.create_image_format()
mock_command.assert_called_once_with(
[
'qemu-img', 'convert', '-c', '-f', 'raw',
'target_dir/some-disk-image.raw', '-O', 'vpc',
'target_dir/some-disk-image.vhd'
]
)