add "seconds" unit

This commit is contained in:
Elián Hanisch 2012-11-03 19:00:31 -03:00
parent a059ab2002
commit f9940e8988
2 changed files with 5 additions and 2 deletions

View File

@ -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,

View File

@ -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')