summaryrefslogtreecommitdiff
path: root/src/test/test-systemd-tmpfiles.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/test-systemd-tmpfiles.py')
-rwxr-xr-xsrc/test/test-systemd-tmpfiles.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/test/test-systemd-tmpfiles.py b/src/test/test-systemd-tmpfiles.py
index 13a44f3c4a..83a66e8772 100755
--- a/src/test/test-systemd-tmpfiles.py
+++ b/src/test/test-systemd-tmpfiles.py
@@ -1,10 +1,10 @@
#!/usr/bin/env python3
-# SPDX-License-Identifier: LGPL-2.1+
+# SPDX-License-Identifier: LGPL-2.1+
#
-# systemd is free software; you can redistribute it and/or modify it
-# under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation; either version 2.1 of the License, or
-# (at your option) any later version.
+# systemd is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or
+# (at your option) any later version.
import os
import sys
@@ -12,6 +12,7 @@ import socket
import subprocess
import tempfile
import pwd
+import grp
try:
from systemd import id128
@@ -95,9 +96,13 @@ def test_valid_specifiers(*, user):
test_content('f {} - - - - %H', '{}'.format(socket.gethostname()), user=user)
test_content('f {} - - - - %v', '{}'.format(os.uname().release), user=user)
test_content('f {} - - - - %U', '{}'.format(os.getuid()), user=user)
+ test_content('f {} - - - - %G', '{}'.format(os.getgid()), user=user)
- user = pwd.getpwuid(os.getuid())
- test_content('f {} - - - - %u', '{}'.format(user.pw_name), user=user)
+ puser = pwd.getpwuid(os.getuid())
+ test_content('f {} - - - - %u', '{}'.format(puser.pw_name), user=user)
+
+ pgroup = grp.getgrgid(os.getgid())
+ test_content('f {} - - - - %g', '{}'.format(pgroup.gr_name), user=user)
# Note that %h is the only specifier in which we look the environment,
# because we check $HOME. Should we even be doing that?