test_project_keys.py 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. from datetime import datetime, timezone
  2. from sentry.models.projectkey import ProjectKey
  3. from sentry.testutils.cases import AcceptanceTestCase, SnubaTestCase
  4. from sentry.testutils.silo import no_silo_test
  5. @no_silo_test
  6. class ProjectKeysTest(AcceptanceTestCase, SnubaTestCase):
  7. def setUp(self):
  8. super().setUp()
  9. self.user = self.create_user("foo@example.com")
  10. self.org = self.create_organization(name="Rowdy Tiger", owner=None)
  11. self.team = self.create_team(organization=self.org, name="Mariachi Band")
  12. self.project = self.create_project(organization=self.org, teams=[self.team], name="Bengal")
  13. self.create_member(user=self.user, organization=self.org, role="owner", teams=[self.team])
  14. ProjectKey.objects.filter(project=self.project).delete()
  15. ProjectKey.objects.create(
  16. project=self.project,
  17. label="Default",
  18. public_key="5cc0482a13d248ff99f9717101dd6356",
  19. secret_key="410fd998318844b8894775f36184ec28",
  20. )
  21. self.login_as(self.user)
  22. self.path = f"/{self.org.slug}/{self.project.slug}/settings/keys/"
  23. def test_simple(self):
  24. self.browser.get(self.path)
  25. self.browser.wait_until_not('[data-test-id="loading-indicator"]')
  26. self.browser.wait_until_test_id("project-keys")
  27. @no_silo_test
  28. class ProjectKeyDetailsTest(AcceptanceTestCase, SnubaTestCase):
  29. def setUp(self):
  30. super().setUp()
  31. self.user = self.create_user("foo@example.com")
  32. self.org = self.create_organization(name="Rowdy Tiger", owner=None)
  33. self.team = self.create_team(organization=self.org, name="Mariachi Band")
  34. self.project = self.create_project(organization=self.org, teams=[self.team], name="Bengal")
  35. self.create_member(user=self.user, organization=self.org, role="owner", teams=[self.team])
  36. self.pk = ProjectKey.objects.create(
  37. project=self.project,
  38. label="Default",
  39. public_key="5cc0482a13d248ff99f9717101dd6356",
  40. secret_key="410fd998318844b8894775f36184ec28",
  41. date_added=datetime(2015, 10, 1, 21, 19, 5, 648517, tzinfo=timezone.utc),
  42. )
  43. self.login_as(self.user)
  44. self.path = f"/{self.org.slug}/{self.project.slug}/settings/keys/{self.pk.public_key}/"
  45. def test_simple(self):
  46. self.browser.get(self.path)
  47. self.browser.wait_until_not('[data-test-id="loading-indicator"]')
  48. self.browser.wait_until_test_id("key-details")
  49. self.browser.wait_until_not('[data-test-id="loading-placeholder"]')