test_project_release_file_details.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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.silo import region_silo_test
  5. @region_silo_test
  6. class ProjectReleaseFileDetailsDocsTest(APIDocsTestCase):
  7. def setUp(self):
  8. self.login_as(user=self.user)
  9. project = self.create_project(name="foo")
  10. release = self.create_release(project=project, version="1")
  11. file1 = self.create_file(
  12. name="blah.js",
  13. size=42,
  14. type="release.file",
  15. headers={"Content-Type": "application/json"},
  16. checksum="dc1e3f3e411979d336c3057cce64294f3420f93a",
  17. )
  18. releasefile = self.create_release_file(
  19. file=file1, release_id=release.id, name="http://example.com/blah.js"
  20. )
  21. self.url = reverse(
  22. "sentry-api-0-project-release-file-details",
  23. kwargs={
  24. "project_slug": project.slug,
  25. "organization_slug": project.organization.slug,
  26. "version": release.version,
  27. "file_id": releasefile.id,
  28. },
  29. )
  30. def test_get(self):
  31. response = self.client.get(self.url)
  32. request = RequestFactory().get(self.url)
  33. self.validate_schema(request, response)
  34. def test_put(self):
  35. data = {"name": "newfilename.js"}
  36. response = self.client.put(self.url, data)
  37. request = RequestFactory().put(self.url, data)
  38. self.validate_schema(request, response)