def test_device_refuses_invalid_nwkKey_value(self): with pytest.raises(Exception): device.Devices( deveui='dead', nwkkey= 'deadbeefddddddddeadbeefeadbeefeadbeefeadbeefeadbeefeadbeefeadbeefeadbeef', # noqa: E501 appkey='12345678901112131415161718192021')
def test_device_refuses_invalid_appKey_length(self): with pytest.raises(Exception): device.Devices( deveui='dead', nwkkey= 'deadbeefddddddddeadbeefeadbeefeadbeefeadbeefeadbeefeadbeefeadbeefeadbeefdeadbeefddddddddeadbeefeadbeefeadbeefeadbeefeadbeefeadbeefeadbeefeadbeef', # noqa: E501 appkey='00000000000000000000000000000000')
def lora_device(self, lora_connection, requests_mock): # Mock the device creation response requests_mock.post("https://loraserver/api/devices", json={}) requests_mock.post( "https://loraserver/api/devices/deadbeefdeadbeef/keys", json={}) from pyloraserver import device return device.Devices(loraserver_connection=lora_connection)
def lora_correct_device(self): from pyloraserver import device return device.Devices(deveui='deadbeefdeadbeef', nwkkey='deadbeefdeadbeefdeadbeefdeadbeef', appkey='00000000000000000000000000000000')
def test_device_list_is_a_dict(self, lora_connection, requests_mock): from pyloraserver import device d = device.Devices(loraserver_connection=lora_connection) devices = d.list_all(appid=1) assert type(devices) is dict
def test_connection_setup_with_device_list(self, lora_connection): devices = device.Devices(loraserver_connection=lora_connection) devices.list_all(limit=10, appid=1)