test-projects.py 1016 B

12345678910111213141516171819202122232425262728293031323334
  1. # -*- coding: utf-8 -*-
  2. from __future__ import absolute_import
  3. from django.core.urlresolvers import reverse
  4. from django.test.client import RequestFactory
  5. from tests.apidocs.util import APIDocsTestCase
  6. class TeamsProjectsDocs(APIDocsTestCase):
  7. def setUp(self):
  8. team = self.create_team(organization=self.organization)
  9. self.create_project(name="foo", organization=self.organization, teams=[team])
  10. self.url = reverse(
  11. "sentry-api-0-team-project-index",
  12. kwargs={"organization_slug": self.organization.slug, "team_slug": team.slug},
  13. )
  14. self.login_as(user=self.user)
  15. def test_get(self):
  16. response = self.client.get(self.url)
  17. request = RequestFactory().get(self.url)
  18. self.validate_schema(request, response)
  19. def test_post(self):
  20. data = {"name": "foo"}
  21. response = self.client.post(self.url, data)
  22. request = RequestFactory().post(self.url, data)
  23. self.validate_schema(request, response)