def test_get_plot_data_filtered(self): """Tests getting the metrics plot data with filters.""" error = error_test_utils.create_error(is_builtin=True) metrics_test_utils.create_error(error=error, occurred=datetime.datetime(2015, 1, 1, tzinfo=utc), total_count=1) metrics_test_utils.create_error(error=error, occurred=datetime.datetime(2015, 1, 20, tzinfo=utc), total_count=1) metrics_test_utils.create_error(occurred=datetime.datetime(2015, 1, 1, tzinfo=utc), total_count=1) plot_data = MetricsError.objects.get_plot_data( started=datetime.datetime(2015, 1, 1, tzinfo=utc), ended=datetime.datetime(2015, 1, 10, tzinfo=utc), choice_ids=[error.id], columns=[MetricsTypeColumn('total_count')]) self.assertEqual(len(plot_data), 1) self.assertEqual(len(plot_data[0].values), 1)
def test_get_plot_data_filtered(self): """Tests getting the metrics plot data with filters.""" job_type = job_test_utils.create_job_type() metrics_test_utils.create_job_type(job_type=job_type, occurred=datetime.date(2015, 1, 1), completed_count=1) metrics_test_utils.create_job_type(job_type=job_type, occurred=datetime.date(2015, 1, 20), completed_count=1) metrics_test_utils.create_job_type(occurred=datetime.date(2015, 1, 1), completed_count=1) plot_data = MetricsJobType.objects.get_plot_data(started=datetime.date(2015, 1, 1), ended=datetime.date(2015, 1, 10), choice_ids=[job_type.id], columns=[MetricsTypeColumn('completed_count')]) self.assertEqual(len(plot_data), 1) self.assertEqual(len(plot_data[0].values), 1)
def test_get_plot_data_filtered(self): """Tests getting the metrics plot data with filters.""" strike = ingest_test_utils.create_strike() metrics_test_utils.create_ingest(strike=strike, occurred=datetime.datetime(2015, 1, 1, tzinfo=utc), ingested_count=1) metrics_test_utils.create_ingest(strike=strike, occurred=datetime.datetime(2015, 1, 20, tzinfo=utc), ingested_count=1) metrics_test_utils.create_ingest(occurred=datetime.datetime(2015, 1, 1, tzinfo=utc), ingested_count=1) plot_data = MetricsIngest.objects.get_plot_data(started=datetime.date(2015, 1, 1), ended=datetime.date(2015, 1, 10), choice_ids=[strike.id], columns=[MetricsTypeColumn('ingested_count')]) self.assertEqual(len(plot_data), 1) self.assertEqual(len(plot_data[0].values), 1)