From 626e4f9443eb4f9f655d6f97a45a598986596780 Mon Sep 17 00:00:00 2001 From: Jelle van der Waa Date: Mon, 13 Nov 2023 17:41:36 +0100 Subject: [PATCH] test: simplify restoring /var/lib/sudo/lectured Use restore_dir instead of restoring four different files. --- test/verify/check-superuser | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/test/verify/check-superuser b/test/verify/check-superuser index 4d77a8ae42f..aab9654cb0e 100755 --- a/test/verify/check-superuser +++ b/test/verify/check-superuser @@ -65,14 +65,11 @@ class TestSuperuser(testlib.MachineCase): b.drop_superuser() # We want to be lectured again - self.restore_file("/var/db/sudo/lectured/admin") - self.restore_file("/var/lib/sudo/lectured/admin") - m.execute("rm -rf /var/{db,lib}/sudo/lectured/admin") + self.restore_dir("/var/db/sudo/lectured") + m.execute("rm -rf /var/{db,lib}/sudo/lectured/admin") # Sudo since 1.9.15 uses a UID not a username https://www.sudo.ws/releases/stable/#1.9.15 uid = m.execute("id -u admin").strip() - self.restore_file(f"/var/db/sudo/lectured/{uid}") - self.restore_file(f"/var/lib/sudo/lectured/{uid}") m.execute(f"rm -rf /var/{{db,lib}}/sudo/lectured/{uid}") # Get the privileges back, this time in the mobile layout