tests: fix places check for timestamp equality
It's actually up to the microsecond, and not finer, so the default places value of 7 isn't good enough. Change-Id: Ic0438db4c9039a904a43547d5c5181400a84d22f Closes-Bug: #1230099
This commit is contained in:
parent
ecdb54d35d
commit
23ae798cee
@ -298,16 +298,20 @@ class TestCollectorService(TestCollector):
|
||||
|
||||
body = {"timestamp": str(modified)}
|
||||
when = service.CollectorService._extract_when(body)
|
||||
self.assertAlmostEqual(timeutils.delta_seconds(modified, when), 0.0)
|
||||
self.assertAlmostEqual(timeutils.delta_seconds(modified, when), 0.0,
|
||||
places=5)
|
||||
|
||||
body = {"_context_timestamp": str(modified)}
|
||||
when = service.CollectorService._extract_when(body)
|
||||
self.assertAlmostEqual(timeutils.delta_seconds(modified, when), 0.0)
|
||||
self.assertAlmostEqual(timeutils.delta_seconds(modified, when), 0.0,
|
||||
places=5)
|
||||
|
||||
then = now + datetime.timedelta(hours=1)
|
||||
body = {"timestamp": str(modified), "_context_timestamp": str(then)}
|
||||
when = service.CollectorService._extract_when(body)
|
||||
self.assertAlmostEqual(timeutils.delta_seconds(modified, when), 0.0)
|
||||
self.assertAlmostEqual(timeutils.delta_seconds(modified, when), 0.0,
|
||||
places=5)
|
||||
|
||||
when = service.CollectorService._extract_when({})
|
||||
self.assertAlmostEqual(timeutils.delta_seconds(now, when), 0.0)
|
||||
self.assertAlmostEqual(timeutils.delta_seconds(now, when), 0.0,
|
||||
places=5)
|
||||
|
Loading…
x
Reference in New Issue
Block a user