def testLastAccessStats(self): """Check that all client stats cron jobs are run.""" run = rdf_cronjobs.CronJobRun() job = rdf_cronjobs.CronJob() system.LastAccessStatsCronJob(run, job).Run() self._CheckLastAccessStats()
def testLastActiveReportPlugin(self): self.MockClients() # Scan for activity to be reported. cron_system.LastAccessStatsCronJob(None, None).Run() report = report_plugins.GetReportByName( client_report_plugins.LastActiveReportPlugin.__name__) api_report_data = report.GetReportData( stats_api.ApiGetReportArgs(name=report.__class__.__name__, client_label="All")) self.assertEqual( api_report_data.representation_type, rdf_report_plugins.ApiReportData.RepresentationType.LINE_CHART) self.assertLen(api_report_data.line_chart.data, 5) labels = [ "60 day active", "30 day active", "7 day active", "3 day active", "1 day active" ] ys = [20, 20, 0, 0, 0] for series, label, y in zip(api_report_data.line_chart.data, labels, ys): self.assertEqual(series.label, label) self.assertLen(series.points, 1) self.assertEqual(series.points[0].y, y)