@@ -159,6 +159,69 @@ async def test_function_job_collection(
159159 )
160160
161161
162+ @pytest .mark .parametrize (
163+ "user_role" ,
164+ [UserRole .USER ],
165+ )
166+ async def test_create_function_job_collection_same_function_job_uuid (
167+ client : TestClient ,
168+ add_user_function_api_access_rights : None ,
169+ create_fake_function_obj : Callable [[FunctionClass ], Function ],
170+ webserver_rpc_client : WebServerRpcClient ,
171+ logged_user : UserInfoDict ,
172+ other_logged_user : UserInfoDict ,
173+ user_without_function_api_access_rights : UserInfoDict ,
174+ osparc_product_name : ProductName ,
175+ ):
176+ # Register the function first
177+ registered_function = await webserver_rpc_client .functions .register_function (
178+ function = create_fake_function_obj (FunctionClass .PROJECT ),
179+ user_id = logged_user ["id" ],
180+ product_name = osparc_product_name ,
181+ )
182+ assert registered_function .uid is not None
183+
184+ registered_function_job = ProjectFunctionJob (
185+ function_uid = registered_function .uid ,
186+ title = "Test Function Job" ,
187+ description = "A test function job" ,
188+ project_job_id = uuid4 (),
189+ inputs = {"input1" : "value1" },
190+ outputs = {"output1" : "result1" },
191+ job_creation_task_id = None ,
192+ )
193+ # Register the function job
194+ function_job_ids = []
195+ registered_function_job = ProjectFunctionJob (
196+ function_uid = registered_function .uid ,
197+ title = "Test Function Job" ,
198+ description = "A test function job" ,
199+ project_job_id = uuid4 (),
200+ inputs = {"input1" : "value1" },
201+ outputs = {"output1" : "result1" },
202+ job_creation_task_id = None ,
203+ )
204+ # Register the function job
205+ registered_job = await webserver_rpc_client .functions .register_function_job (
206+ function_job = registered_function_job ,
207+ user_id = logged_user ["id" ],
208+ product_name = osparc_product_name ,
209+ )
210+ assert registered_job .uid is not None
211+
212+ function_job_ids = [registered_job .uid ] * 3
213+
214+ function_job_collection = FunctionJobCollection (
215+ title = "Test Function Job Collection" ,
216+ description = "A test function job collection" ,
217+ job_ids = function_job_ids ,
218+ )
219+
220+ assert function_job_collection .job_ids [0 ] == registered_job .uid
221+ assert function_job_collection .job_ids [1 ] == registered_job .uid
222+ assert function_job_collection .job_ids [2 ] == registered_job .uid
223+
224+
162225@pytest .mark .parametrize (
163226 "user_role" ,
164227 [UserRole .USER ],
0 commit comments