Skip to content

Commit c196796

Browse files
committed
Add more test-asserts
1 parent 6d87d02 commit c196796

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

tests/test_usb.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ async def test_node_relay_and_power(self, monkeypatch: pytest.MonkeyPatch) -> No
779779

780780
unsub_relay = stick.nodes["0098765432101234"].subscribe_to_feature_update(
781781
node_feature_callback=self.node_relay_state,
782-
features=(pw_api.NodeFeature.RELAY,),
782+
features=(pw_api.NodeFeature.RELAY, pw_api.NodeFeature.RELAY_LOCK,),
783783
)
784784

785785
# Test async switching back from on to off
@@ -790,11 +790,13 @@ async def test_node_relay_and_power(self, monkeypatch: pytest.MonkeyPatch) -> No
790790

791791
# Test blocked async switching due to relay-lock active
792792
await stick.nodes["0098765432101234"].set_relay_lock(True)
793+
assert stick.nodes["0098765432101234"].relay_lock
793794
with pytest.raises(pw_exceptions.NodeError):
794795
await stick.nodes["0098765432101234"].set_relay(True)
795796
assert not stick.nodes["0098765432101234"].relay
796797
# Make sure to turn lock off for further testing
797798
await stick.nodes["0098765432101234"].set_relay_lock(False)
799+
assert not stick.nodes["0098765432101234"].relay_lock
798800

799801
# Test async switching back from off to on
800802
self.test_relay_state_on = asyncio.Future()
@@ -2445,6 +2447,7 @@ async def test_node_discovery_and_load(
24452447
pw_api.NodeFeature.PING,
24462448
pw_api.NodeFeature.INFO,
24472449
pw_api.NodeFeature.RELAY,
2450+
pw_api.NodeFeature.RELAY_LOCK,
24482451
)
24492452
)
24502453

@@ -2487,6 +2490,7 @@ async def test_node_discovery_and_load(
24872490
pw_api.NodeFeature.INFO,
24882491
pw_api.NodeFeature.PING,
24892492
pw_api.NodeFeature.RELAY,
2493+
pw_api.NodeFeature.RELAY_LOCK,
24902494
pw_api.NodeFeature.ENERGY,
24912495
pw_api.NodeFeature.POWER,
24922496
)
@@ -2507,11 +2511,17 @@ async def test_node_discovery_and_load(
25072511
assert state[pw_api.NodeFeature.INFO].version == "070073"
25082512

25092513
assert state[pw_api.NodeFeature.RELAY].state
2514+
assert state[pw_api.NodeFeature.RELAY_LOCK]
25102515

25112516
# Check 1111111111111111
25122517
get_state_timestamp = dt.now(UTC).replace(minute=0, second=0, microsecond=0)
25132518
state = await stick.nodes["1111111111111111"].get_state(
2514-
(pw_api.NodeFeature.PING, pw_api.NodeFeature.INFO, pw_api.NodeFeature.RELAY)
2519+
(
2520+
pw_api.NodeFeature.PING,
2521+
pw_api.NodeFeature.INFO,
2522+
pw_api.NodeFeature.RELAY,
2523+
pw_api.NodeFeature.RELAY_LOCK,
2524+
)
25152525
)
25162526

25172527
assert state[pw_api.NodeFeature.INFO].mac == "1111111111111111"
@@ -2531,12 +2541,15 @@ async def test_node_discovery_and_load(
25312541
pw_api.NodeFeature.INFO,
25322542
pw_api.NodeFeature.PING,
25332543
pw_api.NodeFeature.RELAY,
2544+
pw_api.NodeFeature.RELAY_LOCK,
25342545
pw_api.NodeFeature.ENERGY,
25352546
pw_api.NodeFeature.POWER,
25362547
)
25372548
)
25382549
assert state[pw_api.NodeFeature.AVAILABLE].state
25392550
assert state[pw_api.NodeFeature.RELAY].state
2551+
assert state[pw_api.NodeFeature.RELAY_LOCK]
2552+
25402553

25412554
# region Scan
25422555
self.test_node_awake = asyncio.Future()

0 commit comments

Comments
 (0)