Exemple #1
0
 def run_test(self, incidents, expected_results_list, start=None, end=None):
     query_params_list = bulk_build_incident_query_params(incidents, start=start, end=end)
     results = bulk_get_incident_event_stats(incidents, query_params_list, data_points=20)
     for incident, result, expected_results in zip(incidents, results, expected_results_list):
         # Duration of 300s / 20 data points
         assert result.rollup == 15
         assert result.start == start if start else incident.date_started
         assert result.end == end if end else incident.current_end_date
         assert [r["count"] for r in result.data["data"]] == expected_results
Exemple #2
0
 def run_test(
     self, incidents, expected_results_list, start=None, end=None, windowed_stats=False
 ):
     query_params_list = bulk_build_incident_query_params(
         incidents, start=start, end=end, windowed_stats=windowed_stats
     )
     results = bulk_get_incident_event_stats(incidents, query_params_list)
     for incident, result, expected_results in zip(incidents, results, expected_results_list):
         self.validate_result(incident, result, expected_results, start, end, windowed_stats)
Exemple #3
0
    def test_groups(self):
        other_group = self.create_group()
        other_incident = self.create_incident(
            date_started=self.now - timedelta(minutes=5),
            query="",
            projects=[],
            groups=[other_group],
        )

        params = bulk_build_incident_query_params([self.group_incident, other_incident])
        assert bulk_get_incident_aggregates(params) == [
            {"count": 4, "unique_users": 2},
            {"count": 0, "unique_users": 0},
        ]
Exemple #4
0
    def test_projects(self):
        other_project = self.create_project()
        other_incident = self.create_incident(
            date_started=self.now - timedelta(minutes=5),
            query='',
            projects=[other_project],
            groups=[],
        )
        params = bulk_build_incident_query_params(
            [self.project_incident, other_incident])

        assert bulk_get_incident_aggregates(params) == [
            {
                'count': 4,
                'unique_users': 2
            },
            {
                'count': 0,
                'unique_users': 0
            },
        ]