diff --git a/gso/cli/imports.py b/gso/cli/imports.py index 5ef0233c05361b4d4d97bc212789bd99d8ade120..b398c7c5fd11d369a8c24a7cf8c860ef51b21ff7 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 01bb97cf559a609170c36799291cebe0be3b3dbb..f2080380e30773156af456daa080ae1e37f0a7bc 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 891a936f8faad9f06f3b227cfa48806bcbb87842..9575cdfbbf4c88fec5f67e10e1707113ae971b8a 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