From 1d77588ea25fec84f931799ba5611cf56d88bc5c Mon Sep 17 00:00:00 2001
From: Mohammad Torkashvand <mohammad.torkashvand@geant.org>
Date: Fri, 22 Sep 2023 14:18:57 +0200
Subject: [PATCH] fix setup.py file requirements

---
 gso/migrations/env.py                 |  6 +++++-
 gso/workflows/tasks/import_iptrunk.py |  3 +--
 gso/workflows/tasks/import_router.py  |  2 +-
 gso/workflows/tasks/import_site.py    |  2 +-
 requirements.txt                      | 25 ++++++++++++-------------
 setup.py                              |  7 +++----
 test/conftest.py                      |  4 +++-
 7 files changed, 26 insertions(+), 23 deletions(-)

diff --git a/gso/migrations/env.py b/gso/migrations/env.py
index 1b039d7f..2f41e241 100644
--- a/gso/migrations/env.py
+++ b/gso/migrations/env.py
@@ -68,8 +68,12 @@ def run_migrations_online() -> None:
                 directives[:] = []
                 logger.info("No changes in schema detected.")
 
+    config_section = config.get_section(config.config_ini_section)
+    if config_section is None:
+        raise ValueError("Config section not found!")
+
     engine = engine_from_config(
-        config.get_section(config.config_ini_section), prefix="sqlalchemy.", poolclass=pool.NullPool
+        config_section, prefix="sqlalchemy.", poolclass=pool.NullPool
     )
 
     connection = engine.connect()
diff --git a/gso/workflows/tasks/import_iptrunk.py b/gso/workflows/tasks/import_iptrunk.py
index 72dddffc..db4cb347 100644
--- a/gso/workflows/tasks/import_iptrunk.py
+++ b/gso/workflows/tasks/import_iptrunk.py
@@ -1,5 +1,4 @@
 import ipaddress
-from uuid import UUID
 
 from orchestrator import workflow
 from orchestrator.forms import FormPage
@@ -65,7 +64,7 @@ def initial_input_form_generator() -> FormGenerator:
 
 @step("Create a new subscription")
 def create_subscription(customer: str) -> State:
-    customer_id: UUID = get_customer_by_name(customer)["id"]
+    customer_id = get_customer_by_name(customer)["id"]
     product_id = subscriptions.get_product_id_by_name(ProductType.IP_TRUNK)
     subscription = IptrunkInactive.from_product_id(product_id, customer_id)
 
diff --git a/gso/workflows/tasks/import_router.py b/gso/workflows/tasks/import_router.py
index 9e0a4337..4d157709 100644
--- a/gso/workflows/tasks/import_router.py
+++ b/gso/workflows/tasks/import_router.py
@@ -36,7 +36,7 @@ def _get_site_by_name(site_name: str) -> Site:
 
 @step("Create subscription")
 def create_subscription(customer: str) -> State:
-    customer_id: UUID = get_customer_by_name(customer)["id"]
+    customer_id = get_customer_by_name(customer)["id"]
     product_id: UUID = subscriptions.get_product_id_by_name(ProductType.ROUTER)
     subscription = RouterInactive.from_product_id(product_id, customer_id)
 
diff --git a/gso/workflows/tasks/import_site.py b/gso/workflows/tasks/import_site.py
index 0d03ed87..20967c71 100644
--- a/gso/workflows/tasks/import_site.py
+++ b/gso/workflows/tasks/import_site.py
@@ -16,7 +16,7 @@ from gso.workflows.site.create_site import initialize_subscription
 
 @step("Create subscription")
 def create_subscription(customer: str) -> State:
-    customer_id: UUID = get_customer_by_name(customer)["id"]
+    customer_id = get_customer_by_name(customer)["id"]
     product_id: UUID = subscriptions.get_product_id_by_name(ProductType.SITE)
     subscription = SiteInactive.from_product_id(product_id, customer_id)
 
diff --git a/requirements.txt b/requirements.txt
index 29e9766b..8b230dfd 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,16 +1,15 @@
 orchestrator-core==1.3.0
-requests
+requests==2.31.0
 infoblox-client~=0.6.0
-pycountry
+pycountry==22.3.5
 
-pytest
-faker
-responses
-black
-isort
-flake8
-mypy
-ruff
-sphinx
-sphinx-rtd-theme
-typer
\ No newline at end of file
+pytest==7.4.2
+faker==19.6.2
+responses==0.23.3
+black==23.9.1
+isort==5.12.0
+flake8==6.1.0
+mypy==1.5.1
+ruff==0.0.290
+sphinx==7.2.6
+sphinx-rtd-theme==1.3.0
diff --git a/setup.py b/setup.py
index 92b2801a..dfb10261 100644
--- a/setup.py
+++ b/setup.py
@@ -9,10 +9,9 @@ setup(
     url="https://gitlab.software.geant.org/goat/gap/geant-service-orchestrator",
     packages=find_packages(),
     install_requires=[
-        "orchestrator-core==1.2.2",
-        "pydantic~=1.10.9",
-        "requests~=2.31.0",
+        "orchestrator-core==1.3.0",
+        "requests==2.31.0",
         "infoblox-client~=0.6.0",
-        "pycountry",
+        "pycountry==22.3.5",
     ],
 )
diff --git a/test/conftest.py b/test/conftest.py
index ff3cb944..a811b7c3 100644
--- a/test/conftest.py
+++ b/test/conftest.py
@@ -171,7 +171,9 @@ def database(db_uri):
     with engine.connect() as conn:
         conn.execute(text("COMMIT;"))
         conn.execute(
-            text("SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname=:dbname"), dbname=db_to_create
+            text("SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname=:db_name").bindparams(
+                db_name=db_to_create
+            )
         )
 
         conn.execute(text(f'DROP DATABASE IF EXISTS "{db_to_create}";'))
-- 
GitLab