test_projects.py 946 B

123456789101112131415161718192021222324252627282930
  1. from django.test.client import RequestFactory
  2. from django.urls import reverse
  3. from fixtures.apidocs_test_case import APIDocsTestCase
  4. class TeamsProjectsDocs(APIDocsTestCase):
  5. def setUp(self):
  6. team = self.create_team(organization=self.organization)
  7. self.create_project(name="foo", organization=self.organization, teams=[team])
  8. self.url = reverse(
  9. "sentry-api-0-team-project-index",
  10. kwargs={"organization_slug": self.organization.slug, "team_slug": team.slug},
  11. )
  12. self.login_as(user=self.user)
  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. data = {"name": "foo"}
  19. response = self.client.post(self.url, data)
  20. request = RequestFactory().post(self.url, data)
  21. self.validate_schema(request, response)