test_group_index.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  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.cases import SCIMTestCase
  5. from sentry.testutils.silo import region_silo_test
  6. @region_silo_test
  7. class SCIMTeamIndexDocs(APIDocsTestCase, SCIMTestCase):
  8. def setUp(self):
  9. super().setUp()
  10. self.member = self.create_member(user=self.create_user(), organization=self.organization)
  11. self.team = self.create_team(organization=self.organization, members=[self.user])
  12. self.url = reverse(
  13. "sentry-api-0-organization-scim-team-index",
  14. kwargs={"organization_slug": self.organization.slug},
  15. )
  16. def test_get(self):
  17. response = self.client.get(self.url)
  18. request = RequestFactory().get(self.url)
  19. self.validate_schema(request, response)
  20. def test_post(self):
  21. post_data = {
  22. "schemas": ["urn:ietf:params:scim:schemas:core:2.0:Group"],
  23. "displayName": "Test SCIMv2",
  24. "members": [],
  25. }
  26. response = self.client.post(self.url, post_data)
  27. request = RequestFactory().post(self.url, post_data)
  28. self.validate_schema(request, response)