]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
Revert "tests/: extend basic usermod test"
authorSerge Hallyn <serge@hallyn.com>
Thu, 22 May 2025 11:27:11 +0000 (06:27 -0500)
committerGitHub <noreply@github.com>
Thu, 22 May 2025 11:27:11 +0000 (06:27 -0500)
This reverts commit 1791d8a638fbd4d9a4fc6dc6043c764c6f997f82.

tests/system/tests/test_usermod.py

index f1ba8c689ed5337736a4a4b1f48e7b787dab319f..2b42363e91701f640633a1d579f9fa9dcacec0c7 100644 (file)
@@ -18,39 +18,26 @@ def test_usermod__rename_user(shadow: Shadow):
         1. Create user
         2. Rename user
     :steps:
-        1. Check passwd entry
-        2. Check shadow entry
-        3. Check group entry
-        4. Check gshadow entry
-        5. Check home folder
+        1. User exists with new name and GID is 1000
+        2. Group exists and GID is 1000
+        3. Home folder exists
     :expectedresults:
-        1. passwd entry for the user exists and the attributes are correct
-        2. shadow entry for the user exists and the attributes are correct
-        3. group entry for the user exists and the attributes are correct
-        4. gshadow entry for the user exists and the attributes are correct
-        5. Home folder exists
+        1. User is found and UID matches
+        2. Group is found and GID matches
+        3. Home folder is found
     :customerscenario: False
     """
     shadow.useradd("tuser1")
     shadow.usermod("-l tuser2 tuser1")
 
-    result = shadow.tools.getent.passwd("tuser2")
+    result = shadow.tools.id("tuser2")
     assert result is not None, "User should be found"
-    assert result.name == "tuser2", "Incorrect username"
-    assert result.uid == 1000, "Incorrect UID"
-
-    result = shadow.tools.getent.shadow("tuser2")
-    assert result is not None, "User should be found"
-    assert result.name == "tuser2", "Incorrect username"
+    assert result.user.name == "tuser2", "Incorrect username"
+    assert result.user.id == 1000, "Incorrect UID"
 
     result = shadow.tools.getent.group("tuser1")
     assert result is not None, "Group should be found"
     assert result.name == "tuser1", "Incorrect groupname"
     assert result.gid == 1000, "Incorrect GID"
 
-    if shadow.host.features["gshadow"]:
-        result = shadow.tools.getent.gshadow("tuser1")
-        assert result is not None, "User should be found"
-        assert result.name == "tuser1", "Incorrect username"
-
     assert shadow.fs.exists("/home/tuser1"), "Home folder should be found"