test_api.py 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. from sentry.testutils.cases import AcceptanceTestCase
  2. from sentry.testutils.silo import no_silo_test
  3. @no_silo_test(stable=True)
  4. class ApiTokensTest(AcceptanceTestCase):
  5. def setUp(self):
  6. super().setUp()
  7. self.org = self.create_organization(name="Rowdy Tiger Rowdy Tiger Rowdy Tiger", owner=None)
  8. self.project = self.create_project(
  9. organization=self.org, teams=[self.team], name="Bengal Bengal Bengal Bengal"
  10. )
  11. self.login_as(self.user)
  12. self.path = "/api/"
  13. def test_simple(self):
  14. self.browser.get(self.path)
  15. self.browser.wait_until_not('[data-test-id="loading-indicator"]')
  16. self.browser.snapshot("api tokens - no tokens")
  17. self.browser.click_when_visible('[data-test-id="create-token"]')
  18. self.browser.wait_until_not('[data-test-id="loading-indicator"]')
  19. self.browser.snapshot("api tokens - new token")
  20. self.browser.click_when_visible('[data-test-id="form-submit"]')
  21. self.browser.wait_until_not('[data-test-id="loading-indicator"]')
  22. self.browser.snapshot("api tokens - single token")
  23. class ApiApplicationTest(AcceptanceTestCase):
  24. def setUp(self):
  25. super().setUp()
  26. self.org = self.create_organization(name="Rowdy Tiger Rowdy Tiger Rowdy Tiger", owner=None)
  27. self.project = self.create_project(
  28. organization=self.org, teams=[self.team], name="Bengal Bengal Bengal Bengal"
  29. )
  30. self.login_as(self.user)
  31. self.path = "/api/applications/"
  32. def test_simple(self):
  33. self.browser.get(self.path)
  34. self.browser.wait_until_not('[data-test-id="loading-indicator"]')
  35. self.browser.snapshot("api applications - no applications")
  36. self.browser.click_when_visible('[aria-label="Create New Application"]')
  37. self.browser.wait_until_not('[data-test-id="loading-indicator"]')
  38. self.browser.snapshot("api applications - new application")
  39. self.browser.click('[href="/settings/account/api/applications/"]')
  40. self.browser.wait_until_not('[data-test-id="loading-indicator"]')
  41. self.browser.click_when_visible('[data-test-id="toast-success"]')
  42. self.browser.wait_until_not('[data-test-id="toast-success"]')
  43. self.browser.snapshot("api applications - single application")
  44. self.browser.get(self.path)
  45. self.browser.wait_until_not('[data-test-id="loading-indicator"]')
  46. self.browser.click_when_visible('[aria-label="Remove"]')
  47. self.browser.wait_until_not('[data-test-id="toast-loading"]')
  48. self.browser.wait_until_test_id("empty-message")