]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
tests/: extend basic userdel test
authorIker Pedrosa <ipedrosa@redhat.com>
Wed, 12 Mar 2025 08:10:25 +0000 (09:10 +0100)
committerIker Pedrosa <ikerpedrosam@gmail.com>
Wed, 21 May 2025 08:04:42 +0000 (10:04 +0200)
Add additional checks for shadow and gshadow entries.

Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
Reviewed-by: Dan Lavu <dlavu@redhat.com>
tests/system/tests/test_userdel.py

index c92b645c5419968d32577e922c8e939c3718f42d..78c6bb361c5ed0b732516aff1fc21c324eb1e5b5 100644 (file)
@@ -18,22 +18,32 @@ def test_userdel__homedir_removed(shadow: Shadow):
         1. Create user
         2. Delete the user and the homedir
     :steps:
-        1. User doesn't exist
-        2. Group doesn't exist
-        3. Home folder doesn't exist
+        1. Check passwd entry
+        2. Check shadow entry
+        3. Check group entry
+        4. Check gshadow entry
+        5. Check home folder
     :expectedresults:
-        1. User is not found
-        2. Group is not found
-        3. Home folder is not found
+        1. passwd entry for the user doesn't exist
+        2. shadow entry for the user doesn't exist
+        3. group entry for the user doesn't exist
+        4. gshadow entry for the user doesn't exist
+        5. Home folder doesn't exist
     :customerscenario: False
     """
     shadow.useradd("tuser")
     shadow.userdel("-r tuser")
 
-    result = shadow.tools.id("tuser")
+    result = shadow.tools.getent.passwd("tuser")
+    assert result is None, "User should not be found"
+
+    result = shadow.tools.getent.shadow("tuser")
     assert result is None, "User should not be found"
 
     result = shadow.tools.getent.group("tuser")
     assert result is None, "Group should not be found"
 
+    result = shadow.tools.getent.gshadow("tuser1")
+    assert result is None, "User should not be found"
+
     assert not shadow.fs.exists("/home/tuser"), "Home folder should not exist"