test_keys.py 799 B

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