test: update test_mount.py for lsblk --json differences

Older version of `lsblk --json` will not have the plural `mountpoints`
but only a singular `mountpoint`. But newer version lost the
singular `mountpoint` in the json. Adjust the test accordingly.
This commit is contained in:
Michael Vogt 2024-01-16 11:42:21 +01:00 committed by Tomáš Hozza
parent d96f94fede
commit e0bbb3397d

View file

@ -224,5 +224,10 @@ def test_mount_with_partition(tmp_path):
lsblk_info = json.loads(output)
assert len(lsblk_info["blockdevices"][0]["children"]) == 2
chld = lsblk_info["blockdevices"][0]["children"]
assert chld[0]["mountpoints"] == [f"{mnt_base}/mnt-1"]
assert chld[1]["mountpoints"] == [f"{mnt_base}/mnt-2"]
# rhel8 lsblk only gives us a single mountpoint (no plural)
if "mountpoint" in chld[0]:
assert chld[0]["mountpoint"] == f"{mnt_base}/mnt-1"
assert chld[1]["mountpoint"] == f"{mnt_base}/mnt-2"
else:
assert chld[0]["mountpoints"] == [f"{mnt_base}/mnt-1"]
assert chld[1]["mountpoints"] == [f"{mnt_base}/mnt-2"]