mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2025-12-10 07:44:39 +01:00
28 lines
821 B
Python
Executable file
28 lines
821 B
Python
Executable file
#!/usr/bin/python3
|
|
|
|
import ubus
|
|
import pathlib
|
|
import subprocess
|
|
import json
|
|
|
|
TEST_NAME = "Get Device."
|
|
|
|
print("Running: " + TEST_NAME)
|
|
|
|
sock = pathlib.Path('/var/run/ubus/ubus.sock')
|
|
if sock.exists():
|
|
assert ubus.connect('/var/run/ubus/ubus.sock')
|
|
else:
|
|
assert ubus.connect()
|
|
|
|
out = ubus.call('bbfdm', 'get', {"path":"Device.", "optional":{"format":"raw"}})
|
|
assert isinstance(out[0]["results"][0], dict), "FAIL: get Device. on bbfdm with raw format"
|
|
|
|
out = ubus.call('bbfdm', 'get', {"path":"Device", "optional":{"format":"raw"}})
|
|
assert out[0]["results"][0]["fault"] == 9005, "FAIL: get Device on bbfdm with raw format"
|
|
|
|
out = ubus.call('bbfdm', 'get', {"path":"Device."})
|
|
assert isinstance(out[0]['Device'], dict), "FAIL: get Device. on bbfdm with pretty format"
|
|
|
|
ubus.disconnect()
|
|
print("PASS: " + TEST_NAME)
|