|
5 | 5 | import pytest |
6 | 6 |
|
7 | 7 | from simplipy import API |
| 8 | +from simplipy.errors import SimplipyError |
8 | 9 | from simplipy.sensor import SensorTypes |
9 | 10 |
|
10 | 11 | from .const import TEST_EMAIL, TEST_PASSWORD |
@@ -37,12 +38,23 @@ async def test_properties_v2(event_loop, v2_server): |
37 | 38 | TEST_EMAIL, TEST_PASSWORD, websession) |
38 | 39 | [system] = await api.get_systems() |
39 | 40 |
|
40 | | - sensor = system.sensors['195'] |
41 | | - assert sensor.data == 0 |
42 | | - assert not sensor.error |
43 | | - assert not sensor.low_battery |
44 | | - assert sensor.settings == 1 |
45 | | - assert not sensor.triggered |
| 41 | + keypad = system.sensors['195'] |
| 42 | + assert keypad.data == 0 |
| 43 | + assert not keypad.error |
| 44 | + assert not keypad.low_battery |
| 45 | + assert keypad.settings == 1 |
| 46 | + |
| 47 | + # Ensure that attempting to access the triggered of anything but |
| 48 | + # an entry sensor in a V2 system throws an error: |
| 49 | + with pytest.raises(SimplipyError): |
| 50 | + assert keypad.triggered == 42 |
| 51 | + |
| 52 | + entry_sensor = system.sensors['609'] |
| 53 | + assert entry_sensor.data == 210 |
| 54 | + assert not entry_sensor.error |
| 55 | + assert not entry_sensor.low_battery |
| 56 | + assert entry_sensor.settings == 1 |
| 57 | + assert not entry_sensor.triggered |
46 | 58 |
|
47 | 59 |
|
48 | 60 | @pytest.mark.asyncio |
|
0 commit comments