コード例 #1
0
ファイル: management.py プロジェクト: sravanmedarapu/idb
 async def list_targets(self) -> List[TargetDescription]:
     (_, companions) = await asyncio.gather(
         self._spawn_notifier(),
         self.direct_companion_manager.get_companions())
     connected_targets = [
         target for target in (await asyncio.gather(
             *(self._companion_to_target(companion=companion)
               for companion in companions))) if target is not None
     ]
     return merge_connected_targets(
         local_targets=self.local_targets_manager.get_local_targets(),
         connected_targets=connected_targets,
     )
コード例 #2
0
ファイル: companion_tests.py プロジェクト: 5l1v3r1/idb-1
 def test_merge_connected_targets(self) -> None:
     merged_targets = merge_connected_targets(
         local_targets=[
             TargetDescription(
                 udid="a",
                 name="aa",
                 state=None,
                 target_type=None,
                 os_version=None,
                 architecture=None,
                 companion_info=None,
                 screen_dimensions=None,
             ),
             TargetDescription(
                 udid="b",
                 name="bb",
                 state=None,
                 target_type=None,
                 os_version=None,
                 architecture=None,
                 companion_info=None,
                 screen_dimensions=None,
             ),
             TargetDescription(
                 udid="c",
                 name="cc",
                 state=None,
                 target_type=None,
                 os_version=None,
                 architecture=None,
                 companion_info=None,
                 screen_dimensions=None,
             ),
         ],
         connected_targets=[
             TargetDescription(
                 udid="a",
                 name="aa",
                 state=None,
                 target_type=None,
                 os_version=None,
                 architecture=None,
                 companion_info=CompanionInfo(udid="a",
                                              host="remotehost",
                                              port=1,
                                              is_local=False),
                 screen_dimensions=None,
             ),
             TargetDescription(
                 udid="d",
                 name="dd",
                 state=None,
                 target_type=None,
                 os_version=None,
                 architecture=None,
                 companion_info=CompanionInfo(udid="d",
                                              host="remotehost",
                                              port=2,
                                              is_local=False),
                 screen_dimensions=None,
             ),
         ],
     )
     self.assertEqual(
         merged_targets,
         [
             TargetDescription(
                 udid="a",
                 name="aa",
                 state=None,
                 target_type=None,
                 os_version=None,
                 architecture=None,
                 companion_info=CompanionInfo(
                     udid="a", host="remotehost", port=1, is_local=False),
                 screen_dimensions=None,
             ),
             TargetDescription(
                 udid="b",
                 name="bb",
                 state=None,
                 target_type=None,
                 os_version=None,
                 architecture=None,
                 companion_info=None,
                 screen_dimensions=None,
             ),
             TargetDescription(
                 udid="c",
                 name="cc",
                 state=None,
                 target_type=None,
                 os_version=None,
                 architecture=None,
                 companion_info=None,
                 screen_dimensions=None,
             ),
             TargetDescription(
                 udid="d",
                 name="dd",
                 state=None,
                 target_type=None,
                 os_version=None,
                 architecture=None,
                 companion_info=CompanionInfo(
                     udid="d", host="remotehost", port=2, is_local=False),
                 screen_dimensions=None,
             ),
         ],
     )