test_member_index.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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 import SCIMTestCase
  5. class SCIMMemberIndexDocs(APIDocsTestCase, SCIMTestCase):
  6. def setUp(self):
  7. super().setUp()
  8. self.member = self.create_member(user=self.create_user(), organization=self.organization)
  9. self.url = reverse(
  10. "sentry-api-0-organization-scim-member-index",
  11. kwargs={"organization_slug": self.organization.slug},
  12. )
  13. def test_get(self):
  14. response = self.client.get(self.url)
  15. request = RequestFactory().get(self.url)
  16. self.validate_schema(request, response)
  17. def test_post(self):
  18. post_data = {
  19. "schemas": ["urn:ietf:params:scim:schemas:core:2.0:User"],
  20. "userName": "test.user@okta.local",
  21. "name": {"givenName": "Test", "familyName": "User"},
  22. "emails": [{"primary": True, "value": "test.user@okta.local", "type": "work"}],
  23. "displayName": "Test User",
  24. "locale": "en-US",
  25. "externalId": "00ujl29u0le5T6Aj10h7",
  26. "groups": [],
  27. "password": "1mz050nq",
  28. "active": True,
  29. }
  30. response = self.client.post(self.url, post_data)
  31. request = RequestFactory().post(self.url, post_data)
  32. self.validate_schema(request, response)