async def test_video(self) -> None: mock = AsyncMock() with patch( "idb.cli.commands.record.RecordVideoCommand._run_impl", new=mock, create=True, ): output_file = "video.mp4" await cli_main(cmd_input=["record-video", output_file]) namespace = Namespace() # pyre-fixme[16]: `Namespace` has no attribute `log_level`. namespace.log_level = "WARNING" # pyre-fixme[16]: `Namespace` has no attribute `root_command`. namespace.root_command = "record-video" # pyre-fixme[16]: `Namespace` has no attribute `udid`. namespace.udid = None # pyre-fixme[16]: `Namespace` has no attribute `json`. namespace.json = False # pyre-fixme[16]: `Namespace` has no attribute `output_file`. namespace.output_file = output_file # pyre-fixme[16]: `Namespace` has no attribute `daemon_port`. namespace.daemon_port = 9888 # pyre-fixme[16]: `Namespace` has no attribute `daemon_grpc_port`. namespace.daemon_grpc_port = 9889 # pyre-fixme[16]: `Namespace` has no attribute `daemon_host`. namespace.daemon_host = "localhost" # pyre-fixme[16]: `Namespace` has no attribute `force`. namespace.force = False mock.assert_called_once_with(namespace)
async def test_daemon(self) -> None: mock = AsyncMock() with patch("idb.cli.commands.daemon.DaemonCommand._run_impl", new=mock, create=True): port = 9888 grpc_port = 1235 await cli_main( cmd_input=["daemon", "--daemon-grpc-port", str(grpc_port)]) namespace = Namespace() namespace.companion_path = COMPANION_PATH namespace.companion = None namespace.companion_local = False namespace.prune_dead_companion = True namespace.daemon_port = port namespace.daemon_grpc_port = grpc_port namespace.log_level = "WARNING" namespace.log_level_deprecated = None namespace.root_command = "daemon" namespace.json = False namespace.reply_fd = None namespace.prefer_ipv6 = False namespace.notifier_path = None mock.assert_called_once_with(namespace)
async def test_log_arguments(self) -> None: mock = AsyncMock() with patch("idb.cli.commands.log.LogCommand._run_impl", new=mock, create=True): await cli_main(cmd_input=["log", "--", "--style", "json"]) namespace = Namespace() # pyre-fixme[16]: `Namespace` has no attribute `log_level`. namespace.log_level = "WARNING" # pyre-fixme[16]: `Namespace` has no attribute `root_command`. namespace.root_command = "log" # pyre-fixme[16]: `Namespace` has no attribute `udid`. namespace.udid = None # pyre-fixme[16]: `Namespace` has no attribute `json`. namespace.json = False # pyre-fixme[16]: `Namespace` has no attribute `log_arguments`. namespace.log_arguments = ["--", "--style", "json"] # pyre-fixme[16]: `Namespace` has no attribute `daemon_port`. namespace.daemon_port = 9888 # pyre-fixme[16]: `Namespace` has no attribute `daemon_grpc_port`. namespace.daemon_grpc_port = 9889 # pyre-fixme[16]: `Namespace` has no attribute `daemon_host`. namespace.daemon_host = "localhost" # pyre-fixme[16]: `Namespace` has no attribute `force`. namespace.force = False mock.assert_called_once_with(namespace)
async def test_daemon(self) -> None: mock = AsyncMock() with patch("idb.cli.commands.daemon.DaemonCommand._run_impl", new=mock, create=True): port = 9888 grpc_port = 1235 await cli_main( cmd_input=["daemon", "--daemon-grpc-port", str(grpc_port)]) namespace = Namespace() # pyre-fixme[16]: `Namespace` has no attribute `daemon_port`. namespace.daemon_port = port # pyre-fixme[16]: `Namespace` has no attribute `daemon_grpc_port`. namespace.daemon_grpc_port = grpc_port # pyre-fixme[16]: `Namespace` has no attribute `log_level`. namespace.log_level = "WARNING" # pyre-fixme[16]: `Namespace` has no attribute `root_command`. namespace.root_command = "daemon" # pyre-fixme[16]: `Namespace` has no attribute `json`. namespace.json = False # pyre-fixme[16]: `Namespace` has no attribute `reply_fd`. namespace.reply_fd = None # pyre-fixme[16]: `Namespace` has no attribute `prefer_ipv6`. namespace.prefer_ipv6 = False # pyre-fixme[16]: `Namespace` has no attribute `notifier_path`. namespace.notifier_path = None mock.assert_called_once_with(namespace)
async def test_xctest_run_ui(self) -> None: mock = AsyncMock() mock.return_value = [] with patch("idb.cli.commands.xctest.XctestRunUICommand.run", new=mock, create=True): test_bundle_id = "com.me.tests" app_under_test_id = "com.me.app" test_host_app_bundle_id = "com.host.app" await cli_main(cmd_input=[ "xctest", "run", "ui", test_bundle_id, app_under_test_id, test_host_app_bundle_id, ]) namespace = self.xctest_run_namespace("ui", test_bundle_id) # pyre-fixme[16]: `Namespace` has no attribute `app_bundle_id`. namespace.app_bundle_id = app_under_test_id # pyre-fixme[16]: `Namespace` has no attribute `test_host_app_bundle_id`. namespace.test_host_app_bundle_id = test_host_app_bundle_id # pyre-fixme[16]: `Namespace` has no attribute `force`. namespace.force = False # pyre-fixme[16]: `Namespace` has no attribute `timeout`. namespace.timeout = XCTEST_TIMEOUT mock.assert_called_once_with(namespace)
async def test_xctest_run_logic(self) -> None: mock = AsyncMock() mock.return_value = [] with patch( "idb.cli.commands.xctest.CommonRunXcTestCommand.run", new=mock, create=True ): test_bundle_id = "com.me.tests" await cli_main(cmd_input=["xctest", "run", "logic", test_bundle_id]) namespace = self.xctest_run_namespace("logic", test_bundle_id) namespace.timeout = XCTEST_TIMEOUT mock.assert_called_once_with(namespace)
async def test_xctest_run_app(self) -> None: mock = AsyncMock() mock.return_value = [] with patch( "idb.cli.commands.xctest.XctestRunAppCommand.run", new=mock, create=True ): test_bundle_id = "com.me.tests" app_under_test_id = "com.me.app" await cli_main( cmd_input=["xctest", "run", "app", test_bundle_id, app_under_test_id] ) namespace = self.xctest_run_namespace("app", test_bundle_id) namespace.app_bundle_id = app_under_test_id namespace.timeout = XCTEST_TIMEOUT mock.assert_called_once_with(namespace)
async def test_log_arguments(self) -> None: mock = AsyncMock() with patch("idb.cli.commands.log.LogCommand._run_impl", new=mock, create=True): await cli_main(cmd_input=["log", "--", "--style", "json"]) namespace = Namespace() namespace.companion_path = COMPANION_PATH namespace.companion = None namespace.companion_local = False namespace.prune_dead_companion = True namespace.log_level = "WARNING" namespace.log_level_deprecated = None namespace.root_command = "log" namespace.udid = None namespace.json = False namespace.log_arguments = ["--", "--style", "json"] mock.assert_called_once_with(namespace)
async def test_xctest_run_logic(self) -> None: mock = AsyncMock() mock.return_value = [] with patch( "idb.cli.commands.xctest.CommonRunXcTestCommand.run", new=mock, create=True ): test_bundle_id = "com.me.tests" await cli_main(cmd_input=["xctest", "run", "logic", test_bundle_id]) namespace = self.xctest_run_namespace("logic", test_bundle_id) # pyre-fixme[16]: `Namespace` has no attribute `timeout`. namespace.timeout = XCTEST_TIMEOUT # pyre-fixme[16]: `Namespace` has no attribute `force`. namespace.force = False # pyre-fixme[16]: `Namespace` has no attribute `grpc`. namespace.grpc = False mock.assert_called_once_with(namespace)
async def test_log_arguments(self) -> None: mock = AsyncMock() with patch("idb.cli.commands.log.LogCommand._run_impl", new=mock, create=True): await cli_main(cmd_input=["log", "--", "--style", "json"]) namespace = Namespace() namespace.log_level = "WARNING" namespace.root_command = "log" namespace.udid = None namespace.json = False namespace.log_arguments = ["--", "--style", "json"] namespace.daemon_port = 9888 namespace.daemon_grpc_port = 9889 namespace.daemon_host = "localhost" namespace.force = False namespace.grpc = False mock.assert_called_once_with(namespace)
async def test_video_record(self) -> None: mock = AsyncMock() with patch( "idb.cli.commands.video.VideoRecordCommand._run_impl", new=mock, create=True ): output_file = "video.mp4" await cli_main(cmd_input=["record-video", output_file]) namespace = Namespace() namespace.companion_path = COMPANION_PATH namespace.companion = None namespace.companion_local = False namespace.prune_dead_companion = True namespace.log_level = "WARNING" namespace.log_level_deprecated = None namespace.root_command = "record-video" namespace.udid = None namespace.json = False namespace.output_file = output_file mock.assert_called_once_with(namespace)
async def test_log(self) -> None: mock = AsyncMock() with patch("idb.cli.commands.log.LogCommand._run_impl", new=mock, create=True): await cli_main(cmd_input=["log", "--udid", "1234"]) namespace = Namespace() namespace.companion_path = "/usr/local/bin/idb_companion" namespace.companion = None namespace.log_level = "WARNING" namespace.log_level_deprecated = None namespace.root_command = "log" namespace.udid = "1234" namespace.json = False namespace.log_arguments = [] namespace.daemon_port = 9888 namespace.daemon_grpc_port = 9889 namespace.daemon_host = "localhost" namespace.force = False mock.assert_called_once_with(namespace)
async def test_video(self) -> None: mock = AsyncMock() with patch( "idb.cli.commands.record.RecordVideoCommand._run_impl", new=mock, create=True, ): output_file = "video.mp4" await cli_main(cmd_input=["record-video", output_file]) namespace = Namespace() namespace.log_level = "WARNING" namespace.root_command = "record-video" namespace.udid = None namespace.json = False namespace.output_file = output_file namespace.daemon_port = 9888 namespace.daemon_grpc_port = 9889 namespace.daemon_host = "localhost" namespace.force = False namespace.grpc = False mock.assert_called_once_with(namespace)
async def test_video_stream(self) -> None: mock = AsyncMock() with patch("idb.cli.commands.video.VideoStreamCommand._run_impl", new=mock, create=True): output_file = "video.mp4" await cli_main(cmd_input=["video-stream", output_file]) mock.assert_called_once_with( Namespace( companion=None, companion_path=COMPANION_PATH, companion_local=False, prune_dead_companion=True, log_level="WARNING", format="h264", fps=None, log_level_deprecated=None, root_command="video-stream", udid=None, json=False, output_file=output_file, ))
async def test_xctest_run_ui(self) -> None: mock = AsyncMock() mock.return_value = [] with patch("idb.cli.commands.xctest_run.RunXcTestUICommand.run", new=mock, create=True): test_bundle_id = "com.me.tests" app_under_test_id = "com.me.app" test_host_app_bundle_id = "com.host.app" await cli_main(cmd_input=[ "xctest", "run", "ui", test_bundle_id, app_under_test_id, test_host_app_bundle_id, ]) namespace = self.xctest_run_namespace("ui", test_bundle_id) namespace.app_bundle_id = app_under_test_id namespace.test_host_app_bundle_id = test_host_app_bundle_id namespace.force = False namespace.timeout = XCTEST_TIMEOUT namespace.grpc = False mock.assert_called_once_with(namespace, Namespace())