Skip to content

Commit

Permalink
tests: change GID of a group
Browse files Browse the repository at this point in the history
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 <ipedrosa@redhat.com>
  • Loading branch information
ikerexxe authored and hallyn committed Jan 11, 2025
1 parent 55dea3c commit d4b3299
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions tests/system/tests/test_groupmod.py
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit d4b3299

Please sign in to comment.