From: Akshay Sakure Date: Tue, 23 Jun 2026 13:45:43 +0000 (+0530) Subject: Tests: Add group with specified GID using -g flag X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bede4805a6f3c7a3e942b97428171e91f23c53ba;p=thirdparty%2Fshadow.git Tests: Add group with specified GID using -g flag This is Python transformation of the test located in `tests/grouptools/groupadd/05_groupadd_set_GID/groupadd.test` which checks that `groupadd` can create group with sepcified GID using -g flag Signed-off-by: Akshay Sakure --- diff --git a/tests/system/tests/test_groupadd.py b/tests/system/tests/test_groupadd.py index 0a8df92c8..31c6ef5a8 100644 --- a/tests/system/tests/test_groupadd.py +++ b/tests/system/tests/test_groupadd.py @@ -66,3 +66,23 @@ def test_groupadd__u_option_empty_string_clears_members(shadow: Shadow): assert gshadow_entry is not None, "Group should be found" assert gshadow_entry.name == "tgroup", "Incorrect groupname" assert not gshadow_entry.members, "Group should have no members" + + +@pytest.mark.topology(KnownTopology.Shadow) +def test_groupadd__set_gid(shadow: Shadow): + """ + :title: Create group with specific GID using -g flag + :setup: + 1. Create group with specific GID + :steps: + 1. Check group entry + :expectedresults: + 1. Group entry is created with the specified GID + :customerscenario: False + """ + shadow.groupadd("-g 1500 tgroup") + + group_entry = shadow.tools.getent.group("tgroup") + assert group_entry is not None, "Group should be found" + assert group_entry.name == "tgroup", "Incorrect groupname" + assert group_entry.gid == 1500, "Incorrect GID"