def test_unprovisioned_beacon_created_uri_hash(): beacon = UnprovisionedDeviceBeacon( uuid.UUID('25bdf2eb-03cc-4383-a65a-dd3e8007fb55'), 0x4243, bytes.fromhex('04030201')) assert beacon.pack() == bytes.fromhex( '25bdf2eb03cc4383a65add3e8007fb55424304030201')
def test_unprovisioned_beacon_created_uri_hash_too_short(): with raises(ValueError, match="expected 4 bytes"): beacon = UnprovisionedDeviceBeacon( uuid.UUID("25bdf2eb-03cc-4383-a65a-dd3e8007fb55"), 0x4243, bytes.fromhex("040302"), )
def test_unprovisioned_beacon_received(): beacon = UnprovisionedDeviceBeacon.unpack( bytes.fromhex("25bdf2eb03cc4383a65add3e8007fb554243") ) assert beacon.uuid == uuid.UUID("25bdf2eb-03cc-4383-a65a-dd3e8007fb55") assert beacon.oob == 0x4243
def test_unprovisioned_beacon_received_uri_hash(): beacon = UnprovisionedDeviceBeacon.unpack( bytes.fromhex('25bdf2eb03cc4383a65add3e8007fb55424301020304')) assert beacon.uuid == uuid.UUID('25bdf2eb-03cc-4383-a65a-dd3e8007fb55') assert beacon.oob == 0x4243 assert beacon.uri_hash == bytes.fromhex('01020304')
def test_unprovisioned_beacon_created(): beacon = UnprovisionedDeviceBeacon( uuid.UUID("25bdf2eb-03cc-4383-a65a-dd3e8007fb55"), 0x4243 ) assert beacon.pack() == bytes.fromhex("25bdf2eb03cc4383a65add3e8007fb554243")
def test_unprovisioned_beacon_received_uri_hash_too_short(): with raises(ValueError, match="expected 4 bytes"): UnprovisionedDeviceBeacon.unpack( bytes.fromhex("25bdf2eb03cc4383a65add3e8007fb554243010203") )