]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
tests/system/framework/utils/tools.py: fix GShadowEntry
authorIker Pedrosa <ipedrosa@redhat.com>
Tue, 23 Dec 2025 09:26:33 +0000 (10:26 +0100)
committerAlejandro Colomar <foss+github@alejandro-colomar.es>
Thu, 1 Jan 2026 14:44:52 +0000 (15:44 +0100)
GShadowEntry administrators and members represent a list of usernames,
not a single string. Thus, set them to `list[str]`. This fixes type
safety and clarifies the expected data structure.

Fixes: 458700b5d670 (2025-09-10; "tests/system/framework/: fix Python linter issues")
Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
tests/system/framework/utils/tools.py

index a2c85cba4b460f513a99ff24a21bbe1dd20f9e82..03a79219afb0e4741db08f214d9082f157c251e4 100644 (file)
@@ -388,8 +388,8 @@ class GShadowEntry(object):
         self,
         name: str | None,
         password: str | None,
-        administrators: str | None,
-        members: str | None,
+        administrators: list[str],
+        members: list[str],
     ) -> None:
         self.name: str | None = name
         """
@@ -401,18 +401,18 @@ class GShadowEntry(object):
         Group password.
         """
 
-        self.administrators: str | None = administrators
+        self.administrators: list[str] = administrators
         """
         Group administrators.
         """
 
-        self.members: str | None = members
+        self.members: list[str] = members
         """
         Group members.
         """
 
     def __str__(self) -> str:
-        return f"({self.name}:{self.password}:{self.administrators}:" f"{self.members})"
+        return f"({self.name}:{self.password}:" f"{self.administrators}:" f"{self.members})"
 
     def __repr__(self) -> str:
         return str(self)
@@ -422,7 +422,7 @@ class GShadowEntry(object):
         return cls(
             name=d.get("group_name", None),
             password=d.get("password", None),
-            administrators=d.get("administrators", None),
+            administrators=d.get("administrators", []),
             members=d.get("members", []),
         )