test_organization_sentry_app_detailed_view.py 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. from fixtures.page_objects.organization_integration_settings import (
  2. OrganizationSentryAppDetailViewPage,
  3. )
  4. from sentry.models import SentryAppInstallation
  5. from sentry.testutils import AcceptanceTestCase
  6. from sentry.testutils.silo import region_silo_test
  7. @region_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=self.organization,
  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. self.browser.snapshot("integrations - sentry app detail uninstalled")
  26. detail_view_page = OrganizationSentryAppDetailViewPage(browser=self.browser)
  27. detail_view_page.click_install_button()
  28. self.browser.wait_until('[data-test-id="toast-success"]')
  29. assert SentryAppInstallation.objects.filter(
  30. organization=self.organization, sentry_app=self.sentry_app
  31. )
  32. def test_uninstallation(self):
  33. self.installation = self.create_sentry_app_installation(
  34. slug=self.sentry_app.slug,
  35. organization=self.organization,
  36. user=self.user,
  37. prevent_token_exchange=True,
  38. )
  39. self.load_page(self.sentry_app.slug)
  40. self.browser.snapshot("integrations - sentry app detail installed")
  41. detail_view_page = OrganizationSentryAppDetailViewPage(browser=self.browser)
  42. detail_view_page.uninstall()
  43. self.browser.wait_until('[data-test-id="toast-success"]')
  44. assert not SentryAppInstallation.objects.filter(
  45. organization=self.organization, sentry_app=self.sentry_app
  46. )