From b31a64273e78855274878ea060ed305f712e79f6 Mon Sep 17 00:00:00 2001
From: Karel van Klink <karel.vanklink@geant.org>
Date: Fri, 19 Apr 2024 14:17:20 +0200
Subject: [PATCH] modify input form for router validation workflow

---
 gso/workflows/router/modify_connection_strategy.py |  2 +-
 gso/workflows/router/validate_router.py            | 10 +++++-----
 test/workflows/router/test_validate_router.py      |  5 +++--
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/gso/workflows/router/modify_connection_strategy.py b/gso/workflows/router/modify_connection_strategy.py
index 3aacfc0a..bff6fdc7 100644
--- a/gso/workflows/router/modify_connection_strategy.py
+++ b/gso/workflows/router/modify_connection_strategy.py
@@ -13,7 +13,7 @@ from gso.utils.shared_enums import ConnectionStrategy
 
 
 def initial_input_form_generator(subscription_id: UUIDstr) -> FormGenerator:
-    """Modify the connection strategy initial formruff format."""
+    """Modify the connection strategy initial form."""
     subscription = Router.from_subscription(subscription_id)
 
     current_connection_strategy = (
diff --git a/gso/workflows/router/validate_router.py b/gso/workflows/router/validate_router.py
index eb5059eb..c81e82ba 100644
--- a/gso/workflows/router/validate_router.py
+++ b/gso/workflows/router/validate_router.py
@@ -19,13 +19,13 @@ from gso.workflows.router.update_ibgp_mesh import add_p_to_mesh_dry
 TT_NUMBER_ZERO = "TT#0000000000000000"
 
 
-def _seed_initial_state(subscription_id: UUIDstr) -> FormGenerator:
-    router = Router.from_subscription(subscription_id)
+def _seed_initial_state() -> FormGenerator:
 
-    class EmptyForm(FormPage):
-        pass
+    class InputForm(FormPage):
+        subscription_id: UUIDstr
 
-    yield EmptyForm
+    user_input = yield InputForm
+    router = Router.from_subscription(user_input["subscription_id"])
 
     return {"subscription": router, "tt_number": TT_NUMBER_ZERO}
 
diff --git a/test/workflows/router/test_validate_router.py b/test/workflows/router/test_validate_router.py
index c6610c74..c8d6c610 100644
--- a/test/workflows/router/test_validate_router.py
+++ b/test/workflows/router/test_validate_router.py
@@ -15,7 +15,7 @@ from test.workflows import (
 @pytest.mark.workflow()
 @pytest.mark.parametrize("product_id", ["nokia_router_subscription_factory", "juniper_router_subscription_factory"])
 @patch("gso.services.infoblox.find_host_by_fqdn")
-@patch("gso.workflows.router.validate_router.execute_playbook")
+@patch("gso.services.lso_client.execute_playbook")
 def test_validate_router_success(
     mock_validate_router,
     mock_find_host_by_fqdn,
@@ -23,9 +23,10 @@ def test_validate_router_success(
     faker,
     data_config_filename,
     request,
+    geant_partner,
 ):
     #  Run workflow
-    subscription_id = request.getfixturevalue(product_id)()
+    subscription_id = request.getfixturevalue(product_id)(partner=geant_partner)
     mock_fqdn = Router.from_subscription(subscription_id).router.router_fqdn
     mock_v4 = faker.ipv4()
     mock_find_host_by_fqdn.return_value = objects.HostRecord(
-- 
GitLab