Skip to content

Commit

Permalink
test(api): Add test for issue create config raising
Browse files Browse the repository at this point in the history
  • Loading branch information
macqueen committed Oct 29, 2018
1 parent 9f25c42 commit 51ee24a
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/sentry/api/endpoints/test_group_integration_details.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
from __future__ import absolute_import

import six
import mock

from sentry.integrations.example.integration import ExampleIntegration
from sentry.integrations.exceptions import IntegrationError
from sentry.models import ExternalIssue, GroupLink, Integration
from sentry.testutils import APITestCase
from sentry.utils.http import absolute_uri
Expand Down Expand Up @@ -115,6 +118,26 @@ def test_simple_get_create(self):
]
}

def test_get_create_with_error(self):
self.login_as(user=self.user)
org = self.organization
group = self.create_group()
self.create_event(group=group)
integration = Integration.objects.create(
provider='example',
name='Example',
)
integration.add_organization(org, self.user)

path = u'/api/0/issues/{}/integrations/{}/?action=create'.format(group.id, integration.id)

with self.feature('organizations:integrations-issue-basic'):
with mock.patch.object(ExampleIntegration, 'get_create_issue_config', side_effect=IntegrationError('oops')):
response = self.client.get(path)

assert response.status_code == 400
assert response.data == {'detail': 'oops'}

def test_get_feature_disabled(self):
self.login_as(user=self.user)
org = self.organization
Expand Down

0 comments on commit 51ee24a

Please sign in to comment.