[virt-tools-list] [virt-bootstrap] [PATCH v4 25/26] tests: DockerSource for fmt='qcow2'
Cedric Bosdonnat
cbosdonnat at suse.com
Thu Aug 3 16:35:39 UTC 2017
On Thu, 2017-08-03 at 14:13 +0100, Radostin Stoyanov wrote:
> ---
> tests/test_docker_source.py | 27 +++++++++++++++++++++++++++
> 1 file changed, 27 insertions(+)
>
> diff --git a/tests/test_docker_source.py b/tests/test_docker_source.py
> index d9fe32f..501ec1c 100644
> --- a/tests/test_docker_source.py
> +++ b/tests/test_docker_source.py
> @@ -526,6 +526,33 @@ class TestDockerSource(unittest.TestCase):
> """
> self._unpack_test_fmt('dir', 'virtBootstrap.utils.untar_layers')
>
> + def test_unpack_qcow2_format(self):
> + """
> + Ensures that unpack() calls Build_QCOW2_Image() when the output
> + format is set to 'qcow2'.
> + """
> + patch_method = 'virtBootstrap.utils.Build_QCOW2_Image'
> +
> + m_self = self._mock_docker_source()
> + m_self.output_format = 'qcow2'
> + m_self.tar_files = ['foo', 'bar']
> + m_self.uid_map = 'uid_map'
> + m_self.gid_map = 'gid_map'
> + m_self.root_password = 'secret'
> + m_self.fetch_layers = mock.Mock()
> + dest = 'destination path'
> + with mock.patch(patch_method) as m_Build_QCOW2_Image:
> + sources.DockerSource.unpack(m_self, dest)
> +
> + m_Build_QCOW2_Image.assert_called_once_with(
> + tar_files=m_self.tar_files,
> + dest=dest,
> + progress=m_self.progress,
> + uid_map=m_self.uid_map,
> + gid_map=m_self.gid_map,
> + root_password=m_self.root_password
> + )
> +
> def unpack_raise_error_test(self,
> output_format,
> patch_method,
For this commit and the following one, I guess, we'ld better have a global test of virt-bootstrap,
but that is more or less the same thing than the tests I suggested in an earlier email.
--
Cedric
More information about the virt-tools-list
mailing list