def test_delete_service_hook_on_update(self): self.create_project(organization=self.org) internal_app = self.create_internal_integration( name="Internal", organization=self.org, webhook_url="https://sentry.io/hook" ) assert len(ServiceHook.objects.filter(application=internal_app.application)) == 1 updater = Updater(sentry_app=internal_app, user=self.user) updater.webhook_url = "" updater.call() assert len(ServiceHook.objects.filter(application=internal_app.application)) == 0
def test_update_webhook_published_app(self): sentry_app = self.create_sentry_app( name="sentry", organization=self.org, scopes=("project:read",), published=True ) updater = Updater(sentry_app=sentry_app, user=self.user) # pass in scopes but as the same value updater.scopes = ["project:read"] updater.webhook_url = "http://example.com/hooks" updater.call() assert sentry_app.webhook_url == "http://example.com/hooks"
def test_create_service_hook_on_update(self): self.create_project(organization=self.org) internal_app = self.create_internal_integration( name="Internal", organization=self.org, webhook_url=None, scopes=("event:read",) ) assert len(ServiceHook.objects.filter(application=internal_app.application)) == 0 updater = Updater(sentry_app=internal_app, user=self.user) updater.webhook_url = "https://sentry.io/hook" updater.events = ("issue",) updater.call() service_hook = ServiceHook.objects.get(application=internal_app.application) assert service_hook.url == "https://sentry.io/hook" assert set(service_hook.events) == expand_events(["issue"])