Skip to content

Commit 7df9250

Browse files
Better tes of deletion
1 parent 52afe01 commit 7df9250

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

backend/test/integration/test_vm_life.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ def test_old_vm_deletion(init_vm_database):
2929
else :
3030
assert True
3131
# If previous test fail, we do not try to create a new one
32-
32+
3333
@pytest.mark.dependency(name="creation", depends=["clean"])
3434
def test_valid_vm_creation(monkeypatch, init_user_database, init_vm_database):
35-
"""Test case for vm_creation. The vm configuration is also tested
35+
"""Test case for vm_creation. The vm configuration is also tested
3636
"""
37-
37+
3838
def fake_next_available_vmid():
3939
return VMID
4040

@@ -45,14 +45,14 @@ def fake_set_new_vm_ip(next_vmid, node):
4545
db = SQLAlchemy()
4646
db.init_app(app.app)
4747
with app.app.app_context():
48-
# Mocking
48+
# Mocking
4949
monkeypatch.setattr(proxmox, 'next_available_vmid', fake_next_available_vmid)
5050
monkeypatch.setattr(proxmox, 'set_new_vm_ip', fake_set_new_vm_ip)
5151

5252

5353

5454
body,status = proxmox.create_vm("INTEGRATION-TEST-VM", "bare_vm", "valid-user", password="1A#aaaaaaaaa", vm_user="user", main_ssh_key="ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKWkpOTUuLKpZEQT2CmEsgZwZzegitYCx/8vHICvv261 fake@key")
55-
assert status == 201
55+
assert status == 201
5656
start_time = time.time()
5757
configuration_state = "creating"
5858
while time.time() - start_time <= 600 and configuration_state == "creating": # timeout after 10min
@@ -98,6 +98,7 @@ def test_vm_deletion():
9898
node = proxmox.get_node_from_vm(VMID)
9999
isProxmoxDeleted = proxmox.delete_from_proxmox(VMID, node)
100100
isDbDeleted = proxmox.delete_from_db(VMID)
101-
assert isProxmoxDeleted and isDbDeleted
101+
assert isProxmoxDeleted
102+
assert isDbDeleted
103+
102104

103-

0 commit comments

Comments
 (0)