From f9940e898802e19b0d7c65aa9aed1ff744906b4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eli=C3=A1n=20Hanisch?= Date: Sat, 3 Nov 2012 19:00:31 -0300 Subject: [PATCH] add "seconds" unit --- Bantracker/plugin.py | 1 + Bantracker/test.py | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Bantracker/plugin.py b/Bantracker/plugin.py index bc5c94c..1d6492f 100644 --- a/Bantracker/plugin.py +++ b/Bantracker/plugin.py @@ -97,6 +97,7 @@ class FuzzyDict(dict): return dict.__getitem__(self, keys[0]) timeUnits = FuzzyDict({ + 'seconds': 1, 'minutes': 60, 'm': 60, 'hours' : 3600, 'M': 2592000, 'days' : 86400, diff --git a/Bantracker/test.py b/Bantracker/test.py index dbe6fae..4e5a046 100644 --- a/Bantracker/test.py +++ b/Bantracker/test.py @@ -512,10 +512,12 @@ class BantrackerTestCase(ChannelPluginTestCase): self.assertEqual(cb.managedBans.shelf[0].expires, 172860) self.assertNotError('duration 1 24h 1day') self.assertEqual(cb.managedBans.shelf[0].expires, 172800) - self.assertNotError('duration 1 1m1h1d1w1M1y') - self.assertEqual(cb.managedBans.shelf[0].expires, 34822860) + self.assertNotError('duration 1 1s1m1h1d1w1M1y') + self.assertEqual(cb.managedBans.shelf[0].expires, 34822861) self.assertNotError('duration 1 999') self.assertEqual(cb.managedBans.shelf[0].expires, 999) + self.assertNotError('duration 1 1 second') + self.assertEqual(cb.managedBans.shelf[0].expires, 1) def testDurationTimeFormatBad(self): self.assertError('duration 1 10 apples')