test_index.py 826 B

1234567891011121314151617181920212223242526272829
  1. from django.test.client import RequestFactory
  2. from django.urls import reverse
  3. from fixtures.apidocs_test_case import APIDocsTestCase
  4. class TeamsIndexDocs(APIDocsTestCase):
  5. def setUp(self):
  6. self.create_team(organization=self.organization)
  7. self.url = reverse(
  8. "sentry-api-0-organization-teams",
  9. kwargs={"organization_slug": self.organization.slug},
  10. )
  11. self.login_as(user=self.user)
  12. def test_get(self):
  13. response = self.client.get(self.url)
  14. request = RequestFactory().get(self.url)
  15. self.validate_schema(request, response)
  16. def test_post(self):
  17. data = {"name": "foo"}
  18. response = self.client.post(self.url, data)
  19. request = RequestFactory().post(self.url, data)
  20. self.validate_schema(request, response)