def test_automatic_timestamp(self): timestamp = main.get_timestamp() app_id = 'test-application' data = json.dumps({'test-type': 'test-data'}) event = main.create_event_ds(app_id, 'test-event', data) self.assertEqual(event.name, 'test-event') self.assertAlmostEqual(event.ts, timestamp) self.assertEqual(event.data, data)
def test_timestamped_events(self): timestamp = main.get_timestamp() data = json.dumps({'test-type': 'test-data', 'creation-time': timestamp}) app_id = 'test-application' event = main.create_event_ds(app_id, 'test-event', data) self.assertEqual(event.name, 'test-event') self.assertEqual(event.ts, timestamp) self.assertEqual(event.data, data)