Tests: Add system tests for groupadd in test_groupadd.py - #1693
Open
asakure wants to merge 3 commits into
Open
Conversation
asakure
marked this pull request as ready for review
July 23, 2026 15:01
This is Python transformation of the test located in `tests/grouptools/groupadd/22_groupadd_usage/groupadd.test` which checks that `groupadd` command shows usage with -h option. Signed-off-by: Akshay Sakure <asakure@redhat.com>
This is Python transformation of the test located in `tests/grouptools/groupadd/23_groupadd_no_groups/groupadd.test` which checks that `groupadd` fails when no groupname is mentioned. It also fixes an issue in shadow.py file to handle empty args in _parse_args and groupadd. Signed-off-by: Akshay Sakure <asakure@redhat.com>
This is Python transformation of the test located in `tests/grouptools/groupadd/24_groupadd_2_groups/groupadd.test` which checks that `groupadd` command fails when two groupnames are mentioned. It also parametrize python tests 23 and 24 into single test. Signed-off-by: Akshay Sakure <asakure@redhat.com>
asakure
force-pushed
the
system_tests_groupadd_22_23_24
branch
from
August 26, 2026 06:02
cbb8850 to
d010ea7
Compare
ikerexxe
reviewed
Aug 26, 2026
| :customerscenario: False | ||
| """ | ||
| result = shadow.groupadd("-h") | ||
| assert result.rc == 0, f"Expected return code 0(success), got {result.rc}" |
Collaborator
There was a problem hiding this comment.
You could add additional asserts checking specific parts of the output
Comment on lines
50
to
234
| @@ -230,7 +230,7 @@ def groupadd(self, *args) -> ProcessResult: | |||
| """ | |||
| args_dict = self._parse_args(args) | |||
| self.logger.info(f'Creating group "{args_dict["name"]}" on {self.host.hostname}') | |||
| cmd = self.host.conn.run("groupadd " + args[0], log_level=ProcessLogLevel.Error) | |||
| cmd = self.host.conn.run("groupadd " + (args[0] if args else ""), log_level=ProcessLogLevel.Error) | |||
|
|
|||
Collaborator
There was a problem hiding this comment.
Move the changes in this file to a separate commit
| """ | ||
| with pytest.raises(ProcessError) as exc_info: | ||
| shadow.groupadd() | ||
| shadow.groupadd(f"{args}") |
Collaborator
There was a problem hiding this comment.
You don't need to prepend the f
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add system tests for groupadd in test_groupadd.py for
existing bash tests with numbering 22, 23, 24.