@@ -254,6 +254,92 @@ def test___sessions_reserved_using_nested_relay_group___get_connections_by_relay
254254 ]
255255
256256
257+ def test___sessions_reserved___get_connections_by_pin_group___returns_connections (
258+ pin_map_client : PinMapClient ,
259+ pin_map_directory : pathlib .Path ,
260+ session_management_client : SessionManagementClient ,
261+ ) -> None :
262+ with ExitStack () as stack :
263+ pin_map_id = pin_map_client .update_pin_map (pin_map_directory / _PIN_MAP_C )
264+ pin_map_context = PinMapContext (pin_map_id = pin_map_id , sites = [0 ])
265+ pin_group = ["PinGroup1" ]
266+ reservation = stack .enter_context (
267+ session_management_client .reserve_sessions (pin_map_context , pin_group )
268+ )
269+
270+ connections = reservation .get_connections (object , pin_or_relay_names = pin_group )
271+
272+ assert [get_connection_subset (conn ) for conn in connections ] == [
273+ ConnectionSubset ("A" , 0 , "DCPower1/0, DCPower1/2, DCPower2/1" , "DCPower1/0" ),
274+ ConnectionSubset ("S1" , - 1 , "SCOPE1" , "1" ),
275+ ]
276+
277+
278+ def test___sessions_reserved___get_connections_by_nested_pin_group___returns_connections (
279+ pin_map_client : PinMapClient ,
280+ pin_map_directory : pathlib .Path ,
281+ session_management_client : SessionManagementClient ,
282+ ) -> None :
283+ with ExitStack () as stack :
284+ pin_map_id = pin_map_client .update_pin_map (pin_map_directory / _PIN_MAP_C )
285+ pin_map_context = PinMapContext (pin_map_id = pin_map_id , sites = [0 ])
286+ pin_groups = ["PinGroup1" , "PinGroup2" ]
287+ reservation = stack .enter_context (
288+ session_management_client .reserve_sessions (pin_map_context , pin_groups )
289+ )
290+
291+ connections = reservation .get_connections (object , pin_or_relay_names = pin_groups )
292+
293+ assert [get_connection_subset (conn ) for conn in connections ] == [
294+ ConnectionSubset ("A" , 0 , "DCPower1/0, DCPower1/2, DCPower2/1" , "DCPower1/0" ),
295+ ConnectionSubset ("C" , 0 , "SCOPE1" , "2" ),
296+ ConnectionSubset ("S1" , - 1 , "SCOPE1" , "1" ),
297+ ]
298+
299+
300+ def test___sessions_reserved___get_connections_by_relay_group___returns_connections (
301+ pin_map_client : PinMapClient ,
302+ pin_map_directory : pathlib .Path ,
303+ session_management_client : SessionManagementClient ,
304+ ) -> None :
305+ with ExitStack () as stack :
306+ pin_map_id = pin_map_client .update_pin_map (pin_map_directory / _PIN_MAP_C )
307+ pin_map_context = PinMapContext (pin_map_id = pin_map_id , sites = [0 ])
308+ relay_group = ["RelayGroup1" ]
309+ reservation = stack .enter_context (
310+ session_management_client .reserve_sessions (pin_map_context , relay_group )
311+ )
312+
313+ connections = reservation .get_connections (object , pin_or_relay_names = relay_group )
314+
315+ assert [get_connection_subset (conn ) for conn in connections ] == [
316+ ConnectionSubset ("RelayUsingSameDriver" , 0 , "RelayDriver1" , "K0" ),
317+ ConnectionSubset ("SystemRelay" , - 1 , "RelayDriver1" , "K60" ),
318+ ]
319+
320+
321+ def test___sessions_reserved___get_connections_by_nested_relay_groups___returns_connections (
322+ pin_map_client : PinMapClient ,
323+ pin_map_directory : pathlib .Path ,
324+ session_management_client : SessionManagementClient ,
325+ ) -> None :
326+ with ExitStack () as stack :
327+ pin_map_id = pin_map_client .update_pin_map (pin_map_directory / _PIN_MAP_C )
328+ pin_map_context = PinMapContext (pin_map_id = pin_map_id , sites = [0 ])
329+ relay_groups = ["RelayGroup1" , "RelayGroup2" ]
330+ reservation = stack .enter_context (
331+ session_management_client .reserve_sessions (pin_map_context , relay_groups )
332+ )
333+
334+ connections = reservation .get_connections (object , pin_or_relay_names = relay_groups )
335+
336+ assert [get_connection_subset (conn ) for conn in connections ] == [
337+ ConnectionSubset ("RelayUsingSameDriver" , 0 , "RelayDriver1" , "K0" ),
338+ ConnectionSubset ("RelayUsingDifferentDrivers" , 0 , "RelayDriver1" , "K10" ),
339+ ConnectionSubset ("SystemRelay" , - 1 , "RelayDriver1" , "K60" ),
340+ ]
341+
342+
257343def test___reserve_sessions_with_multiplexer___get_connections_with_multiplexer___returns_connections (
258344 pin_map_client : PinMapClient ,
259345 pin_map_directory : pathlib .Path ,
0 commit comments