38 lines
900 B
Python
38 lines
900 B
Python
from __future__ import annotations
|
|
|
|
from types import SimpleNamespace
|
|
|
|
from gui.components.wifi_adb_one_click_scan import _handle_scan_result
|
|
|
|
|
|
class _Var:
|
|
def __init__(self):
|
|
self.value = ""
|
|
|
|
def set(self, value):
|
|
self.value = value
|
|
|
|
|
|
def test_failed_scan_hint_mentions_multi_target_connect_without_saying_multiple_adb_conflict():
|
|
logs: list[str] = []
|
|
devs = [
|
|
SimpleNamespace(
|
|
target="192.168.10.105:44219",
|
|
adb_state="failed",
|
|
message="cannot connect",
|
|
)
|
|
]
|
|
|
|
_handle_scan_result(
|
|
devs,
|
|
on_line=logs.append,
|
|
device_var=_Var(),
|
|
refresh_devices=lambda: None,
|
|
open_pick_dialog=lambda _devs: None,
|
|
)
|
|
|
|
hint = "\n".join(logs)
|
|
assert "adb connect 192.168.10.105:44219" in hint
|
|
assert "adb devices -l" in hint
|
|
assert "多个 adb 进程冲突" not in hint
|