Beispiel #1
0
    def test_paginates_project_issue_summaries_and_reassembles_result(self):
        self.login_as(user=self.user)

        now = timezone.now()
        min_ago = iso_format(now - timedelta(minutes=1))
        two_min_ago = now - timedelta(minutes=2)

        self.store_event(
            data={
                "event_id": "a" * 32,
                "message": "message",
                "timestamp": min_ago,
                "stacktrace": copy.deepcopy(DEFAULT_EVENT_DATA["stacktrace"]),
                "fingerprint": ["group-1"],
            },
            project_id=self.project.id,
        )

        self.store_event(
            data={
                "event_id": "b" * 32,
                "message": "message",
                "timestamp": min_ago,
                "stacktrace": copy.deepcopy(DEFAULT_EVENT_DATA["stacktrace"]),
                "fingerprint": ["group-2"],
            },
            project_id=self.project.id,
        )

        assert prepare_project_issue_summaries([two_min_ago, now],
                                               self.project) == [2, 0, 0]
Beispiel #2
0
    def test_paginates_and_reassumbles_result(self):
        import copy
        from datetime import timedelta
        from django.utils import timezone

        from sentry.testutils.factories import DEFAULT_EVENT_DATA

        self.login_as(user=self.user)

        now = timezone.now()
        min_ago = (now - timedelta(minutes=1)).isoformat()[:19]
        two_min_ago = now - timedelta(minutes=2)

        self.store_event(
            data={
                "event_id": "a" * 32,
                "message": "message",
                "timestamp": min_ago,
                "stacktrace": copy.deepcopy(DEFAULT_EVENT_DATA["stacktrace"]),
                "fingerprint": ["group-1"],
            },
            project_id=self.project.id,
        )

        self.store_event(
            data={
                "event_id": "b" * 32,
                "message": "message",
                "timestamp": min_ago,
                "stacktrace": copy.deepcopy(DEFAULT_EVENT_DATA["stacktrace"]),
                "fingerprint": ["group-2"],
            },
            project_id=self.project.id,
        )

        assert prepare_project_issue_summaries([two_min_ago, now],
                                               self.project) == [2, 0, 0]