test_organization_sentry_app_detailed_view.py 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. from fixtures.page_objects.organization_integration_settings import (
  2. OrganizationSentryAppDetailViewPage,
  3. )
  4. from sentry.sentry_apps.models.sentry_app_installation import SentryAppInstallation
  5. from sentry.testutils.cases import AcceptanceTestCase
  6. from sentry.testutils.silo import no_silo_test
  7. @no_silo_test
  8. class OrganizationSentryAppDetailedView(AcceptanceTestCase):
  9. def setUp(self):
  10. super().setUp()
  11. self.create_project(organization=self.organization)
  12. self.sentry_app = self.create_sentry_app(
  13. organization_id=self.organization.id,
  14. published=True,
  15. verify_install=False,
  16. name="Super Awesome App",
  17. )
  18. self.login_as(self.user)
  19. def load_page(self, slug):
  20. url = f"/settings/{self.organization.slug}/sentry-apps/{slug}/"
  21. self.browser.get(url)
  22. self.browser.wait_until_not('[data-test-id="loading-indicator"]')
  23. def test_add_sentry_app(self):
  24. self.load_page(self.sentry_app.slug)
  25. detail_view_page = OrganizationSentryAppDetailViewPage(browser=self.browser)
  26. detail_view_page.click_install_button()
  27. self.browser.wait_until('[data-test-id="toast-success"]')
  28. assert SentryAppInstallation.objects.filter(
  29. organization_id=self.organization.id, sentry_app=self.sentry_app
  30. )
  31. def test_uninstallation(self):
  32. self.installation = self.create_sentry_app_installation(
  33. slug=self.sentry_app.slug,
  34. organization=self.organization,
  35. user=self.user,
  36. prevent_token_exchange=True,
  37. )
  38. self.load_page(self.sentry_app.slug)
  39. detail_view_page = OrganizationSentryAppDetailViewPage(browser=self.browser)
  40. detail_view_page.uninstall()
  41. self.browser.wait_until('[data-test-id="toast-success"]')
  42. assert not SentryAppInstallation.objects.filter(
  43. organization_id=self.organization.id, sentry_app=self.sentry_app
  44. )