selftest: Avoid a build started just before midnight failing
authorAndrew Bartlett <abartlet@samba.org>
Sat, 2 Sep 2017 02:07:11 +0000 (14:07 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 7 Sep 2017 04:56:26 +0000 (06:56 +0200)
By allowing 41 or 42 days, we still test the expiry but are less sensitive to the
current time.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
python/samba/tests/pam_winbind_warn_pwd_expire.py

index c78cf58c17123b86aca4955d4f54d273bf931cb7..2567f98c6d4a181ab682d8109748dabb5941ba80 100644 (file)
@@ -36,6 +36,9 @@ class PasswordExpirePamTests(samba.tests.TestCase):
         if warn_pwd_expire == 0:
             self.assertTrue(res.info == ())
         elif warn_pwd_expire == 50:
-            self.assertEqual(res.info[0], u"Your password will expire in 42 days.\n")
+            # This is needed as otherwise a build started just before
+            # midnight can fail
+            if (res.info[0] != u"Your password will expire in 41 days"):
+                self.assertEqual(res.info[0], u"Your password will expire in 42 days.\n")
         else:
             self.assertEqual(warn_pwd_expire, 0)