test_api.py 2.5 KB

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