def setUp(self): self.period_begin = tzutils.local_to_utc( tzutils.get_month_start()).isoformat() self.period_end = tzutils.local_to_utc( tzutils.get_next_month()).isoformat() self.client = influx.InfluxClient() self._storage = influx.InfluxStorage()
def test_build_dataframes_differenciates_periods(self): points = [copy.deepcopy(self.point) for _ in range(3)] for idx, point in enumerate(points): point[influx.PERIOD_FIELD_NAME] = 100 * (idx + 1) dataframes = influx.InfluxStorage()._build_dataframes(points) self.assertEqual(len(dataframes), 3) for idx, frame in enumerate(dataframes): self.assertEqual(frame.start, datetime(2019, 1, 1, tzinfo=tz.UTC)) delta = timedelta(seconds=(idx + 1) * 100) self.assertEqual(frame.end, datetime(2019, 1, 1, tzinfo=tz.UTC) + delta) typelist = list(frame.itertypes()) self.assertEqual(len(typelist), 1) type_, points = typelist[0] self.assertEqual(len(points), 1) self.assertEqual(type_, 'amazing_type')
def setUp(self): self.client = influx.InfluxClient() self._storage = influx.InfluxStorage()