test_organization_release_file_details.py 1.4 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 ReleaseFileDetailsDocsTest(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-organization-release-file-details",
  21. kwargs={
  22. "organization_id_or_slug": project.organization.slug,
  23. "version": release.version,
  24. "file_id": releasefile.id,
  25. },
  26. )
  27. def test_get(self):
  28. response = self.client.get(self.url)
  29. request = RequestFactory().get(self.url)
  30. self.validate_schema(request, response)
  31. def test_put(self):
  32. data = {"name": "newfilename.js"}
  33. response = self.client.put(self.url, data)
  34. request = RequestFactory().put(self.url, data)
  35. self.validate_schema(request, response)