test_org_users.py 985 B

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