style: ruff format and the lint rules of the driver standard
Mechanical: ruff format, and ruff check --fix with the rule set every NAPALM driver uses (E, F, I, UP, B at line length 100, Python 3.10). Mapping and Iterable come from collections.abc, imports are sorted. What ruff cannot fix comes in the next commit.
This commit is contained in:
1 parent
5b24675a12
commit
09029ca0a4
29 files changed
+985
-456
No files matched your search
@@ -47,16 +47,18 @@ def test_system_links(rackmount):
|
||||
|
||||
def test_system_placeholders_and_blanks_are_none():
|
||||
# Supermicro boards report the DMI defaults the board vendor never filled in.
|
||||
s = parse_system({
|
||||
"Id": "1",
|
||||
"Manufacturer": "Supermicro",
|
||||
"Model": "X10DRL-i",
|
||||
"SerialNumber": "0123456789",
|
||||
"SKU": "To Be Filled By O.E.M.",
|
||||
"HostName": "",
|
||||
"UUID": " ",
|
||||
"PartNumber": "Default string",
|
||||
})
|
||||
s = parse_system(
|
||||
{
|
||||
"Id": "1",
|
||||
"Manufacturer": "Supermicro",
|
||||
"Model": "X10DRL-i",
|
||||
"SerialNumber": "0123456789",
|
||||
"SKU": "To Be Filled By O.E.M.",
|
||||
"HostName": "",
|
||||
"UUID": " ",
|
||||
"PartNumber": "Default string",
|
||||
}
|
||||
)
|
||||
assert s["manufacturer"] == "Supermicro"
|
||||
assert s["model"] == "X10DRL-i"
|
||||
assert s["serial_number"] is None
|
||||
@@ -88,8 +90,15 @@ def test_reset_action_inline_allowable_values(rackmount):
|
||||
reset = parse_reset_action(rackmount(SYSTEM))
|
||||
assert reset["target"] == SYSTEM + "/Actions/ComputerSystem.Reset"
|
||||
assert reset["allowed"] == [
|
||||
"On", "ForceOff", "GracefulShutdown", "GracefulRestart", "ForceRestart",
|
||||
"Nmi", "ForceOn", "PushPowerButton", "FullPowerCycle",
|
||||
"On",
|
||||
"ForceOff",
|
||||
"GracefulShutdown",
|
||||
"GracefulRestart",
|
||||
"ForceRestart",
|
||||
"Nmi",
|
||||
"ForceOn",
|
||||
"PushPowerButton",
|
||||
"FullPowerCycle",
|
||||
]
|
||||
assert reset["action_info"] is None
|
||||
|
||||
@@ -104,13 +113,25 @@ def test_reset_action_with_action_info(telemetry):
|
||||
|
||||
def test_action_info(telemetry):
|
||||
allowed = parse_action_info(telemetry("/redfish/v1/Systems/1/ResetActionInfo"))
|
||||
assert allowed == ["On", "ForceOff", "GracefulShutdown", "GracefulRestart",
|
||||
"ForceRestart", "Nmi", "ForceOn", "PushPowerButton"]
|
||||
assert allowed == [
|
||||
"On",
|
||||
"ForceOff",
|
||||
"GracefulShutdown",
|
||||
"GracefulRestart",
|
||||
"ForceRestart",
|
||||
"Nmi",
|
||||
"ForceOn",
|
||||
"PushPowerButton",
|
||||
]
|
||||
|
||||
|
||||
def test_action_info_other_parameter():
|
||||
info = {"Parameters": [{"Name": "ResetType", "AllowableValues": ["On"]},
|
||||
{"Name": "Delay", "AllowableValues": ["0", "5"]}]}
|
||||
info = {
|
||||
"Parameters": [
|
||||
{"Name": "ResetType", "AllowableValues": ["On"]},
|
||||
{"Name": "Delay", "AllowableValues": ["0", "5"]},
|
||||
]
|
||||
}
|
||||
assert parse_action_info(info, "Delay") == ["0", "5"]
|
||||
assert parse_action_info(info, "Missing") is None
|
||||
assert parse_action_info({}) is None
|
||||
|
||||
Reference in new issue
Block a user