Skip to content

Commit

Permalink
One more negative test
Browse files Browse the repository at this point in the history
  • Loading branch information
glennmatthews committed Jan 29, 2015
1 parent f235056 commit ea8529f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions COT/tests/add_disk.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,8 @@ def test_overwrite_implicit_file_id(self):
+ </ovf:Item>
</ovf:VirtualHardwareSection>
""".format(input_size=self.FILE_SIZE['input.vmdk']))
# ovftool will fail because invalid_ovf has an invalid Disk fileRef
self.validate_output_with_ovftool = False

def test_overwrite_disk_with_bad_host_resource(self):
self.instance.set_value("PACKAGE", self.invalid_ovf)
Expand All @@ -639,8 +641,7 @@ def test_overwrite_disk_with_bad_host_resource(self):
self.instance.set_value("address", "0:0")
with self.assertRaises(ValueUnsupportedError) as cm:
self.instance.run()
self.assertRegexpMatches(str(cm.exception),
"HostResource")
self.assertTrue(re.search("HostResource", str(cm.exception)))

def test_overwrite_disk_with_bad_parent_by_file(self):
self.instance.set_value("PACKAGE", self.invalid_ovf)
Expand All @@ -654,3 +655,9 @@ def test_overwrite_disk_with_bad_parent_by_fileid(self):
self.instance.set_value("DISK_IMAGE", self.new_vmdk)
self.instance.set_value("file_id", "input.iso")
self.assertRaises(LookupError, self.instance.run)

def test_overwrite_disk_with_bad_fileref(self):
self.instance.set_value("PACKAGE", self.invalid_ovf)
self.instance.set_value("DISK_IMAGE", self.new_vmdk)
self.instance.set_value("file_id", "flash2")
self.assertRaises(LookupError, self.instance.run)
2 changes: 1 addition & 1 deletion COT/tests/invalid.ovf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<ovf:DiskSection>
<ovf:Info>Virtual disk information</ovf:Info>
<ovf:Disk ovf:capacity="1" ovf:capacityAllocationUnits="byte * 2^30" ovf:diskId="input.vmdk" ovf:fileRef="input.vmdk" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized" />
<ovf:Disk ovf:capacity="128" ovf:capacityAllocationUnits="byte * 2^20" ovf:diskId="flash2" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized" />
<ovf:Disk ovf:capacity="128" ovf:capacityAllocationUnits="byte * 2^20" ovf:diskId="flash2" ovf:fileRef="flash2" ovf:format="http://www.vmware.com/interfaces/specifications/vmdk.html#streamOptimized" />
</ovf:DiskSection>
<ovf:DeploymentOptionSection>
<ovf:Info>Configuration Profiles</ovf:Info>
Expand Down

0 comments on commit ea8529f

Please sign in to comment.