Skip to content

Commit e05d4f4

Browse files
committed
improve test
1 parent 6e561f8 commit e05d4f4

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

tests/test_application.py

+4-10
Original file line numberDiff line numberDiff line change
@@ -600,20 +600,14 @@ async def test_move_network_to_channel(app):
600600

601601

602602
async def test_energy_scan(app):
603-
async def mock_at_command(cmd, *args):
604-
if cmd == "ED":
605-
return b"\x0A\x0F\x14\x19\x1E\x23\x28\x2D\x32\x37\x3C\x41\x46\x4B\x50\x55"
606-
607-
return None
608-
609-
app._api._at_command = mock.MagicMock(
610-
spec=XBee._at_command, side_effect=mock_at_command
611-
)
612-
time_s = 300
603+
rssi = b"\x0A\x0F\x14\x19\x1E\x23\x28\x2D\x32\x37\x3C\x41\x46\x4B\x50\x55"
604+
app._api._at_command = mock.AsyncMock(spec=XBee._at_command, return_value=rssi)
605+
time_s = 3
613606
energy = await app.energy_scan(
614607
channels=[x for x in range(11, 27)], duration_exp=time_s, count=3
615608
)
616609
assert app._api._at_command.call_count == 3
610+
assert app._api._at_command.call_args_list[0][0][0] == "ED"
617611
assert app._api._at_command.call_args_list[0][0][1] == time_s
618612
assert {k: round(v, 3) for k, v in energy.items()} == {
619613
11: 254.032,

0 commit comments

Comments
 (0)