コード例 #1
0
    def test_simple(self, mock_sync_integration_docs):
        responses.add("GET", "https://docs.getsentry.com/hosted/_platforms/_index.json", body=INDEX_JSON)

        sync_docs()

        data = options.get("sentry:docs")
        assert data == {
            "platforms": [
                {
                    "id": "go",
                    "integrations": [
                        {
                            "id": "go",
                            "link": "https://docs.getsentry.com/hosted/clients/go/",
                            "name": "Go",
                            "type": "language",
                        },
                        {"id": "go-http", "link": None, "name": "net/http", "type": "framework"},
                    ],
                    "name": "Go",
                }
            ]
        }

        assert mock_sync_integration_docs.mock_calls == [
            mock.call.delay("go", "_self", "go.json"),
            mock.call.delay("go", "http", "go/http.json"),
        ]
コード例 #2
0
ファイル: repair.py プロジェクト: AyrtonRicardo/sentry
def repair():
    "Attempt to repair any invalid data."

    click.echo('Forcing documentation sync')
    from sentry.tasks.sync_docs import sync_docs
    sync_docs()

    from sentry.models import Activity, Project, ProjectKey
    click.echo('Creating missing project keys')
    queryset = Project.objects.filter(key_set__isnull=True)
    for project in queryset:
        try:
            ProjectKey.objects.get_or_create(
                project=project,
            )
        except ProjectKey.MultipleObjectsReturned:
            pass

    from django.db import connection
    click.echo("Correcting Group.num_comments counter")
    cursor = connection.cursor()
    cursor.execute("""
        UPDATE sentry_groupedmessage SET num_comments = (
            SELECT COUNT(*) from sentry_activity
            WHERE type = %s and group_id = sentry_groupedmessage.id
        )
    """, [Activity.NOTE])
コード例 #3
0
ファイル: test_sync_docs.py プロジェクト: jargij/sentry
    def test_simple(self, mock_sync_integration_docs):
        responses.add(
            'GET',
            'https://docs.getsentry.com/hosted/_platforms/_index.json',
            body=INDEX_JSON)

        sync_docs()

        data = options.get('sentry:docs')
        assert data == {
            'platforms': [{
                'id':
                'go',
                'integrations': [{
                    'id': 'go',
                    'link': 'https://docs.getsentry.com/hosted/clients/go/',
                    'name': 'Go',
                    'type': 'language'
                }, {
                    'id': 'go-http',
                    'link': None,
                    'name': 'net/http',
                    'type': 'framework'
                }],
                'name':
                'Go',
            }]
        }

        assert mock_sync_integration_docs.mock_calls == [
            mock.call.delay('go', '_self', 'go.json'),
            mock.call.delay('go', 'http', 'go/http.json'),
        ]
コード例 #4
0
    def handle(self, **options):
        print("Forcing documentation sync")
        from sentry.tasks.sync_docs import sync_docs
        sync_docs()

        from sentry.models import Project, ProjectKey
        print("Creating missing project keys")
        queryset = Project.objects.filter(key_set__isnull=True)
        for project in queryset:
            try:
                ProjectKey.objects.get_or_create(
                    project=project,
                )
            except ProjectKey.MultipleObjectsReturned:
                pass
コード例 #5
0
ファイル: repair.py プロジェクト: noah-lee/sentry
    def handle(self, **options):
        print("Forcing documentation sync")
        from sentry.tasks.sync_docs import sync_docs

        sync_docs()

        from sentry.models import Project, ProjectKey

        print("Creating missing project keys")
        queryset = Project.objects.filter(key_set__isnull=True)
        for project in queryset:
            try:
                ProjectKey.objects.get_or_create(project=project)
            except ProjectKey.MultipleObjectsReturned:
                pass
コード例 #6
0
    def handle(self, **options):
        print("Forcing documentation sync")
        from sentry.tasks.sync_docs import sync_docs
        sync_docs()

        from sentry.models import Activity, Project, ProjectKey
        print("Creating missing project keys")
        queryset = Project.objects.filter(key_set__isnull=True)
        for project in queryset:
            try:
                ProjectKey.objects.get_or_create(project=project, )
            except ProjectKey.MultipleObjectsReturned:
                pass

        print("Correcting Group.num_comments counter")
        cursor = connection.cursor()
        cursor.execute(
            """
            UPDATE sentry_groupedmessage SET num_comments = (
                SELECT COUNT(*) from sentry_activity
                WHERE type = %s and group_id = sentry_groupedmessage.id
            )
        """, [Activity.NOTE])