Exemple #1
0
def register_extensions():
    from sentry.plugins.base import plugins
    from sentry.plugins.utils import TestIssuePlugin2

    plugins.register(TestIssuePlugin2)

    from sentry import integrations
    from sentry.integrations.example import (
        AlertRuleIntegrationProvider,
        AliasedIntegrationProvider,
        ExampleIntegrationProvider,
        ExampleRepositoryProvider,
        FeatureFlagIntegration,
        ServerExampleProvider,
    )

    integrations.register(ExampleIntegrationProvider)
    integrations.register(AliasedIntegrationProvider)
    integrations.register(ServerExampleProvider)
    integrations.register(FeatureFlagIntegration)
    integrations.register(AlertRuleIntegrationProvider)

    from sentry.plugins.base import bindings
    from sentry.plugins.providers.dummy import DummyRepositoryProvider

    bindings.add("repository.provider", DummyRepositoryProvider, id="dummy")
    bindings.add(
        "integration-repository.provider", ExampleRepositoryProvider, id="integrations:example"
    )
Exemple #2
0
    def setup(self):
        from sentry.plugins.base import bindings

        bindings.add(
            "integration-repository.provider",
            GitHubEnterpriseRepositoryProvider,
            id="integrations:github_enterprise",
        )
Exemple #3
0
    def setup(self):
        from sentry.plugins.base import bindings

        bindings.add(
            "integration-repository.provider",
            BitbucketRepositoryProvider,
            id="integrations:%s" % self.key,
        )
Exemple #4
0
    def setup(self):
        from sentry.plugins.base import bindings

        bindings.add(
            "integration-repository.provider",
            CustomSCMRepositoryProvider,
            id="integrations:custom_scm",
        )
Exemple #5
0
    def setup(self):
        from sentry.plugins.base import bindings

        bindings.add(
            "integration-repository.provider",
            BitbucketServerRepositoryProvider,
            id=f"integrations:{self.key}",
        )
Exemple #6
0
def register_extensions():
    from sentry.plugins.base import plugins
    from sentry.plugins.utils import TestIssuePlugin2

    plugins.register(TestIssuePlugin2)

    from sentry import integrations
    from sentry.integrations.bitbucket import BitbucketIntegrationProvider
    from sentry.integrations.bitbucket_server import BitbucketServerIntegrationProvider
    from sentry.integrations.example import (
        ExampleIntegrationProvider,
        AliasedIntegrationProvider,
        ExampleRepositoryProvider,
        ServerExampleProvider,
        FeatureFlagIntegration,
    )
    from sentry.integrations.github import GitHubIntegrationProvider
    from sentry.integrations.github_enterprise import GitHubEnterpriseIntegrationProvider
    from sentry.integrations.gitlab import GitlabIntegrationProvider
    from sentry.integrations.jira import JiraIntegrationProvider
    from sentry.integrations.jira_server import JiraServerIntegrationProvider
    from sentry.integrations.slack import SlackIntegrationProvider
    from sentry.integrations.vsts import VstsIntegrationProvider
    from sentry.integrations.vsts_extension import VstsExtensionIntegrationProvider
    from sentry.integrations.pagerduty.integration import PagerDutyIntegrationProvider

    integrations.register(BitbucketIntegrationProvider)
    integrations.register(BitbucketServerIntegrationProvider)
    integrations.register(ExampleIntegrationProvider)
    integrations.register(AliasedIntegrationProvider)
    integrations.register(ServerExampleProvider)
    integrations.register(FeatureFlagIntegration)
    integrations.register(GitHubIntegrationProvider)
    integrations.register(GitHubEnterpriseIntegrationProvider)
    integrations.register(GitlabIntegrationProvider)
    integrations.register(JiraIntegrationProvider)
    integrations.register(JiraServerIntegrationProvider)
    integrations.register(SlackIntegrationProvider)
    integrations.register(VstsIntegrationProvider)
    integrations.register(VstsExtensionIntegrationProvider)
    integrations.register(PagerDutyIntegrationProvider)

    from sentry.plugins.base import bindings
    from sentry.plugins.providers.dummy import DummyRepositoryProvider

    bindings.add("repository.provider", DummyRepositoryProvider, id="dummy")
    bindings.add("integration-repository.provider",
                 ExampleRepositoryProvider,
                 id="integrations:example")
Exemple #7
0
    def test_integration_repository(self):
        # Add binding in case they aren't set.
        bindings.add("integration-repository.provider",
                     GitHubRepositoryProvider,
                     id="integrations:github")

        user = self.create_user()
        project = self.create_project()
        release = Release.objects.create(
            organization_id=project.organization_id, version=uuid4().hex)
        release.add_project(project)
        repository = Repository.objects.create(
            organization_id=project.organization_id,
            name="test/test",
            provider="integrations:github",
            url="https://github.com/test/test",
        )
        commit_author = CommitAuthor.objects.create(
            name="stebe",
            email="*****@*****.**",
            organization_id=project.organization_id)
        pull_request = PullRequest.objects.create(
            organization_id=project.organization_id,
            repository_id=repository.id,
            key="9",
            author=commit_author,
            message="waddap",
            title="cool pr",
        )

        result = serialize(pull_request, user)

        assert result["externalUrl"] == "https://github.com/test/test/pull/9"
        assert result["message"] == "waddap"
        assert result["title"] == "cool pr"
        assert result["repository"]["name"] == "test/test"
        assert result["author"] == {
            "name": "stebe",
            "email": "*****@*****.**"
        }
Exemple #8
0
    def setup(self):
        from sentry.plugins.base import bindings

        bindings.add("integration-repository.provider",
                     GitlabRepositoryProvider,
                     id="integrations:gitlab")
Exemple #9
0
    def setup(self) -> None:
        from sentry.plugins.base import bindings

        bindings.add("integration-repository.provider",
                     VstsRepositoryProvider,
                     id="integrations:vsts")