Пример #1
0
    def test_simple(self):
        release = self.create_release(project=self.project, version="v12")
        event = self.store_event(
            data={
                "timestamp": iso_format(before_now(minutes=1)),
                "fingerprint": ["group-1"],
                "message": "Kaboom!",
                "platform": "python",
                "stacktrace": {"frames": [{"filename": "sentry/models/release.py"}]},
                "release": release.version,
            },
            project_id=self.project.id,
        )
        group = event.group
        self.repo = Repository.objects.create(
            organization_id=self.organization.id, name=self.organization.id
        )
        release.set_commits(
            [
                {
                    "id": "a" * 40,
                    "repository": self.repo.name,
                    "author_email": "*****@*****.**",
                    "author_name": "Bob",
                    "message": "i fixed a bug",
                    "patch_set": [{"path": "src/sentry/models/release.py", "type": "M"}],
                }
            ]
        )

        commit = Commit.objects.filter(releasecommit__release__in=[release])
        incident = self.create_incident(self.organization, groups=[group])
        calculate_incident_suspects(incident.id)
        assert IncidentSuspectCommit.objects.filter(incident=incident, commit__in=commit).exists()
Пример #2
0
    def test_simple(self):
        release = self.create_release(project=self.project, version='v12')
        event = self.store_event(
            data={
                'timestamp':
                (timezone.now() - timedelta(minutes=1)).isoformat()[:19],
                'fingerprint': ['group-1'],
                'message':
                'Kaboom!',
                'platform':
                'python',
                'stacktrace': {
                    'frames': [{
                        'filename': 'sentry/models/release.py'
                    }]
                },
                'release':
                release.version,
            },
            project_id=self.project.id,
        )
        group = event.group
        self.repo = Repository.objects.create(
            organization_id=self.organization.id,
            name=self.organization.id,
        )
        release.set_commits([{
            'id':
            'a' * 40,
            'repository':
            self.repo.name,
            'author_email':
            '*****@*****.**',
            'author_name':
            'Bob',
            'message':
            'i fixed a bug',
            'patch_set': [{
                'path': 'src/sentry/models/release.py',
                'type': 'M'
            }]
        }])

        commit = Commit.objects.filter(releasecommit__release__in=[release])
        incident = self.create_incident(self.organization, groups=[group])
        calculate_incident_suspects(incident.id)
        assert IncidentSuspectCommit.objects.filter(
            incident=incident,
            commit=commit,
        ).exists()