Exemple #1
0
 def testTimeseries(self):
     response = dashboard_service.Timeseries('some test path')
     self.assertEqual(response, 'OK')
     self.mock_request.assert_called_once_with(
         dashboard_service.SERVICE_URL + '/timeseries/some%20test%20path',
         params={'num_days': 30},
         method='POST',
         use_auth=True,
         accept='json')
Exemple #2
0
    def Process(test_path):
        try:
            if isinstance(test_path, tables.timeseries.Key):
                params = test_path.AsApiParams()
                params['min_timestamp'] = min_timestamp
                data = dashboard_service.Timeseries2(**params)
            else:
                data = dashboard_service.Timeseries(test_path, days=args.days)
        except KeyError:
            logging.info('Timeseries not found: %s', test_path)
            return

        timeseries = tables.timeseries.DataFrameFromJson(test_path, data)
        pandas_sqlite.InsertOrReplaceRecords(con, 'timeseries', timeseries)
Exemple #3
0
 def testTimeseries_notFoundRaisesKeyError(self):
     self.mock_request.side_effect = TestResponse(
         400, '{"error": "Invalid test_path"}')
     with self.assertRaises(KeyError):
         dashboard_service.Timeseries('some test path')