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
@@ -83,12 +83,20 @@ def test_memory_absent(rackmount):
|
||||
|
||||
def test_memory_older_schema():
|
||||
# Memory 1.0-1.x: DeviceLocator instead of Location, speed in OperatingSpeedMhz.
|
||||
dimm = parse_memory({
|
||||
"Id": "1", "Name": "Memory 1", "DeviceLocator": "P1-DIMMA1", "CapacityMiB": 16384,
|
||||
"OperatingSpeedMhz": 2133, "Manufacturer": "Samsung ", "PartNumber": "M393A2G40DB0-CPB",
|
||||
"SerialNumber": "12345678", "MemoryDeviceType": "DDR4",
|
||||
"Status": {"State": "Enabled", "Health": "OK"},
|
||||
})
|
||||
dimm = parse_memory(
|
||||
{
|
||||
"Id": "1",
|
||||
"Name": "Memory 1",
|
||||
"DeviceLocator": "P1-DIMMA1",
|
||||
"CapacityMiB": 16384,
|
||||
"OperatingSpeedMhz": 2133,
|
||||
"Manufacturer": "Samsung ",
|
||||
"PartNumber": "M393A2G40DB0-CPB",
|
||||
"SerialNumber": "12345678",
|
||||
"MemoryDeviceType": "DDR4",
|
||||
"Status": {"State": "Enabled", "Health": "OK"},
|
||||
}
|
||||
)
|
||||
assert dimm["location"] == "P1-DIMMA1"
|
||||
assert dimm["speed_mhz"] == 2133
|
||||
assert dimm["manufacturer"] == "Samsung"
|
||||
@@ -110,16 +118,18 @@ def test_storage(localstorage):
|
||||
assert st["name"] == "Local Storage Controller"
|
||||
assert st["state"] == "Enabled"
|
||||
assert st["health"] == "OK"
|
||||
assert st["controllers"] == [{
|
||||
"name": "Contoso Integrated RAID",
|
||||
"manufacturer": "Contoso",
|
||||
"model": "12Gbs Integrated RAID",
|
||||
"serial_number": "2M220100SL",
|
||||
"firmware_version": "1.0.0.7",
|
||||
"speed_gbps": 12,
|
||||
"state": "Enabled",
|
||||
"health": "OK",
|
||||
}]
|
||||
assert st["controllers"] == [
|
||||
{
|
||||
"name": "Contoso Integrated RAID",
|
||||
"manufacturer": "Contoso",
|
||||
"model": "12Gbs Integrated RAID",
|
||||
"serial_number": "2M220100SL",
|
||||
"firmware_version": "1.0.0.7",
|
||||
"speed_gbps": 12,
|
||||
"state": "Enabled",
|
||||
"health": "OK",
|
||||
}
|
||||
]
|
||||
assert st["drive_paths"] == [
|
||||
"/redfish/v1/Chassis/1U/Drives/35D38F11ACEF7BD3",
|
||||
"/redfish/v1/Chassis/1U/Drives/3F5A8C54207B7233",
|
||||
@@ -163,7 +173,11 @@ def test_simple_storage(rackmount):
|
||||
assert st["name"] == "Simple Storage Controller"
|
||||
assert st["health"] == "OK"
|
||||
assert [d["name"] for d in st["drives"]] == [
|
||||
"SATA Bay 1", "SATA Bay 2", "SATA Bay 3", "SATA Bay 4"]
|
||||
"SATA Bay 1",
|
||||
"SATA Bay 2",
|
||||
"SATA Bay 3",
|
||||
"SATA Bay 4",
|
||||
]
|
||||
bay1, bay2, bay3, _ = st["drives"]
|
||||
assert bay1["model"] == "3000GT8"
|
||||
assert bay1["capacity_bytes"] == 8000000000000
|
||||
|
||||
Reference in new issue
Block a user