mirror of https://github.com/fail2ban/fail2ban
tests/samplestestcase.py: fixes retrieving of microseconds by epoch (and comparison within tests factory)
parent
4a2f4226b8
commit
595054639b
|
@ -277,7 +277,7 @@ def testSampleRegexsFactory(name, basedir):
|
||||||
except ValueError:
|
except ValueError:
|
||||||
jsonTimeLocal = datetime.datetime.strptime(t, "%Y-%m-%dT%H:%M:%S.%f")
|
jsonTimeLocal = datetime.datetime.strptime(t, "%Y-%m-%dT%H:%M:%S.%f")
|
||||||
jsonTime = time.mktime(jsonTimeLocal.timetuple())
|
jsonTime = time.mktime(jsonTimeLocal.timetuple())
|
||||||
jsonTime += jsonTimeLocal.microsecond / 1000000
|
jsonTime += jsonTimeLocal.microsecond / 1000000.0
|
||||||
self.assertEqual(fail2banTime, jsonTime,
|
self.assertEqual(fail2banTime, jsonTime,
|
||||||
"UTC Time mismatch %s (%s) != %s (%s) (diff %.3f seconds)" %
|
"UTC Time mismatch %s (%s) != %s (%s) (diff %.3f seconds)" %
|
||||||
(fail2banTime, time.strftime("%Y-%m-%dT%H:%M:%S", time.gmtime(fail2banTime)),
|
(fail2banTime, time.strftime("%Y-%m-%dT%H:%M:%S", time.gmtime(fail2banTime)),
|
||||||
|
|
Loading…
Reference in New Issue