Skip to content

Commit

Permalink
improve test
Browse files Browse the repository at this point in the history
  • Loading branch information
Shulyaka committed Oct 1, 2023
1 parent 6e561f8 commit f0e7918
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions tests/test_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,20 +600,14 @@ async def test_move_network_to_channel(app):


async def test_energy_scan(app):
async def mock_at_command(cmd, *args):
if cmd == "ED":
return b"\x0A\x0F\x14\x19\x1E\x23\x28\x2D\x32\x37\x3C\x41\x46\x4B\x50\x55"

return None

app._api._at_command = mock.MagicMock(
spec=XBee._at_command, side_effect=mock_at_command
)
time_s = 300
rssi = (b"\x0A\x0F\x14\x19\x1E\x23\x28\x2D\x32\x37\x3C\x41\x46\x4B\x50\x55",)
app._api._at_command = mock.AsyncMock(spec=XBee._at_command, return_value=rssi)
time_s = 3
energy = await app.energy_scan(

Check failure on line 606 in tests/test_application.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.8.14

test_energy_scan ValueError: invalid literal for int() with base 10: b'\n\x0f\x14\x19\x1e#(-27<AFKPU'

Check failure on line 606 in tests/test_application.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.9.15

test_energy_scan ValueError: invalid literal for int() with base 10: b'\n\x0f\x14\x19\x1e#(-27<AFKPU'

Check failure on line 606 in tests/test_application.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.10.8

test_energy_scan ValueError: invalid literal for int() with base 10: b'\n\x0f\x14\x19\x1e#(-27<AFKPU'

Check failure on line 606 in tests/test_application.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.11.0

test_energy_scan ValueError: invalid literal for int() with base 10: b'\n\x0f\x14\x19\x1e#(-27<AFKPU'

Check failure on line 606 in tests/test_application.py

View workflow job for this annotation

GitHub Actions / shared-ci / Run tests Python 3.12

test_energy_scan ValueError: invalid literal for int() with base 10: b'\n\x0f\x14\x19\x1e#(-27<AFKPU'
channels=[x for x in range(11, 27)], duration_exp=time_s, count=3
)
assert app._api._at_command.call_count == 3
assert app._api._at_command.call_args_list[0][0][0] == "ED"
assert app._api._at_command.call_args_list[0][0][1] == time_s
assert {k: round(v, 3) for k, v in energy.items()} == {
11: 254.032,
Expand Down

0 comments on commit f0e7918

Please sign in to comment.