test_users.py 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. from django.test.client import RequestFactory
  2. from django.urls import reverse
  3. from fixtures.apidocs_test_case import APIDocsTestCase
  4. from sentry.models import EventUser
  5. from sentry.testutils.silo import region_silo_test
  6. @region_silo_test
  7. class ProjectUsersDocs(APIDocsTestCase):
  8. def setUp(self):
  9. self.project = self.create_project()
  10. self.euser1 = EventUser.objects.create(
  11. project_id=self.project.id,
  12. ident="1",
  13. email="foo@example.com",
  14. username="foobar",
  15. ip_address="127.0.0.1",
  16. )
  17. self.euser2 = EventUser.objects.create(
  18. project_id=self.project.id,
  19. ident="2",
  20. email="bar@example.com",
  21. username="baz",
  22. ip_address="192.168.0.1",
  23. )
  24. self.url = reverse(
  25. "sentry-api-0-project-users",
  26. kwargs={"organization_slug": self.organization.slug, "project_slug": self.project.slug},
  27. )
  28. self.login_as(user=self.user)
  29. def test_get(self):
  30. response = self.client.get(self.url)
  31. request = RequestFactory().get(self.url)
  32. self.validate_schema(request, response)