class SentryAppDocs(APIDocsTestCase): def setUp(self): self.org = self.create_organization(owner=self.user, name="Rowdy Tiger") self.project = self.create_project(organization=self.org) self.group = self.create_group(project=self.project) self.sentry_app = self.create_sentry_app( name="Hellboy App", published=True, organization=self.org ) self.install = SentryAppInstallation(sentry_app=self.sentry_app, organization=self.org) self.install.save() self.url = reverse( "sentry-api-0-sentry-app-installation-external-issues", kwargs={"uuid": self.install.uuid}, ) self.login_as(user=self.user) def test_post(self): data = { "issueId": self.group.id, "webUrl": "https://somerandom.io/project/issue-id", "project": "ExternalProj", "identifier": "issue-1", } response = self.client.post(self.url, data) request = RequestFactory().post(self.url, data) self.validate_schema(request, response)
class SentryAppDetailsDocs(APIDocsTestCase): def setUp(self): self.org = self.create_organization(owner=self.user, name="Rowdy Tiger") self.project = self.create_project(organization=self.org) self.group = self.create_group(project=self.project) self.sentry_app = self.create_sentry_app( name="Hellboy App", published=True, organization=self.org ) self.install = SentryAppInstallation(sentry_app=self.sentry_app, organization=self.org) self.install.save() self.external_issue = self.create_platform_external_issue( group=self.group, service_type=self.sentry_app.slug, display_name="App#issue-1", web_url=self.sentry_app.webhook_url, ) self.url = reverse( "sentry-api-0-sentry-app-installation-external-issue-details", kwargs={"uuid": self.install.uuid, "external_issue_id": self.external_issue.id}, ) self.login_as(user=self.user) def test_delete(self): response = self.client.delete(self.url) request = RequestFactory().delete(self.url) self.validate_schema(request, response)
class SentryAppInstallationTest(TestCase): def setUp(self): self.user = self.create_user() self.proxy = self.create_user() self.org = self.create_organization() self.application = ApiApplication.objects.create(owner=self.proxy) self.sentry_app = SentryApp.objects.create( application=self.application, name="NullDB", proxy_user=self.proxy, owner=self.org, scope_list=("project:read",), webhook_url="http://example.com", ) self.install = SentryAppInstallation(sentry_app=self.sentry_app, organization=self.org) def test_paranoid(self): self.install.save() self.install.delete() assert self.install.date_deleted is not None assert self.install not in SentryAppInstallation.objects.all() def test_date_updated(self): self.install.save() date_updated = self.install.date_updated self.install.save() assert not self.install.date_updated == date_updated def test_related_names(self): self.install.save() assert self.install in self.install.sentry_app.installations.all() assert self.install in self.install.organization.sentry_app_installations.all()
class SentryAppInstallationDocs(APIDocsTestCase): def setUp(self): self.user = self.create_user("*****@*****.**") self.org = self.create_organization(name="Jessla", owner=None) self.create_member(user=self.user, organization=self.org, role="owner") self.sentry_app = self.create_sentry_app( name="Tesla App", published=True, organization=self.org ) self.install = SentryAppInstallation(sentry_app=self.sentry_app, organization=self.org) self.install.save() self.login_as(user=self.user) self.url = reverse( "sentry-api-0-sentry-app-installations", kwargs={"organization_slug": self.org.slug}, ) def test_get(self): response = self.client.get(self.url) request = RequestFactory().get(self.url) self.validate_schema(request, response)
class SentryAppInstallationTest(TestCase): def setUp(self): self.user = self.create_user() self.proxy = self.create_user() self.org = self.create_organization() self.application = ApiApplication.objects.create(owner=self.proxy) self.sentry_app = SentryApp.objects.create( application=self.application, name='NullDB', proxy_user=self.proxy, owner=self.user, scope_list=('project:read', ), webhook_url='http://example.com', ) self.install = SentryAppInstallation( sentry_app=self.sentry_app, organization=self.org, ) def test_paranoid(self): self.install.save() self.install.delete() assert self.install.date_deleted is not None assert self.install not in SentryAppInstallation.objects.all() def test_date_updated(self): self.install.save() date_updated = self.install.date_updated self.install.save() assert not self.install.date_updated == date_updated def test_related_names(self): self.install.save() assert self.install in self.install.sentry_app.installations.all() assert self.install in \ self.install.organization.sentry_app_installations.all()