[virt-tools-list] [virt-bootstrap] [PATCH v3 23/24] tests: DockerSource for fmt='qcow2'

Radostin Stoyanov rstoyanov1 at gmail.com
Wed Aug 2 12:08:37 UTC 2017


---
 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,
-- 
2.13.3




More information about the virt-tools-list mailing list