Skip to content

Fix test_scan implementation #83

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion avatar/cases/le_host_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,29 @@ def test_scan(
scan_response_data = DataTypes() if scannable == 'scannable' else None
target = self.dut.address if directed == 'directed' else None

# Advertise with Android and Scan with Bumble to retrieve the address
android_advertise = self.dut.host.Advertise(
legacy=True,
connectable=True,
own_address_type=RANDOM,
data=DataTypes(manufacturer_specific_data=b'pause cafe'),
)
bumble_scan = self.ref.host.Scan(legacy=False, passive=False, timeout=self.scan_timeout)
result_scan = next((x for x in bumble_scan if b'pause cafe' in x.data.manufacturer_specific_data)) # pytype: disable=name-error
android_advertise.cancel()
bumble_scan.cancel()
logging.error(f'result_scan: {result_scan}')
logging.error(f'random address: {result_scan.random.hex()}')
target = result_scan.random

# Perform the test as usual
advertise = self.ref.host.Advertise(
legacy=True,
connectable=is_connectable,
data=data, # type: ignore[arg-type]
scan_response_data=scan_response_data, # type: ignore[arg-type]
public=target,
# public=target,
random=target,
own_address_type=PUBLIC,
)

Expand Down