test: Obtain default password expiry from /etc/login.defs

shadow-utils 4.20 did not change the default expiry but Arch changed
/etc/login.defs.
This commit is contained in:
Jelle van der Waa 2026-10-16 16:48:46 +02:00 committed by Jelle van der Waa
parent 978ba9055d
commit 06b332eede

View file

@ -1078,8 +1078,8 @@ class TestAccounts(testlib.MachineCase):
# Try to expire a password
b.wait_text("#password-expiration-text", "Never expire password")
# arch now uses the "modern" value "-1" to indicate the password has no expiration set
EXPIRE_NEVER_VALUE = "-1" if m.image in SHADOW_UTILS_WITHOUT_EXPIRE else "99999"
# The default "never expire" value depends on PASS_MAX_DAYS in login.defs which varies per distro and is unset in Arch Linux.
EXPIRE_NEVER_VALUE = m.execute("awk '/^PASS_MAX_DAYS/ {print $2}' /etc/login.defs").strip() or "-1"
self.assertEqual(self.accountExpiryInfo("scruffy", "Maximum number of days between password change"), EXPIRE_NEVER_VALUE)
b.click("#password-expiration-button")
b.wait_visible("#password-expiration")