From fce3f2071b6501a3addf95ee403e2d344ff5d629 Mon Sep 17 00:00:00 2001 From: "Josephine.Rutten" Date: Fri, 20 Dec 2024 10:33:20 +0100 Subject: [PATCH] improved unit test cleanup --- src/cnaas_nms/api/tests/test_interface.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/cnaas_nms/api/tests/test_interface.py b/src/cnaas_nms/api/tests/test_interface.py index 8ac1ec19..60f403c2 100644 --- a/src/cnaas_nms/api/tests/test_interface.py +++ b/src/cnaas_nms/api/tests/test_interface.py @@ -12,7 +12,6 @@ from cnaas_nms.db.device import Device, DeviceState, DeviceType from cnaas_nms.db.interface import Interface, InterfaceConfigType from cnaas_nms.db.session import sqla_session -from cnaas_nms.db.stackmember import Stackmember @pytest.mark.integration @@ -24,10 +23,10 @@ def requirements(self, postgresql, settings_directory): def cleandb(self): with sqla_session() as session: # type: ignore - for hardware_id in ["AB1234", "CD5555", "GF43534"]: - stack = session.query(Stackmember).filter(Stackmember.hardware_id == hardware_id).one_or_none() - if stack: - session.delete(stack) + for interface_name in ["testinterface1", "testinterface2"]: + interface = session.query(Interface).filter(Interface.name == interface_name).one_or_none() + if interface: + session.delete(interface) session.commit() for hostname in ["testdevice", "testdevice2"]: device = session.query(Device).filter(Device.hostname == hostname).one_or_none()