mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-09-29 22:34:33 +00:00
28 lines
1.1 KiB
Python
28 lines
1.1 KiB
Python
from sentry.integrations.example import ExampleIntegrationProvider, ExampleSetupView
|
|
from sentry.models.integrations.integration import Integration
|
|
from sentry.models.integrations.organization_integration import OrganizationIntegration
|
|
from sentry.testutils.cases import IntegrationTestCase
|
|
from sentry.testutils.silo import control_silo_test
|
|
|
|
|
|
@control_silo_test
|
|
class ExampleIntegrationTest(IntegrationTestCase):
|
|
provider = ExampleIntegrationProvider
|
|
|
|
def test_basic_flow(self):
|
|
resp = self.client.get(self.init_path)
|
|
assert resp.status_code == 200
|
|
assert ExampleSetupView.TEMPLATE in resp.content.decode("utf-8")
|
|
|
|
resp = self.client.post(self.setup_path, {"name": "test"})
|
|
assert resp.status_code == 200
|
|
self.assertDialogSuccess(resp)
|
|
|
|
integration = Integration.objects.get(provider=self.provider.key)
|
|
assert integration.external_id == "test"
|
|
assert integration.name == "test"
|
|
assert integration.metadata == {}
|
|
assert OrganizationIntegration.objects.filter(
|
|
integration=integration, organization_id=self.organization.id
|
|
).exists()
|