@@ -96,6 +96,8 @@ def _create_test_plan_templates(
9696@pytest .mark .enterprise
9797class TestTestPlanClient :
9898
99+ _workspace = "33eba2fe-fe42-48a1-a47f-a6669479a8aa"
100+
99101 _dashboard = Dashboard (
100102 id = "DashBoardId" , variables = {"product" : "PXIe-4080" , "location" : "Lab1" }
101103 )
@@ -123,14 +125,13 @@ class TestTestPlanClient:
123125 state = "NEW" ,
124126 description = "Test plan for verifying integration flow" ,
125127 assigned_to = "test.user@example.com" ,
126- # work_order_id="Sample-Work-Order",
127128 estimated_duration_in_seconds = 86400 ,
128129 properties = {"env" : "staging" , "priority" : "high" },
129130 part_number = "px40482" ,
130131 dut_id = "Sample-Dut_Id" ,
131132 test_program = "TP-Integration-001" ,
132133 system_filter = "os:linux AND arch:x64" ,
133- # workspace="33eba2fe-fe42-48a1-a47f-a6669479a8aa" ,
134+ workspace = _workspace ,
134135 file_ids_from_template = ["file1" , "file2" ],
135136 dashboard = _dashboard ,
136137 execution_actions = _execution_actions ,
@@ -151,7 +152,7 @@ class TestTestPlanClient:
151152 system_filter = "os:linux AND arch:x64" ,
152153 execution_actions = _execution_actions ,
153154 file_ids = ["file1" , "file2" ],
154- # workspace="33eba2fe-fe42-48a1-a47f-a6669479a8aa" ,
155+ workspace = _workspace ,
155156 properties = {"env" : "staging" , "priority" : "high" },
156157 dashboard = _dashboard ,
157158 )
@@ -161,14 +162,32 @@ class TestTestPlanClient:
161162 def test__create_and_delete_test_plan__returns_created_and_deleted_test_plans (
162163 self , client : TestPlanClient , create_test_plans
163164 ):
164- create_test_plan_response = create_test_plans (self ._test_plan_create )
165+ create_test_plan_template_response = client .create_test_plan_templates (
166+ test_plan_templates = self ._create_test_plan_template_request
167+ )
168+
169+ template_id = (
170+ create_test_plan_template_response .created_test_plan_templates [0 ].id
171+ if create_test_plan_template_response .created_test_plan_templates
172+ and create_test_plan_template_response .created_test_plan_templates [0 ].id
173+ else None
174+ )
175+
176+ assert template_id is not None
177+
178+ test_plan_request = self ._test_plan_create
179+ test_plan_request [0 ].template_id = template_id
180+
181+ create_test_plan_response = create_test_plans (test_plan_request )
165182
166183 assert create_test_plan_response .created_test_plans is not None
167184
168185 created_test_plan = create_test_plan_response .created_test_plans [0 ]
169186
170187 get_test_plan_response : TestPlan = client .get_test_plan (created_test_plan .id )
171188
189+ client .delete_test_plan_templates (ids = [template_id ])
190+
172191 assert created_test_plan is not None
173192 assert created_test_plan .name == "Python integration test plan"
174193 assert created_test_plan .state == State .NEW
0 commit comments