From 55dea3c3ad80489816e4121ef3d591419e360d57 Mon Sep 17 00:00:00 2001 From: Iker Pedrosa Date: Tue, 19 Nov 2024 16:18:45 +0100 Subject: [PATCH] tests: basic group creation This is the transformation to Python of the test located in `tests/grouptools/groupadd/02_groupadd_add_group_GID_MIN/groupadd.test`, which checks that `groupadd` is able to create a new group. Signed-off-by: Iker Pedrosa --- tests/system/tests/test_groupadd.py | 30 +++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tests/system/tests/test_groupadd.py diff --git a/tests/system/tests/test_groupadd.py b/tests/system/tests/test_groupadd.py new file mode 100644 index 000000000..2573b0d7e --- /dev/null +++ b/tests/system/tests/test_groupadd.py @@ -0,0 +1,30 @@ +""" +Test groupadd +""" + +from __future__ import annotations + +import pytest + +from framework.roles.shadow import Shadow +from framework.topology import KnownTopology + + +@pytest.mark.topology(KnownTopology.Shadow) +def test_groupadd__add_group(shadow: Shadow): + """ + :title: Basic group creation + :setup: + 1. Create group + :steps: + 1. Group exists and GID is 1000 + :expectedresults: + 1. Group is found and GID matches + :customerscenario: False + """ + shadow.groupadd("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 == 1000, "Incorrect GID" -- 2.47.3