From ae79362271b0c5dae240adfc7456c6a0e45abe56 Mon Sep 17 00:00:00 2001 From: elajkat Date: Fri, 17 May 2024 11:35:35 +0200 Subject: [PATCH] SQLAlchemy2: fix remaining issues Remove leftover subransaction=True arguments in some of the unit tests, and fix get_port_network_data as result of session query is tuple instead of dict. Closes-Bug: #2065924 Change-Id: Id87eafeb1a3bbe565ef3ee30f43d449eb0166532 --- neutron_taas/db/taas_db.py | 4 ++-- neutron_taas/tests/unit/db/test_taas_db.py | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/neutron_taas/db/taas_db.py b/neutron_taas/db/taas_db.py index 12fc3b19..f39737ab 100644 --- a/neutron_taas/db/taas_db.py +++ b/neutron_taas/db/taas_db.py @@ -161,8 +161,8 @@ class Taas_db_Mixin(taas_extension.TaasPluginBase): return ns_data = { - 'physical_network': ns['physical_network'], - 'network_type': ns['network_type'] + 'physical_network': ns[1], + 'network_type': ns[2] } return ns_data diff --git a/neutron_taas/tests/unit/db/test_taas_db.py b/neutron_taas/tests/unit/db/test_taas_db.py index d97d0f9e..a7b658d2 100644 --- a/neutron_taas/tests/unit/db/test_taas_db.py +++ b/neutron_taas/tests/unit/db/test_taas_db.py @@ -60,54 +60,54 @@ class TaaSDbTestCase(testlib_api.SqlTestCase): def _get_tap_service(self, tap_service_id): """Helper method to retrieve tap service.""" - with self.ctx.session.begin(subtransactions=True): + with self.ctx.session.begin(): return self.mixin.get_tap_service(self.ctx, tap_service_id) def _get_tap_services(self): """Helper method to retrieve all tap services.""" - with self.ctx.session.begin(subtransactions=True): + with self.ctx.session.begin(): return self.mixin.get_tap_services(self.ctx) def _create_tap_service(self, tap_service): """Helper method to create tap service.""" - with self.ctx.session.begin(subtransactions=True): + with self.ctx.session.begin(): return self.mixin.create_tap_service(self.ctx, tap_service) def _update_tap_service(self, tap_service_id, tap_service): """Helper method to update tap service.""" - with self.ctx.session.begin(subtransactions=True): + with self.ctx.session.begin(): return self.mixin.update_tap_service(self.ctx, tap_service_id, tap_service) def _delete_tap_service(self, tap_service_id): """Helper method to delete tap service.""" - with self.ctx.session.begin(subtransactions=True): + with self.ctx.session.begin(): return self.mixin.delete_tap_service(self.ctx, tap_service_id) def _get_tap_flow(self, tap_flow_id): """Helper method to retrieve tap flow.""" - with self.ctx.session.begin(subtransactions=True): + with self.ctx.session.begin(): return self.mixin.get_tap_flow(self.ctx, tap_flow_id) def _get_tap_flows(self): """Helper method to retrieve all tap flows.""" - with self.ctx.session.begin(subtransactions=True): + with self.ctx.session.begin(): return self.mixin.get_tap_flows(self.ctx) def _create_tap_flow(self, tap_flow): """Helper method to create tap flow.""" - with self.ctx.session.begin(subtransactions=True): + with self.ctx.session.begin(): return self.mixin.create_tap_flow(self.ctx, tap_flow) def _update_tap_flow(self, tap_flow_id, tap_flow): """Helper method to update tap flow.""" - with self.ctx.session.begin(subtransactions=True): + with self.ctx.session.begin(): return self.mixin.update_tap_flow(self.ctx, tap_flow_id, tap_flow) def _delete_tap_flow(self, tap_flow_id): """Helper method to delete tap flow.""" - with self.ctx.session.begin(subtransactions=True): + with self.ctx.session.begin(): return self.mixin.delete_tap_flow(self.ctx, tap_flow_id) def test_tap_service_get(self):