[virt-bootstrap] [PATCH v4 25/26] tests: DockerSource for fmt='qcow2'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list



[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux