mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 22:11:14 +02:00
Fix: #1066 - Catching parsing errors at linked vbox file
This commit is contained in:
1 parent
c1c3a9ed80
commit
5c0d955156
2 files changed
+18
-1
No files matched your search
@@ -113,3 +113,15 @@ def test_patch_vm_uuid(vm):
|
||||
with open(vm._linked_vbox_file()) as f:
|
||||
c = f.read()
|
||||
assert "{" + vm.id + "}" in c
|
||||
|
||||
|
||||
def test_patch_vm_uuid_with_corrupted_file(vm):
|
||||
xml = """<?xml version="1.0"?>
|
||||
<VirtualBox>
|
||||
"""
|
||||
os.makedirs(os.path.join(vm.working_dir, vm._vmname), exist_ok=True)
|
||||
with open(vm._linked_vbox_file(), "w+") as f:
|
||||
f.write(xml)
|
||||
vm._linked_clone = True
|
||||
with pytest.raises(VirtualBoxError):
|
||||
vm._patch_vm_uuid()
|
||||
Reference in new issue
Block a user