mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
When we remove a VM, the VM is removed from the project.
This commit is contained in:
1 parent
3f5c2390cd
commit
7bf121c6da
4 files changed
+24
-7
No files matched your search
@@ -68,14 +68,17 @@ def test_vm_working_directory(tmpdir, vm):
|
||||
|
||||
|
||||
def test_mark_vm_for_destruction(tmpdir, vm):
|
||||
p = Project(location=str(tmpdir))
|
||||
p.mark_vm_for_destruction(vm)
|
||||
assert len(p._vms_to_destroy) == 1
|
||||
project = Project(location=str(tmpdir))
|
||||
project.add_vm(vm)
|
||||
project.mark_vm_for_destruction(vm)
|
||||
assert len(project._vms_to_destroy) == 1
|
||||
assert len(project.vms) == 0
|
||||
|
||||
|
||||
def test_commit(tmpdir, manager):
|
||||
project = Project(location=str(tmpdir))
|
||||
vm = VPCSVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", project, manager)
|
||||
project.add_vm(vm)
|
||||
directory = project.vm_working_directory(vm)
|
||||
project.mark_vm_for_destruction(vm)
|
||||
assert len(project._vms_to_destroy) == 1
|
||||
@@ -83,6 +86,7 @@ def test_commit(tmpdir, manager):
|
||||
project.commit()
|
||||
assert len(project._vms_to_destroy) == 0
|
||||
assert os.path.exists(directory) is False
|
||||
assert len(project.vms) == 0
|
||||
|
||||
|
||||
def test_project_delete(tmpdir):
|
||||
@@ -95,8 +99,8 @@ def test_project_delete(tmpdir):
|
||||
|
||||
def test_project_add_vm(tmpdir, manager):
|
||||
project = Project(location=str(tmpdir))
|
||||
# The VM initalizer call the add_vm method
|
||||
vm = VPCSVM("test", "00010203-0405-0607-0809-0a0b0c0d0e0f", project, manager)
|
||||
project.add_vm(vm)
|
||||
assert len(project.vms) == 1
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user