Esempio n. 1
0
 async def test_add_companion_with_host_and_port_adds_companion(
         self) -> None:
     companion_manager = CompanionManager(logger=mock.MagicMock())
     companion_manager.add_companion(
         CompanionInfo(udid="asdasda",
                       host="foohost",
                       port=123,
                       is_local=False))
     assert companion_manager._udid_companion_map["asdasda"]
Esempio n. 2
0
 async def test_get_default_companion(self) -> None:
     companion_manager = CompanionManager(logger=mock.MagicMock())
     self.assertFalse(companion_manager.has_default_companion())
     add_companion(companion_manager, TEST_COMPANION)
     self.assertTrue(companion_manager.has_default_companion())
     self.assertEqual(companion_manager.get_default_companion(),
                      TEST_COMPANION)
     companion_manager.add_companion(
         CompanionInfo(
             udid="someOtherUdid",
             host=TEST_COMPANION.host,
             port=TEST_COMPANION.port,
             is_local=TEST_COMPANION.is_local,
         ))
     self.assertFalse(companion_manager.has_default_companion())
Esempio n. 3
0
 async def test_add_companion_assigns_to_target(self) -> None:
     companion_manager = CompanionManager(logger=mock.MagicMock())
     companion_manager.update_target(
         TargetDescription(
             udid="asdasda",
             name="iPhone",
             state="Booted",
             target_type="simulator",
             os_version="iOS 11.4",
             architecture="x86_64",
             companion_info=None,
             screen_dimensions=None,
         ))
     companion_manager.add_companion(
         CompanionInfo(udid="asdasda",
                       host="foohost",
                       port=123,
                       is_local=False))
     assert companion_manager._udid_target_map["asdasda"].companion_info
Esempio n. 4
0
def add_companion(companion_manager: CompanionManager,
                  companion: CompanionInfo = TEST_COMPANION) -> None:
    companion_manager.add_companion(companion)