Fix functionla test

This commit is contained in:
Amin Ben Romdhane 2025-02-20 14:57:30 +01:00
parent 0c484cbd5b
commit 89cc2bce1d
3 changed files with 9 additions and 60 deletions

View file

@ -5,7 +5,7 @@
"method": "get",
"args": {
"path": "Device.DeviceInfo.Manufacturer",
"optional": {"format":"raw", "proto":"usp"}
"optional": {"proto":"usp"}
},
"rc": 0
},
@ -13,7 +13,7 @@
"method": "get",
"args": {
"path": "Device.DeviceInfo.Manufacturer",
"optional": {"format":"raw", "proto":"cwmp"}
"optional": {"proto":"cwmp"}
},
"rc": 0
},
@ -21,7 +21,7 @@
"method": "get",
"args": {
"path":"Device.WiFi.SSID.*.Alias",
"optional": {"format":"raw", "proto":"cwmp"}
"optional": {"proto":"cwmp"}
},
"rc": 0
},
@ -29,7 +29,7 @@
"method": "get",
"args": {
"path": "Device.DeviceInfo.Manufacturer",
"optional": {"format":"raw", "proto":"both"}
"optional": {"proto":"both"}
},
"rc": 0
},
@ -40,15 +40,6 @@
},
"rc": 0
},
{
"method": "get",
"args": {
"path": "Device.DeviceInfo.Manufacturer",
"optional": {"format":"raw", "proto":"usp"},
"maxdepth": "1"
},
"rc": 0
},
{
"method": "get",
"args": {
@ -78,7 +69,7 @@
"method": "instances",
"args": {
"path": "Device.WiFi.SSID.",
"optional": {"format":"raw", "proto":"usp"}
"optional": {"proto":"usp"}
},
"rc": 0
},
@ -104,14 +95,6 @@
},
"rc": 0
},
{
"method": "get",
"args": {
"paths": ["Device.WiFi.SSID.1.SSID","Device.WiFi.SSID.2.SSID"],
"proto": "usp"
},
"rc": 0
},
{
"method": "set",
"args": {

View file

@ -1,33 +0,0 @@
#!/usr/bin/python3
import subprocess
import json
TEST_NAME = "BUG_3536"
print("Running: " + TEST_NAME)
def bbf_get(path, proto = ""):
path_arg = "{\"path\":\"" + path + "\", \"optional\":{\"format\":\"raw\", \"proto\":\"" + proto + "\"}}"
cmd = ['ubus', 'call', 'bbfdm', 'get', path_arg]
out = subprocess.Popen(cmd,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
stdout,stderr = out.communicate()
return stdout
# check fault code of invalid path
output = json.loads(bbf_get("Device", "usp"))
assert output["results"][0]["fault"] == 7026, "Wrong fault code"
# check fault code of invalid path
output = json.loads(bbf_get("Device", "cwmp"))
assert output["results"][0]["fault"] == 9005, "Wrong fault code for cwmp"
# check fault code of invalid path
output = json.loads(bbf_get("Device"))
assert output["results"][0]["fault"] == 9005, "Wrong fault code for default proto"
print("PASS: " + TEST_NAME)

View file

@ -15,12 +15,11 @@ if sock.exists():
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 bbf with raw format"
# Check get operation for Device. path succeed
out = ubus.call('bbfdm', 'get', {"path":"Device."})
assert isinstance(out[0]['Device'], dict), "FAIL: get Device. on bbf with pretty format"
assert isinstance(out[0]["results"][0], dict), "FAIL: get Device."
out = ubus.call('bbfdm', 'get', {"path":"Device"})
assert out[0]["results"][0]["fault"] == 9005, "FAIL: get Device"
ubus.disconnect()
print("PASS: " + TEST_NAME)