Change in vdsm[master]: v2v: add test to v2v._read_ovf_from_tar_ova

shavivi at redhat.com shavivi at redhat.com
Wed Dec 9 09:46:04 UTC 2015


Shahar Havivi has uploaded a new change for review.

Change subject: v2v: add test to v2v._read_ovf_from_tar_ova
......................................................................

v2v: add test to v2v._read_ovf_from_tar_ova

Change-Id: Id73516164e81e609c70caeac20fb819eaf04a56b
Signed-off-by: Shahar Havivi <shaharh at redhat.com>
---
M tests/v2vTests.py
1 file changed, 18 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/58/50158/1

diff --git a/tests/v2vTests.py b/tests/v2vTests.py
index 884abec..6d37092 100644
--- a/tests/v2vTests.py
+++ b/tests/v2vTests.py
@@ -18,7 +18,10 @@
 #
 
 from collections import namedtuple
+from contextlib import closing
 from StringIO import StringIO
+import tarfile
+import tempfile
 import uuid
 
 import libvirt
@@ -368,3 +371,18 @@
 
         with open('fake-virt-v2v.out', 'r') as f:
             self.assertEqual(output, f.read())
+
+    def testReadOvfFromTarOva(self):
+        ovf = '<ovf/>'
+        ovapath = tempfile.mktemp('.ova')
+        ovfpath = tempfile.mktemp('.ovf')
+
+        with open(ovfpath, 'w') as ovffile:
+            ovffile.write(ovf)
+            ovffile.close()
+
+        with closing(tarfile.open(ovapath, 'w')) as tar:
+            #tar.addfile(tarfile.TarInfo('testvm.ovf'), file(ovfpath))
+            tar.add(ovfpath, arcname='testvm.ovf')
+
+        self.assertEqual(ovf, v2v._read_ovf_from_tar_ova(ovapath))


-- 
To view, visit https://gerrit.ovirt.org/50158
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id73516164e81e609c70caeac20fb819eaf04a56b
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Shahar Havivi <shavivi at redhat.com>


More information about the vdsm-patches mailing list