@@ -1768,6 +1768,7 @@ def test_leak_active():
1768
1768
active = True ,
1769
1769
)
1770
1770
1771
+
1771
1772
def test_leak_passive ():
1772
1773
"""Test parse_advertisement_data for the leak detector."""
1773
1774
ble_device = generate_ble_device ("aa:bb:cc:dd:ee:ff" , "any" )
@@ -1789,13 +1790,16 @@ def test_leak_passive():
1789
1790
active = False ,
1790
1791
)
1791
1792
1793
+
1792
1794
def test_leak_no_leak_detected ():
1793
1795
"""Test parse_advertisement_data for the leak detector."""
1794
1796
ble_device = generate_ble_device ("aa:bb:cc:dd:ee:ff" , "Any" )
1795
1797
adv_data = generate_advertisement_data (
1796
- manufacturer_data = {2409 : b'\xc4 407LzJd\x98 ga\xc4 \n <\x05 \x00 \x00 \x00 \x00 ' }, # no leak, batt
1797
- service_data = {"0000fd3d-0000-1000-8000-00805f9b34fb" : b'&\x00 d' },
1798
- rssi = - 73
1798
+ manufacturer_data = {
1799
+ 2409 : b"\xc4 407LzJd\x98 ga\xc4 \n <\x05 \x00 \x00 \x00 \x00 "
1800
+ }, # no leak, batt
1801
+ service_data = {"0000fd3d-0000-1000-8000-00805f9b34fb" : b"&\x00 d" },
1802
+ rssi = - 73 ,
1799
1803
)
1800
1804
result = parse_advertisement_data (ble_device , adv_data , SwitchbotModel .LEAK )
1801
1805
assert result == SwitchBotAdvertisement (
@@ -1818,13 +1822,16 @@ def test_leak_no_leak_detected():
1818
1822
active = True ,
1819
1823
)
1820
1824
1825
+
1821
1826
def test_leak_leak_detected ():
1822
1827
"""Test parse_advertisement_data for the leak detector."""
1823
1828
ble_device = generate_ble_device ("aa:bb:cc:dd:ee:ff" , "Any" )
1824
1829
adv_data = generate_advertisement_data (
1825
- manufacturer_data = {2409 : b'\xc4 407LzGd\xf9 ga\xc4 \x08 <\x05 \x00 \x00 \x00 \x00 ' }, # leak, batt
1826
- service_data = {"0000fd3d-0000-1000-8000-00805f9b34fb" : b'&\x00 d' },
1827
- rssi = - 73
1830
+ manufacturer_data = {
1831
+ 2409 : b"\xc4 407LzGd\xf9 ga\xc4 \x08 <\x05 \x00 \x00 \x00 \x00 "
1832
+ }, # leak, batt
1833
+ service_data = {"0000fd3d-0000-1000-8000-00805f9b34fb" : b"&\x00 d" },
1834
+ rssi = - 73 ,
1828
1835
)
1829
1836
result = parse_advertisement_data (ble_device , adv_data , SwitchbotModel .LEAK )
1830
1837
assert result == SwitchBotAdvertisement (
0 commit comments