From 55bf6babd9762c34b8b01e420bdfd284adbffdbb Mon Sep 17 00:00:00 2001
From: Mohammad Torkashvand <mohammad.torkashvand@geant.org>
Date: Mon, 18 Mar 2024 14:57:46 +0100
Subject: [PATCH] resolve review notes

---
 gso/cli/imports.py       | 4 ++--
 gso/schema/__init__.py   | 2 +-
 gso/services/partners.py | 4 ++++
 test/fixtures.py         | 3 ++-
 4 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/gso/cli/imports.py b/gso/cli/imports.py
index e728884c..5ef0233c 100644
--- a/gso/cli/imports.py
+++ b/gso/cli/imports.py
@@ -3,7 +3,7 @@
 import csv
 import ipaddress
 import json
-from datetime import datetime, UTC
+from datetime import UTC, datetime
 from pathlib import Path
 from typing import TypeVar
 
@@ -216,7 +216,7 @@ def import_partners(file_path: str = typer.Argument(..., help="Path to the CSV f
     """Import partners from a CSV file into the database."""
     typer.echo(f"Importing partners from {file_path} ...")
 
-    partners = import_partners_from_csv(file_path)
+    partners = import_partners_from_csv(Path(file_path))
 
     try:
         for partner in partners:
diff --git a/gso/schema/__init__.py b/gso/schema/__init__.py
index 1a41e97b..20b21e2c 100644
--- a/gso/schema/__init__.py
+++ b/gso/schema/__init__.py
@@ -1 +1 @@
-"""Partner schema module."""
+"""It is used to group the schema files together as a package."""
diff --git a/gso/services/partners.py b/gso/services/partners.py
index ea226028..f2080380 100644
--- a/gso/services/partners.py
+++ b/gso/services/partners.py
@@ -47,6 +47,8 @@ def create_partner(
     except SQLAlchemyError:
         db.session.rollback()
         raise
+    finally:
+        db.session.close()
 
 
 def delete_partner_by_name(name: str) -> None:
@@ -61,3 +63,5 @@ def delete_partner_by_name(name: str) -> None:
     except SQLAlchemyError:
         db.session.rollback()
         raise
+    finally:
+        db.session.close()
diff --git a/test/fixtures.py b/test/fixtures.py
index 3c24cb4d..891a936f 100644
--- a/test/fixtures.py
+++ b/test/fixtures.py
@@ -257,7 +257,8 @@ def iptrunk_subscription_factory(iptrunk_side_subscription_factory, faker, geant
         iptrunk_side_b = iptrunk_side_subscription_factory()
         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)
+        iptrunk_subscription = IptrunkInactive.from_product_id(
+            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