test_project_release_file_details.py 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. from django.test.client import RequestFactory
  2. from django.urls import reverse
  3. from fixtures.apidocs_test_case import APIDocsTestCase
  4. class ProjectReleaseFileDetailsDocsTest(APIDocsTestCase):
  5. def setUp(self):
  6. self.login_as(user=self.user)
  7. project = self.create_project(name="foo")
  8. release = self.create_release(project=project, version="1")
  9. file1 = self.create_file(
  10. name="blah.js",
  11. size=42,
  12. type="release.file",
  13. headers={"Content-Type": "application/json"},
  14. checksum="dc1e3f3e411979d336c3057cce64294f3420f93a",
  15. )
  16. releasefile = self.create_release_file(
  17. file=file1, release_id=release.id, name="http://example.com/blah.js"
  18. )
  19. self.url = reverse(
  20. "sentry-api-0-project-release-file-details",
  21. kwargs={
  22. "project_id_or_slug": project.slug,
  23. "organization_id_or_slug": project.organization.slug,
  24. "version": release.version,
  25. "file_id": releasefile.id,
  26. },
  27. )
  28. def test_get(self):
  29. response = self.client.get(self.url)
  30. request = RequestFactory().get(self.url)
  31. self.validate_schema(request, response)
  32. def test_put(self):
  33. data = {"name": "newfilename.js"}
  34. response = self.client.put(self.url, data)
  35. request = RequestFactory().put(self.url, data)
  36. self.validate_schema(request, response)