test_member_details.py 1.3 KB

1234567891011121314151617181920212223242526272829303132333435
  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 SCIMMemberDetailsDocs(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-details",
  11. kwargs={"organization_slug": self.organization.slug, "member_id": self.member.id},
  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_delete(self):
  18. response = self.client.delete(self.url)
  19. request = RequestFactory().delete(self.url)
  20. self.validate_schema(request, response)
  21. def test_get_invalid(self):
  22. url = reverse(
  23. "sentry-api-0-organization-scim-member-details",
  24. kwargs={"organization_slug": self.organization.slug, "member_id": 321},
  25. )
  26. response = self.client.get(url)
  27. assert response.status_code == 404
  28. assert response.data["schemas"] == ["urn:ietf:params:scim:api:messages:2.0:Error"]