From d4b3299324b98336cb807c67497a4246e309a4f7 Mon Sep 17 00:00:00 2001 From: Iker Pedrosa Date: Wed, 20 Nov 2024 10:13:33 +0100 Subject: [PATCH] tests: change GID of a group This is the transformation to Python of the test located in `tests/grouptools/groupmod/01_groupmod_change_gid/groupmod.test`, which checks that `groupmod` is able to change the GID of a group. Signed-off-by: Iker Pedrosa --- tests/system/tests/test_groupmod.py | 32 +++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 tests/system/tests/test_groupmod.py diff --git a/tests/system/tests/test_groupmod.py b/tests/system/tests/test_groupmod.py new file mode 100644 index 000000000..5088831e9 --- /dev/null +++ b/tests/system/tests/test_groupmod.py @@ -0,0 +1,32 @@ +""" +Test groupmod +""" + +from __future__ import annotations + +import pytest + +from framework.roles.shadow import Shadow +from framework.topology import KnownTopology + + +@pytest.mark.topology(KnownTopology.Shadow) +def test_groupmod__change_gid(shadow: Shadow): + """ + :title: Change the GID of a group + :setup: + 1. Create group + 2. Change GID + :steps: + 1. Group exists and GID is 1001 + :expectedresults: + 1. Group is found and GID matches + :customerscenario: False + """ + shadow.groupadd("tgroup") + shadow.groupmod("-g 1001 tgroup") + + result = shadow.tools.getent.group("tgroup") + assert result is not None, "Group should be found" + assert result.name == "tgroup", "Incorrect groupname" + assert result.gid == 1001, "Incorrect GID" -- 2.47.3