From 098c38c9b05d64bca726681fd4329093a028e798 Mon Sep 17 00:00:00 2001 From: Mohammad Torkashvand <mohammad.torkashvand@geant.org> Date: Mon, 18 Mar 2024 15:04:44 +0100 Subject: [PATCH] regnerated the PartnerTable migration again --- gso/cli/imports.py | 4 +--- gso/services/partners.py | 4 ---- test/fixtures.py | 3 ++- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/gso/cli/imports.py b/gso/cli/imports.py index 5ef0233c0..b398c7c5f 100644 --- a/gso/cli/imports.py +++ b/gso/cli/imports.py @@ -221,9 +221,7 @@ def import_partners(file_path: str = typer.Argument(..., help="Path to the CSV f try: for partner in partners: if partner.get("created_at"): - partner["created_at"] = datetime.strptime(partner["created_at"], "%Y-%m-%d").replace( - tzinfo=UTC - ) + partner["created_at"] = datetime.strptime(partner["created_at"], "%Y-%m-%d").replace(tzinfo=UTC) new_partner = PartnerTable(**partner) db.session.add(new_partner) diff --git a/gso/services/partners.py b/gso/services/partners.py index 01bb97cf5..f2080380e 100644 --- a/gso/services/partners.py +++ b/gso/services/partners.py @@ -49,8 +49,6 @@ def create_partner( raise finally: db.session.close() - finally: - db.session.close() def delete_partner_by_name(name: str) -> None: @@ -67,5 +65,3 @@ def delete_partner_by_name(name: str) -> None: raise finally: db.session.close() - finally: - db.session.close() diff --git a/test/fixtures.py b/test/fixtures.py index 891a936f8..9575cdfbb 100644 --- a/test/fixtures.py +++ b/test/fixtures.py @@ -258,7 +258,8 @@ def iptrunk_subscription_factory(iptrunk_side_subscription_factory, faker, geant iptrunk_sides = iptrunk_sides or [iptrunk_side_a, iptrunk_side_b] iptrunk_subscription = IptrunkInactive.from_product_id( - product_id, customer_id=partner["partner_id"], insync=True) + product_id, customer_id=partner["partner_id"], insync=True + ) iptrunk_subscription.iptrunk.geant_s_sid = geant_s_sid iptrunk_subscription.iptrunk.iptrunk_description = iptrunk_description iptrunk_subscription.iptrunk.iptrunk_type = iptrunk_type -- GitLab