]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
tests/: extend basic groupadd test
authorIker Pedrosa <ipedrosa@redhat.com>
Wed, 12 Mar 2025 08:16:36 +0000 (09:16 +0100)
committerIker Pedrosa <ikerpedrosam@gmail.com>
Wed, 21 May 2025 08:04:42 +0000 (10:04 +0200)
Add additional check for gshadow entry.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Reviewed-by: Dan Lavu <dlavu@redhat.com>
tests/system/tests/test_groupadd.py

index 2573b0d7e05b1fed61d7e046aed70df47fdc267a..5e4bea53270f48fc1fbf2ede45bc86e91fd5b5fb 100644 (file)
@@ -17,9 +17,11 @@ def test_groupadd__add_group(shadow: Shadow):
     :setup:
         1. Create group
     :steps:
-        1. Group exists and GID is 1000
+        1. Check group entry
+        2. Check gshadow entry
     :expectedresults:
-        1. Group is found and GID matches
+        1. group entry for the user exists and the attributes are correct
+        2. gshadow entry for the user exists and the attributes are correct
     :customerscenario: False
     """
     shadow.groupadd("tgroup")
@@ -28,3 +30,9 @@ def test_groupadd__add_group(shadow: Shadow):
     assert result is not None, "Group should be found"
     assert result.name == "tgroup", "Incorrect groupname"
     assert result.gid == 1000, "Incorrect GID"
+
+    if shadow.host.features["gshadow"]:
+        result = shadow.tools.getent.gshadow("tgroup")
+        assert result is not None, "Group should be found"
+        assert result.name == "tgroup", "Incorrect groupname"
+        assert result.password == "!", "Incorrect password"