test_org_users.py 1.0 KB

1234567891011121314151617181920212223242526272829
  1. from django.test.client import RequestFactory
  2. from django.urls import reverse
  3. from fixtures.apidocs_test_case import APIDocsTestCase
  4. from sentry.testutils.silo import region_silo_test
  5. @region_silo_test(stable=True)
  6. class OrganizationUsersDocs(APIDocsTestCase):
  7. def setUp(self):
  8. self.owner_user = self.create_user("foo@localhost", username="foo")
  9. self.user_2 = self.create_user("bar@localhost", username="bar")
  10. self.org = self.create_organization(owner=self.owner_user)
  11. self.org.member_set.create(user_id=self.user_2.id)
  12. self.team = self.create_team(organization=self.org, members=[self.owner_user, self.user_2])
  13. self.project = self.create_project(teams=[self.team])
  14. self.login_as(user=self.user_2)
  15. self.url = reverse(
  16. "sentry-api-0-organization-users",
  17. kwargs={"organization_slug": self.org.slug},
  18. )
  19. def test_get(self):
  20. response = self.client.get(self.url)
  21. request = RequestFactory().get(self.url)
  22. self.validate_schema(request, response)